##// END OF EJS Templates
rev 1.0.0.5
paul -
r114:46134e185f55 VHDLib206
parent child
Show More
@@ -1,253 +1,253
1 1 #############################################################################
2 2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Apr 1 12:03:12 2014
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Apr 3 10:09:31 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=5 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=5 -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../../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_processing.c \
49 49 ../src/fsw_misc.c \
50 50 ../src/fsw_init.c \
51 51 ../src/fsw_globals.c \
52 52 ../src/fsw_spacewire.c \
53 53 ../src/tc_load_dump_parameters.c \
54 54 ../src/tm_lfr_tc_exe.c \
55 55 ../src/tc_acceptance.c \
56 56 ../../LFR_basic-parameters/basic_parameters.c
57 57 OBJECTS = obj/wf_handler.o \
58 58 obj/tc_handler.o \
59 59 obj/fsw_processing.o \
60 60 obj/fsw_misc.o \
61 61 obj/fsw_init.o \
62 62 obj/fsw_globals.o \
63 63 obj/fsw_spacewire.o \
64 64 obj/tc_load_dump_parameters.o \
65 65 obj/tm_lfr_tc_exe.o \
66 66 obj/tc_acceptance.o \
67 67 obj/basic_parameters.o
68 68 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
69 69 /usr/lib64/qt4/mkspecs/common/linux.conf \
70 70 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
71 71 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
72 72 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
73 73 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
74 74 /usr/lib64/qt4/mkspecs/qconfig.pri \
75 75 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
76 76 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
77 77 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
78 78 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
79 79 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
80 80 sparc.pri \
81 81 /usr/lib64/qt4/mkspecs/features/release.prf \
82 82 /usr/lib64/qt4/mkspecs/features/default_post.prf \
83 83 /usr/lib64/qt4/mkspecs/features/shared.prf \
84 84 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
85 85 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
86 86 /usr/lib64/qt4/mkspecs/features/resources.prf \
87 87 /usr/lib64/qt4/mkspecs/features/uic.prf \
88 88 /usr/lib64/qt4/mkspecs/features/yacc.prf \
89 89 /usr/lib64/qt4/mkspecs/features/lex.prf \
90 90 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
91 91 fsw-qt.pro
92 92 QMAKE_TARGET = fsw
93 93 DESTDIR = bin/
94 94 TARGET = bin/fsw
95 95
96 96 first: all
97 97 ####### Implicit rules
98 98
99 99 .SUFFIXES: .o .c .cpp .cc .cxx .C
100 100
101 101 .cpp.o:
102 102 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
103 103
104 104 .cc.o:
105 105 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
106 106
107 107 .cxx.o:
108 108 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
109 109
110 110 .C.o:
111 111 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
112 112
113 113 .c.o:
114 114 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
115 115
116 116 ####### Build rules
117 117
118 118 all: Makefile $(TARGET)
119 119
120 120 $(TARGET): $(OBJECTS)
121 121 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
122 122 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
123 123
124 124 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
125 125 /usr/lib64/qt4/mkspecs/common/linux.conf \
126 126 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
127 127 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
128 128 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
129 129 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
130 130 /usr/lib64/qt4/mkspecs/qconfig.pri \
131 131 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
132 132 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
133 133 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
134 134 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
135 135 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
136 136 sparc.pri \
137 137 /usr/lib64/qt4/mkspecs/features/release.prf \
138 138 /usr/lib64/qt4/mkspecs/features/default_post.prf \
139 139 /usr/lib64/qt4/mkspecs/features/shared.prf \
140 140 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
141 141 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
142 142 /usr/lib64/qt4/mkspecs/features/resources.prf \
143 143 /usr/lib64/qt4/mkspecs/features/uic.prf \
144 144 /usr/lib64/qt4/mkspecs/features/yacc.prf \
145 145 /usr/lib64/qt4/mkspecs/features/lex.prf \
146 146 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
147 147 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
148 148 /usr/lib64/qt4/mkspecs/common/unix.conf:
149 149 /usr/lib64/qt4/mkspecs/common/linux.conf:
150 150 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
151 151 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
152 152 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
153 153 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
154 154 /usr/lib64/qt4/mkspecs/qconfig.pri:
155 155 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
156 156 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
157 157 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
158 158 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
159 159 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
160 160 sparc.pri:
161 161 /usr/lib64/qt4/mkspecs/features/release.prf:
162 162 /usr/lib64/qt4/mkspecs/features/default_post.prf:
163 163 /usr/lib64/qt4/mkspecs/features/shared.prf:
164 164 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
165 165 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
166 166 /usr/lib64/qt4/mkspecs/features/resources.prf:
167 167 /usr/lib64/qt4/mkspecs/features/uic.prf:
168 168 /usr/lib64/qt4/mkspecs/features/yacc.prf:
169 169 /usr/lib64/qt4/mkspecs/features/lex.prf:
170 170 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
171 171 qmake: FORCE
172 172 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
173 173
174 174 dist:
175 175 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
176 176 $(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
177 177
178 178
179 179 clean:compiler_clean
180 180 -$(DEL_FILE) $(OBJECTS)
181 181 -$(DEL_FILE) *~ core *.core
182 182
183 183
184 184 ####### Sub-libraries
185 185
186 186 distclean: clean
187 187 -$(DEL_FILE) $(TARGET)
188 188 -$(DEL_FILE) Makefile
189 189
190 190
191 191 grmon:
192 192 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
193 193
194 194 check: first
195 195
196 196 compiler_rcc_make_all:
197 197 compiler_rcc_clean:
198 198 compiler_uic_make_all:
199 199 compiler_uic_clean:
200 200 compiler_image_collection_make_all: qmake_image_collection.cpp
201 201 compiler_image_collection_clean:
202 202 -$(DEL_FILE) qmake_image_collection.cpp
203 203 compiler_yacc_decl_make_all:
204 204 compiler_yacc_decl_clean:
205 205 compiler_yacc_impl_make_all:
206 206 compiler_yacc_impl_clean:
207 207 compiler_lex_make_all:
208 208 compiler_lex_clean:
209 209 compiler_clean:
210 210
211 211 ####### Compile
212 212
213 213 obj/wf_handler.o: ../src/wf_handler.c
214 214 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
215 215
216 216 obj/tc_handler.o: ../src/tc_handler.c
217 217 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
218 218
219 219 obj/fsw_processing.o: ../src/fsw_processing.c ../src/fsw_processing_globals.c
220 220 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c
221 221
222 222 obj/fsw_misc.o: ../src/fsw_misc.c
223 223 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
224 224
225 225 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
226 226 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
227 227
228 228 obj/fsw_globals.o: ../src/fsw_globals.c
229 229 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
230 230
231 231 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
232 232 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
233 233
234 234 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
235 235 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
236 236
237 237 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
238 238 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
239 239
240 240 obj/tc_acceptance.o: ../src/tc_acceptance.c
241 241 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
242 242
243 243 obj/basic_parameters.o: ../../LFR_basic-parameters/basic_parameters.c ../../LFR_basic-parameters/basic_parameters.h
244 244 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../../LFR_basic-parameters/basic_parameters.c
245 245
246 246 ####### Install
247 247
248 248 install: FORCE
249 249
250 250 uninstall: FORCE
251 251
252 252 FORCE:
253 253
@@ -1,85 +1,85
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 CONFIG += console verbose cpu_usage_report
4 CONFIG += console verbose
5 5 CONFIG -= qt
6 6
7 7 include(./sparc.pri)
8 8
9 9 # flight software version
10 10 SWVERSION=-1-0
11 11 DEFINES += SW_VERSION_N1=1 # major
12 12 DEFINES += SW_VERSION_N2=0 # minor
13 13 DEFINES += SW_VERSION_N3=0 # patch
14 14 DEFINES += SW_VERSION_N4=5 # 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 ../../LFR_basic-parameters
54 54
55 55 SOURCES += \
56 56 ../src/wf_handler.c \
57 57 ../src/tc_handler.c \
58 58 ../src/fsw_processing.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 ../../LFR_basic-parameters/basic_parameters.c
67 67
68 68
69 69 HEADERS += \
70 70 ../header/wf_handler.h \
71 71 ../header/tc_handler.h \
72 72 ../header/grlib_regs.h \
73 73 ../header/fsw_processing.h \
74 74 ../header/fsw_params.h \
75 75 ../header/fsw_misc.h \
76 76 ../header/fsw_init.h \
77 77 ../header/ccsds_types.h \
78 78 ../header/fsw_params_processing.h \
79 79 ../header/fsw_spacewire.h \
80 80 ../header/tc_load_dump_parameters.h \
81 81 ../header/tm_lfr_tc_exe.h \
82 82 ../header/tc_acceptance.h \
83 83 ../header/fsw_params_nb_bytes.h \
84 84 ../../LFR_basic-parameters/basic_parameters.h
85 85
@@ -1,339 +1,339
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 3.0.1, 2014-04-01T07:09:49. -->
3 <!-- Written by QtCreator 3.0.1, 2014-04-03T08:17:16. -->
4 4 <qtcreator>
5 5 <data>
6 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
7 7 <value type="int">1</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</value>
55 55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
56 56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{e04e3924-0bd8-4708-be18-f1474e45608e}</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">false</value>
181 181 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</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.Target.1</variable>
191 191 <valuemap type="QVariantMap">
192 192 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
193 193 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
194 194 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
195 195 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
196 196 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
197 197 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
198 198 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
199 199 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value>
200 200 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
201 201 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
202 202 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
203 203 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
204 204 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
205 205 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
206 206 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
207 207 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
208 208 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
209 209 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
210 210 </valuemap>
211 211 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
212 212 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
213 213 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
214 214 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
215 215 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
216 216 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
217 217 <value type="QString">-w</value>
218 218 <value type="QString">-r</value>
219 219 </valuelist>
220 220 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
221 221 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
222 222 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
223 223 </valuemap>
224 224 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
225 225 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
226 226 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
227 227 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
228 228 </valuemap>
229 229 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
230 230 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
231 231 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
232 232 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
233 233 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
234 234 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
235 235 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
236 236 <value type="QString">-w</value>
237 237 <value type="QString">-r</value>
238 238 </valuelist>
239 239 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
240 240 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
241 241 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
242 242 </valuemap>
243 243 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
244 244 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
245 245 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
246 246 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
247 247 </valuemap>
248 248 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
249 249 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
250 250 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
251 251 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
252 252 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
253 253 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
254 254 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
255 255 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
256 256 </valuemap>
257 257 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
258 258 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
259 259 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
260 260 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
261 261 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
262 262 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
263 263 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
264 264 </valuemap>
265 265 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
266 266 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
267 267 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
268 268 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
269 269 </valuemap>
270 270 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
271 271 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
272 272 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
273 273 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
274 274 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
275 275 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
276 276 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
277 277 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
278 278 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
279 279 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
280 280 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
281 281 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
282 282 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
283 283 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
284 284 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
285 285 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
286 286 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
287 287 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
288 288 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
289 289 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
290 290 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
291 291 <value type="int">0</value>
292 292 <value type="int">1</value>
293 293 <value type="int">2</value>
294 294 <value type="int">3</value>
295 295 <value type="int">4</value>
296 296 <value type="int">5</value>
297 297 <value type="int">6</value>
298 298 <value type="int">7</value>
299 299 <value type="int">8</value>
300 300 <value type="int">9</value>
301 301 <value type="int">10</value>
302 302 <value type="int">11</value>
303 303 <value type="int">12</value>
304 304 <value type="int">13</value>
305 305 <value type="int">14</value>
306 306 </valuelist>
307 307 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
308 308 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
309 309 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
310 310 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
311 311 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
312 312 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
313 313 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
314 314 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
315 315 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
316 316 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
317 317 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
318 318 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
319 319 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
320 320 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
321 321 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
322 322 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
323 323 </valuemap>
324 324 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
325 325 </valuemap>
326 326 </data>
327 327 <data>
328 328 <variable>ProjectExplorer.Project.TargetCount</variable>
329 329 <value type="int">2</value>
330 330 </data>
331 331 <data>
332 332 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
333 333 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
334 334 </data>
335 335 <data>
336 336 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
337 337 <value type="int">15</value>
338 338 </data>
339 339 </qtcreator>
@@ -1,59 +1,59
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
7 7 #define TOTAL_SIZE_BP1_F0 99 // 11 * 9 = 99
8 8 #define TOTAL_SIZE_BP1_F1 117 // 13 * 9 = 117
9 9 #define TOTAL_SIZE_BP1_F2 108 // 12 * 9 = 108
10 10 //
11 11 #define NB_RING_NODES_ASM_F0 12 // AT LEAST 3
12 12 #define NB_RING_NODES_ASM_F1 2 // AT LEAST 3
13 13 #define NB_RING_NODES_ASM_F2 2 // AT LEAST 3
14 14 //
15 15 #define NB_BINS_PER_ASM_F0 88
16 16 #define NB_BINS_PER_PKT_ASM_F0 44
17 17 #define TOTAL_SIZE_ASM_F0_IN_BYTES 4400 // 25 * 88 * 2
18 18 #define ASM_F0_INDICE_START 17 // 88 bins
19 19 #define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins
20 20 //
21 21 #define NB_BINS_PER_ASM_F1 104
22 22 #define NB_BINS_PER_PKT_ASM_F1 52
23 23 #define TOTAL_SIZE_ASM_F1 2600 // 25 * 104
24 24 #define ASM_F1_INDICE_START 6 // 104 bins
25 25 #define ASM_F1_INDICE_STOP 109 // 2 packets of 52 bins
26 26 //
27 27 #define NB_BINS_PER_ASM_F2 96
28 28 #define NB_BINS_PER_PKT_ASM_F2 48
29 29 #define TOTAL_SIZE_ASM_F2 2400 // 25 * 96
30 30 #define ASM_F2_INDICE_START 7 // 96 bins
31 31 #define ASM_F2_INDICE_STOP 102 // 2 packets of 48 bins
32 32 //
33 33 #define NB_BINS_COMPRESSED_SM_F0 11
34 34 #define NB_BINS_COMPRESSED_SM_F1 13
35 35 #define NB_BINS_COMPRESSED_SM_F2 12
36 36 //
37 37 #define NB_BINS_TO_AVERAGE_ASM_F0 8
38 38 #define NB_BINS_TO_AVERAGE_ASM_F1 8
39 39 #define NB_BINS_TO_AVERAGE_ASM_F2 8
40 40 //
41 41 #define TOTAL_SIZE_COMPRESSED_ASM_F0 275 // 11 * 25 WORDS
42 42 #define TOTAL_SIZE_COMPRESSED_ASM_F1 325 // 13 * 25 WORDS
43 43 #define TOTAL_SIZE_COMPRESSED_ASM_F2 300 // 12 * 25 WORDS
44 44 #define TOTAL_SIZE_COMPRESSED_ASM_SBM1 550 // 22 * 25 WORDS
45 #define NB_AVERAGE_NORMAL_f0 384 // 96 * 4
46 #define NB_AVERAGE_SBM1_f0 24 // 24 matrices at f0 = 0.25 second
45 #define NB_AVERAGE_NORMAL_F0 384 // 96 * 4
46 #define NB_AVERAGE_SBM1_F0 24 // 24 matrices at f0 = 0.25 second
47 47 #define NB_SM_TO_RECEIVE_BEFORE_AVF0 8
48 48
49 49 typedef struct {
50 50 volatile unsigned char PE[2];
51 51 volatile unsigned char PB[2];
52 52 volatile unsigned char V0;
53 53 volatile unsigned char V1;
54 54 volatile unsigned char V2_ELLIP_DOP;
55 55 volatile unsigned char SZ;
56 56 volatile unsigned char VPHI;
57 57 } BP1_t;
58 58
59 59 #endif // FSW_PARAMS_PROCESSING_H
@@ -1,885 +1,887
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 <fsw_processing.h>
11 11
12 12 #include "fsw_processing_globals.c"
13 13
14 14 //************************
15 15 // spectral matrices rings
16 16 ring_node_sm sm_ring_f0[NB_RING_NODES_ASM_F0];
17 17 ring_node_sm sm_ring_f1[NB_RING_NODES_ASM_F1];
18 18 ring_node_sm sm_ring_f2[NB_RING_NODES_ASM_F2];
19 19 ring_node_sm *current_ring_node_sm_f0;
20 20 ring_node_sm *ring_node_for_averaging_sm_f0;
21 21 ring_node_sm *current_ring_node_sm_f1;
22 22 ring_node_sm *current_ring_node_sm_f2;
23 23
24 24 BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ];
25 25
26 26 //*****
27 27 // NORM
28 28 // F0
29 29 float averaged_sm_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ];
30 30 float averaged_sm_f0_reorganized[ TIME_OFFSET + TOTAL_SIZE_SM ];
31 31 char averaged_sm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
32 32 float compressed_sm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_F0 ];
33 33
34 34 //*****
35 35 // SBM1
36 36 float averaged_sm_sbm1 [ TIME_OFFSET + TOTAL_SIZE_SM ];
37 37 float compressed_sm_sbm1 [ TOTAL_SIZE_COMPRESSED_ASM_SBM1 ];
38 38
39 39 unsigned char LFR_BP1_F0[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_BP1_F0 * 2 ];
40 40 unsigned char LFR_BP1_F1[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_BP1_F1 ];
41 41 unsigned char LFR_BP1_F2[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_BP1_F2 ];
42 42
43 43 unsigned int nb_sm_f0;
44 44
45 45 void init_sm_rings( void )
46 46 {
47 47 unsigned char i;
48 48
49 49 // F0 RING
50 50 sm_ring_f0[0].next = (ring_node_sm*) &sm_ring_f0[1];
51 51 sm_ring_f0[0].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_ASM_F0-1];
52 52 sm_ring_f0[0].buffer_address =
53 53 (int) &sm_f0[ 0 ];
54 54
55 55 sm_ring_f0[NB_RING_NODES_ASM_F0-1].next = (ring_node_sm*) &sm_ring_f0[0];
56 56 sm_ring_f0[NB_RING_NODES_ASM_F0-1].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_ASM_F0-2];
57 57 sm_ring_f0[NB_RING_NODES_ASM_F0-1].buffer_address =
58 58 (int) &sm_f0[ (NB_RING_NODES_ASM_F0-1) * TOTAL_SIZE_SM ];
59 59
60 60 for(i=1; i<NB_RING_NODES_ASM_F0-1; i++)
61 61 {
62 62 sm_ring_f0[i].next = (ring_node_sm*) &sm_ring_f0[i+1];
63 63 sm_ring_f0[i].previous = (ring_node_sm*) &sm_ring_f0[i-1];
64 64 sm_ring_f0[i].buffer_address =
65 65 (int) &sm_f0[ i * TOTAL_SIZE_SM ];
66 66 }
67 67
68 68 // F1 RING
69 69 sm_ring_f1[0].next = (ring_node_sm*) &sm_ring_f1[1];
70 70 sm_ring_f1[0].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_ASM_F1-1];
71 71 sm_ring_f1[0].buffer_address =
72 72 (int) &sm_f1[ 0 ];
73 73
74 74 sm_ring_f1[NB_RING_NODES_ASM_F1-1].next = (ring_node_sm*) &sm_ring_f1[0];
75 75 sm_ring_f1[NB_RING_NODES_ASM_F1-1].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_ASM_F1-2];
76 76 sm_ring_f1[NB_RING_NODES_ASM_F1-1].buffer_address =
77 77 (int) &sm_f1[ (NB_RING_NODES_ASM_F1-1) * TOTAL_SIZE_SM ];
78 78
79 79 for(i=1; i<NB_RING_NODES_ASM_F1-1; i++)
80 80 {
81 81 sm_ring_f1[i].next = (ring_node_sm*) &sm_ring_f1[i+1];
82 82 sm_ring_f1[i].previous = (ring_node_sm*) &sm_ring_f1[i-1];
83 83 sm_ring_f1[i].buffer_address =
84 84 (int) &sm_f1[ i * TOTAL_SIZE_SM ];
85 85 }
86 86
87 87 // F2 RING
88 88 sm_ring_f2[0].next = (ring_node_sm*) &sm_ring_f2[1];
89 89 sm_ring_f2[0].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_ASM_F2-1];
90 90 sm_ring_f2[0].buffer_address =
91 91 (int) &sm_f2[ 0 ];
92 92
93 93 sm_ring_f2[NB_RING_NODES_ASM_F2-1].next = (ring_node_sm*) &sm_ring_f2[0];
94 94 sm_ring_f2[NB_RING_NODES_ASM_F2-1].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_ASM_F2-2];
95 95 sm_ring_f2[NB_RING_NODES_ASM_F2-1].buffer_address =
96 96 (int) &sm_f2[ (NB_RING_NODES_ASM_F2-1) * TOTAL_SIZE_SM ];
97 97
98 98 for(i=1; i<NB_RING_NODES_ASM_F2-1; i++)
99 99 {
100 100 sm_ring_f2[i].next = (ring_node_sm*) &sm_ring_f2[i+1];
101 101 sm_ring_f2[i].previous = (ring_node_sm*) &sm_ring_f2[i-1];
102 102 sm_ring_f2[i].buffer_address =
103 103 (int) &sm_f2[ i * TOTAL_SIZE_SM ];
104 104 }
105 105
106 106 DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0)
107 107 DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1)
108 108 DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2)
109 109
110 110 spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address;
111 111 DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0)
112 112 }
113 113
114 114 void reset_current_sm_ring_nodes( void )
115 115 {
116 116 current_ring_node_sm_f0 = sm_ring_f0;
117 117 current_ring_node_sm_f1 = sm_ring_f1;
118 118 current_ring_node_sm_f2 = sm_ring_f2;
119 119
120 120 ring_node_for_averaging_sm_f0 = sm_ring_f0;
121 121 }
122 122
123 123 //***********************************************************
124 124 // Interrupt Service Routine for spectral matrices processing
125 125 void reset_nb_sm_f0( void )
126 126 {
127 127 nb_sm_f0 = 0;
128 128 }
129 129
130 130 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
131 131 {
132 132 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
133 133
134 134 if ( (spectral_matrix_regs->status & 0x1) == 0x01)
135 135 {
136 136 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
137 137 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
138 138 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110
139 139 nb_sm_f0 = nb_sm_f0 + 1;
140 140 }
141 141 else if ( (spectral_matrix_regs->status & 0x2) == 0x02)
142 142 {
143 143 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
144 144 spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address;
145 145 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101
146 146 nb_sm_f0 = nb_sm_f0 + 1;
147 147 }
148 148
149 149 if ( (spectral_matrix_regs->status & 0x30) != 0x00)
150 150 {
151 151 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
152 152 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111
153 153 }
154 154
155 155 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011
156 156
157 157 if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) )
158 158 {
159 159 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
160 160 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
161 161 {
162 162 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
163 163 }
164 164 nb_sm_f0 = 0;
165 165 }
166 166 else
167 167 {
168 168 nb_sm_f0 = nb_sm_f0 + 1;
169 169 }
170 170 }
171 171
172 172 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
173 173 {
174 174 if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) )
175 175 {
176 176 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
177 177 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
178 178 {
179 179 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
180 180 }
181 181 nb_sm_f0 = 0;
182 182 }
183 183 else
184 184 {
185 185 nb_sm_f0 = nb_sm_f0 + 1;
186 186 }
187 187 }
188 188
189 189 //************
190 190 // RTEMS TASKS
191 191
192 192 rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ
193 193 {
194 194 rtems_event_set event_out;
195 195
196 196 BOOT_PRINTF("in SMIQ *** \n")
197 197
198 198 while(1){
199 199 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
200 200 }
201 201 }
202 202
203 203 rtems_task avf0_task(rtems_task_argument argument)
204 204 {
205 205 int i;
206 static unsigned int nb_average_norm;
207 static unsigned int nb_average_sbm1;
206 static unsigned int nb_average_norm_f0;
207 static unsigned int nb_average_sbm1_f0;
208 208 rtems_event_set event_out;
209 209 rtems_status_code status;
210 210 ring_node_sm *ring_node_tab[8];
211 211
212 nb_average_norm = 0;
213 nb_average_sbm1 = 0;
212 nb_average_norm_f0 = 0;
213 nb_average_sbm1_f0 = 0;
214 214
215 215 BOOT_PRINTF("in AVFO *** \n")
216 216
217 217 while(1){
218 218 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
219 219 ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0;
220 220 for ( i = 2; i < (NB_SM_TO_RECEIVE_BEFORE_AVF0+1); i++ )
221 221 {
222 222 ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous;
223 223 ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0;
224 224 }
225 225
226 226 // copy time information in the averaged_sm_f0 buffer
227 227 averaged_sm_f0[0] = ring_node_tab[7]->coarseTime;
228 228 averaged_sm_f0[1] = ring_node_tab[7]->fineTime;
229 averaged_sm_f1[0] = ring_node_tab[7]->coarseTime;
230 averaged_sm_f1[1] = ring_node_tab[7]->fineTime;
229 averaged_sm_sbm1[0] = ring_node_tab[7]->coarseTime;
230 averaged_sm_sbm1[1] = ring_node_tab[7]->fineTime;
231 231
232 232 // compute the average and store it in the averaged_sm_f1 buffer
233 ASM_average( averaged_sm_f0, averaged_sm_f1,
233 ASM_average( averaged_sm_f0, averaged_sm_sbm1,
234 234 ring_node_tab,
235 nb_average_norm, nb_average_sbm1 );
235 nb_average_norm_f0, nb_average_sbm1_f0 );
236 236
237 237
238 238 // update nb_average
239 nb_average_norm = nb_average_norm + NB_SM_TO_RECEIVE_BEFORE_AVF0;
240 nb_average_sbm1 = nb_average_sbm1 + NB_SM_TO_RECEIVE_BEFORE_AVF0;
239 nb_average_norm_f0 = nb_average_norm_f0 + NB_SM_TO_RECEIVE_BEFORE_AVF0;
240 nb_average_sbm1_f0 = nb_average_sbm1_f0 + NB_SM_TO_RECEIVE_BEFORE_AVF0;
241 241
242 242 // launch actions depending on the current mode
243
244 if (nb_average_sbm1_f0 == NB_AVERAGE_SBM1_F0)
245 {
246 nb_average_sbm1_f0 = 0;
243 247 if (lfrCurrentMode == LFR_MODE_SBM1)
244 248 {
245 if (nb_average_sbm1 == NB_AVERAGE_SBM1_f0) {
246 nb_average_sbm1 = 0;
247 249 status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_MODE_SBM1 ); // sending an event to the task 7, BPF0
248 if (status != RTEMS_SUCCESSFUL) {
249 printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status);
250 if (status != RTEMS_SUCCESSFUL)
251 {
252 printf("in AVF0 *** Error sending RTEMS_EVENT_MODE_SBM1, code %d\n", status);
250 253 }
251 254 }
252 255 }
253 if (lfrCurrentMode == LFR_MODE_NORMAL)
254 {
255 if (nb_average_norm == NB_AVERAGE_NORMAL_f0) {
256 nb_average_norm = 0;
256
257 if (nb_average_norm_f0 == NB_AVERAGE_NORMAL_F0) {
258 nb_average_norm_f0 = 0;
257 259 status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_MODE_NORMAL ); // sending an event to the task 7, BPF0
258 260 if (status != RTEMS_SUCCESSFUL) {
259 261 printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status);
260 262 }
261 263 }
262 264 }
263 265 }
264 }
265 266
266 267 rtems_task matr_task(rtems_task_argument argument)
267 268 {
268 269 spw_ioctl_pkt_send spw_ioctl_send_ASM;
269 270 rtems_event_set event_out;
270 271 rtems_status_code status;
271 272 rtems_id queue_id;
272 273 Header_TM_LFR_SCIENCE_ASM_t headerASM;
273 274
274 275 init_header_asm( &headerASM );
275 276
276 277 status = get_message_queue_id_send( &queue_id );
277 278 if (status != RTEMS_SUCCESSFUL)
278 279 {
279 280 PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status)
280 281 }
281 282
282 283 BOOT_PRINTF("in MATR *** \n")
283 284
284 285 fill_averaged_spectral_matrix( );
285 286
286 287 while(1){
287 288 rtems_event_receive( RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1,
288 289 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
289 290 if (event_out==RTEMS_EVENT_MODE_NORMAL)
290 291 {
291 292 // 1) compress the matrix for Basic Parameters calculation
292 293 ASM_compress( averaged_sm_f0, 0, compressed_sm_f0 );
293 294 // 2) compute the BP1 set
294 295
295 // 3) convert the float array in a char array
296 // 3) send the BP1 set
297
298 // 4) convert the float array in a char array
296 299 ASM_reorganize( averaged_sm_f0, averaged_sm_f0_reorganized );
297 300 ASM_convert( averaged_sm_f0_reorganized, averaged_sm_f0_char);
298 // 4) send the spectral matrix packets
301 // 5) send the spectral matrix packets
299 302 ASM_send( &headerASM, averaged_sm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
300 303 }
301 304 else if (event_out==RTEMS_EVENT_MODE_SBM1)
302 305 {
303 306 // 1) compress the matrix for Basic Parameters calculation
304 ASM_compress( averaged_sm_f1, 0, compressed_sm_f1 );
307 ASM_compress( averaged_sm_sbm1, 0, compressed_sm_sbm1 );
305 308 // 2) compute the BP1 set
306 309
307 // 4) send the basic parameters set 1 packet
308 BP1_send( );
310 // 3) send the basic parameters set 1 packet
311
309 312 }
310 313 else
311 314 {
312 315 PRINTF1("ERR *** in MATR *** unexect event = %x\n", (unsigned int) event_out)
313 316 }
314 317 }
315 318 }
316 319
317 320 //*****************************
318 321 // Spectral matrices processing
319 322
320 323 void matrix_reset(volatile float *averaged_spec_mat)
321 324 {
322 325 int i;
323 326 for(i=0; i<TOTAL_SIZE_SM; i++){
324 327 averaged_spec_mat[i] = 0;
325 328 }
326 329 }
327 330
328 331 void ASM_average( float *averaged_spec_mat_f0, float *averaged_spec_mat_f1,
329 332 ring_node_sm *ring_node_tab[],
330 unsigned int firstTimeF0, unsigned int firstTimeF1 )
333 unsigned int nbAverageNormF0, unsigned int nbAverageSBM1F0 )
331 334 {
332 335 float sum;
333 336 unsigned int i;
334 337
335 338 for(i=0; i<TOTAL_SIZE_SM; i++)
336 339 {
337 340 sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ]
338 341 + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ]
339 342 + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ]
340 343 + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ]
341 344 + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ]
342 345 + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ]
343 346 + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ]
344 347 + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ];
345 348
346 if ( (firstTimeF0 == 0) && (firstTimeF1 == 0) )
349 if ( (nbAverageNormF0 == 0) && (nbAverageSBM1F0 == 0) )
347 350 {
348 averaged_spec_mat_f0[ i ] = averaged_spec_mat_f0[ i ] + sum;
349 averaged_spec_mat_f1[ i ] = averaged_spec_mat_f1[ i ] + sum;
351 averaged_spec_mat_f0[ TIME_OFFSET + i ] = sum;
352 averaged_spec_mat_f1[ TIME_OFFSET + i ] = sum;
350 353 }
351 else if ( (firstTimeF0 == 0) && (firstTimeF1 != 0) )
354 else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 != 0) )
352 355 {
353 averaged_spec_mat_f0[ i ] = averaged_spec_mat_f0[ i ] + sum;
354 averaged_spec_mat_f1[ i ] = sum;
356 averaged_spec_mat_f0[ TIME_OFFSET + i ] = ( averaged_spec_mat_f0[ TIME_OFFSET + i ] + sum );
357 averaged_spec_mat_f1[ TIME_OFFSET + i ] = ( averaged_spec_mat_f1[ TIME_OFFSET + i ] + sum );
355 358 }
356 else if ( (firstTimeF0 != 0) && (firstTimeF1 == 0) )
359 else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 == 0) )
357 360 {
358 averaged_spec_mat_f0[ i ] = sum;
359 averaged_spec_mat_f1[ i ] = averaged_spec_mat_f1[ i ] + sum;
361 averaged_spec_mat_f0[ TIME_OFFSET + i ] = ( averaged_spec_mat_f0[ TIME_OFFSET + i ] + sum );
362 averaged_spec_mat_f1[ TIME_OFFSET + i ] = sum;
360 363 }
361 364 else
362 365 {
363 averaged_spec_mat_f0[ i ] = sum;
364 averaged_spec_mat_f1[ i ] = sum;
366 PRINTF2("ERR *** in ASM_average *** unexpected parameters %d %d\n", nbAverageNormF0, nbAverageSBM1F0)
365 367 }
366 368 }
367 369 }
368 370
369 371 void ASM_reorganize( float *averaged_spec_mat, float *averaged_spec_mat_reorganized )
370 372 {
371 373 int frequencyBin;
372 374 int asmComponent;
373 375
374 376 // copy the time information
375 377 averaged_spec_mat_reorganized[ 0 ] = averaged_spec_mat[ 0 ];
376 378 averaged_spec_mat_reorganized[ 1 ] = averaged_spec_mat[ 1 ];
377 379
378 380 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
379 381 {
380 382 for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ )
381 383 {
382 averaged_spec_mat_reorganized[ frequencyBin * NB_VALUES_PER_SM + asmComponent + TIME_OFFSET ] =
383 averaged_spec_mat[ asmComponent * NB_BINS_PER_SM + frequencyBin + TIME_OFFSET];
384 averaged_spec_mat_reorganized[ TIME_OFFSET + frequencyBin * NB_VALUES_PER_SM + asmComponent ] =
385 averaged_spec_mat[ TIME_OFFSET + asmComponent * NB_BINS_PER_SM + frequencyBin ];
384 386 }
385 387 }
386 388 }
387 389
388 390 void ASM_compress( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat )
389 391 {
390 392 int frequencyBin;
391 393 int asmComponent;
392 394 int offsetASM;
393 395 int offsetCompressed;
394 396 int k;
395 397
396 398 switch (fChannel){
397 399 case 0:
398 400 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
399 401 {
400 402 for( frequencyBin = 0; frequencyBin < NB_BINS_COMPRESSED_SM_F0; frequencyBin++ )
401 403 {
402 404 offsetCompressed = TIME_OFFSET
403 405 + frequencyBin * NB_VALUES_PER_SM
404 406 + asmComponent;
405 407 offsetASM = TIME_OFFSET
406 408 + asmComponent * NB_BINS_PER_SM
407 409 + ASM_F0_INDICE_START
408 410 + frequencyBin * NB_BINS_TO_AVERAGE_ASM_F0;
409 411 compressed_spec_mat[ offsetCompressed ] = 0;
410 412 for ( k = 0; k < NB_BINS_TO_AVERAGE_ASM_F0; k++ )
411 413 {
412 414 compressed_spec_mat[offsetCompressed ] =
413 415 compressed_spec_mat[ offsetCompressed ]
414 416 + averaged_spec_mat[ offsetASM + k ];
415 417 }
416 418 }
417 419 }
418 420 break;
419 421
420 422 case 1:
421 423 // case fChannel = f1 to be completed later
422 424 break;
423 425
424 426 case 2:
425 427 // case fChannel = f1 to be completed later
426 428 break;
427 429
428 430 default:
429 431 break;
430 432 }
431 433 }
432 434
433 435 void ASM_convert( volatile float *input_matrix, char *output_matrix)
434 436 {
435 437 unsigned int i;
436 438 unsigned int frequencyBin;
437 439 unsigned int asmComponent;
438 440 char * pt_char_input;
439 441 char * pt_char_output;
440 442
441 443 pt_char_input = (char*) &input_matrix;
442 444 pt_char_output = (char*) &output_matrix;
443 445
444 446 // copy the time information
445 447 for (i=0; i<TIME_OFFSET_IN_BYTES; i++)
446 448 {
447 449 pt_char_output[ i ] = pt_char_output[ i ];
448 450 }
449 451
450 452 // convert all other data
451 453 for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++)
452 454 {
453 455 for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++)
454 456 {
455 457 pt_char_input = (char*) &input_matrix [ (frequencyBin*NB_VALUES_PER_SM) + asmComponent + TIME_OFFSET ];
456 458 pt_char_output = (char*) &output_matrix[ 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) + TIME_OFFSET_IN_BYTES ];
457 459 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
458 460 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
459 461 }
460 462 }
461 463 }
462 464
463 465 void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
464 466 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id)
465 467 {
466 468 unsigned int i;
467 469 unsigned int length = 0;
468 470 rtems_status_code status;
469 471
470 472 for (i=0; i<2; i++)
471 473 {
472 474 // (1) BUILD THE DATA
473 475 switch(sid)
474 476 {
475 477 case SID_NORM_ASM_F0:
476 478 spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2;
477 479 spw_ioctl_send->data = &spectral_matrix[
478 480 ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2
479 481 + TIME_OFFSET_IN_BYTES
480 482 ];
481 483 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0;
482 484 header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB
483 485 header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB
484 486 break;
485 487 case SID_NORM_ASM_F1:
486 488 break;
487 489 case SID_NORM_ASM_F2:
488 490 break;
489 491 default:
490 492 PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid)
491 493 break;
492 494 }
493 495 spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES;
494 496 spw_ioctl_send->hdr = (char *) header;
495 497 spw_ioctl_send->options = 0;
496 498
497 499 // (2) BUILD THE HEADER
498 500 header->packetLength[0] = (unsigned char) (length>>8);
499 501 header->packetLength[1] = (unsigned char) (length);
500 502 header->sid = (unsigned char) sid; // SID
501 503 header->pa_lfr_pkt_cnt_asm = 2;
502 504 header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1);
503 505
504 506 // (3) SET PACKET TIME
505 507 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
506 508 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
507 509 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
508 510 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
509 511 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
510 512 header->time[5] = (unsigned char) (time_management_regs->fine_time);
511 513 //
512 514 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
513 515 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
514 516 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
515 517 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
516 518 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
517 519 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
518 520
519 521 // (4) SEND PACKET
520 522 status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
521 523 if (status != RTEMS_SUCCESSFUL) {
522 524 printf("in ASM_send *** ERR %d\n", (int) status);
523 525 }
524 526 }
525 527 }
526 528
527 529 void BP1_send()
528 530 {
529 531
530 532 }
531 533
532 534 void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){
533 535 int i;
534 536 int j;
535 537 unsigned char tmp_u_char;
536 538 unsigned char * pt_char = NULL;
537 539 float PSDB, PSDE;
538 540 float NVEC_V0;
539 541 float NVEC_V1;
540 542 float NVEC_V2;
541 543 //float significand;
542 544 //int exponent;
543 545 float aux;
544 546 float tr_SB_SB;
545 547 float tmp;
546 548 float sx_re;
547 549 float sx_im;
548 550 float nebx_re = 0;
549 551 float nebx_im = 0;
550 552 float ny = 0;
551 553 float nz = 0;
552 554 float bx_bx_star = 0;
553 555 for(i=0; i<nb_bins_compressed_spec_mat; i++){
554 556 //==============================================
555 557 // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits
556 558 PSDB = compressed_spec_mat[i*30] // S11
557 559 + compressed_spec_mat[(i*30) + 10] // S22
558 560 + compressed_spec_mat[(i*30) + 18]; // S33
559 561 //significand = frexp(PSDB, &exponent);
560 562 pt_char = (unsigned char*) &PSDB;
561 563 LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float
562 564 LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float
563 565 //==============================================
564 566 // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits
565 567 PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44
566 568 + compressed_spec_mat[(i*30) + 28] * K55_pe // S55
567 569 + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45
568 570 - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45
569 571 pt_char = (unsigned char*) &PSDE;
570 572 LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float
571 573 LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float
572 574 //==============================================================================
573 575 // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits
574 576 // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits
575 577 // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits
576 578 tmp = sqrt(
577 579 compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12
578 580 +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13
579 581 +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23
580 582 );
581 583 NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23
582 584 NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13
583 585 NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12
584 586 LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127);
585 587 LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127);
586 588 pt_char = (unsigned char*) &NVEC_V2;
587 589 LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2
588 590 //=======================================================
589 591 // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits
590 592 aux = 2*tmp / PSDB; // compute the ellipticity
591 593 tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity
592 594 LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char
593 595 //==============================================================
594 596 // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits
595 597 for(j = 0; j<NB_VALUES_PER_SM;j++){
596 598 tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30]
597 599 + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10]
598 600 + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18]
599 601 + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2]
600 602 + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3]
601 603 + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4]
602 604 + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5]
603 605 + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12]
604 606 + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13];
605 607 }
606 608 aux = PSDB*PSDB;
607 609 tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) );
608 610 tmp_u_char = (unsigned char) (NVEC_V0*(8-1));
609 611 LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char
610 612 //=======================================================================================
611 613 // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1)
612 614 sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re
613 615 + compressed_spec_mat[(i*30) + 6] * K14_sx_re
614 616 + compressed_spec_mat[(i*30) + 8] * K15_sx_re
615 617 + compressed_spec_mat[(i*30) + 14] * K24_sx_re
616 618 + compressed_spec_mat[(i*30) + 16] * K25_sx_re
617 619 + compressed_spec_mat[(i*30) + 22] * K35_sx_re;
618 620 sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im
619 621 + compressed_spec_mat[(i*30) + 7] * K14_sx_im
620 622 + compressed_spec_mat[(i*30) + 9] * K15_sx_im
621 623 + compressed_spec_mat[(i*30) + 15] * K24_sx_im
622 624 + compressed_spec_mat[(i*30) + 17] * K25_sx_im
623 625 + compressed_spec_mat[(i*30) + 23] * K35_sx_im;
624 626 LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression
625 627 if ( abs(sx_re) > abs(sx_im) ) {
626 628 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx
627 629 }
628 630 else {
629 631 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx
630 632 }
631 633 //======================================================================
632 634 // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1)
633 635 ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2;
634 636 nz = NVEC_V0;
635 637 bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22
636 638 + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33
637 639 - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23
638 640 nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re
639 641 +compressed_spec_mat[(i*30) + 16] * K25_ny_re
640 642 +compressed_spec_mat[(i*30) + 20] * K34_ny_re
641 643 +compressed_spec_mat[(i*30) + 22] * K35_ny_re)
642 644 + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re
643 645 +compressed_spec_mat[(i*30) + 16] * K25_nz_re
644 646 +compressed_spec_mat[(i*30) + 20] * K34_nz_re
645 647 +compressed_spec_mat[(i*30) + 22] * K35_nz_re);
646 648 nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re
647 649 +compressed_spec_mat[(i*30) + 17] * K25_ny_re
648 650 +compressed_spec_mat[(i*30) + 21] * K34_ny_re
649 651 +compressed_spec_mat[(i*30) + 23] * K35_ny_re)
650 652 + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im
651 653 +compressed_spec_mat[(i*30) + 17] * K25_nz_im
652 654 +compressed_spec_mat[(i*30) + 21] * K34_nz_im
653 655 +compressed_spec_mat[(i*30) + 23] * K35_nz_im);
654 656 tmp = nebx_re / bx_bx_star;
655 657 LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression
656 658 if ( abs(nebx_re) > abs(nebx_im) ) {
657 659 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx
658 660 }
659 661 else {
660 662 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx
661 663 }
662 664 }
663 665
664 666 }
665 667
666 668 void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){
667 669 // BP2 autocorrelation
668 670 int i;
669 671 int aux = 0;
670 672
671 673 for(i = 0; i<nb_bins_compressed_spec_mat; i++){
672 674 // S12
673 675 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]);
674 676 compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux;
675 677 compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux;
676 678 // S13
677 679 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]);
678 680 compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux;
679 681 compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux;
680 682 // S23
681 683 aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]);
682 684 compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux;
683 685 compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux;
684 686 // S45
685 687 aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]);
686 688 compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux;
687 689 compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux;
688 690 // S14
689 691 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]);
690 692 compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux;
691 693 compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux;
692 694 // S15
693 695 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]);
694 696 compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux;
695 697 compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux;
696 698 // S24
697 699 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]);
698 700 compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux;
699 701 compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux;
700 702 // S25
701 703 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]);
702 704 compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux;
703 705 compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux;
704 706 // S34
705 707 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]);
706 708 compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux;
707 709 compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux;
708 710 // S35
709 711 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]);
710 712 compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux;
711 713 compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux;
712 714 }
713 715 }
714 716
715 717 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header)
716 718 {
717 719 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
718 720 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
719 721 header->reserved = 0x00;
720 722 header->userApplication = CCSDS_USER_APP;
721 723 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
722 724 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
723 725 header->packetSequenceControl[0] = 0xc0;
724 726 header->packetSequenceControl[1] = 0x00;
725 727 header->packetLength[0] = 0x00;
726 728 header->packetLength[1] = 0x00;
727 729 // DATA FIELD HEADER
728 730 header->spare1_pusVersion_spare2 = 0x10;
729 731 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
730 732 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
731 733 header->destinationID = TM_DESTINATION_ID_GROUND;
732 734 // AUXILIARY DATA HEADER
733 735 header->sid = 0x00;
734 736 header->biaStatusInfo = 0x00;
735 737 header->pa_lfr_pkt_cnt_asm = 0x00;
736 738 header->pa_lfr_pkt_nr_asm = 0x00;
737 739 header->time[0] = 0x00;
738 740 header->time[0] = 0x00;
739 741 header->time[0] = 0x00;
740 742 header->time[0] = 0x00;
741 743 header->time[0] = 0x00;
742 744 header->time[0] = 0x00;
743 745 header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB
744 746 header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB
745 747 }
746 748
747 749 void init_header_bp( Header_TM_LFR_SCIENCE_BP_t *header)
748 750 {
749 751 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
750 752 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
751 753 header->reserved = 0x00;
752 754 header->userApplication = CCSDS_USER_APP;
753 755 // header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
754 756 // header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
755 757 header->packetSequenceControl[0] = 0xc0;
756 758 header->packetSequenceControl[1] = 0x00;
757 759 header->packetLength[0] = 0x00;
758 760 header->packetLength[1] = 0x00;
759 761 // DATA FIELD HEADER
760 762 header->spare1_pusVersion_spare2 = 0x10;
761 763 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
762 764 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
763 765 header->destinationID = TM_DESTINATION_ID_GROUND;
764 766 // AUXILIARY DATA HEADER
765 767 header->sid = 0x00;
766 768 header->biaStatusInfo = 0x00;
767 769 header->time[0] = 0x00;
768 770 header->time[0] = 0x00;
769 771 header->time[0] = 0x00;
770 772 header->time[0] = 0x00;
771 773 header->time[0] = 0x00;
772 774 header->time[0] = 0x00;
773 775 header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB
774 776 header->pa_lfr_bp_blk_nr[1] = 0x00; // BLK_NR LSB
775 777 }
776 778
777 779 void fill_averaged_spectral_matrix(void)
778 780 {
779 781 /** This function fills spectral matrices related buffers with arbitrary data.
780 782 *
781 783 * This function is for testing purpose only.
782 784 *
783 785 */
784 786
785 787 float offset;
786 788 float coeff;
787 789
788 790 offset = 10.;
789 791 coeff = 100000.;
790 792 averaged_sm_f0[ 0 + 25 * 0 ] = 0. + offset;
791 793 averaged_sm_f0[ 0 + 25 * 1 ] = 1. + offset;
792 794 averaged_sm_f0[ 0 + 25 * 2 ] = 2. + offset;
793 795 averaged_sm_f0[ 0 + 25 * 3 ] = 3. + offset;
794 796 averaged_sm_f0[ 0 + 25 * 4 ] = 4. + offset;
795 797 averaged_sm_f0[ 0 + 25 * 5 ] = 5. + offset;
796 798 averaged_sm_f0[ 0 + 25 * 6 ] = 6. + offset;
797 799 averaged_sm_f0[ 0 + 25 * 7 ] = 7. + offset;
798 800 averaged_sm_f0[ 0 + 25 * 8 ] = 8. + offset;
799 801 averaged_sm_f0[ 0 + 25 * 9 ] = 9. + offset;
800 802 averaged_sm_f0[ 0 + 25 * 10 ] = 10. + offset;
801 803 averaged_sm_f0[ 0 + 25 * 11 ] = 11. + offset;
802 804 averaged_sm_f0[ 0 + 25 * 12 ] = 12. + offset;
803 805 averaged_sm_f0[ 0 + 25 * 13 ] = 13. + offset;
804 806 averaged_sm_f0[ 0 + 25 * 14 ] = 14. + offset;
805 807 averaged_sm_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff;
806 808 averaged_sm_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff;
807 809 averaged_sm_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff;
808 810 averaged_sm_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff;
809 811 averaged_sm_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff;
810 812 averaged_sm_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff;
811 813 averaged_sm_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff;
812 814 averaged_sm_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff;
813 815 averaged_sm_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff;
814 816 averaged_sm_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff;
815 817 averaged_sm_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff;
816 818 averaged_sm_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff;
817 819 averaged_sm_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff;
818 820 averaged_sm_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff;
819 821 averaged_sm_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff;
820 822
821 823 offset = 10000000;
822 824 averaged_sm_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff;
823 825 averaged_sm_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff;
824 826 averaged_sm_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff;
825 827 averaged_sm_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff;
826 828 averaged_sm_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff;
827 829 averaged_sm_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff;
828 830 averaged_sm_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff;
829 831 averaged_sm_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff;
830 832 averaged_sm_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff;
831 833 averaged_sm_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff;
832 834 averaged_sm_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff;
833 835 averaged_sm_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff;
834 836 averaged_sm_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff;
835 837 averaged_sm_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff;
836 838 averaged_sm_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff;
837 839
838 840 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_sm_f0[ 0 ];
839 841 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_sm_f0[ 1 ];
840 842 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_sm_f0[ 2 ];
841 843 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_sm_f0[ 3 ];
842 844 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_sm_f0[ 4 ];
843 845 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_sm_f0[ 5 ];
844 846 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_sm_f0[ 6 ];
845 847 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_sm_f0[ 7 ];
846 848 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_sm_f0[ 8 ];
847 849 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_sm_f0[ 9 ];
848 850 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_sm_f0[ 10 ];
849 851 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_sm_f0[ 11 ];
850 852 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_sm_f0[ 12 ];
851 853 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_sm_f0[ 13 ];
852 854 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_sm_f0[ 14 ];
853 855 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_sm_f0[ 15 ];
854 856 }
855 857
856 858 void reset_spectral_matrix_regs()
857 859 {
858 860 /** This function resets the spectral matrices module registers.
859 861 *
860 862 * The registers affected by this function are located at the following offset addresses:
861 863 *
862 864 * - 0x00 config
863 865 * - 0x04 status
864 866 * - 0x08 matrixF0_Address0
865 867 * - 0x10 matrixFO_Address1
866 868 * - 0x14 matrixF1_Address
867 869 * - 0x18 matrixF2_Address
868 870 *
869 871 */
870 872
871 873 spectral_matrix_regs->config = 0x00;
872 874 spectral_matrix_regs->status = 0x00;
873 875
874 876 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
875 877 spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address;
876 878 spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address;
877 879 spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address;
878 880 }
879 881
880 882 //******************
881 883 // general functions
882 884
883 885
884 886
885 887
@@ -1,879 +1,879
1 1 /** Functions and tasks related to TeleCommand handling.
2 2 *
3 3 * @file
4 4 * @author P. LEROY
5 5 *
6 6 * A group of functions to handle TeleCommands:\n
7 7 * action launching\n
8 8 * TC parsing\n
9 9 * ...
10 10 *
11 11 */
12 12
13 13 #include "tc_handler.h"
14 14
15 15 //***********
16 16 // RTEMS TASK
17 17
18 18 rtems_task actn_task( rtems_task_argument unused )
19 19 {
20 20 /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands.
21 21 *
22 22 * @param unused is the starting argument of the RTEMS task
23 23 *
24 24 * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending
25 25 * on the incoming TeleCommand.
26 26 *
27 27 */
28 28
29 29 int result;
30 30 rtems_status_code status; // RTEMS status code
31 31 ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task
32 32 size_t size; // size of the incoming TC packet
33 33 unsigned char subtype; // subtype of the current TC packet
34 34 unsigned char time[6];
35 35 rtems_id queue_rcv_id;
36 36 rtems_id queue_snd_id;
37 37
38 38 status = get_message_queue_id_recv( &queue_rcv_id );
39 39 if (status != RTEMS_SUCCESSFUL)
40 40 {
41 41 PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status)
42 42 }
43 43
44 44 status = get_message_queue_id_send( &queue_snd_id );
45 45 if (status != RTEMS_SUCCESSFUL)
46 46 {
47 47 PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status)
48 48 }
49 49
50 50 result = LFR_SUCCESSFUL;
51 51 subtype = 0; // subtype of the current TC packet
52 52
53 53 BOOT_PRINTF("in ACTN *** \n")
54 54
55 55 while(1)
56 56 {
57 57 status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
58 58 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
59 59 getTime( time ); // set time to the current time
60 60 if (status!=RTEMS_SUCCESSFUL)
61 61 {
62 62 PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
63 63 }
64 64 else
65 65 {
66 66 subtype = TC.serviceSubType;
67 67 switch(subtype)
68 68 {
69 69 case TC_SUBTYPE_RESET:
70 70 result = action_reset( &TC, queue_snd_id, time );
71 71 close_action( &TC, result, queue_snd_id );
72 72 break;
73 73 //
74 74 case TC_SUBTYPE_LOAD_COMM:
75 75 result = action_load_common_par( &TC );
76 76 close_action( &TC, result, queue_snd_id );
77 77 break;
78 78 //
79 79 case TC_SUBTYPE_LOAD_NORM:
80 80 result = action_load_normal_par( &TC, queue_snd_id, time );
81 81 close_action( &TC, result, queue_snd_id );
82 82 break;
83 83 //
84 84 case TC_SUBTYPE_LOAD_BURST:
85 85 result = action_load_burst_par( &TC, queue_snd_id, time );
86 86 close_action( &TC, result, queue_snd_id );
87 87 break;
88 88 //
89 89 case TC_SUBTYPE_LOAD_SBM1:
90 90 result = action_load_sbm1_par( &TC, queue_snd_id, time );
91 91 close_action( &TC, result, queue_snd_id );
92 92 break;
93 93 //
94 94 case TC_SUBTYPE_LOAD_SBM2:
95 95 result = action_load_sbm2_par( &TC, queue_snd_id, time );
96 96 close_action( &TC, result, queue_snd_id );
97 97 break;
98 98 //
99 99 case TC_SUBTYPE_DUMP:
100 100 result = action_dump_par( queue_snd_id );
101 101 close_action( &TC, result, queue_snd_id );
102 102 break;
103 103 //
104 104 case TC_SUBTYPE_ENTER:
105 105 result = action_enter_mode( &TC, queue_snd_id );
106 106 close_action( &TC, result, queue_snd_id );
107 107 break;
108 108 //
109 109 case TC_SUBTYPE_UPDT_INFO:
110 110 result = action_update_info( &TC, queue_snd_id );
111 111 close_action( &TC, result, queue_snd_id );
112 112 break;
113 113 //
114 114 case TC_SUBTYPE_EN_CAL:
115 115 result = action_enable_calibration( &TC, queue_snd_id, time );
116 116 close_action( &TC, result, queue_snd_id );
117 117 break;
118 118 //
119 119 case TC_SUBTYPE_DIS_CAL:
120 120 result = action_disable_calibration( &TC, queue_snd_id, time );
121 121 close_action( &TC, result, queue_snd_id );
122 122 break;
123 123 //
124 124 case TC_SUBTYPE_UPDT_TIME:
125 125 result = action_update_time( &TC );
126 126 close_action( &TC, result, queue_snd_id );
127 127 break;
128 128 //
129 129 default:
130 130 break;
131 131 }
132 132 }
133 133 }
134 134 }
135 135
136 136 //***********
137 137 // TC ACTIONS
138 138
139 139 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
140 140 {
141 141 /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
142 142 *
143 143 * @param TC points to the TeleCommand packet that is being processed
144 144 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
145 145 *
146 146 */
147 147
148 148 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
149 149 return LFR_DEFAULT;
150 150 }
151 151
152 152 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
153 153 {
154 154 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
155 155 *
156 156 * @param TC points to the TeleCommand packet that is being processed
157 157 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
158 158 *
159 159 */
160 160
161 161 rtems_status_code status;
162 162 unsigned char requestedMode;
163 163 unsigned int *transitionCoarseTime_ptr;
164 164 unsigned int transitionCoarseTime;
165 165 unsigned char * bytePosPtr;
166 166
167 167 bytePosPtr = (unsigned char *) &TC->packetID;
168 168
169 169 requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ];
170 170 transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] );
171 171 transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff;
172 172
173 173 status = check_mode_value( requestedMode );
174 174
175 175 if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent
176 176 {
177 177 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode );
178 178 }
179 179 else // the mode value is consistent, check the transition
180 180 {
181 181 status = check_mode_transition(requestedMode);
182 182 if (status != LFR_SUCCESSFUL)
183 183 {
184 184 PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n")
185 185 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
186 186 }
187 187 }
188 188
189 189 if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode
190 190 {
191 191 status = check_transition_date( transitionCoarseTime );
192 192 if (status != LFR_SUCCESSFUL)
193 193 {
194 194 PRINTF("ERR *** in action_enter_mode *** check_transition_date\n")
195 195 send_tm_lfr_tc_exe_inconsistent( TC, queue_id,
196 196 BYTE_POS_CP_LFR_ENTER_MODE_TIME,
197 197 bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] );
198 198 }
199 199 }
200 200
201 201 if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode
202 202 {
203 203 PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode);
204 204 status = enter_mode( requestedMode, transitionCoarseTime );
205 205 }
206 206
207 207 return status;
208 208 }
209 209
210 210 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
211 211 {
212 212 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
213 213 *
214 214 * @param TC points to the TeleCommand packet that is being processed
215 215 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
216 216 *
217 217 * @return LFR directive status code:
218 218 * - LFR_DEFAULT
219 219 * - LFR_SUCCESSFUL
220 220 *
221 221 */
222 222
223 223 unsigned int val;
224 224 int result;
225 225 unsigned int status;
226 226 unsigned char mode;
227 227 unsigned char * bytePosPtr;
228 228
229 229 bytePosPtr = (unsigned char *) &TC->packetID;
230 230
231 231 // check LFR mode
232 232 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1;
233 233 status = check_update_info_hk_lfr_mode( mode );
234 234 if (status == LFR_SUCCESSFUL) // check TDS mode
235 235 {
236 236 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4;
237 237 status = check_update_info_hk_tds_mode( mode );
238 238 }
239 239 if (status == LFR_SUCCESSFUL) // check THR mode
240 240 {
241 241 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f);
242 242 status = check_update_info_hk_thr_mode( mode );
243 243 }
244 244 if (status == LFR_SUCCESSFUL) // if the parameter check is successful
245 245 {
246 246 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
247 247 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
248 248 val++;
249 249 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
250 250 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
251 251 }
252 252
253 253 result = status;
254 254
255 255 return result;
256 256 }
257 257
258 258 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
259 259 {
260 260 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
261 261 *
262 262 * @param TC points to the TeleCommand packet that is being processed
263 263 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
264 264 *
265 265 */
266 266
267 267 int result;
268 268 unsigned char lfrMode;
269 269
270 270 result = LFR_DEFAULT;
271 271 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
272 272
273 273 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
274 274 result = LFR_DEFAULT;
275 275
276 276 return result;
277 277 }
278 278
279 279 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
280 280 {
281 281 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
282 282 *
283 283 * @param TC points to the TeleCommand packet that is being processed
284 284 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
285 285 *
286 286 */
287 287
288 288 int result;
289 289 unsigned char lfrMode;
290 290
291 291 result = LFR_DEFAULT;
292 292 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
293 293
294 294 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
295 295 result = LFR_DEFAULT;
296 296
297 297 return result;
298 298 }
299 299
300 300 int action_update_time(ccsdsTelecommandPacket_t *TC)
301 301 {
302 302 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
303 303 *
304 304 * @param TC points to the TeleCommand packet that is being processed
305 305 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
306 306 *
307 307 * @return LFR_SUCCESSFUL
308 308 *
309 309 */
310 310
311 311 unsigned int val;
312 312
313 313 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
314 314 + (TC->dataAndCRC[1] << 16)
315 315 + (TC->dataAndCRC[2] << 8)
316 316 + TC->dataAndCRC[3];
317 317
318 318 PRINTF1("time received: %x\n", time_management_regs->coarse_time_load)
319 319
320 320 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
321 321 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
322 322 val++;
323 323 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
324 324 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
325 325 // time_management_regs->ctrl = time_management_regs->ctrl | 1; // force tick
326 326
327 327 return LFR_SUCCESSFUL;
328 328 }
329 329
330 330 //*******************
331 331 // ENTERING THE MODES
332 332 int check_mode_value( unsigned char requestedMode )
333 333 {
334 334 int status;
335 335
336 336 if ( (requestedMode != LFR_MODE_STANDBY)
337 337 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
338 338 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
339 339 {
340 340 status = LFR_DEFAULT;
341 341 }
342 342 else
343 343 {
344 344 status = LFR_SUCCESSFUL;
345 345 }
346 346
347 347 return status;
348 348 }
349 349
350 350 int check_mode_transition( unsigned char requestedMode )
351 351 {
352 352 /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
353 353 *
354 354 * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
355 355 *
356 356 * @return LFR directive status codes:
357 357 * - LFR_SUCCESSFUL - the transition is authorized
358 358 * - LFR_DEFAULT - the transition is not authorized
359 359 *
360 360 */
361 361
362 362 int status;
363 363
364 364 switch (requestedMode)
365 365 {
366 366 case LFR_MODE_STANDBY:
367 367 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
368 368 status = LFR_DEFAULT;
369 369 }
370 370 else
371 371 {
372 372 status = LFR_SUCCESSFUL;
373 373 }
374 374 break;
375 375 case LFR_MODE_NORMAL:
376 376 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
377 377 status = LFR_DEFAULT;
378 378 }
379 379 else {
380 380 status = LFR_SUCCESSFUL;
381 381 }
382 382 break;
383 383 case LFR_MODE_BURST:
384 384 if ( lfrCurrentMode == LFR_MODE_BURST ) {
385 385 status = LFR_DEFAULT;
386 386 }
387 387 else {
388 388 status = LFR_SUCCESSFUL;
389 389 }
390 390 break;
391 391 case LFR_MODE_SBM1:
392 392 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
393 393 status = LFR_DEFAULT;
394 394 }
395 395 else {
396 396 status = LFR_SUCCESSFUL;
397 397 }
398 398 break;
399 399 case LFR_MODE_SBM2:
400 400 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
401 401 status = LFR_DEFAULT;
402 402 }
403 403 else {
404 404 status = LFR_SUCCESSFUL;
405 405 }
406 406 break;
407 407 default:
408 408 status = LFR_DEFAULT;
409 409 break;
410 410 }
411 411
412 412 return status;
413 413 }
414 414
415 415 int check_transition_date( unsigned int transitionCoarseTime )
416 416 {
417 417 int status;
418 418 unsigned int localCoarseTime;
419 419 unsigned int deltaCoarseTime;
420 420
421 421 status = LFR_SUCCESSFUL;
422 422
423 423 if (transitionCoarseTime == 0) // transition time = 0 means an instant transition
424 424 {
425 425 status = LFR_SUCCESSFUL;
426 426 }
427 427 else
428 428 {
429 429 localCoarseTime = time_management_regs->coarse_time & 0x7fffffff;
430 430
431 431 if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322
432 432 {
433 433 status = LFR_DEFAULT;
434 434 PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime)
435 435 }
436 436
437 437 if (status == LFR_SUCCESSFUL)
438 438 {
439 439 deltaCoarseTime = transitionCoarseTime - localCoarseTime;
440 440 if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323
441 441 {
442 442 status = LFR_DEFAULT;
443 443 PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime)
444 444 }
445 445 }
446 446 }
447 447
448 448 return status;
449 449 }
450 450
451 451 int stop_current_mode( void )
452 452 {
453 453 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
454 454 *
455 455 * @return RTEMS directive status codes:
456 456 * - RTEMS_SUCCESSFUL - task restarted successfully
457 457 * - RTEMS_INVALID_ID - task id invalid
458 458 * - RTEMS_ALREADY_SUSPENDED - task already suspended
459 459 *
460 460 */
461 461
462 462 rtems_status_code status;
463 463
464 464 status = RTEMS_SUCCESSFUL;
465 465
466 466 // (1) mask interruptions
467 467 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
468 468 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
469 469
470 470 // (2) clear interruptions
471 471 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
472 472 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
473 473
474 474 // (3) reset waveform picker registers
475 475 reset_wfp_burst_enable(); // reset burst and enable bits
476 476 reset_wfp_status(); // reset all the status bits
477 477
478 478 // (4) reset spectral matrices registers
479 479 set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices
480 480 set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0
481 481 reset_extractSWF(); // reset the extractSWF flag to false
482 482
483 483 // <Spectral Matrices simulator>
484 484 LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator
485 485 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
486 486 LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator
487 487 // </Spectral Matrices simulator>
488 488
489 489 // suspend several tasks
490 490 if (lfrCurrentMode != LFR_MODE_STANDBY) {
491 491 status = suspend_science_tasks();
492 492 }
493 493
494 494 if (status != RTEMS_SUCCESSFUL)
495 495 {
496 496 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
497 497 }
498 498
499 499 return status;
500 500 }
501 501
502 502 int enter_mode( unsigned char mode, unsigned int transitionCoarseTime )
503 503 {
504 504 /** This function is launched after a mode transition validation.
505 505 *
506 506 * @param mode is the mode in which LFR will be put.
507 507 *
508 508 * @return RTEMS directive status codes:
509 509 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
510 510 * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully
511 511 *
512 512 */
513 513
514 514 rtems_status_code status;
515 515
516 516 //**********************
517 517 // STOP THE CURRENT MODE
518 518 status = stop_current_mode();
519 519 if (status != RTEMS_SUCCESSFUL)
520 520 {
521 521 PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode)
522 522 }
523 523
524 524 //*************************
525 525 // ENTER THE REQUESTED MODE
526 526 if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST)
527 527 || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) )
528 528 {
529 529 #ifdef PRINT_TASK_STATISTICS
530 530 rtems_cpu_usage_reset();
531 531 maxCount = 0;
532 532 #endif
533 533 status = restart_science_tasks();
534 534 launch_waveform_picker( mode, transitionCoarseTime );
535 launch_spectral_matrix_simu( mode );
535 // launch_spectral_matrix_simu( mode );
536 536 }
537 537 else if ( mode == LFR_MODE_STANDBY )
538 538 {
539 539 #ifdef PRINT_TASK_STATISTICS
540 540 rtems_cpu_usage_report();
541 541 #endif
542 542
543 543 #ifdef PRINT_STACK_REPORT
544 544 rtems_stack_checker_report_usage();
545 545 #endif
546 546 PRINTF1("maxCount = %d\n", maxCount)
547 547 }
548 548 else
549 549 {
550 550 status = RTEMS_UNSATISFIED;
551 551 }
552 552
553 553 if (status != RTEMS_SUCCESSFUL)
554 554 {
555 555 PRINTF1("ERR *** in enter_mode *** status = %d\n", status)
556 556 status = RTEMS_UNSATISFIED;
557 557 }
558 558
559 559 return status;
560 560 }
561 561
562 562 int restart_science_tasks()
563 563 {
564 564 /** This function is used to restart all science tasks.
565 565 *
566 566 * @return RTEMS directive status codes:
567 567 * - RTEMS_SUCCESSFUL - task restarted successfully
568 568 * - RTEMS_INVALID_ID - task id invalid
569 569 * - RTEMS_INCORRECT_STATE - task never started
570 570 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
571 571 *
572 572 * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1
573 573 *
574 574 */
575 575
576 576 rtems_status_code status[6];
577 577 rtems_status_code ret;
578 578
579 579 ret = RTEMS_SUCCESSFUL;
580 580
581 581 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 );
582 582 if (status[0] != RTEMS_SUCCESSFUL)
583 583 {
584 584 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
585 585 }
586 586
587 587 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
588 588 if (status[2] != RTEMS_SUCCESSFUL)
589 589 {
590 590 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
591 591 }
592 592
593 593 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
594 594 if (status[3] != RTEMS_SUCCESSFUL)
595 595 {
596 596 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
597 597 }
598 598
599 599 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
600 600 if (status[4] != RTEMS_SUCCESSFUL)
601 601 {
602 602 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
603 603 }
604 604
605 605 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
606 606 if (status[5] != RTEMS_SUCCESSFUL)
607 607 {
608 608 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
609 609 }
610 610
611 611 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
612 612 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
613 613 {
614 614 ret = RTEMS_UNSATISFIED;
615 615 }
616 616
617 617 return ret;
618 618 }
619 619
620 620 int suspend_science_tasks()
621 621 {
622 622 /** This function suspends the science tasks.
623 623 *
624 624 * @return RTEMS directive status codes:
625 625 * - RTEMS_SUCCESSFUL - task restarted successfully
626 626 * - RTEMS_INVALID_ID - task id invalid
627 627 * - RTEMS_ALREADY_SUSPENDED - task already suspended
628 628 *
629 629 */
630 630
631 631 rtems_status_code status;
632 632
633 633 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
634 634 if (status != RTEMS_SUCCESSFUL)
635 635 {
636 636 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
637 637 }
638 638
639 639 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
640 640 {
641 641 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
642 642 if (status != RTEMS_SUCCESSFUL)
643 643 {
644 644 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
645 645 }
646 646 }
647 647
648 648 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
649 649 {
650 650 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
651 651 if (status != RTEMS_SUCCESSFUL)
652 652 {
653 653 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
654 654 }
655 655 }
656 656
657 657 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
658 658 {
659 659 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
660 660 if (status != RTEMS_SUCCESSFUL)
661 661 {
662 662 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
663 663 }
664 664 }
665 665
666 666 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
667 667 {
668 668 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
669 669 if (status != RTEMS_SUCCESSFUL)
670 670 {
671 671 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
672 672 }
673 673 }
674 674
675 675 return status;
676 676 }
677 677
678 678 void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime )
679 679 {
680 680 reset_current_ring_nodes();
681 681 reset_waveform_picker_regs();
682 682 set_wfp_burst_enable_register( mode );
683 683
684 684 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
685 685 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
686 686
687 687 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000]
688 688 if (transitionCoarseTime == 0)
689 689 {
690 690 waveform_picker_regs->start_date = time_management_regs->coarse_time;
691 691 }
692 692 else
693 693 {
694 694 waveform_picker_regs->start_date = transitionCoarseTime;
695 695 }
696 696 }
697 697
698 698 void launch_spectral_matrix( unsigned char mode )
699 699 {
700 700 reset_nb_sm_f0();
701 701 reset_current_sm_ring_nodes();
702 702 reset_spectral_matrix_regs();
703 703
704 704 struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO;
705 705 grgpio_regs->io_port_direction_register =
706 706 grgpio_regs->io_port_direction_register | 0x01; // [0001 1000], 0 = output disabled, 1 = output enabled
707 707 grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register | 0x00; // set the bit 0 to 1
708 708 set_irq_on_new_ready_matrix( 1 );
709 709 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX );
710 710 LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX );
711 711 set_run_matrix_spectral( 1 );
712 712
713 713 }
714 714
715 715 void set_irq_on_new_ready_matrix( unsigned char value )
716 716 {
717 717 if (value == 1)
718 718 {
719 719 spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01;
720 720 }
721 721 else
722 722 {
723 723 spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110
724 724 }
725 725 }
726 726
727 727 void set_run_matrix_spectral( unsigned char value )
728 728 {
729 729 if (value == 1)
730 730 {
731 731 spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1
732 732 }
733 733 else
734 734 {
735 735 spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0
736 736 }
737 737 }
738 738
739 739 void launch_spectral_matrix_simu( unsigned char mode )
740 740 {
741 741 reset_nb_sm_f0();
742 742 reset_current_sm_ring_nodes();
743 743 reset_spectral_matrix_regs();
744 744
745 745 // Spectral Matrices simulator
746 746 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
747 747 LEON_Clear_interrupt( IRQ_SM_SIMULATOR );
748 748 LEON_Unmask_interrupt( IRQ_SM_SIMULATOR );
749 749 set_local_nb_interrupt_f0_MAX();
750 750 }
751 751
752 752 //****************
753 753 // CLOSING ACTIONS
754 754 void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time )
755 755 {
756 756 /** This function is used to update the HK packets statistics after a successful TC execution.
757 757 *
758 758 * @param TC points to the TC being processed
759 759 * @param time is the time used to date the TC execution
760 760 *
761 761 */
762 762
763 763 unsigned int val;
764 764
765 765 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
766 766 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
767 767 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
768 768 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
769 769 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
770 770 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
771 771 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
772 772 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
773 773 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
774 774 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
775 775 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
776 776 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
777 777
778 778 val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1];
779 779 val++;
780 780 housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8);
781 781 housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val);
782 782 }
783 783
784 784 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time )
785 785 {
786 786 /** This function is used to update the HK packets statistics after a TC rejection.
787 787 *
788 788 * @param TC points to the TC being processed
789 789 * @param time is the time used to date the TC rejection
790 790 *
791 791 */
792 792
793 793 unsigned int val;
794 794
795 795 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
796 796 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
797 797 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
798 798 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
799 799 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
800 800 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
801 801 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
802 802 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
803 803 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
804 804 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
805 805 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
806 806 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
807 807
808 808 val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1];
809 809 val++;
810 810 housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8);
811 811 housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val);
812 812 }
813 813
814 814 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id )
815 815 {
816 816 /** This function is the last step of the TC execution workflow.
817 817 *
818 818 * @param TC points to the TC being processed
819 819 * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
820 820 * @param queue_id is the id of the RTEMS message queue used to send TM packets
821 821 * @param time is the time used to date the TC execution
822 822 *
823 823 */
824 824
825 825 unsigned char requestedMode;
826 826
827 827 if (result == LFR_SUCCESSFUL)
828 828 {
829 829 if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
830 830 &
831 831 !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
832 832 )
833 833 {
834 834 send_tm_lfr_tc_exe_success( TC, queue_id );
835 835 }
836 836 if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) )
837 837 {
838 838 //**********************************
839 839 // UPDATE THE LFRMODE LOCAL VARIABLE
840 840 requestedMode = TC->dataAndCRC[1];
841 841 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d);
842 842 updateLFRCurrentMode();
843 843 }
844 844 }
845 845 else
846 846 {
847 847 send_tm_lfr_tc_exe_error( TC, queue_id );
848 848 }
849 849 }
850 850
851 851 //***************************
852 852 // Interrupt Service Routines
853 853 rtems_isr commutation_isr1( rtems_vector_number vector )
854 854 {
855 855 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
856 856 printf("In commutation_isr1 *** Error sending event to DUMB\n");
857 857 }
858 858 }
859 859
860 860 rtems_isr commutation_isr2( rtems_vector_number vector )
861 861 {
862 862 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
863 863 printf("In commutation_isr2 *** Error sending event to DUMB\n");
864 864 }
865 865 }
866 866
867 867 //****************
868 868 // OTHER FUNCTIONS
869 869 void updateLFRCurrentMode()
870 870 {
871 871 /** This function updates the value of the global variable lfrCurrentMode.
872 872 *
873 873 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
874 874 *
875 875 */
876 876 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
877 877 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
878 878 }
879 879
General Comments 0
You need to be logged in to leave comments. Login now