##// END OF EJS Templates
Sync before going back to 1.0.0.12 for sources delivery
paul -
r163:397b59567aca VHDLib206
parent child
Show More
@@ -1,273 +1,273
1 1 #############################################################################
2 2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.6) on: Tue Jun 24 09:17:30 2014
3 # Generated by qmake (2.01a) (Qt 4.8.6) on: Fri Jun 27 09:11:27 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 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=13 -DPRINT_MESSAGES_ON_CONSOLE
13 DEFINES = -DSW_VERSION_N1=2 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=1 -DPRINT_MESSAGES_ON_CONSOLE
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/LFR_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/processing/fsw_processing.c \
56 56 ../src/processing/avf0_prc0.c \
57 57 ../src/processing/avf1_prc1.c \
58 58 ../src/processing/avf2_prc2.c \
59 59 ../src/lfr_cpu_usage_report.c \
60 60 ../src/LFR_basic-parameters/basic_parameters.c
61 61 OBJECTS = obj/wf_handler.o \
62 62 obj/tc_handler.o \
63 63 obj/fsw_misc.o \
64 64 obj/fsw_init.o \
65 65 obj/fsw_globals.o \
66 66 obj/fsw_spacewire.o \
67 67 obj/tc_load_dump_parameters.o \
68 68 obj/tm_lfr_tc_exe.o \
69 69 obj/tc_acceptance.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 obj/lfr_cpu_usage_report.o \
75 75 obj/basic_parameters.o
76 76 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
77 77 /usr/lib64/qt4/mkspecs/common/linux.conf \
78 78 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
79 79 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
80 80 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
81 81 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
82 82 /usr/lib64/qt4/mkspecs/qconfig.pri \
83 83 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
84 84 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
85 85 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
86 86 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
87 87 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
88 88 sparc.pri \
89 89 /usr/lib64/qt4/mkspecs/features/release.prf \
90 90 /usr/lib64/qt4/mkspecs/features/default_post.prf \
91 91 /usr/lib64/qt4/mkspecs/features/shared.prf \
92 92 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
93 93 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
94 94 /usr/lib64/qt4/mkspecs/features/resources.prf \
95 95 /usr/lib64/qt4/mkspecs/features/uic.prf \
96 96 /usr/lib64/qt4/mkspecs/features/yacc.prf \
97 97 /usr/lib64/qt4/mkspecs/features/lex.prf \
98 98 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
99 99 fsw-qt.pro
100 100 QMAKE_TARGET = fsw
101 101 DESTDIR = bin/
102 102 TARGET = bin/fsw
103 103
104 104 first: all
105 105 ####### Implicit rules
106 106
107 107 .SUFFIXES: .o .c .cpp .cc .cxx .C
108 108
109 109 .cpp.o:
110 110 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
111 111
112 112 .cc.o:
113 113 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
114 114
115 115 .cxx.o:
116 116 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
117 117
118 118 .C.o:
119 119 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
120 120
121 121 .c.o:
122 122 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
123 123
124 124 ####### Build rules
125 125
126 126 all: Makefile $(TARGET)
127 127
128 128 $(TARGET): $(OBJECTS)
129 129 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
130 130 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
131 131
132 132 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
133 133 /usr/lib64/qt4/mkspecs/common/linux.conf \
134 134 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
135 135 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
136 136 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
137 137 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
138 138 /usr/lib64/qt4/mkspecs/qconfig.pri \
139 139 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
140 140 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
141 141 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
142 142 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
143 143 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
144 144 sparc.pri \
145 145 /usr/lib64/qt4/mkspecs/features/release.prf \
146 146 /usr/lib64/qt4/mkspecs/features/default_post.prf \
147 147 /usr/lib64/qt4/mkspecs/features/shared.prf \
148 148 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
149 149 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
150 150 /usr/lib64/qt4/mkspecs/features/resources.prf \
151 151 /usr/lib64/qt4/mkspecs/features/uic.prf \
152 152 /usr/lib64/qt4/mkspecs/features/yacc.prf \
153 153 /usr/lib64/qt4/mkspecs/features/lex.prf \
154 154 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
155 155 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
156 156 /usr/lib64/qt4/mkspecs/common/unix.conf:
157 157 /usr/lib64/qt4/mkspecs/common/linux.conf:
158 158 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
159 159 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
160 160 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
161 161 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
162 162 /usr/lib64/qt4/mkspecs/qconfig.pri:
163 163 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
164 164 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
165 165 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
166 166 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
167 167 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
168 168 sparc.pri:
169 169 /usr/lib64/qt4/mkspecs/features/release.prf:
170 170 /usr/lib64/qt4/mkspecs/features/default_post.prf:
171 171 /usr/lib64/qt4/mkspecs/features/shared.prf:
172 172 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
173 173 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
174 174 /usr/lib64/qt4/mkspecs/features/resources.prf:
175 175 /usr/lib64/qt4/mkspecs/features/uic.prf:
176 176 /usr/lib64/qt4/mkspecs/features/yacc.prf:
177 177 /usr/lib64/qt4/mkspecs/features/lex.prf:
178 178 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
179 179 qmake: FORCE
180 180 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
181 181
182 182 dist:
183 183 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
184 184 $(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
185 185
186 186
187 187 clean:compiler_clean
188 188 -$(DEL_FILE) $(OBJECTS)
189 189 -$(DEL_FILE) *~ core *.core
190 190
191 191
192 192 ####### Sub-libraries
193 193
194 194 distclean: clean
195 195 -$(DEL_FILE) $(TARGET)
196 196 -$(DEL_FILE) Makefile
197 197
198 198
199 199 grmon:
200 200 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
201 201
202 202 check: first
203 203
204 204 compiler_rcc_make_all:
205 205 compiler_rcc_clean:
206 206 compiler_uic_make_all:
207 207 compiler_uic_clean:
208 208 compiler_image_collection_make_all: qmake_image_collection.cpp
209 209 compiler_image_collection_clean:
210 210 -$(DEL_FILE) qmake_image_collection.cpp
211 211 compiler_yacc_decl_make_all:
212 212 compiler_yacc_decl_clean:
213 213 compiler_yacc_impl_make_all:
214 214 compiler_yacc_impl_clean:
215 215 compiler_lex_make_all:
216 216 compiler_lex_clean:
217 217 compiler_clean:
218 218
219 219 ####### Compile
220 220
221 221 obj/wf_handler.o: ../src/wf_handler.c
222 222 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
223 223
224 224 obj/tc_handler.o: ../src/tc_handler.c
225 225 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
226 226
227 227 obj/fsw_misc.o: ../src/fsw_misc.c
228 228 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
229 229
230 230 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
231 231 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
232 232
233 233 obj/fsw_globals.o: ../src/fsw_globals.c
234 234 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
235 235
236 236 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
237 237 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
238 238
239 239 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
240 240 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
241 241
242 242 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
243 243 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
244 244
245 245 obj/tc_acceptance.o: ../src/tc_acceptance.c
246 246 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
247 247
248 248 obj/fsw_processing.o: ../src/processing/fsw_processing.c
249 249 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c
250 250
251 251 obj/avf0_prc0.o: ../src/processing/avf0_prc0.c
252 252 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c
253 253
254 254 obj/avf1_prc1.o: ../src/processing/avf1_prc1.c
255 255 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c
256 256
257 257 obj/avf2_prc2.o: ../src/processing/avf2_prc2.c
258 258 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c
259 259
260 260 obj/lfr_cpu_usage_report.o: ../src/lfr_cpu_usage_report.c
261 261 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/lfr_cpu_usage_report.o ../src/lfr_cpu_usage_report.c
262 262
263 263 obj/basic_parameters.o: ../src/LFR_basic-parameters/basic_parameters.c
264 264 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/LFR_basic-parameters/basic_parameters.c
265 265
266 266 ####### Install
267 267
268 268 install: FORCE
269 269
270 270 uninstall: FORCE
271 271
272 272 FORCE:
273 273
@@ -1,95 +1,95
1 1 TEMPLATE = app
2 2 # CONFIG += console v8 sim
3 3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
4 4 CONFIG += console verbose
5 5 CONFIG -= qt
6 6
7 7 include(./sparc.pri)
8 8
9 9 # flight software version
10 SWVERSION=-1-0
11 DEFINES += SW_VERSION_N1=1 # major
10 SWVERSION=-2-0
11 DEFINES += SW_VERSION_N1=2 # major
12 12 DEFINES += SW_VERSION_N2=0 # minor
13 13 DEFINES += SW_VERSION_N3=0 # patch
14 DEFINES += SW_VERSION_N4=13 # internal
14 DEFINES += SW_VERSION_N4=1 # internal
15 15
16 16 contains( CONFIG, debug_tch ) {
17 17 DEFINES += DEBUG_TCH
18 18 }
19 19
20 20 contains( CONFIG, vhdl_dev ) {
21 21 DEFINES += VHDL_DEV
22 22 }
23 23
24 24 contains( CONFIG, verbose ) {
25 25 DEFINES += PRINT_MESSAGES_ON_CONSOLE
26 26 }
27 27
28 28 contains( CONFIG, debug_messages ) {
29 29 DEFINES += DEBUG_MESSAGES
30 30 }
31 31
32 32 contains( CONFIG, cpu_usage_report ) {
33 33 DEFINES += PRINT_TASK_STATISTICS
34 34 }
35 35
36 36 contains( CONFIG, stack_report ) {
37 37 DEFINES += PRINT_STACK_REPORT
38 38 }
39 39
40 40 contains( CONFIG, boot_messages ) {
41 41 DEFINES += BOOT_MESSAGES
42 42 }
43 43
44 44 #doxygen.target = doxygen
45 45 #doxygen.commands = doxygen ../doc/Doxyfile
46 46 #QMAKE_EXTRA_TARGETS += doxygen
47 47
48 48 TARGET = fsw
49 49
50 50 INCLUDEPATH += \
51 51 ../src \
52 52 ../header \
53 53 ../header/processing \
54 54 ../src/LFR_basic-parameters
55 55
56 56 SOURCES += \
57 57 ../src/wf_handler.c \
58 58 ../src/tc_handler.c \
59 59 ../src/fsw_misc.c \
60 60 ../src/fsw_init.c \
61 61 ../src/fsw_globals.c \
62 62 ../src/fsw_spacewire.c \
63 63 ../src/tc_load_dump_parameters.c \
64 64 ../src/tm_lfr_tc_exe.c \
65 65 ../src/tc_acceptance.c \
66 66 ../src/processing/fsw_processing.c \
67 67 ../src/processing/avf0_prc0.c \
68 68 ../src/processing/avf1_prc1.c \
69 69 ../src/processing/avf2_prc2.c \
70 70 ../src/lfr_cpu_usage_report.c \
71 71 ../src/LFR_basic-parameters/basic_parameters.c
72 72
73 73 HEADERS += \
74 74 ../header/wf_handler.h \
75 75 ../header/tc_handler.h \
76 76 ../header/grlib_regs.h \
77 77 ../header/fsw_params.h \
78 78 ../header/fsw_misc.h \
79 79 ../header/fsw_init.h \
80 80 ../header/ccsds_types.h \
81 81 ../header/fsw_spacewire.h \
82 82 ../header/tc_load_dump_parameters.h \
83 83 ../header/tm_lfr_tc_exe.h \
84 84 ../header/tc_acceptance.h \
85 85 ../header/fsw_params_nb_bytes.h \
86 86 ../header/fsw_params_processing.h \
87 87 ../header/processing/fsw_processing.h \
88 88 ../header/processing/avf0_prc0.h \
89 89 ../header/processing/avf1_prc1.h \
90 90 ../header/processing/avf2_prc2.h \
91 91 ../header/fsw_params_wf_handler.h \
92 92 ../header/lfr_cpu_usage_report.h \
93 93 ../src/LFR_basic-parameters/basic_parameters.h \
94 94 ../src/LFR_basic-parameters/basic_parameters_params.h
95 95
@@ -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-06-24T12:52:17. -->
3 <!-- Written by QtCreator 3.0.1, 2014-06-27T15:54:25. -->
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 54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
55 55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
56 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 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,70 +1,73
1 1 #ifndef FSW_PARAMS_PROCESSING_H
2 2 #define FSW_PARAMS_PROCESSING_H
3 3
4 4 #define NB_BINS_PER_SM 128
5 5 #define NB_VALUES_PER_SM 25
6 6 #define TOTAL_SIZE_SM 3200 // 25 * 128 = 0xC80
7 7 #define TOTAL_SIZE_NORM_BP1_F0 99 // 11 * 9 = 99
8 8 #define TOTAL_SIZE_NORM_BP1_F1 117 // 13 * 9 = 117
9 9 #define TOTAL_SIZE_NORM_BP1_F2 108 // 12 * 9 = 108
10 10 #define TOTAL_SIZE_SBM1_BP1_F0 198 // 22 * 9 = 198
11 11 //
12 12 #define NB_RING_NODES_SM_F0 12 // AT LEAST 3
13 13 #define NB_RING_NODES_ASM_BURST_SBM_F0 10 // AT LEAST 3
14 14 #define NB_RING_NODES_ASM_NORM_F0 10 // AT LEAST 3
15 15 #define NB_RING_NODES_SM_F1 3 // AT LEAST 3
16 16 #define NB_RING_NODES_ASM_BURST_SBM_F1 5 // AT LEAST 3
17 17 #define NB_RING_NODES_ASM_NORM_F1 5 // AT LEAST 3
18 18 #define NB_RING_NODES_SM_F2 3 // AT LEAST 3
19 19 #define NB_RING_NODES_ASM_BURST_SBM_F2 3 // AT LEAST 3
20 20 #define NB_RING_NODES_ASM_NORM_F2 3 // AT LEAST 3
21 21 //
22 22 #define NB_BINS_PER_ASM_F0 88
23 23 #define NB_BINS_PER_PKT_ASM_F0 44
24 24 #define TOTAL_SIZE_ASM_F0_IN_BYTES 4400 // 25 * 88 * 2
25 #define ASM_F0_INDICE_START 17 // 88 bins
25 //#define ASM_F0_INDICE_START 17 // 88 bins
26 #define ASM_F0_INDICE_START 0
26 27 #define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins
27 28 //
28 29 #define NB_BINS_PER_ASM_F1 104
29 30 #define NB_BINS_PER_PKT_ASM_F1 52
30 31 #define TOTAL_SIZE_ASM_F1_IN_BYTES 5200 // 25 * 104 * 2
31 #define ASM_F1_INDICE_START 6 // 104 bins
32 //#define ASM_F1_INDICE_START 6 // 104 bins
33 #define ASM_F1_INDICE_START 0
32 34 #define ASM_F1_INDICE_STOP 109 // 2 packets of 52 bins
33 35 //
34 36 #define NB_BINS_PER_ASM_F2 96
35 37 #define NB_BINS_PER_PKT_ASM_F2 48
36 38 #define TOTAL_SIZE_ASM_F2_IN_BYTES 4800 // 25 * 96 * 2
37 #define ASM_F2_INDICE_START 7 // 96 bins
39 //#define ASM_F2_INDICE_START 7 // 96 bins
40 #define ASM_F2_INDICE_START 0
38 41 #define ASM_F2_INDICE_STOP 102 // 2 packets of 48 bins
39 42 //
40 43 #define NB_BINS_COMPRESSED_SM_F0 11
41 44 #define NB_BINS_COMPRESSED_SM_F1 13
42 45 #define NB_BINS_COMPRESSED_SM_F2 12
43 46 #define NB_BINS_COMPRESSED_SM_SBM_F0 22
44 47 #define NB_BINS_COMPRESSED_SM_SBM_F1 26
45 48 #define NB_BINS_COMPRESSED_SM_SBM_F2 24
46 49 //
47 50 #define NB_BYTES_PER_BP1 9
48 51 //
49 52 #define NB_BINS_TO_AVERAGE_ASM_F0 8
50 53 #define NB_BINS_TO_AVERAGE_ASM_F1 8
51 54 #define NB_BINS_TO_AVERAGE_ASM_F2 8
52 55 #define NB_BINS_TO_AVERAGE_ASM_SBM_F0 4
53 56 #define NB_BINS_TO_AVERAGE_ASM_SBM_F1 4
54 57 #define NB_BINS_TO_AVERAGE_ASM_SBM_F2 4
55 58 //
56 59 #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F0 275 // 11 * 25 WORDS
57 60 #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F1 325 // 13 * 25 WORDS
58 61 #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F2 300 // 12 * 25 WORDS
59 62 #define TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 550 // 22 * 25 WORDS
60 63 #define TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 650 // 26 * 25 WORDS
61 64 #define TOTAL_SIZE_COMPRESSED_ASM_SBM_F2 600 // 24 * 25 WORDS
62 65 #define TOTAL_SIZE_BP1_NORM_F0 99 // 9 * 11 UNSIGNED CHAR
63 66 #define TOTAL_SIZE_BP1_SBM_F0 198 // 9 * 22 UNSIGNED CHAR
64 67 // GENERAL
65 68 #define NB_SM_BEFORE_AVF0 8 // must be 8 due to the SM_average() function
66 69 #define NB_SM_BEFORE_AVF1 8 // must be 8 due to the SM_average() function
67 70 #define NB_SM_BEFORE_AVF2 1 // must be 1 due to the SM_average_f2() function
68 71
69 72 #endif // FSW_PARAMS_PROCESSING_H
70 73
@@ -1,28 +1,29
1 1 #ifndef AVF2_PRC2_H
2 2 #define AVF2_PRC2_H
3 3
4 4 #include "fsw_processing.h"
5 5
6 6 typedef struct {
7 7 unsigned int norm_bp1;
8 8 unsigned int norm_bp2;
9 9 unsigned int norm_asm;
10 10 } nb_sm_before_bp_asm_f2;
11 11
12 12 //************
13 13 // RTEMS TASKS
14 14 rtems_task avf2_task( rtems_task_argument lfrRequestedMode );
15 15 rtems_task prc2_task( rtems_task_argument lfrRequestedMode );
16 16
17 17 //**********
18 18 // FUNCTIONS
19 19
20 20 void reset_nb_sm_f2( void );
21 21 void SM_average_f2( float *averaged_spec_mat_f2, ring_node_sm *ring_node, unsigned int nbAverageNormF2 );
22 void SM_average_f2_alt( float *averaged_spec_mat_f2, ring_node_sm *ring_node, unsigned int nbAverageNormF2 );
22 23
23 24 //*******
24 25 // EXTERN
25 26 extern struct ring_node_sm *ring_node_for_averaging_sm_f2;
26 27 extern rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
27 28
28 29 #endif // AVF2_PRC2_H
@@ -1,255 +1,272
1 1 #ifndef FSW_PROCESSING_H_INCLUDED
2 2 #define FSW_PROCESSING_H_INCLUDED
3 3
4 4 #include <rtems.h>
5 5 #include <grspw.h>
6 6 #include <math.h>
7 7 #include <stdlib.h> // abs() is in the stdlib
8 8 #include <stdio.h> // printf()
9 9 #include <math.h>
10 10
11 11 #include "fsw_params.h"
12 12 #include "fsw_spacewire.h"
13 13
14 14 typedef struct ring_node_sm
15 15 {
16 16 struct ring_node_sm *previous;
17 17 struct ring_node_sm *next;
18 18 int buffer_address;
19 19 unsigned int status;
20 20 unsigned int coarseTime;
21 21 unsigned int fineTime;
22 22 } ring_node_sm;
23 23
24 24 typedef struct ring_node_asm
25 25 {
26 26 struct ring_node_asm *next;
27 27 float matrix[ TOTAL_SIZE_SM ];
28 28 unsigned int status;
29 29 } ring_node_asm;
30 30
31 31 typedef struct
32 32 {
33 33 Header_TM_LFR_SCIENCE_BP_t header;
34 34 unsigned char data[ 30 * 22 ]; // MAX size is 22 * 30 [TM_LFR_SCIENCE_BURST_BP2_F1]
35 35 } bp_packet;
36 36
37 37 typedef struct
38 38 {
39 39 Header_TM_LFR_SCIENCE_BP_with_spare_t header;
40 40 unsigned char data[ 9 * 13 ]; // only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1
41 41 } bp_packet_with_spare;
42 42
43 43 typedef struct
44 44 {
45 45 ring_node_asm *norm;
46 46 ring_node_asm *burst_sbm;
47 47 rtems_event_set event;
48 48 unsigned int coarseTime;
49 49 unsigned int fineTime;
50 50 } asm_msg;
51 51
52 52 extern volatile int sm_f0[ ];
53 53 extern volatile int sm_f1[ ];
54 54 extern volatile int sm_f2[ ];
55 55
56 56 // parameters
57 57 extern struct param_local_str param_local;
58 58
59 59 // registers
60 60 extern time_management_regs_t *time_management_regs;
61 61 extern spectral_matrix_regs_t *spectral_matrix_regs;
62 62
63 63 extern rtems_name misc_name[5];
64 64 extern rtems_id Task_id[20]; /* array of task ids */
65 65
66 66 // ISR
67 67 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
68 68 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
69 69
70 70 //******************
71 71 // Spectral Matrices
72 72 void reset_nb_sm( void );
73 73 // SM
74 74 void SM_init_rings( void );
75 75 void SM_reset_current_ring_nodes( void );
76 76 void SM_generic_init_ring(ring_node_sm *ring, unsigned char nbNodes, volatile int sm_f[] );
77 77 // ASM
78 78 void ASM_generic_init_ring(ring_node_asm *ring, unsigned char nbNodes );
79 79 void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header);
80 80 void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
81 81 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id);
82 82
83 83 //*****************
84 84 // Basic Parameters
85 85
86 86 void BP_reset_current_ring_nodes( void );
87 87 void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header,
88 88 unsigned int apid, unsigned char sid,
89 89 unsigned int packetLength , unsigned char blkNr);
90 90 void BP_init_header_with_spare( Header_TM_LFR_SCIENCE_BP_with_spare_t *header,
91 91 unsigned int apid, unsigned char sid,
92 92 unsigned int packetLength, unsigned char blkNr );
93 93 void BP_send( char *data,
94 94 rtems_id queue_id ,
95 95 unsigned int nbBytesToSend , unsigned int sid );
96 96
97 97 //******************
98 98 // general functions
99 99 void reset_spectral_matrix_regs( void );
100 100 void set_time(unsigned char *time, unsigned char *timeInBuffer );
101 101 unsigned long long int get_acquisition_time( unsigned char *timePtr );
102 102 void close_matrix_actions(unsigned int *nb_sm, unsigned int nb_sm_before_avf, rtems_id task_id,
103 103 ring_node_sm *node_for_averaging, ring_node_sm *ringNode, unsigned long long int time);
104 104 unsigned char getSID( rtems_event_set event );
105 105
106 106 extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
107 107 extern rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
108 108
109 109 //***************************************
110 110 // DEFINITIONS OF STATIC INLINE FUNCTIONS
111 111 static inline void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
112 ring_node_sm *ring_node_tab[],
113 unsigned int nbAverageNORM, unsigned int nbAverageSBM );
112 ring_node_sm *ring_node_tab[],
113 unsigned int nbAverageNORM, unsigned int nbAverageSBM );
114 static inline void SM_average_alt( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
115 ring_node_sm *ring_node_tab[],
116 unsigned int nbAverageNORM, unsigned int nbAverageSBM );
114 117 static inline void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized,
115 118 float divider );
116 119 static inline void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat,
117 120 float divider,
118 121 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart);
119 122 static inline void ASM_convert(volatile float *input_matrix, char *output_matrix);
120 123
121 124 void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
122 125 ring_node_sm *ring_node_tab[],
123 126 unsigned int nbAverageNORM, unsigned int nbAverageSBM )
124 127 {
125 128 float sum;
126 129 unsigned int i;
127 130
128 131 for(i=0; i<TOTAL_SIZE_SM; i++)
129 132 {
130 133 sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ]
131 134 + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ]
132 135 + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ]
133 136 + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ]
134 137 + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ]
135 138 + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ]
136 139 + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ]
137 140 + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ];
138 141
139 142 if ( (nbAverageNORM == 0) && (nbAverageSBM == 0) )
140 143 {
141 144 averaged_spec_mat_NORM[ i ] = sum;
142 145 averaged_spec_mat_SBM[ i ] = sum;
143 146 }
144 147 else if ( (nbAverageNORM != 0) && (nbAverageSBM != 0) )
145 148 {
146 149 averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum );
147 150 averaged_spec_mat_SBM[ i ] = ( averaged_spec_mat_SBM[ i ] + sum );
148 151 }
149 152 else if ( (nbAverageNORM != 0) && (nbAverageSBM == 0) )
150 153 {
151 154 averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum );
152 155 averaged_spec_mat_SBM[ i ] = sum;
153 156 }
154 157 else
155 158 {
156 159 PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNORM, nbAverageSBM)
157 160 }
158 161 }
159 162 }
160 163
164 void SM_average_alt( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
165 ring_node_sm *ring_node_tab[], unsigned int nbAverageNORM, unsigned int nbAverageSBM )
166 {
167 float sum;
168 unsigned int i;
169
170 for(i=0; i<TOTAL_SIZE_SM; i++)
171 {
172 sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ];
173 averaged_spec_mat_NORM[ i ] = sum;
174 averaged_spec_mat_SBM[ i ] = sum;
175 }
176 }
177
161 178 void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider )
162 179 {
163 // reorganize the data to have a matrix in the VHDL format
180 // reorganize the data to have a matrix in the ICD format
164 181 // INPUT (VHDL format)
165 // component_0[0 .. 127] component_1[0 .. 127] .. component_24[0 .. 127]
182 // component_0[0 .. 127] component_1_re[0 .. 127] component_1_im[0 .. 127] .. component_24[0 .. 127]
166 183 // OUTPUT (ICD format)
167 184 // matrix_0[0 .. 24] matrix_1[0 .. 24] .. matrix_127[0 .. 24]
168 185
169 186 int frequencyBin;
170 187 int asmComponent;
171 188 unsigned int offsetASMReorganized;
172 189 unsigned int offsetASM;
173 190
174 191 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
175 192 {
176 193 for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ )
177 194 {
178 195 offsetASM =
179 196 asmComponent * NB_BINS_PER_SM
180 197 + frequencyBin;
181 198 offsetASMReorganized =
182 199 frequencyBin * NB_VALUES_PER_SM
183 200 + asmComponent;
184 201 averaged_spec_mat_reorganized[ offsetASMReorganized ] =
185 202 averaged_spec_mat[ offsetASM ] / divider;
186 203 }
187 204 }
188 205 }
189 206
190 207 void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider,
191 208 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart )
192 209 {
193 210 int frequencyBin;
194 211 int asmComponent;
195 212 int offsetASM;
196 213 int offsetCompressed;
197 214 int k;
198 215
199 216 // build data
200 217 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
201 218 {
202 219 for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ )
203 220 {
204 221 offsetCompressed = // NO TIME OFFSET
205 222 frequencyBin * NB_VALUES_PER_SM
206 223 + asmComponent;
207 224 offsetASM = // NO TIME OFFSET
208 225 asmComponent * NB_BINS_PER_SM
209 226 + ASMIndexStart
210 227 + frequencyBin * nbBinsToAverage;
211 228 compressed_spec_mat[ offsetCompressed ] = 0;
212 229 for ( k = 0; k < nbBinsToAverage; k++ )
213 230 {
214 231 compressed_spec_mat[offsetCompressed ] =
215 232 ( compressed_spec_mat[ offsetCompressed ]
216 233 + averaged_spec_mat[ offsetASM + k ] ) / (divider * nbBinsToAverage);
217 234 }
218 235 }
219 236 }
220 237 }
221 238
222 239 void ASM_convert( volatile float *input_matrix, char *output_matrix)
223 240 {
224 241 // convert the data to have a matrix in compressed float, 16 bits = [sign 1 bit *** exp 8 bits *** fraction 7 bits]
225 242 // INTPUT (ICD format)
226 243 // matrix_0[0 .. 24] matrix_1[0 .. 24] .. matrix_127[0 .. 24]
227 244 // OUTPUT (ICD format)
228 245 // matrix_0[0 .. 24] matrix_1[0 .. 24] .. matrix_127[0 .. 24]
229 246
230 247 unsigned int frequencyBin;
231 248 unsigned int asmComponent;
232 249 char * pt_char_input;
233 250 char * pt_char_output;
234 251 unsigned int offsetInput;
235 252 unsigned int offsetOutput;
236 253
237 254 pt_char_input = (char*) &input_matrix;
238 255 pt_char_output = (char*) &output_matrix;
239 256
240 257 // convert all other data
241 258 for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++)
242 259 {
243 260 for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++)
244 261 {
245 262 offsetInput = (frequencyBin*NB_VALUES_PER_SM) + asmComponent ;
246 263 offsetOutput = 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) ;
247 264 pt_char_input = (char*) &input_matrix [ offsetInput ];
248 265 pt_char_output = (char*) &output_matrix[ offsetOutput ];
249 266 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
250 267 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
251 268 }
252 269 }
253 270 }
254 271
255 272 #endif // FSW_PROCESSING_H_INCLUDED
@@ -1,380 +1,380
1 1 /** Functions related to data processing.
2 2 *
3 3 * @file
4 4 * @author P. LEROY
5 5 *
6 6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
7 7 *
8 8 */
9 9
10 10 #include "avf0_prc0.h"
11 11 #include "fsw_processing.h"
12 12
13 13 nb_sm_before_bp_asm_f0 nb_sm_before_f0;
14 14
15 15 //***
16 16 // F0
17 17 ring_node_asm asm_ring_norm_f0 [ NB_RING_NODES_ASM_NORM_F0 ];
18 18 ring_node_asm asm_ring_burst_sbm_f0[ NB_RING_NODES_ASM_BURST_SBM_F0 ];
19 19
20 20 float asm_f0_reorganized [ TOTAL_SIZE_SM ];
21 21 char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
22 22 float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F0];
23 23 float compressed_sm_sbm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 ];
24 24 //unsigned char bp1_norm_f0 [ TOTAL_SIZE_BP1_NORM_F0 ];
25 25 //unsigned char bp1_sbm_f0 [ TOTAL_SIZE_BP1_SBM_F0 ];
26 26
27 27 //************
28 28 // RTEMS TASKS
29 29
30 30 rtems_task avf0_task( rtems_task_argument lfrRequestedMode )
31 31 {
32 32 int i;
33 33
34 34 rtems_event_set event_out;
35 35 rtems_status_code status;
36 36 rtems_id queue_id_prc0;
37 37 asm_msg msgForMATR;
38 38 ring_node_sm *ring_node_tab[8];
39 39 ring_node_asm *current_ring_node_asm_burst_sbm_f0;
40 40 ring_node_asm *current_ring_node_asm_norm_f0;
41 41
42 42 unsigned int nb_norm_bp1;
43 43 unsigned int nb_norm_bp2;
44 44 unsigned int nb_norm_asm;
45 45 unsigned int nb_sbm_bp1;
46 46 unsigned int nb_sbm_bp2;
47 47
48 48 nb_norm_bp1 = 0;
49 49 nb_norm_bp2 = 0;
50 50 nb_norm_asm = 0;
51 51 nb_sbm_bp1 = 0;
52 52 nb_sbm_bp2 = 0;
53 53
54 54 reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions
55 55 ASM_generic_init_ring( asm_ring_norm_f0, NB_RING_NODES_ASM_NORM_F0 );
56 56 ASM_generic_init_ring( asm_ring_burst_sbm_f0, NB_RING_NODES_ASM_BURST_SBM_F0 );
57 57 current_ring_node_asm_norm_f0 = asm_ring_norm_f0;
58 58 current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0;
59 59
60 60 BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
61 61
62 62 status = get_message_queue_id_prc0( &queue_id_prc0 );
63 63 if (status != RTEMS_SUCCESSFUL)
64 64 {
65 65 PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status)
66 66 }
67 67
68 68 while(1){
69 69 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
70 70
71 71 //****************************************
72 72 // initialize the mesage for the MATR task
73 73 msgForMATR.norm = current_ring_node_asm_norm_f0;
74 74 msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f0;
75 75 msgForMATR.event = 0x00; // this composite event will be sent to the MATR task
76 76 msgForMATR.coarseTime = ring_node_for_averaging_sm_f0->coarseTime;
77 77 msgForMATR.fineTime = ring_node_for_averaging_sm_f0->fineTime;
78 78 //
79 79 //****************************************
80 80
81 81 ring_node_tab[NB_SM_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0;
82 82 for ( i = 2; i < (NB_SM_BEFORE_AVF0+1); i++ )
83 83 {
84 84 ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous;
85 85 ring_node_tab[NB_SM_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0;
86 86 }
87 87
88 88 // compute the average and store it in the averaged_sm_f1 buffer
89 SM_average( current_ring_node_asm_norm_f0->matrix,
89 SM_average_alt( current_ring_node_asm_norm_f0->matrix,
90 90 current_ring_node_asm_burst_sbm_f0->matrix,
91 91 ring_node_tab,
92 92 nb_norm_bp1, nb_sbm_bp1 );
93 93
94 94 // update nb_average
95 95 nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF0;
96 96 nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF0;
97 97 nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF0;
98 98 nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF0;
99 99 nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF0;
100 100
101 101 if (nb_sbm_bp1 == nb_sm_before_f0.burst_sbm_bp1)
102 102 {
103 103 nb_sbm_bp1 = 0;
104 104 // set another ring for the ASM storage
105 105 current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next;
106 106 if ( lfrCurrentMode == LFR_MODE_BURST )
107 107 {
108 108 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_BP1_F0;
109 109 }
110 110 else if ( (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
111 111 {
112 112 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_SBM_BP1_F0;
113 113 }
114 114 }
115 115
116 116 if (nb_sbm_bp2 == nb_sm_before_f0.burst_sbm_bp2)
117 117 {
118 118 nb_sbm_bp2 = 0;
119 119 if ( lfrCurrentMode == LFR_MODE_BURST )
120 120 {
121 121 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_BP2_F0;
122 122 }
123 123 else if ( (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
124 124 {
125 125 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_SBM_BP2_F0;
126 126 }
127 127 }
128 128
129 129 if (nb_norm_bp1 == nb_sm_before_f0.norm_bp1)
130 130 {
131 131 nb_norm_bp1 = 0;
132 132 // set another ring for the ASM storage
133 133 current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next;
134 134 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
135 135 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
136 136 {
137 137 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F0;
138 138 }
139 139 }
140 140
141 141 if (nb_norm_bp2 == nb_sm_before_f0.norm_bp2)
142 142 {
143 143 nb_norm_bp2 = 0;
144 144 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
145 145 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
146 146 {
147 147 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F0;
148 148 }
149 149 }
150 150
151 151 if (nb_norm_asm == nb_sm_before_f0.norm_asm)
152 152 {
153 153 nb_norm_asm = 0;
154 154 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
155 155 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
156 156 {
157 157 // PRINTF1("%lld\n", localTime)
158 158 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F0;
159 159 }
160 160 }
161 161
162 162 //*************************
163 163 // send the message to MATR
164 164 if (msgForMATR.event != 0x00)
165 165 {
166 166 status = rtems_message_queue_send( queue_id_prc0, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0);
167 167 }
168 168
169 169 if (status != RTEMS_SUCCESSFUL) {
170 170 printf("in AVF0 *** Error sending message to MATR, code %d\n", status);
171 171 }
172 172 }
173 173 }
174 174
175 175 rtems_task prc0_task( rtems_task_argument lfrRequestedMode )
176 176 {
177 177 char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
178 178 size_t size; // size of the incoming TC packet
179 179 asm_msg *incomingMsg;
180 180 //
181 181 unsigned char sid;
182 182 spw_ioctl_pkt_send spw_ioctl_send_ASM;
183 183 rtems_status_code status;
184 184 rtems_id queue_id;
185 185 rtems_id queue_id_q_p0;
186 186 Header_TM_LFR_SCIENCE_ASM_t headerASM;
187 187 bp_packet_with_spare packet_norm_bp1_f0;
188 188 bp_packet packet_norm_bp2_f0;
189 189 bp_packet packet_sbm_bp1_f0;
190 190 bp_packet packet_sbm_bp2_f0;
191 191
192 192 unsigned long long int localTime;
193 193
194 194 ASM_init_header( &headerASM );
195 195
196 196 //*************
197 197 // NORM headers
198 198 BP_init_header_with_spare( &packet_norm_bp1_f0.header,
199 199 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0,
200 200 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 );
201 201 BP_init_header( &packet_norm_bp2_f0.header,
202 202 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0,
203 203 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0);
204 204
205 205 //****************************
206 206 // BURST SBM1 and SBM2 headers
207 207 if ( lfrRequestedMode == LFR_MODE_BURST )
208 208 {
209 209 BP_init_header( &packet_sbm_bp1_f0.header,
210 210 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0,
211 211 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
212 212 BP_init_header( &packet_sbm_bp2_f0.header,
213 213 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0,
214 214 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
215 215 }
216 216 else if ( lfrRequestedMode == LFR_MODE_SBM1 )
217 217 {
218 218 BP_init_header( &packet_sbm_bp1_f0.header,
219 219 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0,
220 220 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
221 221 BP_init_header( &packet_sbm_bp2_f0.header,
222 222 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0,
223 223 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
224 224 }
225 225 else if ( lfrRequestedMode == LFR_MODE_SBM2 )
226 226 {
227 227 BP_init_header( &packet_sbm_bp1_f0.header,
228 228 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0,
229 229 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
230 230 BP_init_header( &packet_sbm_bp2_f0.header,
231 231 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0,
232 232 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
233 233 }
234 234 else
235 235 {
236 236 PRINTF1("in PRC0 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode)
237 237 }
238 238
239 239 status = get_message_queue_id_send( &queue_id );
240 240 if (status != RTEMS_SUCCESSFUL)
241 241 {
242 242 PRINTF1("in PRC0 *** ERR get_message_queue_id_send %d\n", status)
243 243 }
244 244 status = get_message_queue_id_prc0( &queue_id_q_p0);
245 245 if (status != RTEMS_SUCCESSFUL)
246 246 {
247 247 PRINTF1("in PRC0 *** ERR get_message_queue_id_prc0 %d\n", status)
248 248 }
249 249
250 250 BOOT_PRINTF1("in PRC0 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
251 251
252 252 while(1){
253 253 status = rtems_message_queue_receive( queue_id_q_p0, incomingData, &size, //************************************
254 254 RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0
255 255
256 256 incomingMsg = (asm_msg*) incomingData;
257 257
258 258 localTime = getTimeAsUnsignedLongLongInt( );
259 259
260 260 //****************
261 261 //****************
262 262 // BURST SBM1 SBM2
263 263 //****************
264 264 //****************
265 265 if ( (incomingMsg->event & RTEMS_EVENT_BURST_BP1_F0 ) || (incomingMsg->event & RTEMS_EVENT_SBM_BP1_F0 ) )
266 266 {
267 267 sid = getSID( incomingMsg->event );
268 268 // 1) compress the matrix for Basic Parameters calculation
269 269 ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm_f0,
270 270 nb_sm_before_f0.burst_sbm_bp1,
271 271 NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0,
272 272 ASM_F0_INDICE_START);
273 273 // 2) compute the BP1 set
274 274 // BP1_set( compressed_sm_norm_f0, NB_BINS_COMPRESSED_SM_SBM_F0, bp1_sbm_f0 );
275 275 // 3) send the BP1 set
276 276 set_time( packet_sbm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
277 277 set_time( packet_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
278 278 BP_send( (char *) &packet_sbm_bp1_f0, queue_id,
279 279 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA,
280 280 sid);
281 281 // 4) compute the BP2 set if needed
282 282 if ( (incomingMsg->event & RTEMS_EVENT_BURST_BP2_F0) || (incomingMsg->event & RTEMS_EVENT_SBM_BP2_F0) )
283 283 {
284 284 // 1) compute the BP2 set
285 285
286 286 // 2) send the BP2 set
287 287 set_time( packet_sbm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
288 288 set_time( packet_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
289 289 BP_send( (char *) &packet_sbm_bp2_f0, queue_id,
290 290 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA,
291 291 sid);
292 292 }
293 293 }
294 294
295 295 //*****
296 296 //*****
297 297 // NORM
298 298 //*****
299 299 //*****
300 300 if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0)
301 301 {
302 302 // 1) compress the matrix for Basic Parameters calculation
303 303 ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0,
304 304 nb_sm_before_f0.norm_bp1,
305 305 NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0,
306 306 ASM_F0_INDICE_START );
307 307 // 2) compute the BP1 set
308 308 // BP1_set( compressed_sm_norm_f0, NB_BINS_COMPRESSED_SM_F0, bp1_norm_f0 );
309 309 // 3) send the BP1 set
310 310 set_time( packet_norm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
311 311 set_time( packet_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
312 312 BP_send( (char *) &packet_norm_bp1_f0, queue_id,
313 313 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA,
314 314 SID_NORM_BP1_F0 );
315 315 if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0)
316 316 {
317 317 // 1) compute the BP2 set using the same ASM as the one used for BP1
318 318
319 319 // 2) send the BP2 set
320 320 set_time( packet_norm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
321 321 set_time( packet_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
322 322 BP_send( (char *) &packet_norm_bp2_f0, queue_id,
323 323 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA,
324 324 SID_NORM_BP2_F0);
325 325 }
326 326 }
327 327
328 328 if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0)
329 329 {
330 330 // 1) reorganize the ASM and divide
331 331 ASM_reorganize_and_divide( incomingMsg->norm->matrix,
332 332 asm_f0_reorganized,
333 333 nb_sm_before_f0.norm_bp1 );
334 334 // 2) convert the float array in a char array
335 335 ASM_convert( asm_f0_reorganized, asm_f0_char);
336 336 // 3) send the spectral matrix packets
337 337 set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime );
338 338 set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
339 339 ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
340 340 }
341 341
342 342 }
343 343 }
344 344
345 345 //**********
346 346 // FUNCTIONS
347 347
348 348 void reset_nb_sm_f0( unsigned char lfrMode )
349 349 {
350 350 nb_sm_before_f0.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 96;
351 351 nb_sm_before_f0.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 96;
352 352 nb_sm_before_f0.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 96;
353 353 nb_sm_before_f0.sbm1_bp1 = parameter_dump_packet.sy_lfr_s1_bp_p0 * 24; // 0.25 s per digit
354 354 nb_sm_before_f0.sbm1_bp2 = parameter_dump_packet.sy_lfr_s1_bp_p1 * 96;
355 355 nb_sm_before_f0.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 96;
356 356 nb_sm_before_f0.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 96;
357 357 nb_sm_before_f0.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 96;
358 358 nb_sm_before_f0.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 96;
359 359
360 360 if (lfrMode == LFR_MODE_SBM1)
361 361 {
362 362 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm1_bp1;
363 363 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm1_bp2;
364 364 }
365 365 else if (lfrMode == LFR_MODE_SBM2)
366 366 {
367 367 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm2_bp1;
368 368 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm2_bp2;
369 369 }
370 370 else if (lfrMode == LFR_MODE_BURST)
371 371 {
372 372 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1;
373 373 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2;
374 374 }
375 375 else
376 376 {
377 377 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1;
378 378 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2;
379 379 }
380 380 }
@@ -1,360 +1,360
1 1 /** Functions related to data processing.
2 2 *
3 3 * @file
4 4 * @author P. LEROY
5 5 *
6 6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
7 7 *
8 8 */
9 9
10 10 #include "avf1_prc1.h"
11 11
12 12 nb_sm_before_bp_asm_f1 nb_sm_before_f1;
13 13
14 14 //***
15 15 // F1
16 16 ring_node_asm asm_ring_norm_f1 [ NB_RING_NODES_ASM_NORM_F1 ];
17 17 ring_node_asm asm_ring_burst_sbm_f1[ NB_RING_NODES_ASM_BURST_SBM_F1 ];
18 18
19 19 float asm_f1_reorganized [ TOTAL_SIZE_SM ];
20 20 char asm_f1_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
21 21 float compressed_sm_norm_f1[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F1];
22 22 float compressed_sm_sbm_f1 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 ];
23 23
24 24 //************
25 25 // RTEMS TASKS
26 26
27 27 rtems_task avf1_task( rtems_task_argument lfrRequestedMode )
28 28 {
29 29 int i;
30 30
31 31 rtems_event_set event_out;
32 32 rtems_status_code status;
33 33 rtems_id queue_id_prc1;
34 34 asm_msg msgForMATR;
35 35 ring_node_sm *ring_node_tab[8];
36 36 ring_node_asm *current_ring_node_asm_burst_sbm_f1;
37 37 ring_node_asm *current_ring_node_asm_norm_f1;
38 38
39 39 unsigned int nb_norm_bp1;
40 40 unsigned int nb_norm_bp2;
41 41 unsigned int nb_norm_asm;
42 42 unsigned int nb_sbm_bp1;
43 43 unsigned int nb_sbm_bp2;
44 44
45 45 nb_norm_bp1 = 0;
46 46 nb_norm_bp2 = 0;
47 47 nb_norm_asm = 0;
48 48 nb_sbm_bp1 = 0;
49 49 nb_sbm_bp2 = 0;
50 50
51 51 reset_nb_sm_f1( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions
52 52 ASM_generic_init_ring( asm_ring_norm_f1, NB_RING_NODES_ASM_NORM_F1 );
53 53 ASM_generic_init_ring( asm_ring_burst_sbm_f1, NB_RING_NODES_ASM_BURST_SBM_F1 );
54 54 current_ring_node_asm_norm_f1 = asm_ring_norm_f1;
55 55 current_ring_node_asm_burst_sbm_f1 = asm_ring_burst_sbm_f1;
56 56
57 57 BOOT_PRINTF1("in AVF1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
58 58
59 59 status = get_message_queue_id_prc1( &queue_id_prc1 );
60 60 if (status != RTEMS_SUCCESSFUL)
61 61 {
62 62 PRINTF1("in AVF1 *** ERR get_message_queue_id_prc1 %d\n", status)
63 63 }
64 64
65 65 while(1){
66 66 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
67 67
68 68 //****************************************
69 69 // initialize the mesage for the MATR task
70 70 msgForMATR.event = 0x00; // this composite event will be sent to the PRC1 task
71 71 msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f1;
72 72 msgForMATR.norm = current_ring_node_asm_norm_f1;
73 73 msgForMATR.coarseTime = ring_node_for_averaging_sm_f1->coarseTime;
74 74 msgForMATR.fineTime = ring_node_for_averaging_sm_f1->fineTime;
75 75 //
76 76 //****************************************
77 77
78 78 ring_node_tab[NB_SM_BEFORE_AVF1-1] = ring_node_for_averaging_sm_f1;
79 79 for ( i = 2; i < (NB_SM_BEFORE_AVF1+1); i++ )
80 80 {
81 81 ring_node_for_averaging_sm_f1 = ring_node_for_averaging_sm_f1->previous;
82 82 ring_node_tab[NB_SM_BEFORE_AVF1-i] = ring_node_for_averaging_sm_f1;
83 83 }
84 84
85 85 // compute the average and store it in the averaged_sm_f1 buffer
86 SM_average( current_ring_node_asm_norm_f1->matrix,
86 SM_average_alt( current_ring_node_asm_norm_f1->matrix,
87 87 current_ring_node_asm_burst_sbm_f1->matrix,
88 88 ring_node_tab,
89 89 nb_norm_bp1, nb_sbm_bp1 );
90 90
91 91 // update nb_average
92 92 nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF1;
93 93 nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF1;
94 94 nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF1;
95 95 nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF1;
96 96 nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF1;
97 97
98 98 if (nb_sbm_bp1 == nb_sm_before_f1.burst_sbm_bp1)
99 99 {
100 100 nb_sbm_bp1 = 0;
101 101 // set another ring for the ASM storage
102 102 current_ring_node_asm_burst_sbm_f1 = current_ring_node_asm_burst_sbm_f1->next;
103 103 if ( lfrCurrentMode == LFR_MODE_BURST )
104 104 {
105 105 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_BP1_F1;
106 106 }
107 107 else if ( lfrCurrentMode == LFR_MODE_SBM2 )
108 108 {
109 109 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_SBM_BP1_F1;
110 110 }
111 111 }
112 112
113 113 if (nb_sbm_bp2 == nb_sm_before_f1.burst_sbm_bp2)
114 114 {
115 115 nb_sbm_bp2 = 0;
116 116 if ( lfrCurrentMode == LFR_MODE_BURST )
117 117 {
118 118 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_BP2_F1;
119 119 }
120 120 else if ( lfrCurrentMode == LFR_MODE_SBM2 )
121 121 {
122 122 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_SBM_BP2_F1;
123 123 }
124 124 }
125 125
126 126 if (nb_norm_bp1 == nb_sm_before_f1.norm_bp1)
127 127 {
128 128 nb_norm_bp1 = 0;
129 129 // set another ring for the ASM storage
130 130 current_ring_node_asm_norm_f1 = current_ring_node_asm_norm_f1->next;
131 131 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
132 132 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
133 133 {
134 134 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F1;
135 135 }
136 136 }
137 137
138 138 if (nb_norm_bp2 == nb_sm_before_f1.norm_bp2)
139 139 {
140 140 nb_norm_bp2 = 0;
141 141 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
142 142 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
143 143 {
144 144 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F1;
145 145 }
146 146 }
147 147
148 148 if (nb_norm_asm == nb_sm_before_f1.norm_asm)
149 149 {
150 150 nb_norm_asm = 0;
151 151 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
152 152 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
153 153 {
154 154 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F1;
155 155 }
156 156 }
157 157
158 158 //*************************
159 159 // send the message to MATR
160 160 if (msgForMATR.event != 0x00)
161 161 {
162 162 status = rtems_message_queue_send( queue_id_prc1, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC1);
163 163 }
164 164
165 165 if (status != RTEMS_SUCCESSFUL) {
166 166 printf("in AVF1 *** Error sending message to PRC1, code %d\n", status);
167 167 }
168 168 }
169 169 }
170 170
171 171 rtems_task prc1_task( rtems_task_argument lfrRequestedMode )
172 172 {
173 173 char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
174 174 size_t size; // size of the incoming TC packet
175 175 asm_msg *incomingMsg;
176 176 //
177 177 unsigned char sid;
178 178 spw_ioctl_pkt_send spw_ioctl_send_ASM;
179 179 rtems_status_code status;
180 180 rtems_id queue_id_send;
181 181 rtems_id queue_id_q_p1;
182 182 Header_TM_LFR_SCIENCE_ASM_t headerASM;
183 183 bp_packet_with_spare packet_norm_bp1;
184 184 bp_packet packet_norm_bp2;
185 185 bp_packet packet_sbm_bp1;
186 186 bp_packet packet_sbm_bp2;
187 187
188 188 unsigned long long int localTime;
189 189
190 190 ASM_init_header( &headerASM );
191 191
192 192 //*************
193 193 // NORM headers
194 194 BP_init_header_with_spare( &packet_norm_bp1.header,
195 195 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F1,
196 196 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1, NB_BINS_COMPRESSED_SM_F1 );
197 197 BP_init_header( &packet_norm_bp2.header,
198 198 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F1,
199 199 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1, NB_BINS_COMPRESSED_SM_F1);
200 200
201 201 //***********************
202 202 // BURST and SBM2 headers
203 203 if ( lfrRequestedMode == LFR_MODE_BURST )
204 204 {
205 205 BP_init_header( &packet_sbm_bp1.header,
206 206 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F1,
207 207 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1, NB_BINS_COMPRESSED_SM_SBM_F1);
208 208 BP_init_header( &packet_sbm_bp2.header,
209 209 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F1,
210 210 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1, NB_BINS_COMPRESSED_SM_SBM_F1);
211 211 }
212 212 else if ( lfrRequestedMode == LFR_MODE_SBM2 )
213 213 {
214 214 BP_init_header( &packet_sbm_bp1.header,
215 215 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F1,
216 216 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1, NB_BINS_COMPRESSED_SM_SBM_F1);
217 217 BP_init_header( &packet_sbm_bp2.header,
218 218 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F1,
219 219 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1, NB_BINS_COMPRESSED_SM_SBM_F1);
220 220 }
221 221 else
222 222 {
223 223 PRINTF1("in PRC1 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode)
224 224 }
225 225
226 226 status = get_message_queue_id_send( &queue_id_send );
227 227 if (status != RTEMS_SUCCESSFUL)
228 228 {
229 229 PRINTF1("in PRC1 *** ERR get_message_queue_id_send %d\n", status)
230 230 }
231 231 status = get_message_queue_id_prc1( &queue_id_q_p1);
232 232 if (status != RTEMS_SUCCESSFUL)
233 233 {
234 234 PRINTF1("in PRC1 *** ERR get_message_queue_id_prc1 %d\n", status)
235 235 }
236 236
237 237 BOOT_PRINTF1("in PRC1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
238 238
239 239 while(1){
240 240 status = rtems_message_queue_receive( queue_id_q_p1, incomingData, &size, //************************************
241 241 RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0
242 242
243 243 incomingMsg = (asm_msg*) incomingData;
244 244
245 245 localTime = getTimeAsUnsignedLongLongInt( );
246 246 //***********
247 247 //***********
248 248 // BURST SBM2
249 249 //***********
250 250 //***********
251 251 if ( (incomingMsg->event & RTEMS_EVENT_BURST_BP1_F1) || (incomingMsg->event & RTEMS_EVENT_SBM_BP1_F1) )
252 252 {
253 253 sid = getSID( incomingMsg->event );
254 254 // 1) compress the matrix for Basic Parameters calculation
255 255 ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm_f1,
256 256 nb_sm_before_f1.burst_sbm_bp1,
257 257 NB_BINS_COMPRESSED_SM_SBM_F1, NB_BINS_TO_AVERAGE_ASM_SBM_F1,
258 258 ASM_F1_INDICE_START);
259 259 // 2) compute the BP1 set
260 260
261 261 // 3) send the BP1 set
262 262 set_time( packet_sbm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime );
263 263 set_time( packet_sbm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
264 264 BP_send( (char *) &packet_sbm_bp1, queue_id_send,
265 265 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 + PACKET_LENGTH_DELTA,
266 266 sid );
267 267 // 4) compute the BP2 set if needed
268 268 if ( (incomingMsg->event & RTEMS_EVENT_BURST_BP2_F1) || (incomingMsg->event & RTEMS_EVENT_SBM_BP2_F1) )
269 269 {
270 270 // 1) compute the BP2 set
271 271
272 272 // 2) send the BP2 set
273 273 set_time( packet_sbm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime );
274 274 set_time( packet_sbm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
275 275 BP_send( (char *) &packet_sbm_bp2, queue_id_send,
276 276 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 + PACKET_LENGTH_DELTA,
277 277 sid );
278 278 }
279 279 }
280 280
281 281 //*****
282 282 //*****
283 283 // NORM
284 284 //*****
285 285 //*****
286 286 if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F1)
287 287 {
288 288 // 1) compress the matrix for Basic Parameters calculation
289 289 ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f1,
290 290 nb_sm_before_f1.norm_bp1,
291 291 NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0,
292 292 ASM_F0_INDICE_START );
293 293 // 2) compute the BP1 set
294 294
295 295 // 3) send the BP1 set
296 296 set_time( packet_norm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime );
297 297 set_time( packet_norm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
298 298 BP_send( (char *) &packet_norm_bp1, queue_id_send,
299 299 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 + PACKET_LENGTH_DELTA,
300 300 SID_NORM_BP1_F1 );
301 301 if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F1)
302 302 {
303 303 // 1) compute the BP2 set
304 304
305 305 // 2) send the BP2 set
306 306 set_time( packet_norm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime );
307 307 set_time( packet_norm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
308 308 BP_send( (char *) &packet_norm_bp2, queue_id_send,
309 309 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 + PACKET_LENGTH_DELTA,
310 310 SID_NORM_BP2_F1 );
311 311 }
312 312 }
313 313
314 314 if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F1)
315 315 {
316 316 // 1) reorganize the ASM and divide
317 317 ASM_reorganize_and_divide( incomingMsg->norm->matrix,
318 318 asm_f1_reorganized,
319 319 nb_sm_before_f1.norm_bp1 );
320 320 // 2) convert the float array in a char array
321 321 ASM_convert( asm_f1_reorganized, asm_f1_char);
322 322 // 3) send the spectral matrix packets
323 323 set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime );
324 324 set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
325 325 ASM_send( &headerASM, asm_f1_char, SID_NORM_ASM_F1, &spw_ioctl_send_ASM, queue_id_send);
326 326 }
327 327
328 328 }
329 329 }
330 330
331 331 //**********
332 332 // FUNCTIONS
333 333
334 334 void reset_nb_sm_f1( unsigned char lfrMode )
335 335 {
336 336 nb_sm_before_f1.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 16;
337 337 nb_sm_before_f1.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 16;
338 338 nb_sm_before_f1.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 16;
339 339 nb_sm_before_f1.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 16;
340 340 nb_sm_before_f1.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 16;
341 341 nb_sm_before_f1.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 16;
342 342 nb_sm_before_f1.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 16;
343 343
344 344 if (lfrMode == LFR_MODE_SBM2)
345 345 {
346 346 nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.sbm2_bp1;
347 347 nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.sbm2_bp2;
348 348 }
349 349 else if (lfrMode == LFR_MODE_BURST)
350 350 {
351 351 nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1;
352 352 nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2;
353 353 }
354 354 else
355 355 {
356 356 nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1;
357 357 nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2;
358 358 }
359 359 }
360 360
@@ -1,253 +1,267
1 1 /** Functions related to data processing.
2 2 *
3 3 * @file
4 4 * @author P. LEROY
5 5 *
6 6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
7 7 *
8 8 */
9 9
10 10 #include "avf2_prc2.h"
11 11
12 12 nb_sm_before_bp_asm_f2 nb_sm_before_f2;
13 13
14 14 //***
15 15 // F2
16 16 ring_node_asm asm_ring_norm_f2 [ NB_RING_NODES_ASM_NORM_F2 ];
17 17 ring_node_asm asm_ring_burst_sbm_f2[ NB_RING_NODES_ASM_BURST_SBM_F2 ];
18 18
19 19 float asm_f2_reorganized [ TOTAL_SIZE_SM ];
20 20 char asm_f2_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
21 21 float compressed_sm_norm_f2[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F2];
22 22 float compressed_sm_sbm_f2 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F2 ];
23 23
24 24 //************
25 25 // RTEMS TASKS
26 26
27 27 //***
28 28 // F2
29 29 rtems_task avf2_task( rtems_task_argument argument )
30 30 {
31 31 rtems_event_set event_out;
32 32 rtems_status_code status;
33 33 rtems_id queue_id_prc2;
34 34 asm_msg msgForMATR;
35 35 ring_node_asm *current_ring_node_asm_norm_f2;
36 36
37 37 unsigned int nb_norm_bp1;
38 38 unsigned int nb_norm_bp2;
39 39 unsigned int nb_norm_asm;
40 40
41 41 nb_norm_bp1 = 0;
42 42 nb_norm_bp2 = 0;
43 43 nb_norm_asm = 0;
44 44
45 45 reset_nb_sm_f2( ); // reset the sm counters that drive the BP and ASM computations / transmissions
46 46 ASM_generic_init_ring( asm_ring_norm_f2, NB_RING_NODES_ASM_NORM_F2 );
47 47 current_ring_node_asm_norm_f2 = asm_ring_norm_f2;
48 48
49 49 BOOT_PRINTF("in AVF2 ***\n")
50 50
51 51 status = get_message_queue_id_prc2( &queue_id_prc2 );
52 52 if (status != RTEMS_SUCCESSFUL)
53 53 {
54 54 PRINTF1("in AVF2 *** ERR get_message_queue_id_prc2 %d\n", status)
55 55 }
56 56
57 57 while(1){
58 58 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
59 59
60 60 //****************************************
61 61 // initialize the mesage for the MATR task
62 62 msgForMATR.event = 0x00; // this composite event will be sent to the MATR task
63 63 msgForMATR.burst_sbm = NULL;
64 64 msgForMATR.norm = current_ring_node_asm_norm_f2;
65 65 msgForMATR.coarseTime = ring_node_for_averaging_sm_f2->coarseTime;
66 66 msgForMATR.fineTime = ring_node_for_averaging_sm_f2->fineTime;
67 67 //
68 68 //****************************************
69 69
70 70 // compute the average and store it in the averaged_sm_f2 buffer
71 SM_average_f2( current_ring_node_asm_norm_f2->matrix,
71 SM_average_f2_alt( current_ring_node_asm_norm_f2->matrix,
72 72 ring_node_for_averaging_sm_f2,
73 73 nb_norm_bp1 );
74 74
75 75 // update nb_average
76 76 nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF2;
77 77 nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF2;
78 78 nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF2;
79 79
80 80 if (nb_norm_bp1 == nb_sm_before_f2.norm_bp1)
81 81 {
82 82 nb_norm_bp1 = 0;
83 83 // set another ring for the ASM storage
84 84 current_ring_node_asm_norm_f2 = current_ring_node_asm_norm_f2->next;
85 85 if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1)
86 86 || (lfrCurrentMode == LFR_MODE_SBM2) )
87 87 {
88 88 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F2;
89 89 }
90 90 }
91 91
92 92 if (nb_norm_bp2 == nb_sm_before_f2.norm_bp2)
93 93 {
94 94 nb_norm_bp2 = 0;
95 95 if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1)
96 96 || (lfrCurrentMode == LFR_MODE_SBM2) )
97 97 {
98 98 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F2;
99 99 }
100 100 }
101 101
102 102 if (nb_norm_asm == nb_sm_before_f2.norm_asm)
103 103 {
104 104 nb_norm_asm = 0;
105 105 if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_SBM1)
106 106 || (lfrCurrentMode == LFR_MODE_SBM2) )
107 107 {
108 108 // PRINTF1("%lld\n", localTime)
109 109 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F2;
110 110 }
111 111 }
112 112
113 113 //*************************
114 114 // send the message to MATR
115 115 if (msgForMATR.event != 0x00)
116 116 {
117 117 status = rtems_message_queue_send( queue_id_prc2, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0);
118 118 }
119 119
120 120 if (status != RTEMS_SUCCESSFUL) {
121 121 printf("in AVF2 *** Error sending message to MATR, code %d\n", status);
122 122 }
123 123 }
124 124 }
125 125
126 126 rtems_task prc2_task( rtems_task_argument argument )
127 127 {
128 128 char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
129 129 size_t size; // size of the incoming TC packet
130 130 asm_msg *incomingMsg;
131 131 //
132 132 spw_ioctl_pkt_send spw_ioctl_send_ASM;
133 133 rtems_status_code status;
134 134 rtems_id queue_id;
135 135 rtems_id queue_id_q_p2;
136 136 Header_TM_LFR_SCIENCE_ASM_t headerASM;
137 137 bp_packet packet_norm_bp1_f2;
138 138 bp_packet packet_norm_bp2_f2;
139 139
140 140 unsigned long long int localTime;
141 141
142 142 ASM_init_header( &headerASM );
143 143
144 144 //*************
145 145 // NORM headers
146 146 BP_init_header( &packet_norm_bp1_f2.header,
147 147 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F2,
148 148 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2, NB_BINS_COMPRESSED_SM_F2 );
149 149 BP_init_header( &packet_norm_bp2_f2.header,
150 150 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F2,
151 151 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2, NB_BINS_COMPRESSED_SM_F2 );
152 152
153 153 status = get_message_queue_id_send( &queue_id );
154 154 if (status != RTEMS_SUCCESSFUL)
155 155 {
156 156 PRINTF1("in PRC2 *** ERR get_message_queue_id_send %d\n", status)
157 157 }
158 158 status = get_message_queue_id_prc2( &queue_id_q_p2);
159 159 if (status != RTEMS_SUCCESSFUL)
160 160 {
161 161 PRINTF1("in PRC2 *** ERR get_message_queue_id_prc2 %d\n", status)
162 162 }
163 163
164 164 BOOT_PRINTF("in PRC2 ***\n")
165 165
166 166 while(1){
167 167 status = rtems_message_queue_receive( queue_id_q_p2, incomingData, &size, //************************************
168 168 RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0
169 169
170 170 incomingMsg = (asm_msg*) incomingData;
171 171
172 172 localTime = getTimeAsUnsignedLongLongInt( );
173 173
174 174 //*****
175 175 //*****
176 176 // NORM
177 177 //*****
178 178 //*****
179 179 if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F2)
180 180 {
181 181 // 1) compress the matrix for Basic Parameters calculation
182 182 ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f2,
183 183 nb_sm_before_f2.norm_bp1,
184 184 NB_BINS_COMPRESSED_SM_F2, NB_BINS_TO_AVERAGE_ASM_F2,
185 185 ASM_F2_INDICE_START );
186 186 // 2) compute the BP1 set
187 187
188 188 // 3) send the BP1 set
189 189 set_time( packet_norm_bp1_f2.header.time, (unsigned char *) &incomingMsg->coarseTime );
190 190 set_time( packet_norm_bp1_f2.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
191 191 BP_send( (char *) &packet_norm_bp1_f2, queue_id,
192 192 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2 + PACKET_LENGTH_DELTA,
193 193 SID_NORM_BP1_F2 );
194 194 if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F2)
195 195 {
196 196 // 1) compute the BP2 set using the same ASM as the one used for BP1
197 197
198 198 // 2) send the BP2 set
199 199 set_time( packet_norm_bp2_f2.header.time, (unsigned char *) &incomingMsg->coarseTime );
200 200 set_time( packet_norm_bp2_f2.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
201 201 BP_send( (char *) &packet_norm_bp2_f2, queue_id,
202 202 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2 + PACKET_LENGTH_DELTA,
203 203 SID_NORM_BP2_F2 );
204 204 }
205 205 }
206 206
207 207 if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F2)
208 208 {
209 209 // 1) reorganize the ASM and divide
210 210 ASM_reorganize_and_divide( incomingMsg->norm->matrix,
211 211 asm_f2_reorganized,
212 212 nb_sm_before_f2.norm_bp1 );
213 213 // 2) convert the float array in a char array
214 214 ASM_convert( asm_f2_reorganized, asm_f2_char);
215 215 // 3) send the spectral matrix packets
216 216 set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime );
217 217 set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
218 218 ASM_send( &headerASM, asm_f2_char, SID_NORM_ASM_F2, &spw_ioctl_send_ASM, queue_id);
219 219 }
220 220
221 221 }
222 222 }
223 223
224 224 //**********
225 225 // FUNCTIONS
226 226
227 227 void reset_nb_sm_f2( void )
228 228 {
229 229 nb_sm_before_f2.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0;
230 230 nb_sm_before_f2.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1;
231 231 nb_sm_before_f2.norm_asm = parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1];
232 232 }
233 233
234 234 void SM_average_f2( float *averaged_spec_mat_f2,
235 235 ring_node_sm *ring_node,
236 236 unsigned int nbAverageNormF2 )
237 237 {
238 238 float sum;
239 239 unsigned int i;
240 240
241 241 for(i=0; i<TOTAL_SIZE_SM; i++)
242 242 {
243 243 sum = ( (int *) (ring_node->buffer_address) ) [ i ];
244 244 if ( (nbAverageNormF2 == 0) )
245 245 {
246 246 averaged_spec_mat_f2[ i ] = sum;
247 247 }
248 248 else
249 249 {
250 250 averaged_spec_mat_f2[ i ] = ( averaged_spec_mat_f2[ i ] + sum );
251 251 }
252 252 }
253 253 }
254
255 void SM_average_f2_alt( float *averaged_spec_mat_f2,
256 ring_node_sm *ring_node,
257 unsigned int nbAverageNormF2 )
258 {
259 float sum;
260 unsigned int i;
261
262 for(i=0; i<TOTAL_SIZE_SM; i++)
263 {
264 sum = ( (int *) (ring_node->buffer_address) ) [ i ];
265 averaged_spec_mat_f2[ i ] = sum;
266 }
267 }
General Comments 0
You need to be logged in to leave comments. Login now