##// END OF EJS Templates
HK packet changed due to misalignment of one int data...
paul -
r132:f919b72104cf VHDLib206
parent child
Show More
@@ -1,268 +1,268
1 1 #############################################################################
2 2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.6) on: Tue May 13 07:12:26 2014
3 # Generated by qmake (2.01a) (Qt 4.8.6) on: Tue May 13 15:18:10 2014
4 4 # Project: fsw-qt.pro
5 5 # Template: app
6 6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
7 7 #############################################################################
8 8
9 9 ####### Compiler, tools and options
10 10
11 11 CC = sparc-rtems-gcc
12 12 CXX = sparc-rtems-g++
13 13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=7 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS
14 14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/basic_parameters
17 17 LINK = sparc-rtems-g++
18 18 LFLAGS =
19 19 LIBS = $(SUBLIBS)
20 20 AR = sparc-rtems-ar rcs
21 21 RANLIB =
22 22 QMAKE = /usr/bin/qmake-qt4
23 23 TAR = tar -cf
24 24 COMPRESS = gzip -9f
25 25 COPY = cp -f
26 26 SED = sed
27 27 COPY_FILE = $(COPY)
28 28 COPY_DIR = $(COPY) -r
29 29 STRIP = sparc-rtems-strip
30 30 INSTALL_FILE = install -m 644 -p
31 31 INSTALL_DIR = $(COPY_DIR)
32 32 INSTALL_PROGRAM = install -m 755 -p
33 33 DEL_FILE = rm -f
34 34 SYMLINK = ln -f -s
35 35 DEL_DIR = rmdir
36 36 MOVE = mv -f
37 37 CHK_DIR_EXISTS= test -d
38 38 MKDIR = mkdir -p
39 39
40 40 ####### Output directory
41 41
42 42 OBJECTS_DIR = obj/
43 43
44 44 ####### Files
45 45
46 46 SOURCES = ../src/wf_handler.c \
47 47 ../src/tc_handler.c \
48 48 ../src/fsw_misc.c \
49 49 ../src/fsw_init.c \
50 50 ../src/fsw_globals.c \
51 51 ../src/fsw_spacewire.c \
52 52 ../src/tc_load_dump_parameters.c \
53 53 ../src/tm_lfr_tc_exe.c \
54 54 ../src/tc_acceptance.c \
55 55 ../src/basic_parameters/basic_parameters.c \
56 56 ../src/processing/fsw_processing.c \
57 57 ../src/processing/avf0_prc0.c \
58 58 ../src/processing/avf1_prc1.c \
59 59 ../src/processing/avf2_prc2.c
60 60 OBJECTS = obj/wf_handler.o \
61 61 obj/tc_handler.o \
62 62 obj/fsw_misc.o \
63 63 obj/fsw_init.o \
64 64 obj/fsw_globals.o \
65 65 obj/fsw_spacewire.o \
66 66 obj/tc_load_dump_parameters.o \
67 67 obj/tm_lfr_tc_exe.o \
68 68 obj/tc_acceptance.o \
69 69 obj/basic_parameters.o \
70 70 obj/fsw_processing.o \
71 71 obj/avf0_prc0.o \
72 72 obj/avf1_prc1.o \
73 73 obj/avf2_prc2.o
74 74 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
75 75 /usr/lib64/qt4/mkspecs/common/linux.conf \
76 76 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
77 77 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
78 78 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
79 79 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
80 80 /usr/lib64/qt4/mkspecs/qconfig.pri \
81 81 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
82 82 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
83 83 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
84 84 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
85 85 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
86 86 sparc.pri \
87 87 /usr/lib64/qt4/mkspecs/features/release.prf \
88 88 /usr/lib64/qt4/mkspecs/features/default_post.prf \
89 89 /usr/lib64/qt4/mkspecs/features/shared.prf \
90 90 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
91 91 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
92 92 /usr/lib64/qt4/mkspecs/features/resources.prf \
93 93 /usr/lib64/qt4/mkspecs/features/uic.prf \
94 94 /usr/lib64/qt4/mkspecs/features/yacc.prf \
95 95 /usr/lib64/qt4/mkspecs/features/lex.prf \
96 96 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
97 97 fsw-qt.pro
98 98 QMAKE_TARGET = fsw
99 99 DESTDIR = bin/
100 100 TARGET = bin/fsw
101 101
102 102 first: all
103 103 ####### Implicit rules
104 104
105 105 .SUFFIXES: .o .c .cpp .cc .cxx .C
106 106
107 107 .cpp.o:
108 108 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
109 109
110 110 .cc.o:
111 111 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
112 112
113 113 .cxx.o:
114 114 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
115 115
116 116 .C.o:
117 117 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
118 118
119 119 .c.o:
120 120 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
121 121
122 122 ####### Build rules
123 123
124 124 all: Makefile $(TARGET)
125 125
126 126 $(TARGET): $(OBJECTS)
127 127 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
128 128 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
129 129
130 130 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
131 131 /usr/lib64/qt4/mkspecs/common/linux.conf \
132 132 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
133 133 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
134 134 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
135 135 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
136 136 /usr/lib64/qt4/mkspecs/qconfig.pri \
137 137 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
138 138 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
139 139 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
140 140 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
141 141 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
142 142 sparc.pri \
143 143 /usr/lib64/qt4/mkspecs/features/release.prf \
144 144 /usr/lib64/qt4/mkspecs/features/default_post.prf \
145 145 /usr/lib64/qt4/mkspecs/features/shared.prf \
146 146 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
147 147 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
148 148 /usr/lib64/qt4/mkspecs/features/resources.prf \
149 149 /usr/lib64/qt4/mkspecs/features/uic.prf \
150 150 /usr/lib64/qt4/mkspecs/features/yacc.prf \
151 151 /usr/lib64/qt4/mkspecs/features/lex.prf \
152 152 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
153 153 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
154 154 /usr/lib64/qt4/mkspecs/common/unix.conf:
155 155 /usr/lib64/qt4/mkspecs/common/linux.conf:
156 156 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
157 157 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
158 158 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
159 159 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
160 160 /usr/lib64/qt4/mkspecs/qconfig.pri:
161 161 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
162 162 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
163 163 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
164 164 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
165 165 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
166 166 sparc.pri:
167 167 /usr/lib64/qt4/mkspecs/features/release.prf:
168 168 /usr/lib64/qt4/mkspecs/features/default_post.prf:
169 169 /usr/lib64/qt4/mkspecs/features/shared.prf:
170 170 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
171 171 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
172 172 /usr/lib64/qt4/mkspecs/features/resources.prf:
173 173 /usr/lib64/qt4/mkspecs/features/uic.prf:
174 174 /usr/lib64/qt4/mkspecs/features/yacc.prf:
175 175 /usr/lib64/qt4/mkspecs/features/lex.prf:
176 176 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
177 177 qmake: FORCE
178 178 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
179 179
180 180 dist:
181 181 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
182 182 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0
183 183
184 184
185 185 clean:compiler_clean
186 186 -$(DEL_FILE) $(OBJECTS)
187 187 -$(DEL_FILE) *~ core *.core
188 188
189 189
190 190 ####### Sub-libraries
191 191
192 192 distclean: clean
193 193 -$(DEL_FILE) $(TARGET)
194 194 -$(DEL_FILE) Makefile
195 195
196 196
197 197 grmon:
198 198 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
199 199
200 200 check: first
201 201
202 202 compiler_rcc_make_all:
203 203 compiler_rcc_clean:
204 204 compiler_uic_make_all:
205 205 compiler_uic_clean:
206 206 compiler_image_collection_make_all: qmake_image_collection.cpp
207 207 compiler_image_collection_clean:
208 208 -$(DEL_FILE) qmake_image_collection.cpp
209 209 compiler_yacc_decl_make_all:
210 210 compiler_yacc_decl_clean:
211 211 compiler_yacc_impl_make_all:
212 212 compiler_yacc_impl_clean:
213 213 compiler_lex_make_all:
214 214 compiler_lex_clean:
215 215 compiler_clean:
216 216
217 217 ####### Compile
218 218
219 219 obj/wf_handler.o: ../src/wf_handler.c
220 220 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
221 221
222 222 obj/tc_handler.o: ../src/tc_handler.c
223 223 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
224 224
225 225 obj/fsw_misc.o: ../src/fsw_misc.c
226 226 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
227 227
228 228 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
229 229 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
230 230
231 231 obj/fsw_globals.o: ../src/fsw_globals.c
232 232 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
233 233
234 234 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
235 235 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
236 236
237 237 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
238 238 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
239 239
240 240 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
241 241 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
242 242
243 243 obj/tc_acceptance.o: ../src/tc_acceptance.c
244 244 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
245 245
246 246 obj/basic_parameters.o: ../src/basic_parameters/basic_parameters.c ../src/basic_parameters/basic_parameters.h
247 247 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/basic_parameters/basic_parameters.c
248 248
249 249 obj/fsw_processing.o: ../src/processing/fsw_processing.c
250 250 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c
251 251
252 252 obj/avf0_prc0.o: ../src/processing/avf0_prc0.c
253 253 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c
254 254
255 255 obj/avf1_prc1.o: ../src/processing/avf1_prc1.c
256 256 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c
257 257
258 258 obj/avf2_prc2.o: ../src/processing/avf2_prc2.c
259 259 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c
260 260
261 261 ####### Install
262 262
263 263 install: FORCE
264 264
265 265 uninstall: FORCE
266 266
267 267 FORCE:
268 268
@@ -1,201 +1,201
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 3.0.1, 2014-05-13T07:49:30. -->
3 <!-- Written by QtCreator 3.0.1, 2014-05-13T15:58:32. -->
4 4 <qtcreator>
5 5 <data>
6 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
7 7 <value type="int">0</value>
8 8 </data>
9 9 <data>
10 10 <variable>ProjectExplorer.Project.EditorSettings</variable>
11 11 <valuemap type="QVariantMap">
12 12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13 13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14 14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
15 15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
16 16 <value type="QString" key="language">Cpp</value>
17 17 <valuemap type="QVariantMap" key="value">
18 18 <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
19 19 </valuemap>
20 20 </valuemap>
21 21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
22 22 <value type="QString" key="language">QmlJS</value>
23 23 <valuemap type="QVariantMap" key="value">
24 24 <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
25 25 </valuemap>
26 26 </valuemap>
27 27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
28 28 <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
29 29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
30 30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
31 31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
32 32 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
33 33 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
34 34 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
35 35 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
36 36 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
37 37 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
38 38 <value type="int" key="EditorConfiguration.TabSize">8</value>
39 39 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
40 40 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
41 41 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
42 42 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
43 43 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
44 44 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
45 45 </valuemap>
46 46 </data>
47 47 <data>
48 48 <variable>ProjectExplorer.Project.PluginSettings</variable>
49 49 <valuemap type="QVariantMap"/>
50 50 </data>
51 51 <data>
52 52 <variable>ProjectExplorer.Project.Target.0</variable>
53 53 <valuemap type="QVariantMap">
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.3 in PATH (System)</value>
55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.3 in PATH (System)</value>
56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{be73cf6a-f9d8-4d5a-8adf-adc2d83e2e44}</value>
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
57 57 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
58 58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
59 59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
60 60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
61 61 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value>
62 62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
63 63 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
64 64 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
65 65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
66 66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
67 67 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
68 68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
69 69 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
70 70 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
71 71 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
72 72 </valuemap>
73 73 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
74 74 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
75 75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
76 76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
77 77 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
78 78 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
79 79 <value type="QString">-w</value>
80 80 <value type="QString">-r</value>
81 81 </valuelist>
82 82 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
83 83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
84 84 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
85 85 </valuemap>
86 86 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
87 87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
88 88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
89 89 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
90 90 </valuemap>
91 91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
92 92 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
93 93 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
94 94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
95 95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
96 96 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
97 97 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
98 98 <value type="QString">-w</value>
99 99 <value type="QString">-r</value>
100 100 </valuelist>
101 101 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
102 102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
103 103 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
104 104 </valuemap>
105 105 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
106 106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
107 107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
108 108 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
109 109 </valuemap>
110 110 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
111 111 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
112 112 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
113 113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
114 114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
115 115 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
116 116 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
117 117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
118 118 </valuemap>
119 119 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
120 120 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
121 121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
122 122 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
123 123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
124 124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
125 125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
126 126 </valuemap>
127 127 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
128 128 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
129 129 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
130 130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
131 131 </valuemap>
132 132 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
133 133 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
134 134 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
135 135 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
136 136 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
137 137 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
138 138 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
139 139 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
140 140 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
141 141 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
142 142 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
143 143 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
144 144 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
145 145 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
146 146 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
147 147 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
148 148 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
149 149 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
150 150 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
151 151 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
152 152 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
153 153 <value type="int">0</value>
154 154 <value type="int">1</value>
155 155 <value type="int">2</value>
156 156 <value type="int">3</value>
157 157 <value type="int">4</value>
158 158 <value type="int">5</value>
159 159 <value type="int">6</value>
160 160 <value type="int">7</value>
161 161 <value type="int">8</value>
162 162 <value type="int">9</value>
163 163 <value type="int">10</value>
164 164 <value type="int">11</value>
165 165 <value type="int">12</value>
166 166 <value type="int">13</value>
167 167 <value type="int">14</value>
168 168 </valuelist>
169 169 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
170 170 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
171 171 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
172 172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
173 173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
174 174 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
175 175 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
176 176 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
177 177 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
178 178 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
179 179 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
180 180 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
181 181 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
182 182 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
183 183 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
184 184 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
185 185 </valuemap>
186 186 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
187 187 </valuemap>
188 188 </data>
189 189 <data>
190 190 <variable>ProjectExplorer.Project.TargetCount</variable>
191 191 <value type="int">1</value>
192 192 </data>
193 193 <data>
194 194 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
195 <value type="QByteArray">{cdbf9cdc-1e84-406e-889b-c4feef49e75c}</value>
195 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
196 196 </data>
197 197 <data>
198 198 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
199 199 <value type="int">15</value>
200 200 </data>
201 201 </qtcreator>
@@ -1,665 +1,665
1 1 #ifndef CCSDS_TYPES_H_INCLUDED
2 2 #define CCSDS_TYPES_H_INCLUDED
3 3
4 4 #include "fsw_params_processing.h"
5 5
6 6 #define CCSDS_PROTOCOLE_EXTRA_BYTES 4
7 7 #define CCSDS_TC_TM_PACKET_OFFSET 7
8 8 #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4
9 9 #define CCSDS_TM_PKT_MAX_SIZE 4412
10 10 #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4
11 11 #define CCSDS_TC_PKT_MAX_SIZE 256
12 12 #define CCSDS_TC_PKT_MIN_SIZE 16
13 13 #define CCSDS_PROCESS_ID 76
14 14 #define CCSDS_PACKET_CATEGORY 12
15 15 #define CCSDS_NODE_ADDRESS 0xfe
16 16 #define CCSDS_USER_APP 0x00
17 17
18 18 #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10
19 19 #define DEFAULT_RESERVED 0x00
20 20 #define DEFAULT_HKBIA 0x1e // 0001 1110
21 21
22 22 // PACKET ID
23 23 #define APID_TM_TC_EXE 0x0cc1 // PID 76 CAT 1
24 24 #define APID_TM_HK 0x0cc4 // PID 76 CAT 4
25 25 #define APID_TM_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9
26 26 #define APID_TM_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12
27 27 #define APID_TM_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12
28 28 #define TM_PACKET_PID_DEFAULT 76
29 29 #define TM_PACKET_PID_BURST_SBM1_SBM2 79
30 30 #define TM_PACKET_CAT_TC_EXE 1
31 31 #define TM_PACKET_CAT_HK 4
32 32 #define TM_PACKET_CAT_PARAMETER_DUMP 9
33 33 #define TM_PACKET_CAT_SCIENCE 12
34 34 #define TC_PACKET_CAT 12
35 35
36 36 // PACKET SEQUENCE CONTROL
37 37 #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000]
38 38 #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000]
39 39 #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000]
40 40 #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000]
41 41 #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000]
42 42
43 43 // DESTINATION ID
44 44 #define TM_DESTINATION_ID_GROUND 0
45 45 #define TM_DESTINATION_ID_MISSION_TIMELINE 110
46 46 #define TM_DESTINATION_ID_TC_SEQUENCES 111
47 47 #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112
48 48 #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113
49 49 #define TM_DESTINATION_ID_DIRECT_CMD 120
50 50 #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121
51 51 #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122
52 52 #define TM_DESTINATION_ID_OBCP 15
53 53 #define TM_DESTINATION_ID_SYSTEM_CONTROL 14
54 54 #define TM_DESTINATION_ID_AOCS 11
55 55
56 56 #define CCSDS_DESTINATION_ID 0x01
57 57 #define CCSDS_PROTOCOLE_ID 0x02
58 58 #define CCSDS_RESERVED 0x00
59 59 #define CCSDS_USER_APP 0x00
60 60
61 61 #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24
62 62 #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32
63 63 #define SIZE_HK_PARAMETERS 112
64 64
65 65 // TC TYPES
66 66 #define TC_TYPE_GEN 181
67 67 #define TC_TYPE_TIME 9
68 68
69 69 // TC SUBTYPES
70 70 #define TC_SUBTYPE_RESET 1
71 71 #define TC_SUBTYPE_LOAD_COMM 11
72 72 #define TC_SUBTYPE_LOAD_NORM 13
73 73 #define TC_SUBTYPE_LOAD_BURST 19
74 74 #define TC_SUBTYPE_LOAD_SBM1 25
75 75 #define TC_SUBTYPE_LOAD_SBM2 27
76 76 #define TC_SUBTYPE_DUMP 31
77 77 #define TC_SUBTYPE_ENTER 41
78 78 #define TC_SUBTYPE_UPDT_INFO 51
79 79 #define TC_SUBTYPE_EN_CAL 61
80 80 #define TC_SUBTYPE_DIS_CAL 63
81 81 #define TC_SUBTYPE_UPDT_TIME 129
82 82
83 83 // TC LEN
84 84 #define TC_LEN_RESET 12
85 85 #define TC_LEN_LOAD_COMM 14
86 86 #define TC_LEN_LOAD_NORM 22
87 87 #define TC_LEN_LOAD_BURST 14
88 88 #define TC_LEN_LOAD_SBM1 14
89 89 #define TC_LEN_LOAD_SBM2 14
90 90 #define TC_LEN_DUMP 12
91 91 #define TC_LEN_ENTER 20
92 92 #define TC_LEN_UPDT_INFO 46
93 93 #define TC_LEN_EN_CAL 12
94 94 #define TC_LEN_DIS_CAL 12
95 95 #define TC_LEN_UPDT_TIME 18
96 96
97 97 // TM TYPES
98 98 #define TM_TYPE_TC_EXE 1
99 99 #define TM_TYPE_HK 3
100 100 #define TM_TYPE_PARAMETER_DUMP 3
101 101 #define TM_TYPE_LFR_SCIENCE 21
102 102
103 103 // TM SUBTYPES
104 104 #define TM_SUBTYPE_EXE_OK 7
105 105 #define TM_SUBTYPE_EXE_NOK 8
106 106 #define TM_SUBTYPE_HK 25
107 107 #define TM_SUBTYPE_PARAMETER_DUMP 25
108 108 #define TM_SUBTYPE_SCIENCE 3
109 109 #define TM_SUBTYPE_LFR_SCIENCE 3
110 110
111 111 // FAILURE CODES
112 112 #define ILLEGAL_APID 0
113 113 #define WRONG_LEN_PKT 1
114 114 #define INCOR_CHECKSUM 2
115 115 #define ILL_TYPE 3
116 116 #define ILL_SUBTYPE 4
117 117 #define WRONG_APP_DATA 5 // 0x00 0x05
118 118 #define TC_NOT_EXE 42000 // 0xa4 0x10
119 119 #define WRONG_SRC_ID 42001 // 0xa4 0x11
120 120 #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12
121 121 #define FAIL_DETECTED 42003 // 0xa4 0x13
122 122 #define NOT_ALLOWED 42004 // 0xa4 0x14
123 123 #define CORRUPTED 42005 // 0xa4 0x15
124 124 #define CCSDS_TM_VALID 7
125 125
126 126 // TC SID
127 127 #define SID_TC_GROUND 0
128 128 #define SID_TC_MISSION_TIMELINE 110
129 129 #define SID_TC_TC_SEQUENCES 111
130 130 #define SID_TC_RECOVERY_ACTION_CMD 112
131 131 #define SID_TC_BACKUP_MISSION_TIMELINE 113
132 132 #define SID_TC_DIRECT_CMD 120
133 133 #define SID_TC_SPARE_GRD_SRC1 121
134 134 #define SID_TC_SPARE_GRD_SRC2 122
135 135 #define SID_TC_OBCP 15
136 136 #define SID_TC_SYSTEM_CONTROL 14
137 137 #define SID_TC_AOCS 11
138 138 #define SID_TC_RPW_INTERNAL 254
139 139
140 140 enum apid_destid{
141 141 GROUND,
142 142 MISSION_TIMELINE,
143 143 TC_SEQUENCES,
144 144 RECOVERY_ACTION_CMD,
145 145 BACKUP_MISSION_TIMELINE,
146 146 DIRECT_CMD,
147 147 SPARE_GRD_SRC1,
148 148 SPARE_GRD_SRC2,
149 149 OBCP,
150 150 SYSTEM_CONTROL,
151 151 AOCS,
152 152 RPW_INTERNAL
153 153 };
154 154 // SEQUENCE COUNTERS
155 155 #define SEQ_CNT_MAX 16383
156 156 #define SEQ_CNT_NB_DEST_ID 12
157 157
158 158 // TM SID
159 159 #define SID_HK 1
160 160 #define SID_PARAMETER_DUMP 10
161 161
162 162 #define SID_NORM_SWF_F0 3
163 163 #define SID_NORM_SWF_F1 4
164 164 #define SID_NORM_SWF_F2 5
165 165 #define SID_NORM_CWF_F3 1
166 166 #define SID_BURST_CWF_F2 2
167 167 #define SID_SBM1_CWF_F1 24
168 168 #define SID_SBM2_CWF_F2 25
169 169 #define SID_NORM_ASM_F0 11
170 170 #define SID_NORM_ASM_F1 12
171 171 #define SID_NORM_ASM_F2 13
172 172 #define SID_NORM_BP1_F0 14
173 173 #define SID_NORM_BP1_F1 15
174 174 #define SID_NORM_BP1_F2 16
175 175 #define SID_NORM_BP2_F0 19
176 176 #define SID_NORM_BP2_F1 20
177 177 #define SID_NORM_BP2_F2 21
178 178 #define SID_BURST_BP1_F0 17
179 179 #define SID_BURST_BP2_F0 22
180 180 #define SID_BURST_BP1_F1 18
181 181 #define SID_BURST_BP2_F1 23
182 182 #define SID_SBM1_BP1_F0 28
183 183 #define SID_SBM1_BP2_F0 31
184 184 #define SID_SBM2_BP1_F0 29
185 185 #define SID_SBM2_BP2_F0 32
186 186 #define SID_SBM2_BP1_F1 30
187 187 #define SID_SBM2_BP2_F1 33
188 188 #define SID_NORM_CWF_LONG_F3 34
189 189
190 190 // LENGTH (BYTES)
191 191 #define LENGTH_TM_LFR_TC_EXE_MAX 32
192 192 #define LENGTH_TM_LFR_HK 126
193 193
194 194 // HEADER_LENGTH
195 195 #define TM_HEADER_LEN 16
196 196 #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28
197 197 // PACKET_LENGTH
198 198 #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET)
199 199 #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET)
200 200 #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET)
201 201 #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET)
202 202 #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET)
203 203 #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET)
204 204 #define PACKET_LENGTH_HK (124 - CCSDS_TC_TM_PACKET_OFFSET)
205 205 #define PACKET_LENGTH_PARAMETER_DUMP (36 - CCSDS_TC_TM_PACKET_OFFSET)
206 206 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 (2228 - CCSDS_TC_TM_PACKET_OFFSET) // 44 * 25 * 2 + 28
207 207 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 (2628 - CCSDS_TC_TM_PACKET_OFFSET) // 52 * 25 * 2 + 28
208 208 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 (2428 - CCSDS_TC_TM_PACKET_OFFSET) // 48 * 25 * 2 + 28
209 209 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 (126 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 9 + 27
210 210 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 (356 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 30 + 26
211 211 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 (144 - CCSDS_TC_TM_PACKET_OFFSET) // 13 * 9 + 27
212 212 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 (416 - CCSDS_TC_TM_PACKET_OFFSET) // 13 * 30 + 26
213 213 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2 (134 - CCSDS_TC_TM_PACKET_OFFSET) // 12 * 9 + 26
214 214 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2 (386 - CCSDS_TC_TM_PACKET_OFFSET) // 12 * 30 + 26
215 215 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 (224 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 9 + 26
216 216 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 (686 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 30 + 26
217 217 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 (260 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 9 + 26
218 218 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 (806 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 30 + 26
219 219
220 220 #define PACKET_LENGTH_DELTA 11 // 7 + 4
221 221
222 222 #define SPARE1_PUSVERSION_SPARE2 0x10
223 223
224 224 // R1
225 225 #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1
226 226 #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1
227 227 #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1
228 228 #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1
229 229 #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1
230 230 #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1
231 231 // R2
232 232 #define TM_LEN_SCI_SWF_304 3669 // 304 * 12 + 10 + 12 - 1
233 233 #define TM_LEN_SCI_SWF_224 2709 // 224 * 12 + 10 + 12 - 1
234 234 #define TM_LEN_SCI_CWF_336 4051 // 336 * 12 + 10 + 10 - 1
235 235 #define TM_LEN_SCI_CWF_672 4051 // 672 * 6 + 10 + 10 - 1
236 236 //
237 237 #define DEFAULT_PKTCNT 0x07
238 238 #define BLK_NR_304 0x0130
239 239 #define BLK_NR_224 0x00e0
240 240 #define BLK_NR_CWF 0x0150 // 336
241 241 #define BLK_NR_CWF_SHORT_F3 0x02a0 // 672
242 242
243 243 enum TM_TYPE{
244 244 TM_LFR_TC_EXE_OK,
245 245 TM_LFR_TC_EXE_ERR,
246 246 TM_LFR_HK,
247 247 TM_LFR_SCI,
248 248 TM_LFR_SCI_SBM,
249 249 TM_LFR_PAR_DUMP
250 250 };
251 251
252 252 typedef struct {
253 253 unsigned char targetLogicalAddress;
254 254 unsigned char protocolIdentifier;
255 255 unsigned char reserved;
256 256 unsigned char userApplication;
257 257 // PACKET HEADER
258 258 unsigned char packetID[2];
259 259 unsigned char packetSequenceControl[2];
260 260 unsigned char packetLength[2];
261 261 // DATA FIELD HEADER
262 262 unsigned char spare1_pusVersion_spare2;
263 263 unsigned char serviceType;
264 264 unsigned char serviceSubType;
265 265 unsigned char destinationID;
266 266 unsigned char time[6];
267 267 //
268 268 unsigned char telecommand_pkt_id[2];
269 269 unsigned char pkt_seq_control[2];
270 270 } Packet_TM_LFR_TC_EXE_SUCCESS_t;
271 271
272 272 typedef struct {
273 273 unsigned char targetLogicalAddress;
274 274 unsigned char protocolIdentifier;
275 275 unsigned char reserved;
276 276 unsigned char userApplication;
277 277 // PACKET HEADER
278 278 unsigned char packetID[2];
279 279 unsigned char packetSequenceControl[2];
280 280 unsigned char packetLength[2];
281 281 // DATA FIELD HEADER
282 282 unsigned char spare1_pusVersion_spare2;
283 283 unsigned char serviceType;
284 284 unsigned char serviceSubType;
285 285 unsigned char destinationID;
286 286 unsigned char time[6];
287 287 //
288 288 unsigned char tc_failure_code[2];
289 289 unsigned char telecommand_pkt_id[2];
290 290 unsigned char pkt_seq_control[2];
291 291 unsigned char tc_service;
292 292 unsigned char tc_subtype;
293 293 unsigned char byte_position;
294 294 unsigned char rcv_value;
295 295 } Packet_TM_LFR_TC_EXE_INCONSISTENT_t;
296 296
297 297 typedef struct {
298 298 unsigned char targetLogicalAddress;
299 299 unsigned char protocolIdentifier;
300 300 unsigned char reserved;
301 301 unsigned char userApplication;
302 302 // PACKET HEADER
303 303 unsigned char packetID[2];
304 304 unsigned char packetSequenceControl[2];
305 305 unsigned char packetLength[2];
306 306 // DATA FIELD HEADER
307 307 unsigned char spare1_pusVersion_spare2;
308 308 unsigned char serviceType;
309 309 unsigned char serviceSubType;
310 310 unsigned char destinationID;
311 311 unsigned char time[6];
312 312 //
313 313 unsigned char tc_failure_code[2];
314 314 unsigned char telecommand_pkt_id[2];
315 315 unsigned char pkt_seq_control[2];
316 316 unsigned char tc_service;
317 317 unsigned char tc_subtype;
318 318 unsigned char lfr_status_word[2];
319 319 } Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t;
320 320
321 321 typedef struct {
322 322 unsigned char targetLogicalAddress;
323 323 unsigned char protocolIdentifier;
324 324 unsigned char reserved;
325 325 unsigned char userApplication;
326 326 // PACKET HEADER
327 327 unsigned char packetID[2];
328 328 unsigned char packetSequenceControl[2];
329 329 unsigned char packetLength[2];
330 330 // DATA FIELD HEADER
331 331 unsigned char spare1_pusVersion_spare2;
332 332 unsigned char serviceType;
333 333 unsigned char serviceSubType;
334 334 unsigned char destinationID;
335 335 unsigned char time[6];
336 336 //
337 337 unsigned char tc_failure_code[2];
338 338 unsigned char telecommand_pkt_id[2];
339 339 unsigned char pkt_seq_control[2];
340 340 unsigned char tc_service;
341 341 unsigned char tc_subtype;
342 342 } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t;
343 343
344 344 typedef struct {
345 345 unsigned char targetLogicalAddress;
346 346 unsigned char protocolIdentifier;
347 347 unsigned char reserved;
348 348 unsigned char userApplication;
349 349 // PACKET HEADER
350 350 unsigned char packetID[2];
351 351 unsigned char packetSequenceControl[2];
352 352 unsigned char packetLength[2];
353 353 // DATA FIELD HEADER
354 354 unsigned char spare1_pusVersion_spare2;
355 355 unsigned char serviceType;
356 356 unsigned char serviceSubType;
357 357 unsigned char destinationID;
358 358 unsigned char time[6];
359 359 //
360 360 unsigned char tc_failure_code[2];
361 361 unsigned char telecommand_pkt_id[2];
362 362 unsigned char pkt_seq_control[2];
363 363 unsigned char tc_service;
364 364 unsigned char tc_subtype;
365 365 } Packet_TM_LFR_TC_EXE_ERROR_t;
366 366
367 367 typedef struct {
368 368 unsigned char targetLogicalAddress;
369 369 unsigned char protocolIdentifier;
370 370 unsigned char reserved;
371 371 unsigned char userApplication;
372 372 // PACKET HEADER
373 373 unsigned char packetID[2];
374 374 unsigned char packetSequenceControl[2];
375 375 unsigned char packetLength[2];
376 376 // DATA FIELD HEADER
377 377 unsigned char spare1_pusVersion_spare2;
378 378 unsigned char serviceType;
379 379 unsigned char serviceSubType;
380 380 unsigned char destinationID;
381 381 unsigned char time[6];
382 382 //
383 383 unsigned char tc_failure_code[2];
384 384 unsigned char telecommand_pkt_id[2];
385 385 unsigned char pkt_seq_control[2];
386 386 unsigned char tc_service;
387 387 unsigned char tc_subtype;
388 388 unsigned char pkt_len_rcv_value[2];
389 389 unsigned char pkt_datafieldsize_cnt[2];
390 390 unsigned char rcv_crc[2];
391 391 unsigned char computed_crc[2];
392 392 } Packet_TM_LFR_TC_EXE_CORRUPTED_t;
393 393
394 394 typedef struct {
395 395 unsigned char targetLogicalAddress;
396 396 unsigned char protocolIdentifier;
397 397 unsigned char reserved;
398 398 unsigned char userApplication;
399 399 unsigned char packetID[2];
400 400 unsigned char packetSequenceControl[2];
401 401 unsigned char packetLength[2];
402 402 // DATA FIELD HEADER
403 403 unsigned char spare1_pusVersion_spare2;
404 404 unsigned char serviceType;
405 405 unsigned char serviceSubType;
406 406 unsigned char destinationID;
407 407 unsigned char time[6];
408 408 // AUXILIARY HEADER
409 409 unsigned char sid;
410 410 unsigned char hkBIA;
411 411 unsigned char pktCnt;
412 412 unsigned char pktNr;
413 413 unsigned char acquisitionTime[6];
414 414 unsigned char blkNr[2];
415 415 } Header_TM_LFR_SCIENCE_SWF_t;
416 416
417 417 typedef struct {
418 418 unsigned char targetLogicalAddress;
419 419 unsigned char protocolIdentifier;
420 420 unsigned char reserved;
421 421 unsigned char userApplication;
422 422 unsigned char packetID[2];
423 423 unsigned char packetSequenceControl[2];
424 424 unsigned char packetLength[2];
425 425 // DATA FIELD HEADER
426 426 unsigned char spare1_pusVersion_spare2;
427 427 unsigned char serviceType;
428 428 unsigned char serviceSubType;
429 429 unsigned char destinationID;
430 430 unsigned char time[6];
431 431 // AUXILIARY DATA HEADER
432 432 unsigned char sid;
433 433 unsigned char hkBIA;
434 434 unsigned char acquisitionTime[6];
435 435 unsigned char blkNr[2];
436 436 } Header_TM_LFR_SCIENCE_CWF_t;
437 437
438 438 typedef struct {
439 439 unsigned char targetLogicalAddress;
440 440 unsigned char protocolIdentifier;
441 441 unsigned char reserved;
442 442 unsigned char userApplication;
443 443 unsigned char packetID[2];
444 444 unsigned char packetSequenceControl[2];
445 445 unsigned char packetLength[2];
446 446 // DATA FIELD HEADER
447 447 unsigned char spare1_pusVersion_spare2;
448 448 unsigned char serviceType;
449 449 unsigned char serviceSubType;
450 450 unsigned char destinationID;
451 451 unsigned char time[6];
452 452 // AUXILIARY HEADER
453 453 unsigned char sid;
454 454 unsigned char biaStatusInfo;
455 455 unsigned char pa_lfr_pkt_cnt_asm;
456 456 unsigned char pa_lfr_pkt_nr_asm;
457 457 unsigned char acquisitionTime[6];
458 458 unsigned char pa_lfr_asm_blk_nr[2];
459 459 } Header_TM_LFR_SCIENCE_ASM_t;
460 460
461 461 typedef struct {
462 462 unsigned char targetLogicalAddress;
463 463 unsigned char protocolIdentifier;
464 464 unsigned char reserved;
465 465 unsigned char userApplication;
466 466 unsigned char packetID[2];
467 467 unsigned char packetSequenceControl[2];
468 468 unsigned char packetLength[2];
469 469 // DATA FIELD HEADER
470 470 unsigned char spare1_pusVersion_spare2;
471 471 unsigned char serviceType;
472 472 unsigned char serviceSubType;
473 473 unsigned char destinationID;
474 474 unsigned char time[6];
475 475 // AUXILIARY HEADER
476 476 unsigned char sid;
477 477 unsigned char biaStatusInfo;
478 478 unsigned char acquisitionTime[6];
479 479 unsigned char source_data_spare[2];
480 480 unsigned char pa_lfr_bp_blk_nr[2];
481 481 } Header_TM_LFR_SCIENCE_BP_with_spare_t;
482 482
483 483 typedef struct {
484 484 unsigned char targetLogicalAddress;
485 485 unsigned char protocolIdentifier;
486 486 unsigned char reserved;
487 487 unsigned char userApplication;
488 488 unsigned char packetID[2];
489 489 unsigned char packetSequenceControl[2];
490 490 unsigned char packetLength[2];
491 491 // DATA FIELD HEADER
492 492 unsigned char spare1_pusVersion_spare2;
493 493 unsigned char serviceType;
494 494 unsigned char serviceSubType;
495 495 unsigned char destinationID;
496 496 unsigned char time[6];
497 497 // AUXILIARY HEADER
498 498 unsigned char sid;
499 499 unsigned char biaStatusInfo;
500 500 unsigned char acquisitionTime[6];
501 501 unsigned char pa_lfr_bp_blk_nr[2];
502 502 } Header_TM_LFR_SCIENCE_BP_t;
503 503
504 504 typedef struct {
505 505 //targetLogicalAddress is removed by the grspw module
506 506 unsigned char protocolIdentifier;
507 507 unsigned char reserved;
508 508 unsigned char userApplication;
509 509 unsigned char packetID[2];
510 510 unsigned char packetSequenceControl[2];
511 511 unsigned char packetLength[2];
512 512 // DATA FIELD HEADER
513 513 unsigned char headerFlag_pusVersion_Ack;
514 514 unsigned char serviceType;
515 515 unsigned char serviceSubType;
516 516 unsigned char sourceID;
517 517 unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10];
518 518 } ccsdsTelecommandPacket_t;
519 519
520 520 typedef struct {
521 521 unsigned char targetLogicalAddress;
522 522 unsigned char protocolIdentifier;
523 523 unsigned char reserved;
524 524 unsigned char userApplication;
525 525 unsigned char packetID[2];
526 526 unsigned char packetSequenceControl[2];
527 527 unsigned char packetLength[2];
528 528 unsigned char spare1_pusVersion_spare2;
529 529 unsigned char serviceType;
530 530 unsigned char serviceSubType;
531 531 unsigned char destinationID;
532 532 unsigned char time[6];
533 533 unsigned char sid;
534 534
535 535 //**************
536 536 // HK PARAMETERS
537 537 unsigned char lfr_status_word[2];
538 538 unsigned char lfr_sw_version[4];
539 539 unsigned char lfr_fpga_version[3];
540 540 // ressource statistics
541 541 unsigned char hk_lfr_cpu_load;
542 542 unsigned char hk_lfr_load_max;
543 543 unsigned char hk_lfr_load_aver;
544 544 // tc statistics
545 545 unsigned char hk_lfr_update_info_tc_cnt[2];
546 546 unsigned char hk_lfr_update_time_tc_cnt[2];
547 547 unsigned char hk_lfr_exe_tc_cnt[2];
548 548 unsigned char hk_lfr_rej_tc_cnt[2];
549 549 unsigned char hk_lfr_last_exe_tc_id[2];
550 550 unsigned char hk_lfr_last_exe_tc_type[2];
551 551 unsigned char hk_lfr_last_exe_tc_subtype[2];
552 552 unsigned char hk_lfr_last_exe_tc_time[6];
553 553 unsigned char hk_lfr_last_rej_tc_id[2];
554 554 unsigned char hk_lfr_last_rej_tc_type[2];
555 555 unsigned char hk_lfr_last_rej_tc_subtype[2];
556 556 unsigned char hk_lfr_last_rej_tc_time[6];
557 557 // anomaly statistics
558 558 unsigned char hk_lfr_le_cnt[2];
559 559 unsigned char hk_lfr_me_cnt[2];
560 560 unsigned char hk_lfr_he_cnt[2];
561 561 unsigned char hk_lfr_last_er_rid[2];
562 562 unsigned char hk_lfr_last_er_code;
563 563 unsigned char hk_lfr_last_er_time[6];
564 564 // vhdl_blk_status
565 565 unsigned char hk_lfr_vhdl_aa_sm;
566 566 unsigned char hk_lfr_vhdl_fft_sr;
567 567 unsigned char hk_lfr_vhdl_cic_hk;
568 568 unsigned char hk_lfr_vhdl_iir_cal;
569 569 // spacewire_if_statistics
570 570 unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2];
571 571 unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2];
572 572 unsigned char hk_lfr_dpu_spw_tick_out_cnt;
573 573 unsigned char hk_lfr_dpu_spw_last_timc;
574 574 // ahb error statistics
575 unsigned int hk_lfr_last_fail_addr;
575 unsigned char hk_lfr_last_fail_addr[4];
576 576 // temperatures
577 577 unsigned char hk_lfr_temp_scm[2];
578 578 unsigned char hk_lfr_temp_pcb[2];
579 579 unsigned char hk_lfr_temp_fpga[2];
580 580 // spacecraft potential
581 581 unsigned char hk_lfr_sc_v_f3[2];
582 582 unsigned char hk_lfr_sc_e1_f3[2];
583 583 unsigned char hk_lfr_sc_e2_f3[2];
584 584 // error counters
585 585 unsigned char hk_lfr_dpu_spw_parity;
586 586 unsigned char hk_lfr_dpu_spw_disconnect;
587 587 unsigned char hk_lfr_dpu_spw_escape;
588 588 unsigned char hk_lfr_dpu_spw_credit;
589 589 unsigned char hk_lfr_dpu_spw_write_sync;
590 590 unsigned char hk_lfr_dpu_spw_rx_ahb;
591 591 unsigned char hk_lfr_dpu_spw_tx_ahb;
592 592 unsigned char hk_lfr_dpu_spw_early_eop;
593 593 unsigned char hk_lfr_dpu_spw_invalid_addr;
594 594 unsigned char hk_lfr_dpu_spw_eep;
595 595 unsigned char hk_lfr_dpu_spw_rx_too_big;
596 596 // timecode
597 597 unsigned char hk_lfr_timecode_erroneous;
598 598 unsigned char hk_lfr_timecode_missing;
599 599 unsigned char hk_lfr_timecode_invalid;
600 600 // time
601 601 unsigned char hk_lfr_time_timecode_it;
602 602 unsigned char hk_lfr_time_not_synchro;
603 603 unsigned char hk_lfr_time_timecode_ctr;
604 604 // hk_lfr_buffer_dpu_
605 605 unsigned char hk_lfr_buffer_dpu_tc_fifo;
606 606 unsigned char hk_lfr_buffer_dpu_tm_fifo;
607 607 // hk_lfr_ahb_
608 608 unsigned char hk_lfr_ahb_correctable;
609 609 unsigned char hk_lfr_ahb_uncorrectable;
610 610 // spare
611 611 unsigned char parameters_spare;
612 612 } Packet_TM_LFR_HK_t;
613 613
614 614 typedef struct {
615 615 unsigned char targetLogicalAddress;
616 616 unsigned char protocolIdentifier;
617 617 unsigned char reserved;
618 618 unsigned char userApplication;
619 619 unsigned char packetID[2];
620 620 unsigned char packetSequenceControl[2];
621 621 unsigned char packetLength[2];
622 622 // DATA FIELD HEADER
623 623 unsigned char spare1_pusVersion_spare2;
624 624 unsigned char serviceType;
625 625 unsigned char serviceSubType;
626 626 unsigned char destinationID;
627 627 unsigned char time[6];
628 628 unsigned char sid;
629 629
630 630 //******************
631 631 // COMMON PARAMETERS
632 632 unsigned char unused0;
633 633 unsigned char bw_sp0_sp1_r0_r1;
634 634
635 635 //******************
636 636 // NORMAL PARAMETERS
637 637 unsigned char sy_lfr_n_swf_l[2];
638 638 unsigned char sy_lfr_n_swf_p[2];
639 639 unsigned char sy_lfr_n_asm_p[2];
640 640 unsigned char sy_lfr_n_bp_p0;
641 641 unsigned char sy_lfr_n_bp_p1;
642 642 unsigned char sy_lfr_n_cwf_long_f3;
643 643 unsigned char lfr_normal_parameters_spare;
644 644
645 645 //*****************
646 646 // BURST PARAMETERS
647 647 unsigned char sy_lfr_b_bp_p0;
648 648 unsigned char sy_lfr_b_bp_p1;
649 649
650 650 //****************
651 651 // SBM1 PARAMETERS
652 652 unsigned char sy_lfr_s1_bp_p0;
653 653 unsigned char sy_lfr_s1_bp_p1;
654 654
655 655 //****************
656 656 // SBM2 PARAMETERS
657 657 unsigned char sy_lfr_s2_bp_p0;
658 658 unsigned char sy_lfr_s2_bp_p1;
659 659
660 660 // SPARE
661 661 unsigned char source_data_spare;
662 662 } Packet_TM_LFR_PARAMETER_DUMP_t;
663 663
664 664
665 665 #endif // CCSDS_TYPES_H_INCLUDED
@@ -1,43 +1,45
1 1 #ifndef FSW_MISC_H_INCLUDED
2 2 #define FSW_MISC_H_INCLUDED
3 3
4 4 #include <rtems.h>
5 5 #include <stdio.h>
6 6 #include <grspw.h>
7 7
8 8 #include "fsw_params.h"
9 9 #include "fsw_spacewire.h"
10 10
11 11 rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic
12 12 rtems_id HK_id; // id of the HK rate monotonic period
13 13
14 14 //extern rtems_name misc_name[5];
15 15 //time_management_regs_t *time_management_regs;
16 16 //extern Packet_TM_LFR_HK_t housekeeping_packet;
17 17
18 18 void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
19 19 unsigned char interrupt_level, rtems_isr (*timer_isr)() );
20 20 void timer_start( gptimer_regs_t *gptimer_regs, unsigned char timer );
21 21 void timer_stop( gptimer_regs_t *gptimer_regs, unsigned char timer );
22 22 void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider);
23 23
24 24 // SERIAL LINK
25 25 int send_console_outputs_on_apbuart_port( void );
26 26 int enable_apbuart_transmitter( void );
27 27 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value);
28 28
29 29 // RTEMS TASKS
30 30 rtems_task stat_task( rtems_task_argument argument );
31 31 rtems_task hous_task( rtems_task_argument argument );
32 32 rtems_task dumb_task( rtems_task_argument unused );
33 33
34 34 void init_housekeeping_parameters( void );
35 35 void increment_seq_counter( unsigned char *packet_sequence_control);
36 36 void getTime( unsigned char *time);
37 37 unsigned long long int getTimeAsUnsignedLongLongInt( );
38 38 void send_dumb_hk( void );
39 void get_v_e1_e2_f3 (unsigned char *v, unsigned char *e1, unsigned char *e2, bool init_buffer_addr );
39 void get_v_e1_e2_f3 (unsigned char *v, unsigned char *e1, unsigned char *e2);
40 40
41 41 extern int sched_yield( void );
42 extern ring_node *current_ring_node_f3;
43 extern ring_node *ring_node_to_send_cwf_f3;
42 44
43 45 #endif // FSW_MISC_H_INCLUDED
@@ -1,95 +1,94
1 1 #ifndef WF_HANDLER_H_INCLUDED
2 2 #define WF_HANDLER_H_INCLUDED
3 3
4 4 #include <rtems.h>
5 5 #include <grspw.h>
6 6 #include <stdio.h>
7 7 #include <math.h>
8 8
9 9 #include "fsw_params.h"
10 10 #include "fsw_spacewire.h"
11 11 #include "fsw_misc.h"
12 12 #include "fsw_params_wf_handler.h"
13 13
14 14 #define pi 3.1415
15 15
16 16 extern int fdSPW;
17 17
18 18 //*****************
19 19 // waveform buffers
20 20 extern volatile int wf_snap_f0[ ];
21 21 extern volatile int wf_snap_f1[ ];
22 22 extern volatile int wf_snap_f2[ ];
23 23 extern volatile int wf_cont_f3[ ];
24 24 extern char wf_cont_f3_light[ ];
25 25
26 26 extern waveform_picker_regs_new_t *waveform_picker_regs;
27 27 extern time_management_regs_t *time_management_regs;
28 28 extern Packet_TM_LFR_HK_t housekeeping_packet;
29 29 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
30 30 extern struct param_local_str param_local;
31 31
32 32 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
33 33 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
34 34
35 35 extern rtems_id Task_id[20]; /* array of task ids */
36 36
37 37 extern unsigned char lfrCurrentMode;
38 38
39 39 //**********
40 40 // RTEMS_ISR
41 41 void reset_extractSWF( void );
42 42 rtems_isr waveforms_isr( rtems_vector_number vector );
43 43
44 44 //***********
45 45 // RTEMS_TASK
46 46 rtems_task wfrm_task( rtems_task_argument argument );
47 47 rtems_task cwf3_task( rtems_task_argument argument );
48 48 rtems_task cwf2_task( rtems_task_argument argument );
49 49 rtems_task cwf1_task( rtems_task_argument argument );
50 50 rtems_task swbd_task( rtems_task_argument argument );
51 51
52 52 //******************
53 53 // general functions
54 void init_waveforms( void );
55 54 void init_waveform_rings( void );
56 55 void init_waveform_ring( ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] );
57 56 void reset_current_ring_nodes( void );
58 57 //
59 58 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
60 59 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
61 60 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
62 61 //
63 62 int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
64 63 int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
65 64 int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
66 65 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
67 66 //
68 67 void compute_acquisition_time(unsigned int coarseTime, unsigned int fineTime,
69 68 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char *acquisitionTime );
70 69 void build_snapshot_from_ring(ring_node *ring_node_to_send , unsigned char frequencyChannel );
71 70 void build_acquisition_time( unsigned long long int * acquisitionTimeAslong, ring_node *current_ring_node );
72 71 //
73 72 rtems_id get_pkts_queue_id( void );
74 73
75 74 //**************
76 75 // wfp registers
77 76 // RESET
78 77 void reset_wfp_burst_enable( void );
79 78 void reset_wfp_status(void);
80 79 void reset_waveform_picker_regs( void );
81 80 // SET
82 81 void set_wfp_data_shaping(void);
83 82 void set_wfp_burst_enable_register( unsigned char mode );
84 83 void set_wfp_delta_snapshot( void );
85 84 void set_wfp_delta_f0_f0_2( void );
86 85 void set_wfp_delta_f1( void );
87 86 void set_wfp_delta_f2( void );
88 87
89 88 //*****************
90 89 // local parameters
91 90 void set_local_nb_interrupt_f0_MAX( void );
92 91
93 92 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid );
94 93
95 94 #endif // WF_HANDLER_H_INCLUDED
@@ -1,503 +1,503
1 1 /** General usage functions and RTEMS tasks.
2 2 *
3 3 * @file
4 4 * @author P. LEROY
5 5 *
6 6 */
7 7
8 8 #include "fsw_misc.h"
9 9
10 10 void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
11 11 unsigned char interrupt_level, rtems_isr (*timer_isr)() )
12 12 {
13 13 /** This function configures a GPTIMER timer instantiated in the VHDL design.
14 14 *
15 15 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
16 16 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
17 17 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
18 18 * @param interrupt_level is the interrupt level that the timer drives.
19 19 * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer.
20 20 *
21 21 * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76
22 22 *
23 23 */
24 24
25 25 rtems_status_code status;
26 26 rtems_isr_entry old_isr_handler;
27 27
28 28 gptimer_regs->timer[timer].ctrl = 0x00; // reset the control register
29 29
30 30 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
31 31 if (status!=RTEMS_SUCCESSFUL)
32 32 {
33 33 PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n")
34 34 }
35 35
36 36 timer_set_clock_divider( gptimer_regs, timer, clock_divider);
37 37 }
38 38
39 39 void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer)
40 40 {
41 41 /** This function starts a GPTIMER timer.
42 42 *
43 43 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
44 44 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
45 45 *
46 46 */
47 47
48 48 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
49 49 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register
50 50 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer
51 51 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart
52 52 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable
53 53 }
54 54
55 55 void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer)
56 56 {
57 57 /** This function stops a GPTIMER timer.
58 58 *
59 59 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
60 60 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
61 61 *
62 62 */
63 63
64 64 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer
65 65 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable
66 66 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
67 67 }
68 68
69 69 void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider)
70 70 {
71 71 /** This function sets the clock divider of a GPTIMER timer.
72 72 *
73 73 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
74 74 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
75 75 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
76 76 *
77 77 */
78 78
79 79 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
80 80 }
81 81
82 82 int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port
83 83 {
84 84 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
85 85
86 86 apbuart_regs->ctrl = APBUART_CTRL_REG_MASK_TE;
87 87
88 88 return 0;
89 89 }
90 90
91 91 int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register
92 92 {
93 93 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
94 94
95 95 apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE;
96 96
97 97 return 0;
98 98 }
99 99
100 100 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
101 101 {
102 102 /** This function sets the scaler reload register of the apbuart module
103 103 *
104 104 * @param regs is the address of the apbuart registers in memory
105 105 * @param value is the value that will be stored in the scaler register
106 106 *
107 107 * The value shall be set by the software to get data on the serial interface.
108 108 *
109 109 */
110 110
111 111 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
112 112
113 113 apbuart_regs->scaler = value;
114 114 BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value)
115 115 }
116 116
117 117 //************
118 118 // RTEMS TASKS
119 119
120 120 rtems_task stat_task(rtems_task_argument argument)
121 121 {
122 122 int i;
123 123 int j;
124 124 i = 0;
125 125 j = 0;
126 126 BOOT_PRINTF("in STAT *** \n")
127 127 while(1){
128 128 rtems_task_wake_after(1000);
129 129 PRINTF1("%d\n", j)
130 130 if (i == CPU_USAGE_REPORT_PERIOD) {
131 131 // #ifdef PRINT_TASK_STATISTICS
132 132 // rtems_cpu_usage_report();
133 133 // rtems_cpu_usage_reset();
134 134 // #endif
135 135 i = 0;
136 136 }
137 137 else i++;
138 138 j++;
139 139 }
140 140 }
141 141
142 142 rtems_task hous_task(rtems_task_argument argument)
143 143 {
144 144 rtems_status_code status;
145 145 rtems_id queue_id;
146 146 rtems_rate_monotonic_period_status period_status;
147 147
148 148 status = get_message_queue_id_send( &queue_id );
149 149 if (status != RTEMS_SUCCESSFUL)
150 150 {
151 151 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
152 152 }
153 153
154 154 BOOT_PRINTF("in HOUS ***\n")
155 155
156 156 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
157 157 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
158 158 if( status != RTEMS_SUCCESSFUL ) {
159 159 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
160 160 }
161 161 }
162 162
163 163 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
164 164 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
165 165 housekeeping_packet.reserved = DEFAULT_RESERVED;
166 166 housekeeping_packet.userApplication = CCSDS_USER_APP;
167 167 housekeeping_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8);
168 168 housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK);
169 169 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
170 170 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
171 171 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
172 172 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
173 173 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
174 174 housekeeping_packet.serviceType = TM_TYPE_HK;
175 175 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
176 176 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
177 177 housekeeping_packet.sid = SID_HK;
178 178
179 179 status = rtems_rate_monotonic_cancel(HK_id);
180 180 if( status != RTEMS_SUCCESSFUL ) {
181 181 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
182 182 }
183 183 else {
184 184 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
185 185 }
186 186
187 187 // startup phase
188 188 status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks );
189 189 status = rtems_rate_monotonic_get_status( HK_id, &period_status );
190 190 DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state)
191 191 while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway
192 192 {
193 193 if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization
194 194 {
195 195 break; // break if LFR is synchronized
196 196 }
197 197 else
198 198 {
199 199 status = rtems_rate_monotonic_get_status( HK_id, &period_status );
200 200 // sched_yield();
201 201 status = rtems_task_wake_after( 10 ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 100 ms = 10 * 10 ms
202 202 }
203 203 }
204 204 status = rtems_rate_monotonic_cancel(HK_id);
205 205 DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state)
206 206
207 207 while(1){ // launch the rate monotonic task
208 208 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
209 209 if ( status != RTEMS_SUCCESSFUL ) {
210 210 PRINTF1( "in HOUS *** ERR period: %d\n", status);
211 211 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
212 212 }
213 213 else {
214 214 increment_seq_counter( housekeeping_packet.packetSequenceControl );
215 215 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
216 216 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
217 217 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
218 218 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
219 219 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
220 220 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
221 221
222 222 spacewire_update_statistics();
223 223
224 224 get_v_e1_e2_f3(
225 housekeeping_packet.hk_lfr_sc_v_f3, housekeeping_packet.hk_lfr_sc_e1_f3, housekeeping_packet.hk_lfr_sc_e2_f3,
226 false );
225 housekeeping_packet.hk_lfr_sc_v_f3, housekeeping_packet.hk_lfr_sc_e1_f3, housekeeping_packet.hk_lfr_sc_e2_f3 );
227 226
228 227 // SEND PACKET
229 228 status = rtems_message_queue_urgent( queue_id, &housekeeping_packet,
230 229 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
231 230 if (status != RTEMS_SUCCESSFUL) {
232 231 PRINTF1("in HOUS *** ERR send: %d\n", status)
233 232 }
234 233 }
235 234 }
236 235
237 236 PRINTF("in HOUS *** deleting task\n")
238 237
239 238 status = rtems_task_delete( RTEMS_SELF ); // should not return
240 239 printf( "rtems_task_delete returned with status of %d.\n", status );
241 240 return;
242 241 }
243 242
244 243 rtems_task dumb_task( rtems_task_argument unused )
245 244 {
246 245 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
247 246 *
248 247 * @param unused is the starting argument of the RTEMS task
249 248 *
250 249 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
251 250 *
252 251 */
253 252
254 253 unsigned int i;
255 254 unsigned int intEventOut;
256 255 unsigned int coarse_time = 0;
257 256 unsigned int fine_time = 0;
258 257 rtems_event_set event_out;
259 258
260 259 char *DumbMessages[10] = {"in DUMB *** default", // RTEMS_EVENT_0
261 260 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
262 261 "in DUMB *** f3 buffer changed", // RTEMS_EVENT_2
263 262 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
264 263 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
265 264 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
266 265 "ERR HK", // RTEMS_EVENT_6
267 266 "ready for dump", // RTEMS_EVENT_7
268 267 "in DUMB *** spectral_matrices_isr", // RTEMS_EVENT_8
269 268 "tick" // RTEMS_EVENT_9
270 269 };
271 270
272 271 BOOT_PRINTF("in DUMB *** \n")
273 272
274 273 while(1){
275 274 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
276 275 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7
277 276 | RTEMS_EVENT_8 | RTEMS_EVENT_9,
278 277 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
279 278 intEventOut = (unsigned int) event_out;
280 279 for ( i=0; i<32; i++)
281 280 {
282 281 if ( ((intEventOut >> i) & 0x0001) != 0)
283 282 {
284 283 coarse_time = time_management_regs->coarse_time;
285 284 fine_time = time_management_regs->fine_time;
286 285 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
287 286 }
288 287 }
289 288 }
290 289 }
291 290
292 291 //*****************************
293 292 // init housekeeping parameters
294 293
295 294 void init_housekeeping_parameters( void )
296 295 {
297 296 /** This function initialize the housekeeping_packet global variable with default values.
298 297 *
299 298 */
300 299
301 300 unsigned int i = 0;
302 301 unsigned char *parameters;
303 302
304 303 parameters = (unsigned char*) &housekeeping_packet.lfr_status_word;
305 304 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
306 305 {
307 306 parameters[i] = 0x00;
308 307 }
309 308 // init status word
310 309 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
311 310 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
312 311 // init software version
313 312 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
314 313 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
315 314 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
316 315 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
317 316 // init fpga version
318 317 parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0);
319 318 housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1
320 319 housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2
321 320 housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3
322 321 }
323 322
324 323 void increment_seq_counter( unsigned char *packet_sequence_control)
325 324 {
326 325 /** This function increment the sequence counter psased in argument.
327 326 *
328 327 * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0.
329 328 *
330 329 */
331 330
332 331 unsigned short sequence_cnt;
333 332 unsigned short segmentation_grouping_flag;
334 333 unsigned short new_packet_sequence_control;
335 334
336 335 segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; // keep bits 7 downto 6
337 336 sequence_cnt = (unsigned short) (
338 337 ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0
339 338 + packet_sequence_control[1]
340 339 );
341 340
342 341 if ( sequence_cnt < SEQ_CNT_MAX)
343 342 {
344 343 sequence_cnt = sequence_cnt + 1;
345 344 }
346 345 else
347 346 {
348 347 sequence_cnt = 0;
349 348 }
350 349
351 350 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
352 351
353 352 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
354 353 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
355 354 }
356 355
357 356 void getTime( unsigned char *time)
358 357 {
359 358 /** This function write the current local time in the time buffer passed in argument.
360 359 *
361 360 */
362 361
363 362 time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
364 363 time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
365 364 time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
366 365 time[3] = (unsigned char) (time_management_regs->coarse_time);
367 366 time[4] = (unsigned char) (time_management_regs->fine_time>>8);
368 367 time[5] = (unsigned char) (time_management_regs->fine_time);
369 368 }
370 369
371 370 unsigned long long int getTimeAsUnsignedLongLongInt( )
372 371 {
373 372 /** This function write the current local time in the time buffer passed in argument.
374 373 *
375 374 */
376 375 unsigned long long int time;
377 376
378 377 time = ( (unsigned long long int) (time_management_regs->coarse_time & 0x7fffffff) << 16 )
379 378 + time_management_regs->fine_time;
380 379
381 380 return time;
382 381 }
383 382
384 383 void send_dumb_hk( void )
385 384 {
386 385 Packet_TM_LFR_HK_t dummy_hk_packet;
387 386 unsigned char *parameters;
388 387 unsigned int i;
389 388 rtems_id queue_id;
390 389
391 390 dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
392 391 dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
393 392 dummy_hk_packet.reserved = DEFAULT_RESERVED;
394 393 dummy_hk_packet.userApplication = CCSDS_USER_APP;
395 394 dummy_hk_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8);
396 395 dummy_hk_packet.packetID[1] = (unsigned char) (APID_TM_HK);
397 396 dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
398 397 dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
399 398 dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
400 399 dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
401 400 dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
402 401 dummy_hk_packet.serviceType = TM_TYPE_HK;
403 402 dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK;
404 403 dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND;
405 404 dummy_hk_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
406 405 dummy_hk_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
407 406 dummy_hk_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
408 407 dummy_hk_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
409 408 dummy_hk_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
410 409 dummy_hk_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
411 410 dummy_hk_packet.sid = SID_HK;
412 411
413 412 // init status word
414 413 dummy_hk_packet.lfr_status_word[0] = 0xff;
415 414 dummy_hk_packet.lfr_status_word[1] = 0xff;
416 415 // init software version
417 416 dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1;
418 417 dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2;
419 418 dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3;
420 419 dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4;
421 420 // init fpga version
422 421 parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0);
423 422 dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1
424 423 dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2
425 424 dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3
426 425
427 426 parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load;
428 427
429 428 for (i=0; i<100; i++)
430 429 {
431 430 parameters[i] = 0xff;
432 431 }
433 432
434 433 get_message_queue_id_send( &queue_id );
435 434
436 435 rtems_message_queue_urgent( queue_id, &dummy_hk_packet,
437 436 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
438 437 }
439 438
440 void get_v_e1_e2_f3( unsigned char *v, unsigned char *e1, unsigned char *e2, bool init_buffer_addr )
439 void get_v_e1_e2_f3( unsigned char *v, unsigned char *e1, unsigned char *e2 )
441 440 {
442 441 unsigned int coarseTime;
443 442 unsigned int acquisitionTime;
444 443 unsigned int deltaT = 0;
445 444 unsigned char *bufferPtr;
446 445
447 446 unsigned int offset_in_samples;
448 447 unsigned int offset_in_bytes;
449 448 unsigned char f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz
450 449
451 450 if (lfrCurrentMode == LFR_MODE_STANDBY)
452 451 {
453 452 v[0] = 0x00;
454 453 v[1] = 0x00;
455 454 e1[0] = 0x00;
456 455 e1[1] = 0x00;
457 456 e2[0] = 0x00;
458 457 e2[1] = 0x00;
459 458 }
460 459 else
461 460 {
462 461 coarseTime = time_management_regs->coarse_time & 0x7fffffff;
463 bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3;
462 bufferPtr = (unsigned char*) current_ring_node_f3->buffer_address;
464 463 acquisitionTime = (unsigned int) ( ( bufferPtr[2] & 0x7f ) << 24 )
465 464 + (unsigned int) ( bufferPtr[3] << 16 )
466 465 + (unsigned int) ( bufferPtr[0] << 8 )
467 466 + (unsigned int) ( bufferPtr[1] );
468 467 if ( coarseTime > acquisitionTime )
469 468 {
470 469 deltaT = coarseTime - acquisitionTime;
471 470 offset_in_samples = (deltaT-1) * f3 ;
472 471 }
473 472 else if( coarseTime == acquisitionTime )
474 473 {
475 offset_in_samples = 0;
474 bufferPtr = (unsigned char*) current_ring_node_f3->previous->buffer_address; // pick up v e1 and e2 in the previous f3 buffer
475 offset_in_samples = NB_SAMPLES_PER_SNAPSHOT-1;
476 476 }
477 477 else
478 478 {
479 479 offset_in_samples = 0;
480 480 PRINTF2("ERR *** in get_v_e1_e2_f3 *** coarseTime = %x, acquisitionTime = %x\n", coarseTime, acquisitionTime)
481 481 }
482 482
483 483 if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) )
484 484 {
485 PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out the buffer, counter = %d\n", offset_in_samples)
485 PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out of the buffer, counter = %d\n", offset_in_samples)
486 486 offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1;
487 487 }
488 488 PRINTF1("f3 data @ %x *** ", waveform_picker_regs->addr_data_f3 )
489 489 PRINTF2("deltaT = %d, offset_in_samples = %d\n", deltaT, offset_in_samples )
490 490 offset_in_bytes = TIME_OFFSET_IN_BYTES + offset_in_samples * NB_WORDS_SWF_BLK * 4;
491 491 v[0] = bufferPtr[ offset_in_bytes + 0];
492 492 v[1] = bufferPtr[ offset_in_bytes + 1];
493 493 e1[0] = bufferPtr[ offset_in_bytes + 2];
494 494 e1[1] = bufferPtr[ offset_in_bytes + 3];
495 495 e2[0] = bufferPtr[ offset_in_bytes + 4];
496 496 e2[1] = bufferPtr[ offset_in_bytes + 5];
497 497 }
498 498 }
499 499
500 500
501 501
502 502
503 503
@@ -1,1315 +1,1282
1 1 /** Functions and tasks related to waveform packet generation.
2 2 *
3 3 * @file
4 4 * @author P. LEROY
5 5 *
6 6 * A group of functions to handle waveforms, in snapshot or continuous format.\n
7 7 *
8 8 */
9 9
10 10 #include "wf_handler.h"
11 11
12 12 //*****************
13 13 // waveform headers
14 14 // SWF
15 15 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7];
16 16 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
17 17 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
18 18 // CWF
19 19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[ NB_PACKETS_PER_GROUP_OF_CWF ];
20 20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[ NB_PACKETS_PER_GROUP_OF_CWF ];
21 21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[ NB_PACKETS_PER_GROUP_OF_CWF ];
22 22 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[ NB_PACKETS_PER_GROUP_OF_CWF ];
23 23 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[ NB_PACKETS_PER_GROUP_OF_CWF_LIGHT ];
24 24
25 25 //**************
26 26 // waveform ring
27 27 ring_node waveform_ring_f0[NB_RING_NODES_F0];
28 28 ring_node waveform_ring_f1[NB_RING_NODES_F1];
29 29 ring_node waveform_ring_f2[NB_RING_NODES_F2];
30 30 ring_node waveform_ring_f3[NB_RING_NODES_F3];
31 31 ring_node *current_ring_node_f0;
32 32 ring_node *ring_node_to_send_swf_f0;
33 33 ring_node *current_ring_node_f1;
34 34 ring_node *ring_node_to_send_swf_f1;
35 35 ring_node *ring_node_to_send_cwf_f1;
36 36 ring_node *current_ring_node_f2;
37 37 ring_node *ring_node_to_send_swf_f2;
38 38 ring_node *ring_node_to_send_cwf_f2;
39 39 ring_node *current_ring_node_f3;
40 40 ring_node *ring_node_to_send_cwf_f3;
41 41
42 42 bool extractSWF = false;
43 43 bool swf_f0_ready = false;
44 44 bool swf_f1_ready = false;
45 45 bool swf_f2_ready = false;
46 46
47 47 int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
48 48
49 49 //*********************
50 50 // Interrupt SubRoutine
51 51
52 52 void reset_extractSWF( void )
53 53 {
54 54 extractSWF = false;
55 55 swf_f0_ready = false;
56 56 swf_f1_ready = false;
57 57 swf_f2_ready = false;
58 58 }
59 59
60 60 rtems_isr waveforms_isr( rtems_vector_number vector )
61 61 {
62 62 /** This is the interrupt sub routine called by the waveform picker core.
63 63 *
64 64 * This ISR launch different actions depending mainly on two pieces of information:
65 65 * 1. the values read in the registers of the waveform picker.
66 66 * 2. the current LFR mode.
67 67 *
68 68 */
69 69
70 70 rtems_status_code status;
71 71
72 72 if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_BURST) // in BURST the data are used to place v, e1 and e2 in the HK packet
73 73 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
74 74 { // in modes other than STANDBY and BURST, send the CWF_F3 data
75 75 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
76 76 // (1) change the receiving buffer for the waveform picker
77 77 ring_node_to_send_cwf_f3 = current_ring_node_f3;
78 78 current_ring_node_f3 = current_ring_node_f3->next;
79 79 waveform_picker_regs->addr_data_f3 = current_ring_node_f3->buffer_address;
80 80 // (2) send an event for the waveforms transmission
81 81 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
82 82 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
83 83 }
84 84 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2);
85 85 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
86 86 }
87 87 }
88 88
89 89 switch(lfrCurrentMode)
90 90 {
91 91 //********
92 92 // STANDBY
93 93 case(LFR_MODE_STANDBY):
94 94 break;
95 95
96 96 //******
97 97 // NORMAL
98 98 case(LFR_MODE_NORMAL):
99 99 if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits
100 100 {
101 101 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
102 102 }
103 103 if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits
104 104 {
105 105 // change F0 ring node
106 106 ring_node_to_send_swf_f0 = current_ring_node_f0;
107 107 current_ring_node_f0 = current_ring_node_f0->next;
108 108 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address;
109 109 // change F1 ring node
110 110 ring_node_to_send_swf_f1 = current_ring_node_f1;
111 111 current_ring_node_f1 = current_ring_node_f1->next;
112 112 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
113 113 // change F2 ring node
114 114 ring_node_to_send_swf_f2 = current_ring_node_f2;
115 115 current_ring_node_f2 = current_ring_node_f2->next;
116 116 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
117 117 //
118 118 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL)
119 119 {
120 120 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
121 121 }
122 122 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000]
123 123 }
124 124 break;
125 125
126 126 //******
127 127 // BURST
128 128 case(LFR_MODE_BURST):
129 129 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
130 130 // (1) change the receiving buffer for the waveform picker
131 131 ring_node_to_send_cwf_f2 = current_ring_node_f2;
132 132 current_ring_node_f2 = current_ring_node_f2->next;
133 133 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
134 134 // (2) send an event for the waveforms transmission
135 135 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
136 136 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
137 137 }
138 138 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
139 139 }
140 140 break;
141 141
142 142 //*****
143 143 // SBM1
144 144 case(LFR_MODE_SBM1):
145 145 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
146 146 // (1) change the receiving buffer for the waveform picker
147 147 ring_node_to_send_cwf_f1 = current_ring_node_f1;
148 148 current_ring_node_f1 = current_ring_node_f1->next;
149 149 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
150 150 // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed)
151 151 status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 );
152 152 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0
153 153 }
154 154 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
155 155 swf_f0_ready = true;
156 156 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0
157 157 }
158 158 if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit
159 159 swf_f2_ready = true;
160 160 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0
161 161 }
162 162 break;
163 163
164 164 //*****
165 165 // SBM2
166 166 case(LFR_MODE_SBM2):
167 167 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
168 168 // (1) change the receiving buffer for the waveform picker
169 169 ring_node_to_send_cwf_f2 = current_ring_node_f2;
170 170 current_ring_node_f2 = current_ring_node_f2->next;
171 171 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
172 172 // (2) send an event for the waveforms transmission
173 173 status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 );
174 174 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
175 175 }
176 176 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
177 177 swf_f0_ready = true;
178 178 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0
179 179 }
180 180 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
181 181 swf_f1_ready = true;
182 182 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0
183 183 }
184 184 break;
185 185
186 186 //********
187 187 // DEFAULT
188 188 default:
189 189 break;
190 190 }
191 191 }
192 192
193 193 //************
194 194 // RTEMS TASKS
195 195
196 196 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
197 197 {
198 198 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
199 199 *
200 200 * @param unused is the starting argument of the RTEMS task
201 201 *
202 202 * The following data packets are sent by this task:
203 203 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
204 204 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
205 205 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
206 206 *
207 207 */
208 208
209 209 rtems_event_set event_out;
210 210 rtems_id queue_id;
211 211 rtems_status_code status;
212 212
213 213 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
214 214 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
215 215 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
216 216
217 init_waveforms();
218
219 217 status = get_message_queue_id_send( &queue_id );
220 218 if (status != RTEMS_SUCCESSFUL)
221 219 {
222 220 PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status)
223 221 }
224 222
225 223 BOOT_PRINTF("in WFRM ***\n")
226 224
227 225 while(1){
228 226 // wait for an RTEMS_EVENT
229 227 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
230 228 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
231 229 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
232 230 if (event_out == RTEMS_EVENT_MODE_NORMAL)
233 231 {
234 232 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n")
235 233 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
236 234 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
237 235 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
238 236 }
239 237 if (event_out == RTEMS_EVENT_MODE_SBM1)
240 238 {
241 239 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n")
242 240 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
243 241 send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F1, headerSWF_F1, queue_id);
244 242 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
245 243 }
246 244 if (event_out == RTEMS_EVENT_MODE_SBM2)
247 245 {
248 246 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n")
249 247 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
250 248 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
251 249 send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F2, headerSWF_F2, queue_id);
252 250 }
253 251 }
254 252 }
255 253
256 254 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
257 255 {
258 256 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
259 257 *
260 258 * @param unused is the starting argument of the RTEMS task
261 259 *
262 260 * The following data packet is sent by this task:
263 261 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
264 262 *
265 263 */
266 264
267 265 rtems_event_set event_out;
268 266 rtems_id queue_id;
269 267 rtems_status_code status;
270 268
271 269 init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 );
272 270 init_header_continuous_cwf3_light_table( headerCWF_F3_light );
273 271
274 272 status = get_message_queue_id_send( &queue_id );
275 273 if (status != RTEMS_SUCCESSFUL)
276 274 {
277 275 PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status)
278 276 }
279 277
280 278 BOOT_PRINTF("in CWF3 ***\n")
281 279
282 280 while(1){
283 281 // wait for an RTEMS_EVENT
284 282 rtems_event_receive( RTEMS_EVENT_0,
285 283 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
286 284 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
287 285 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode==LFR_MODE_SBM2) )
288 286 {
289 287 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
290 288 {
291 289 PRINTF("send CWF_LONG_F3\n")
292 290 send_waveform_CWF(
293 291 (volatile int*) current_ring_node_f3->buffer_address,
294 292 SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
295 293 }
296 294 else
297 295 {
298 296 PRINTF("send CWF_F3 (light)\n")
299 297 send_waveform_CWF3_light(
300 298 (volatile int*) current_ring_node_f3->buffer_address,
301 299 headerCWF_F3_light, queue_id );
302 300 }
303 301
304 302 }
305 303 else
306 304 {
307 305 PRINTF1("in CWF3 *** lfrCurrentMode is %d, no data will be sent\n", lfrCurrentMode)
308 306 }
309 307 }
310 308 }
311 309
312 310 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
313 311 {
314 312 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
315 313 *
316 314 * @param unused is the starting argument of the RTEMS task
317 315 *
318 316 * The following data packet is sent by this function:
319 317 * - TM_LFR_SCIENCE_BURST_CWF_F2
320 318 * - TM_LFR_SCIENCE_SBM2_CWF_F2
321 319 *
322 320 */
323 321
324 322 rtems_event_set event_out;
325 323 rtems_id queue_id;
326 324 rtems_status_code status;
327 325
328 326 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
329 327 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
330 328
331 329 status = get_message_queue_id_send( &queue_id );
332 330 if (status != RTEMS_SUCCESSFUL)
333 331 {
334 332 PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status)
335 333 }
336 334
337 335 BOOT_PRINTF("in CWF2 ***\n")
338 336
339 337 while(1){
340 338 // wait for an RTEMS_EVENT
341 339 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
342 340 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
343 341 if (event_out == RTEMS_EVENT_MODE_BURST)
344 342 {
345 343 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
346 344 }
347 345 if (event_out == RTEMS_EVENT_MODE_SBM2)
348 346 {
349 347 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
350 348 // launch snapshot extraction if needed
351 349 if (extractSWF == true)
352 350 {
353 351 ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2;
354 352 // extract the snapshot
355 353 build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 );
356 354 // send the snapshot when built
357 355 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 );
358 356 extractSWF = false;
359 357 }
360 358 if (swf_f0_ready && swf_f1_ready)
361 359 {
362 360 extractSWF = true;
363 361 swf_f0_ready = false;
364 362 swf_f1_ready = false;
365 363 }
366 364 }
367 365 }
368 366 }
369 367
370 368 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
371 369 {
372 370 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
373 371 *
374 372 * @param unused is the starting argument of the RTEMS task
375 373 *
376 374 * The following data packet is sent by this function:
377 375 * - TM_LFR_SCIENCE_SBM1_CWF_F1
378 376 *
379 377 */
380 378
381 379 rtems_event_set event_out;
382 380 rtems_id queue_id;
383 381 rtems_status_code status;
384 382
385 383 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
386 384
387 385 status = get_message_queue_id_send( &queue_id );
388 386 if (status != RTEMS_SUCCESSFUL)
389 387 {
390 388 PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status)
391 389 }
392 390
393 391 BOOT_PRINTF("in CWF1 ***\n")
394 392
395 393 while(1){
396 394 // wait for an RTEMS_EVENT
397 395 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
398 396 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
399 397 send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
400 398 // launch snapshot extraction if needed
401 399 if (extractSWF == true)
402 400 {
403 401 ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1;
404 402 // launch the snapshot extraction
405 403 status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 );
406 404 extractSWF = false;
407 405 }
408 406 if (swf_f0_ready == true)
409 407 {
410 408 extractSWF = true;
411 409 swf_f0_ready = false; // this step shall be executed only one time
412 410 }
413 411 if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction
414 412 {
415 413 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 );
416 414 swf_f1_ready = false;
417 415 swf_f2_ready = false;
418 416 }
419 417 }
420 418 }
421 419
422 420 rtems_task swbd_task(rtems_task_argument argument)
423 421 {
424 422 /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers.
425 423 *
426 424 * @param unused is the starting argument of the RTEMS task
427 425 *
428 426 */
429 427
430 428 rtems_event_set event_out;
431 429
432 430 BOOT_PRINTF("in SWBD ***\n")
433 431
434 432 while(1){
435 433 // wait for an RTEMS_EVENT
436 434 rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2,
437 435 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
438 436 if (event_out == RTEMS_EVENT_MODE_SBM1)
439 437 {
440 438 build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 );
441 439 swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent
442 440 }
443 441 else
444 442 {
445 443 PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out)
446 444 }
447 445 }
448 446 }
449 447
450 448 //******************
451 449 // general functions
452 void init_waveforms( void )
453 {
454 int i = 0;
455
456 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
457 {
458 //***
459 // F0
460 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
461 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
462 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
463
464 //***
465 // F1
466 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
467 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
468 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
469
470 //***
471 // F2
472 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
473 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
474 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
475
476 //***
477 // F3
478 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
479 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
480 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
481 }
482 }
483 450
484 451 void init_waveform_rings( void )
485 452 {
486 453 // F0 RING
487 454 init_waveform_ring( waveform_ring_f0, NB_RING_NODES_F0, wf_snap_f0 );
488 455 // F1 RING
489 456 init_waveform_ring( waveform_ring_f1, NB_RING_NODES_F1, wf_snap_f1 );
490 457 // F2 RING
491 458 init_waveform_ring( waveform_ring_f2, NB_RING_NODES_F2, wf_snap_f2 );
492 459 // F3 RING
493 460 init_waveform_ring( waveform_ring_f3, NB_RING_NODES_F3, wf_cont_f3 );
494 461
495 462 DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0)
496 463 DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1)
497 464 DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2)
498 465 DEBUG_PRINTF1("waveform_ring_f3 @%x\n", (unsigned int) waveform_ring_f3)
499 466 }
500 467
501 468 void init_waveform_ring(ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] )
502 469 {
503 470 unsigned char i;
504 471
505 472 waveform_ring[0].next = (ring_node*) &waveform_ring[ 1 ];
506 473 waveform_ring[0].previous = (ring_node*) &waveform_ring[ nbNodes - 1 ];
507 474 waveform_ring[0].buffer_address = (int) &wfrm[0];
508 475
509 476 waveform_ring[nbNodes-1].next = (ring_node*) &waveform_ring[ 0 ];
510 477 waveform_ring[nbNodes-1].previous = (ring_node*) &waveform_ring[ nbNodes - 2 ];
511 478 waveform_ring[nbNodes-1].buffer_address = (int) &wfrm[ (nbNodes-1) * WFRM_BUFFER ];
512 479
513 480 for(i=1; i<nbNodes-1; i++)
514 481 {
515 482 waveform_ring[i].next = (ring_node*) &waveform_ring[ i + 1 ];
516 483 waveform_ring[i].previous = (ring_node*) &waveform_ring[ i - 1 ];
517 484 waveform_ring[i].buffer_address = (int) &wfrm[ i * WFRM_BUFFER ];
518 485 }
519 486 }
520 487
521 488 void reset_current_ring_nodes( void )
522 489 {
523 490 current_ring_node_f0 = waveform_ring_f0;
524 491 ring_node_to_send_swf_f0 = waveform_ring_f0;
525 492
526 493 current_ring_node_f1 = waveform_ring_f1;
527 494 ring_node_to_send_cwf_f1 = waveform_ring_f1;
528 495 ring_node_to_send_swf_f1 = waveform_ring_f1;
529 496
530 497 current_ring_node_f2 = waveform_ring_f2;
531 498 ring_node_to_send_cwf_f2 = waveform_ring_f2;
532 499 ring_node_to_send_swf_f2 = waveform_ring_f2;
533 500
534 501 current_ring_node_f3 = waveform_ring_f3;
535 502 ring_node_to_send_cwf_f3 = waveform_ring_f3;
536 503 }
537 504
538 505 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
539 506 {
540 507 unsigned char i;
541 508
542 509 for (i=0; i<7; i++)
543 510 {
544 511 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
545 512 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
546 513 headerSWF[ i ].reserved = DEFAULT_RESERVED;
547 514 headerSWF[ i ].userApplication = CCSDS_USER_APP;
548 515 headerSWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
549 516 headerSWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
550 517 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
551 518 if (i == 6)
552 519 {
553 520 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8);
554 521 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 );
555 522 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8);
556 523 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 );
557 524 }
558 525 else
559 526 {
560 527 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8);
561 528 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 );
562 529 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8);
563 530 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 );
564 531 }
565 532 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
566 533 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
567 534 headerSWF[ i ].pktNr = i+1; // PKT_NR
568 535 // DATA FIELD HEADER
569 536 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
570 537 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
571 538 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
572 539 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
573 540 // AUXILIARY DATA HEADER
574 541 headerSWF[ i ].time[0] = 0x00;
575 542 headerSWF[ i ].time[0] = 0x00;
576 543 headerSWF[ i ].time[0] = 0x00;
577 544 headerSWF[ i ].time[0] = 0x00;
578 545 headerSWF[ i ].time[0] = 0x00;
579 546 headerSWF[ i ].time[0] = 0x00;
580 547 headerSWF[ i ].sid = sid;
581 548 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
582 549 }
583 550 return LFR_SUCCESSFUL;
584 551 }
585 552
586 553 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
587 554 {
588 555 unsigned int i;
589 556
590 557 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++)
591 558 {
592 559 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
593 560 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
594 561 headerCWF[ i ].reserved = DEFAULT_RESERVED;
595 562 headerCWF[ i ].userApplication = CCSDS_USER_APP;
596 563 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
597 564 {
598 565 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2 >> 8);
599 566 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2);
600 567 }
601 568 else
602 569 {
603 570 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
604 571 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
605 572 }
606 573 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
607 574 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8);
608 575 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 );
609 576 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8);
610 577 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF );
611 578 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
612 579 // DATA FIELD HEADER
613 580 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
614 581 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
615 582 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
616 583 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
617 584 // AUXILIARY DATA HEADER
618 585 headerCWF[ i ].sid = sid;
619 586 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
620 587 headerCWF[ i ].time[0] = 0x00;
621 588 headerCWF[ i ].time[0] = 0x00;
622 589 headerCWF[ i ].time[0] = 0x00;
623 590 headerCWF[ i ].time[0] = 0x00;
624 591 headerCWF[ i ].time[0] = 0x00;
625 592 headerCWF[ i ].time[0] = 0x00;
626 593 }
627 594 return LFR_SUCCESSFUL;
628 595 }
629 596
630 597 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
631 598 {
632 599 unsigned int i;
633 600
634 601 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++)
635 602 {
636 603 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
637 604 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
638 605 headerCWF[ i ].reserved = DEFAULT_RESERVED;
639 606 headerCWF[ i ].userApplication = CCSDS_USER_APP;
640 607
641 608 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
642 609 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
643 610
644 611 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
645 612 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8);
646 613 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 );
647 614 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8);
648 615 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 );
649 616
650 617 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
651 618 // DATA FIELD HEADER
652 619 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
653 620 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
654 621 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
655 622 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
656 623 // AUXILIARY DATA HEADER
657 624 headerCWF[ i ].sid = SID_NORM_CWF_F3;
658 625 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
659 626 headerCWF[ i ].time[0] = 0x00;
660 627 headerCWF[ i ].time[0] = 0x00;
661 628 headerCWF[ i ].time[0] = 0x00;
662 629 headerCWF[ i ].time[0] = 0x00;
663 630 headerCWF[ i ].time[0] = 0x00;
664 631 headerCWF[ i ].time[0] = 0x00;
665 632 }
666 633 return LFR_SUCCESSFUL;
667 634 }
668 635
669 636 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
670 637 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
671 638 {
672 639 /** This function sends SWF CCSDS packets (F2, F1 or F0).
673 640 *
674 641 * @param waveform points to the buffer containing the data that will be send.
675 642 * @param sid is the source identifier of the data that will be sent.
676 643 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
677 644 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
678 645 * contain information to setup the transmission of the data packets.
679 646 *
680 647 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
681 648 *
682 649 */
683 650
684 651 unsigned int i;
685 652 int ret;
686 653 unsigned int coarseTime;
687 654 unsigned int fineTime;
688 655 rtems_status_code status;
689 656 spw_ioctl_pkt_send spw_ioctl_send_SWF;
690 657
691 658 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
692 659 spw_ioctl_send_SWF.options = 0;
693 660
694 661 ret = LFR_DEFAULT;
695 662
696 663 coarseTime = waveform[0];
697 664 fineTime = waveform[1];
698 665
699 666 for (i=0; i<7; i++) // send waveform
700 667 {
701 668 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET];
702 669 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
703 670 // BUILD THE DATA
704 671 if (i==6) {
705 672 spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK;
706 673 }
707 674 else {
708 675 spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK;
709 676 }
710 677 // SET PACKET SEQUENCE COUNTER
711 678 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
712 679 // SET PACKET TIME
713 680 compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime );
714 681 //
715 682 headerSWF[ i ].time[0] = headerSWF[ i ].acquisitionTime[0];
716 683 headerSWF[ i ].time[1] = headerSWF[ i ].acquisitionTime[1];
717 684 headerSWF[ i ].time[2] = headerSWF[ i ].acquisitionTime[2];
718 685 headerSWF[ i ].time[3] = headerSWF[ i ].acquisitionTime[3];
719 686 headerSWF[ i ].time[4] = headerSWF[ i ].acquisitionTime[4];
720 687 headerSWF[ i ].time[5] = headerSWF[ i ].acquisitionTime[5];
721 688 // SEND PACKET
722 689 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
723 690 if (status != RTEMS_SUCCESSFUL) {
724 691 printf("%d-%d, ERR %d\n", sid, i, (int) status);
725 692 ret = LFR_DEFAULT;
726 693 }
727 694 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
728 695 }
729 696
730 697 return ret;
731 698 }
732 699
733 700 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
734 701 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
735 702 {
736 703 /** This function sends CWF CCSDS packets (F2, F1 or F0).
737 704 *
738 705 * @param waveform points to the buffer containing the data that will be send.
739 706 * @param sid is the source identifier of the data that will be sent.
740 707 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
741 708 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
742 709 * contain information to setup the transmission of the data packets.
743 710 *
744 711 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
745 712 *
746 713 */
747 714
748 715 unsigned int i;
749 716 int ret;
750 717 unsigned int coarseTime;
751 718 unsigned int fineTime;
752 719 rtems_status_code status;
753 720 spw_ioctl_pkt_send spw_ioctl_send_CWF;
754 721
755 722 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
756 723 spw_ioctl_send_CWF.options = 0;
757 724
758 725 ret = LFR_DEFAULT;
759 726
760 727 coarseTime = waveform[0];
761 728 fineTime = waveform[1];
762 729
763 730 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform
764 731 {
765 732 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET];
766 733 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
767 734 // BUILD THE DATA
768 735 spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK;
769 736 // SET PACKET SEQUENCE COUNTER
770 737 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
771 738 // SET PACKET TIME
772 739 compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime);
773 740 //
774 741 headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0];
775 742 headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1];
776 743 headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2];
777 744 headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3];
778 745 headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4];
779 746 headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5];
780 747 // SEND PACKET
781 748 if (sid == SID_NORM_CWF_LONG_F3)
782 749 {
783 750 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
784 751 if (status != RTEMS_SUCCESSFUL) {
785 752 printf("%d-%d, ERR %d\n", sid, i, (int) status);
786 753 ret = LFR_DEFAULT;
787 754 }
788 755 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
789 756 }
790 757 else
791 758 {
792 759 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
793 760 if (status != RTEMS_SUCCESSFUL) {
794 761 printf("%d-%d, ERR %d\n", sid, i, (int) status);
795 762 ret = LFR_DEFAULT;
796 763 }
797 764 }
798 765 }
799 766
800 767 return ret;
801 768 }
802 769
803 770 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
804 771 {
805 772 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
806 773 *
807 774 * @param waveform points to the buffer containing the data that will be send.
808 775 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
809 776 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
810 777 * contain information to setup the transmission of the data packets.
811 778 *
812 779 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
813 780 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
814 781 *
815 782 */
816 783
817 784 unsigned int i;
818 785 int ret;
819 786 unsigned int coarseTime;
820 787 unsigned int fineTime;
821 788 rtems_status_code status;
822 789 spw_ioctl_pkt_send spw_ioctl_send_CWF;
823 790 char *sample;
824 791
825 792 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
826 793 spw_ioctl_send_CWF.options = 0;
827 794
828 795 ret = LFR_DEFAULT;
829 796
830 797 //**********************
831 798 // BUILD CWF3_light DATA
832 799 for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
833 800 {
834 801 sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
835 802 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ];
836 803 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ];
837 804 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ];
838 805 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ];
839 806 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ];
840 807 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ];
841 808 }
842 809
843 810 coarseTime = waveform[0];
844 811 fineTime = waveform[1];
845 812
846 813 //*********************
847 814 // SEND CWF3_light DATA
848 815 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform
849 816 {
850 817 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES];
851 818 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
852 819 // BUILD THE DATA
853 820 spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK;
854 821 // SET PACKET SEQUENCE COUNTER
855 822 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
856 823 // SET PACKET TIME
857 824 compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime );
858 825 //
859 826 headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0];
860 827 headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1];
861 828 headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2];
862 829 headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3];
863 830 headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4];
864 831 headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5];
865 832 // SEND PACKET
866 833 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
867 834 if (status != RTEMS_SUCCESSFUL) {
868 835 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
869 836 ret = LFR_DEFAULT;
870 837 }
871 838 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
872 839 }
873 840
874 841 return ret;
875 842 }
876 843
877 844 void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime,
878 845 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime )
879 846 {
880 847 unsigned long long int acquisitionTimeAsLong;
881 848 unsigned char localAcquisitionTime[6];
882 849 double deltaT;
883 850
884 851 deltaT = 0.;
885 852
886 853 localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 8 );
887 854 localAcquisitionTime[1] = (unsigned char) ( coarseTime );
888 855 localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 24 );
889 856 localAcquisitionTime[3] = (unsigned char) ( coarseTime >> 16 );
890 857 localAcquisitionTime[4] = (unsigned char) ( fineTime >> 24 );
891 858 localAcquisitionTime[5] = (unsigned char) ( fineTime >> 16 );
892 859
893 860 acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 )
894 861 + ( (unsigned long long int) localAcquisitionTime[1] << 32 )
895 862 + ( localAcquisitionTime[2] << 24 )
896 863 + ( localAcquisitionTime[3] << 16 )
897 864 + ( localAcquisitionTime[4] << 8 )
898 865 + ( localAcquisitionTime[5] );
899 866
900 867 switch( sid )
901 868 {
902 869 case SID_NORM_SWF_F0:
903 870 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ;
904 871 break;
905 872
906 873 case SID_NORM_SWF_F1:
907 874 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ;
908 875 break;
909 876
910 877 case SID_NORM_SWF_F2:
911 878 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ;
912 879 break;
913 880
914 881 case SID_SBM1_CWF_F1:
915 882 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ;
916 883 break;
917 884
918 885 case SID_SBM2_CWF_F2:
919 886 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
920 887 break;
921 888
922 889 case SID_BURST_CWF_F2:
923 890 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
924 891 break;
925 892
926 893 case SID_NORM_CWF_F3:
927 894 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ;
928 895 break;
929 896
930 897 case SID_NORM_CWF_LONG_F3:
931 898 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ;
932 899 break;
933 900
934 901 default:
935 902 PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid)
936 903 deltaT = 0.;
937 904 break;
938 905 }
939 906
940 907 acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT;
941 908 //
942 909 acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40);
943 910 acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32);
944 911 acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24);
945 912 acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16);
946 913 acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 );
947 914 acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong );
948 915
949 916 }
950 917
951 918 void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel )
952 919 {
953 920 unsigned int i;
954 921 unsigned long long int centerTime_asLong;
955 922 unsigned long long int acquisitionTimeF0_asLong;
956 923 unsigned long long int acquisitionTime_asLong;
957 924 unsigned long long int bufferAcquisitionTime_asLong;
958 925 unsigned char *ptr1;
959 926 unsigned char *ptr2;
960 927 unsigned char nb_ring_nodes;
961 928 unsigned long long int frequency_asLong;
962 929 unsigned long long int nbTicksPerSample_asLong;
963 930 unsigned long long int nbSamplesPart1_asLong;
964 931 unsigned long long int sampleOffset_asLong;
965 932
966 933 unsigned int deltaT_F0;
967 934 unsigned int deltaT_F1;
968 935 unsigned long long int deltaT_F2;
969 936
970 937 deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667;
971 938 deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384;
972 939 deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144;
973 940 sampleOffset_asLong = 0x00;
974 941
975 942 // (1) get the f0 acquisition time
976 943 build_acquisition_time( &acquisitionTimeF0_asLong, current_ring_node_f0 );
977 944
978 945 // (2) compute the central reference time
979 946 centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0;
980 947
981 948 // (3) compute the acquisition time of the current snapshot
982 949 switch(frequencyChannel)
983 950 {
984 951 case 1: // 1 is for F1 = 4096 Hz
985 952 acquisitionTime_asLong = centerTime_asLong - deltaT_F1;
986 953 nb_ring_nodes = NB_RING_NODES_F1;
987 954 frequency_asLong = 4096;
988 955 nbTicksPerSample_asLong = 16; // 65536 / 4096;
989 956 break;
990 957 case 2: // 2 is for F2 = 256 Hz
991 958 acquisitionTime_asLong = centerTime_asLong - deltaT_F2;
992 959 nb_ring_nodes = NB_RING_NODES_F2;
993 960 frequency_asLong = 256;
994 961 nbTicksPerSample_asLong = 256; // 65536 / 256;
995 962 break;
996 963 default:
997 964 acquisitionTime_asLong = centerTime_asLong;
998 965 frequency_asLong = 256;
999 966 nbTicksPerSample_asLong = 256;
1000 967 break;
1001 968 }
1002 969
1003 970 //****************************************************************************
1004 971 // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong
1005 972 for (i=0; i<nb_ring_nodes; i++)
1006 973 {
1007 974 PRINTF1("%d ... ", i)
1008 975 build_acquisition_time( &bufferAcquisitionTime_asLong, ring_node_to_send );
1009 976 if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong)
1010 977 {
1011 978 PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong)
1012 979 break;
1013 980 }
1014 981 ring_node_to_send = ring_node_to_send->previous;
1015 982 }
1016 983
1017 984 // (5) compute the number of samples to take in the current buffer
1018 985 sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16;
1019 986 nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong;
1020 987 PRINTF2("sampleOffset_asLong = %lld, nbSamplesPart1_asLong = %lld\n", sampleOffset_asLong, nbSamplesPart1_asLong)
1021 988
1022 989 // (6) compute the final acquisition time
1023 990 acquisitionTime_asLong = bufferAcquisitionTime_asLong +
1024 991 sampleOffset_asLong * nbTicksPerSample_asLong;
1025 992
1026 993 // (7) copy the acquisition time at the beginning of the extrated snapshot
1027 994 ptr1 = (unsigned char*) &acquisitionTime_asLong;
1028 995 ptr2 = (unsigned char*) wf_snap_extracted;
1029 996 ptr2[0] = ptr1[ 2 + 2 ];
1030 997 ptr2[1] = ptr1[ 3 + 2 ];
1031 998 ptr2[2] = ptr1[ 0 + 2 ];
1032 999 ptr2[3] = ptr1[ 1 + 2 ];
1033 1000 ptr2[4] = ptr1[ 4 + 2 ];
1034 1001 ptr2[5] = ptr1[ 5 + 2 ];
1035 1002
1036 1003 // re set the synchronization bit
1037 1004
1038 1005
1039 1006 // copy the part 1 of the snapshot in the extracted buffer
1040 1007 for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ )
1041 1008 {
1042 1009 wf_snap_extracted[i + TIME_OFFSET] =
1043 1010 ((int*) ring_node_to_send->buffer_address)[i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) + TIME_OFFSET];
1044 1011 }
1045 1012 // copy the part 2 of the snapshot in the extracted buffer
1046 1013 ring_node_to_send = ring_node_to_send->next;
1047 1014 for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ )
1048 1015 {
1049 1016 wf_snap_extracted[i + TIME_OFFSET] =
1050 1017 ((int*) ring_node_to_send->buffer_address)[(i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) + TIME_OFFSET];
1051 1018 }
1052 1019 }
1053 1020
1054 1021 void build_acquisition_time( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node )
1055 1022 {
1056 1023 unsigned char *acquisitionTimeCharPtr;
1057 1024
1058 1025 acquisitionTimeCharPtr = (unsigned char*) current_ring_node->buffer_address;
1059 1026
1060 1027 *acquisitionTimeAslong = 0x00;
1061 1028 *acquisitionTimeAslong = ( acquisitionTimeCharPtr[0] << 24 )
1062 1029 + ( acquisitionTimeCharPtr[1] << 16 )
1063 1030 + ( (unsigned long long int) (acquisitionTimeCharPtr[2] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit
1064 1031 + ( (unsigned long long int) acquisitionTimeCharPtr[3] << 32 )
1065 1032 + ( acquisitionTimeCharPtr[4] << 8 )
1066 1033 + ( acquisitionTimeCharPtr[5] );
1067 1034 }
1068 1035
1069 1036 //**************
1070 1037 // wfp registers
1071 1038 void reset_wfp_burst_enable(void)
1072 1039 {
1073 1040 /** This function resets the waveform picker burst_enable register.
1074 1041 *
1075 1042 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
1076 1043 *
1077 1044 */
1078 1045
1079 1046 waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1080 1047 }
1081 1048
1082 1049 void reset_wfp_status( void )
1083 1050 {
1084 1051 /** This function resets the waveform picker status register.
1085 1052 *
1086 1053 * All status bits are set to 0 [new_err full_err full].
1087 1054 *
1088 1055 */
1089 1056
1090 1057 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1091 1058 }
1092 1059
1093 1060 void reset_waveform_picker_regs(void)
1094 1061 {
1095 1062 /** This function resets the waveform picker module registers.
1096 1063 *
1097 1064 * The registers affected by this function are located at the following offset addresses:
1098 1065 * - 0x00 data_shaping
1099 1066 * - 0x04 run_burst_enable
1100 1067 * - 0x08 addr_data_f0
1101 1068 * - 0x0C addr_data_f1
1102 1069 * - 0x10 addr_data_f2
1103 1070 * - 0x14 addr_data_f3
1104 1071 * - 0x18 status
1105 1072 * - 0x1C delta_snapshot
1106 1073 * - 0x20 delta_f0
1107 1074 * - 0x24 delta_f0_2
1108 1075 * - 0x28 delta_f1
1109 1076 * - 0x2c delta_f2
1110 1077 * - 0x30 nb_data_by_buffer
1111 1078 * - 0x34 nb_snapshot_param
1112 1079 * - 0x38 start_date
1113 1080 * - 0x3c nb_word_in_buffer
1114 1081 *
1115 1082 */
1116 1083
1117 1084 set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW
1118 1085 reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1119 1086 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08
1120 1087 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c
1121 1088 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10
1122 1089 waveform_picker_regs->addr_data_f3 = current_ring_node_f3->buffer_address; // 0x14
1123 1090 reset_wfp_status(); // 0x18
1124 1091 //
1125 1092 set_wfp_delta_snapshot(); // 0x1c
1126 1093 set_wfp_delta_f0_f0_2(); // 0x20, 0x24
1127 1094 set_wfp_delta_f1(); // 0x28
1128 1095 set_wfp_delta_f2(); // 0x2c
1129 1096 DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot)
1130 1097 DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0)
1131 1098 DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2)
1132 1099 DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1)
1133 1100 DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2)
1134 1101 // 2688 = 8 * 336
1135 1102 waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1
1136 1103 waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples
1137 1104 waveform_picker_regs->start_date = 0x00; // 0x38
1138 1105 waveform_picker_regs->nb_word_in_buffer = 0x1f82; // 0x3c *** 2688 * 3 + 2 = 8066
1139 1106 }
1140 1107
1141 1108 void set_wfp_data_shaping( void )
1142 1109 {
1143 1110 /** This function sets the data_shaping register of the waveform picker module.
1144 1111 *
1145 1112 * The value is read from one field of the parameter_dump_packet structure:\n
1146 1113 * bw_sp0_sp1_r0_r1
1147 1114 *
1148 1115 */
1149 1116
1150 1117 unsigned char data_shaping;
1151 1118
1152 1119 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
1153 1120 // waveform picker : [R1 R0 SP1 SP0 BW]
1154 1121
1155 1122 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
1156 1123
1157 1124 waveform_picker_regs->data_shaping =
1158 1125 ( (data_shaping & 0x10) >> 4 ) // BW
1159 1126 + ( (data_shaping & 0x08) >> 2 ) // SP0
1160 1127 + ( (data_shaping & 0x04) ) // SP1
1161 1128 + ( (data_shaping & 0x02) << 2 ) // R0
1162 1129 + ( (data_shaping & 0x01) << 4 ); // R1
1163 1130 }
1164 1131
1165 1132 void set_wfp_burst_enable_register( unsigned char mode )
1166 1133 {
1167 1134 /** This function sets the waveform picker burst_enable register depending on the mode.
1168 1135 *
1169 1136 * @param mode is the LFR mode to launch.
1170 1137 *
1171 1138 * The burst bits shall be before the enable bits.
1172 1139 *
1173 1140 */
1174 1141
1175 1142 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1176 1143 // the burst bits shall be set first, before the enable bits
1177 1144 switch(mode) {
1178 1145 case(LFR_MODE_NORMAL):
1179 1146 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable
1180 1147 waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1181 1148 break;
1182 1149 case(LFR_MODE_BURST):
1183 1150 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1184 1151 // waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2
1185 1152 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1100] enable f3 AND f2
1186 1153 break;
1187 1154 case(LFR_MODE_SBM1):
1188 1155 waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled
1189 1156 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1190 1157 break;
1191 1158 case(LFR_MODE_SBM2):
1192 1159 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1193 1160 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1194 1161 break;
1195 1162 default:
1196 1163 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1197 1164 break;
1198 1165 }
1199 1166 }
1200 1167
1201 1168 void set_wfp_delta_snapshot( void )
1202 1169 {
1203 1170 /** This function sets the delta_snapshot register of the waveform picker module.
1204 1171 *
1205 1172 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
1206 1173 * - sy_lfr_n_swf_p[0]
1207 1174 * - sy_lfr_n_swf_p[1]
1208 1175 *
1209 1176 */
1210 1177
1211 1178 unsigned int delta_snapshot;
1212 1179 unsigned int delta_snapshot_in_T2;
1213 1180
1214 1181 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
1215 1182 + parameter_dump_packet.sy_lfr_n_swf_p[1];
1216 1183
1217 1184 delta_snapshot_in_T2 = delta_snapshot * 256;
1218 1185 waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2; // max 4 bytes
1219 1186 }
1220 1187
1221 1188 void set_wfp_delta_f0_f0_2( void )
1222 1189 {
1223 1190 unsigned int delta_snapshot;
1224 1191 unsigned int nb_samples_per_snapshot;
1225 1192 float delta_f0_in_float;
1226 1193
1227 1194 delta_snapshot = waveform_picker_regs->delta_snapshot;
1228 1195 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1229 1196 delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.;
1230 1197
1231 1198 waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float );
1232 1199 waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits
1233 1200 }
1234 1201
1235 1202 void set_wfp_delta_f1( void )
1236 1203 {
1237 1204 unsigned int delta_snapshot;
1238 1205 unsigned int nb_samples_per_snapshot;
1239 1206 float delta_f1_in_float;
1240 1207
1241 1208 delta_snapshot = waveform_picker_regs->delta_snapshot;
1242 1209 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1243 1210 delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.;
1244 1211
1245 1212 waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float );
1246 1213 }
1247 1214
1248 1215 void set_wfp_delta_f2()
1249 1216 {
1250 1217 unsigned int delta_snapshot;
1251 1218 unsigned int nb_samples_per_snapshot;
1252 1219
1253 1220 delta_snapshot = waveform_picker_regs->delta_snapshot;
1254 1221 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1255 1222
1256 1223 waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2;
1257 1224 }
1258 1225
1259 1226 //*****************
1260 1227 // local parameters
1261 1228 void set_local_nb_interrupt_f0_MAX( void )
1262 1229 {
1263 1230 /** This function sets the value of the nb_interrupt_f0_MAX local parameter.
1264 1231 *
1265 1232 * This parameter is used for the SM validation only.\n
1266 1233 * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices
1267 1234 * module before launching a basic processing.
1268 1235 *
1269 1236 */
1270 1237
1271 1238 param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256
1272 1239 + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100;
1273 1240 }
1274 1241
1275 1242 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1276 1243 {
1277 1244 unsigned short *sequence_cnt;
1278 1245 unsigned short segmentation_grouping_flag;
1279 1246 unsigned short new_packet_sequence_control;
1280 1247
1281 1248 if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2)
1282 1249 || (sid ==SID_NORM_CWF_F3) || (sid==SID_NORM_CWF_LONG_F3) || (sid ==SID_BURST_CWF_F2) )
1283 1250 {
1284 1251 sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_NORMAL_BURST;
1285 1252 }
1286 1253 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) )
1287 1254 {
1288 1255 sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_SBM1_SBM2;
1289 1256 }
1290 1257 else
1291 1258 {
1292 1259 sequence_cnt = (unsigned short *) NULL;
1293 1260 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1294 1261 }
1295 1262
1296 1263 if (sequence_cnt != NULL)
1297 1264 {
1298 1265 // increment the sequence counter
1299 1266 if ( *sequence_cnt < SEQ_CNT_MAX)
1300 1267 {
1301 1268 *sequence_cnt = *sequence_cnt + 1;
1302 1269 }
1303 1270 else
1304 1271 {
1305 1272 *sequence_cnt = 0;
1306 1273 }
1307 1274 segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
1308 1275 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1309 1276
1310 1277 new_packet_sequence_control = segmentation_grouping_flag | (*sequence_cnt) ;
1311 1278
1312 1279 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1313 1280 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1314 1281 }
1315 1282 }
General Comments 0
You need to be logged in to leave comments. Login now