##// END OF EJS Templates
Sync
paul -
r115:f4c5e8b9b4cc 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: Thu Apr 3 10:09:31 2014
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Apr 3 13:43:01 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
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=6 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS
14 14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../../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
4 CONFIG += console verbose cpu_usage_report
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 DEFINES += SW_VERSION_N4=5 # internal
14 DEFINES += SW_VERSION_N4=6 # 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-03T08:17:16. -->
3 <!-- Written by QtCreator 3.0.1, 2014-04-03T15:58:50. -->
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,632 +1,655
1 1 #ifndef CCSDS_TYPES_H_INCLUDED
2 2 #define CCSDS_TYPES_H_INCLUDED
3 3
4 4 #include "fsw_params_processing.h"
5 5
6 6 #define CCSDS_PROTOCOLE_EXTRA_BYTES 4
7 7 #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4
8 8 #define CCSDS_TM_PKT_MAX_SIZE 4412
9 9 #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4
10 10 #define CCSDS_TC_PKT_MAX_SIZE 256
11 11 #define CCSDS_TC_PKT_MIN_SIZE 16
12 12 #define CCSDS_TC_TM_PACKET_OFFSET 7
13 13 #define CCSDS_PROCESS_ID 76
14 14 #define CCSDS_PACKET_CATEGORY 12
15 15 #define CCSDS_NODE_ADDRESS 0xfe
16 16 #define CCSDS_USER_APP 0x00
17 17
18 18 #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10
19 19 #define DEFAULT_RESERVED 0x00
20 20 #define DEFAULT_HKBIA 0x1e // 0001 1110
21 21
22 22 // PACKET ID
23 23 #define TM_PACKET_ID_TC_EXE 0x0cc1 // PID 76 CAT 1
24 24 #define TM_PACKET_ID_HK 0x0cc4 // PID 76 CAT 4
25 25 #define TM_PACKET_ID_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9
26 26 #define TM_PACKET_ID_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12
27 27 #define TM_PACKET_ID_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12
28 28 #define TM_PACKET_PID_DEFAULT 76
29 29 #define TM_PACKET_PID_BURST_SBM1_SBM2 79
30 30 #define TM_PACKET_CAT_TC_EXE 1
31 31 #define TM_PACKET_CAT_HK 4
32 32 #define TM_PACKET_CAT_PARAMETER_DUMP 9
33 33 #define TM_PACKET_CAT_SCIENCE 12
34 34 #define TC_PACKET_CAT 12
35 35
36 36 // PACKET SEQUENCE CONTROL
37 37 #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000]
38 38 #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000]
39 39 #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000]
40 40 #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000]
41 41 #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000]
42 42
43 43 // DESTINATION ID
44 44 #define TM_DESTINATION_ID_GROUND 0
45 45 #define TM_DESTINATION_ID_MISSION_TIMELINE 110
46 46 #define TM_DESTINATION_ID_TC_SEQUENCES 111
47 47 #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112
48 48 #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113
49 49 #define TM_DESTINATION_ID_DIRECT_CMD 120
50 50 #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121
51 51 #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122
52 52 #define TM_DESTINATION_ID_OBCP 15
53 53 #define TM_DESTINATION_ID_SYSTEM_CONTROL 14
54 54 #define TM_DESTINATION_ID_AOCS 11
55 55
56 56 #define CCSDS_DESTINATION_ID 0x01
57 57 #define CCSDS_PROTOCOLE_ID 0x02
58 58 #define CCSDS_RESERVED 0x00
59 59 #define CCSDS_USER_APP 0x00
60 60
61 61 #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24
62 62 #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32
63 63 #define SIZE_HK_PARAMETERS 112
64 64
65 65 // TC TYPES
66 66 #define TC_TYPE_GEN 181
67 67 #define TC_TYPE_TIME 9
68 68
69 69 // TC SUBTYPES
70 70 #define TC_SUBTYPE_RESET 1
71 71 #define TC_SUBTYPE_LOAD_COMM 11
72 72 #define TC_SUBTYPE_LOAD_NORM 13
73 73 #define TC_SUBTYPE_LOAD_BURST 19
74 74 #define TC_SUBTYPE_LOAD_SBM1 25
75 75 #define TC_SUBTYPE_LOAD_SBM2 27
76 76 #define TC_SUBTYPE_DUMP 31
77 77 #define TC_SUBTYPE_ENTER 41
78 78 #define TC_SUBTYPE_UPDT_INFO 51
79 79 #define TC_SUBTYPE_EN_CAL 61
80 80 #define TC_SUBTYPE_DIS_CAL 63
81 81 #define TC_SUBTYPE_UPDT_TIME 129
82 82
83 83 // TC LEN
84 84 #define TC_LEN_RESET 12
85 85 #define TC_LEN_LOAD_COMM 14
86 86 #define TC_LEN_LOAD_NORM 22
87 87 #define TC_LEN_LOAD_BURST 14
88 88 #define TC_LEN_LOAD_SBM1 14
89 89 #define TC_LEN_LOAD_SBM2 14
90 90 #define TC_LEN_DUMP 12
91 91 #define TC_LEN_ENTER 20
92 92 #define TC_LEN_UPDT_INFO 46
93 93 #define TC_LEN_EN_CAL 12
94 94 #define TC_LEN_DIS_CAL 12
95 95 #define TC_LEN_UPDT_TIME 18
96 96
97 97 // TM TYPES
98 98 #define TM_TYPE_TC_EXE 1
99 99 #define TM_TYPE_HK 3
100 100 #define TM_TYPE_PARAMETER_DUMP 3
101 101 #define TM_TYPE_LFR_SCIENCE 21
102 102
103 103 // TM SUBTYPES
104 104 #define TM_SUBTYPE_EXE_OK 7
105 105 #define TM_SUBTYPE_EXE_NOK 8
106 106 #define TM_SUBTYPE_HK 25
107 107 #define TM_SUBTYPE_PARAMETER_DUMP 25
108 108 #define TM_SUBTYPE_SCIENCE 3
109 109 #define TM_SUBTYPE_LFR_SCIENCE 3
110 110
111 111 // FAILURE CODES
112 112 #define ILLEGAL_APID 0
113 113 #define WRONG_LEN_PKT 1
114 114 #define INCOR_CHECKSUM 2
115 115 #define ILL_TYPE 3
116 116 #define ILL_SUBTYPE 4
117 117 #define WRONG_APP_DATA 5 // 0x00 0x05
118 118 #define TC_NOT_EXE 42000 // 0xa4 0x10
119 119 #define WRONG_SRC_ID 42001 // 0xa4 0x11
120 120 #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12
121 121 #define FAIL_DETECTED 42003 // 0xa4 0x13
122 122 #define NOT_ALLOWED 42004 // 0xa4 0x14
123 123 #define CORRUPTED 42005 // 0xa4 0x15
124 124 #define CCSDS_TM_VALID 7
125 125
126 126 // TC SID
127 127 #define SID_TC_GROUND 0
128 128 #define SID_TC_MISSION_TIMELINE 110
129 129 #define SID_TC_TC_SEQUENCES 111
130 130 #define SID_TC_RECOVERY_ACTION_CMD 112
131 131 #define SID_TC_BACKUP_MISSION_TIMELINE 113
132 132 #define SID_TC_DIRECT_CMD 120
133 133 #define SID_TC_SPARE_GRD_SRC1 121
134 134 #define SID_TC_SPARE_GRD_SRC2 122
135 135 #define SID_TC_OBCP 15
136 136 #define SID_TC_SYSTEM_CONTROL 14
137 137 #define SID_TC_AOCS 11
138 138 #define SID_TC_RPW_INTERNAL 254
139 139
140 140 enum apid_destid{
141 141 GROUND,
142 142 MISSION_TIMELINE,
143 143 TC_SEQUENCES,
144 144 RECOVERY_ACTION_CMD,
145 145 BACKUP_MISSION_TIMELINE,
146 146 DIRECT_CMD,
147 147 SPARE_GRD_SRC1,
148 148 SPARE_GRD_SRC2,
149 149 OBCP,
150 150 SYSTEM_CONTROL,
151 151 AOCS,
152 152 RPW_INTERNAL
153 153 };
154 154 // SEQUENCE COUNTERS
155 155 #define SEQ_CNT_MAX 16383
156 156 #define SEQ_CNT_NB_DEST_ID 12
157 157
158 158 // TM SID
159 159 #define SID_HK 1
160 160 #define SID_PARAMETER_DUMP 10
161 161
162 162 #define SID_NORM_SWF_F0 3
163 163 #define SID_NORM_SWF_F1 4
164 164 #define SID_NORM_SWF_F2 5
165 165 #define SID_NORM_CWF_F3 1
166 166 #define SID_BURST_CWF_F2 2
167 167 #define SID_SBM1_CWF_F1 24
168 168 #define SID_SBM2_CWF_F2 25
169 169 #define SID_NORM_ASM_F0 11
170 170 #define SID_NORM_ASM_F1 12
171 171 #define SID_NORM_ASM_F2 13
172 172 #define SID_NORM_BP1_F0 14
173 173 #define SID_NORM_BP1_F1 15
174 174 #define SID_NORM_BP1_F2 16
175 175 #define SID_NORM_BP2_F0 19
176 176 #define SID_NORM_BP2_F1 20
177 177 #define SID_NORM_BP2_F2 21
178 178 #define SID_BURST_BP1_F0 17
179 179 #define SID_BURST_BP2_F0 22
180 180 #define SID_BURST_BP1_F1 18
181 181 #define SID_BURST_BP2_F1 23
182 182 #define SID_SBM1_BP1_F0 28
183 183 #define SID_SBM1_BP2_F0 31
184 184 #define SID_SBM2_BP1_F0 29
185 185 #define SID_SBM2_BP2_F0 32
186 186 #define SID_SBM2_BP1_F1 30
187 187 #define SID_SBM2_BP2_F1 33
188 188 #define SID_NORM_CWF_LONG_F3 34
189 189
190 190 // LENGTH (BYTES)
191 191 #define LENGTH_TM_LFR_TC_EXE_MAX 32
192 192 #define LENGTH_TM_LFR_HK 126
193 193
194 194 // HEADER_LENGTH
195 195 #define TM_HEADER_LEN 16
196 196 #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28
197 197 // PACKET_LENGTH
198 #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET)
199 #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET)
200 #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET)
201 #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET)
202 #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET)
203 #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET)
204 #define PACKET_LENGTH_HK (124 - CCSDS_TC_TM_PACKET_OFFSET)
205 #define PACKET_LENGTH_PARAMETER_DUMP (36 - CCSDS_TC_TM_PACKET_OFFSET)
206 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 2221 // 44 * 25 * 2 + 28 - 7
207 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 2621 // 52 * 25 * 2 + 28 - 7
208 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 2421 // 48 * 25 * 2 + 28 - 7
198 #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET)
199 #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET)
200 #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET)
201 #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET)
202 #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET)
203 #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET)
204 #define PACKET_LENGTH_HK (124 - CCSDS_TC_TM_PACKET_OFFSET)
205 #define PACKET_LENGTH_PARAMETER_DUMP (36 - CCSDS_TC_TM_PACKET_OFFSET)
206 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 (2228 - CCSDS_TC_TM_PACKET_OFFSET) // 44 * 25 * 2 + 28 - 7
207 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 (2628 - CCSDS_TC_TM_PACKET_OFFSET) // 52 * 25 * 2 + 28 - 7
208 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 (2428 - CCSDS_TC_TM_PACKET_OFFSET) // 48 * 25 * 2 + 28 - 7
209 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 (126 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 9 + 27 - 7
210 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM1_BP1_F0 (224 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 9 + 26 - 7
209 211
210 212 #define SPARE1_PUSVERSION_SPARE2 0x10
211 213
212 214 // R1
213 215 #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1
214 216 #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1
215 217 #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1
216 218 #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1
217 219 #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1
218 220 #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1
219 221 // R2
220 222 #define TM_LEN_SCI_SWF_304 3669 // 304 * 12 + 10 + 12 - 1
221 223 #define TM_LEN_SCI_SWF_224 2709 // 224 * 12 + 10 + 12 - 1
222 224 #define TM_LEN_SCI_CWF_336 4051 // 336 * 12 + 10 + 10 - 1
223 225 #define TM_LEN_SCI_CWF_672 4051 // 672 * 6 + 10 + 10 - 1
224 226 //
225 227 #define DEFAULT_PKTCNT 0x07
226 228 #define BLK_NR_304 0x0130
227 229 #define BLK_NR_224 0x00e0
228 230 #define BLK_NR_CWF 0x0150 // 336
229 231 #define BLK_NR_CWF_SHORT_F3 0x02a0 // 672
230 232
231 233 enum TM_TYPE{
232 234 TM_LFR_TC_EXE_OK,
233 235 TM_LFR_TC_EXE_ERR,
234 236 TM_LFR_HK,
235 237 TM_LFR_SCI,
236 238 TM_LFR_SCI_SBM,
237 239 TM_LFR_PAR_DUMP
238 240 };
239 241
240 242 typedef struct {
241 243 unsigned char targetLogicalAddress;
242 244 unsigned char protocolIdentifier;
243 245 unsigned char reserved;
244 246 unsigned char userApplication;
245 247 // PACKET HEADER
246 248 unsigned char packetID[2];
247 249 unsigned char packetSequenceControl[2];
248 250 unsigned char packetLength[2];
249 251 // DATA FIELD HEADER
250 252 unsigned char spare1_pusVersion_spare2;
251 253 unsigned char serviceType;
252 254 unsigned char serviceSubType;
253 255 unsigned char destinationID;
254 256 unsigned char time[6];
255 257 //
256 258 unsigned char telecommand_pkt_id[2];
257 259 unsigned char pkt_seq_control[2];
258 260 } Packet_TM_LFR_TC_EXE_SUCCESS_t;
259 261
260 262 typedef struct {
261 263 unsigned char targetLogicalAddress;
262 264 unsigned char protocolIdentifier;
263 265 unsigned char reserved;
264 266 unsigned char userApplication;
265 267 // PACKET HEADER
266 268 unsigned char packetID[2];
267 269 unsigned char packetSequenceControl[2];
268 270 unsigned char packetLength[2];
269 271 // DATA FIELD HEADER
270 272 unsigned char spare1_pusVersion_spare2;
271 273 unsigned char serviceType;
272 274 unsigned char serviceSubType;
273 275 unsigned char destinationID;
274 276 unsigned char time[6];
275 277 //
276 278 unsigned char tc_failure_code[2];
277 279 unsigned char telecommand_pkt_id[2];
278 280 unsigned char pkt_seq_control[2];
279 281 unsigned char tc_service;
280 282 unsigned char tc_subtype;
281 283 unsigned char byte_position;
282 284 unsigned char rcv_value;
283 285 } Packet_TM_LFR_TC_EXE_INCONSISTENT_t;
284 286
285 287 typedef struct {
286 288 unsigned char targetLogicalAddress;
287 289 unsigned char protocolIdentifier;
288 290 unsigned char reserved;
289 291 unsigned char userApplication;
290 292 // PACKET HEADER
291 293 unsigned char packetID[2];
292 294 unsigned char packetSequenceControl[2];
293 295 unsigned char packetLength[2];
294 296 // DATA FIELD HEADER
295 297 unsigned char spare1_pusVersion_spare2;
296 298 unsigned char serviceType;
297 299 unsigned char serviceSubType;
298 300 unsigned char destinationID;
299 301 unsigned char time[6];
300 302 //
301 303 unsigned char tc_failure_code[2];
302 304 unsigned char telecommand_pkt_id[2];
303 305 unsigned char pkt_seq_control[2];
304 306 unsigned char tc_service;
305 307 unsigned char tc_subtype;
306 308 unsigned char lfr_status_word[2];
307 309 } Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t;
308 310
309 311 typedef struct {
310 312 unsigned char targetLogicalAddress;
311 313 unsigned char protocolIdentifier;
312 314 unsigned char reserved;
313 315 unsigned char userApplication;
314 316 // PACKET HEADER
315 317 unsigned char packetID[2];
316 318 unsigned char packetSequenceControl[2];
317 319 unsigned char packetLength[2];
318 320 // DATA FIELD HEADER
319 321 unsigned char spare1_pusVersion_spare2;
320 322 unsigned char serviceType;
321 323 unsigned char serviceSubType;
322 324 unsigned char destinationID;
323 325 unsigned char time[6];
324 326 //
325 327 unsigned char tc_failure_code[2];
326 328 unsigned char telecommand_pkt_id[2];
327 329 unsigned char pkt_seq_control[2];
328 330 unsigned char tc_service;
329 331 unsigned char tc_subtype;
330 332 } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t;
331 333
332 334 typedef struct {
333 335 unsigned char targetLogicalAddress;
334 336 unsigned char protocolIdentifier;
335 337 unsigned char reserved;
336 338 unsigned char userApplication;
337 339 // PACKET HEADER
338 340 unsigned char packetID[2];
339 341 unsigned char packetSequenceControl[2];
340 342 unsigned char packetLength[2];
341 343 // DATA FIELD HEADER
342 344 unsigned char spare1_pusVersion_spare2;
343 345 unsigned char serviceType;
344 346 unsigned char serviceSubType;
345 347 unsigned char destinationID;
346 348 unsigned char time[6];
347 349 //
348 350 unsigned char tc_failure_code[2];
349 351 unsigned char telecommand_pkt_id[2];
350 352 unsigned char pkt_seq_control[2];
351 353 unsigned char tc_service;
352 354 unsigned char tc_subtype;
353 355 } Packet_TM_LFR_TC_EXE_ERROR_t;
354 356
355 357 typedef struct {
356 358 unsigned char targetLogicalAddress;
357 359 unsigned char protocolIdentifier;
358 360 unsigned char reserved;
359 361 unsigned char userApplication;
360 362 // PACKET HEADER
361 363 unsigned char packetID[2];
362 364 unsigned char packetSequenceControl[2];
363 365 unsigned char packetLength[2];
364 366 // DATA FIELD HEADER
365 367 unsigned char spare1_pusVersion_spare2;
366 368 unsigned char serviceType;
367 369 unsigned char serviceSubType;
368 370 unsigned char destinationID;
369 371 unsigned char time[6];
370 372 //
371 373 unsigned char tc_failure_code[2];
372 374 unsigned char telecommand_pkt_id[2];
373 375 unsigned char pkt_seq_control[2];
374 376 unsigned char tc_service;
375 377 unsigned char tc_subtype;
376 378 unsigned char pkt_len_rcv_value[2];
377 379 unsigned char pkt_datafieldsize_cnt[2];
378 380 unsigned char rcv_crc[2];
379 381 unsigned char computed_crc[2];
380 382 } Packet_TM_LFR_TC_EXE_CORRUPTED_t;
381 383
382 384 typedef struct {
383 385 unsigned char targetLogicalAddress;
384 386 unsigned char protocolIdentifier;
385 387 unsigned char reserved;
386 388 unsigned char userApplication;
387 389 unsigned char packetID[2];
388 390 unsigned char packetSequenceControl[2];
389 391 unsigned char packetLength[2];
390 392 // DATA FIELD HEADER
391 393 unsigned char spare1_pusVersion_spare2;
392 394 unsigned char serviceType;
393 395 unsigned char serviceSubType;
394 396 unsigned char destinationID;
395 397 unsigned char time[6];
396 398 // AUXILIARY HEADER
397 399 unsigned char sid;
398 400 unsigned char hkBIA;
399 401 unsigned char pktCnt;
400 402 unsigned char pktNr;
401 403 unsigned char acquisitionTime[6];
402 404 unsigned char blkNr[2];
403 405 } Header_TM_LFR_SCIENCE_SWF_t;
404 406
405 407 typedef struct {
406 408 unsigned char targetLogicalAddress;
407 409 unsigned char protocolIdentifier;
408 410 unsigned char reserved;
409 411 unsigned char userApplication;
410 412 unsigned char packetID[2];
411 413 unsigned char packetSequenceControl[2];
412 414 unsigned char packetLength[2];
413 415 // DATA FIELD HEADER
414 416 unsigned char spare1_pusVersion_spare2;
415 417 unsigned char serviceType;
416 418 unsigned char serviceSubType;
417 419 unsigned char destinationID;
418 420 unsigned char time[6];
419 421 // AUXILIARY DATA HEADER
420 422 unsigned char sid;
421 423 unsigned char hkBIA;
422 424 unsigned char acquisitionTime[6];
423 425 unsigned char blkNr[2];
424 426 } Header_TM_LFR_SCIENCE_CWF_t;
425 427
426 428 typedef struct {
427 429 unsigned char targetLogicalAddress;
428 430 unsigned char protocolIdentifier;
429 431 unsigned char reserved;
430 432 unsigned char userApplication;
431 433 unsigned char packetID[2];
432 434 unsigned char packetSequenceControl[2];
433 435 unsigned char packetLength[2];
434 436 // DATA FIELD HEADER
435 437 unsigned char spare1_pusVersion_spare2;
436 438 unsigned char serviceType;
437 439 unsigned char serviceSubType;
438 440 unsigned char destinationID;
439 441 unsigned char time[6];
440 442 // AUXILIARY HEADER
441 443 unsigned char sid;
442 444 unsigned char biaStatusInfo;
443 445 unsigned char pa_lfr_pkt_cnt_asm;
444 446 unsigned char pa_lfr_pkt_nr_asm;
445 447 unsigned char acquisitionTime[6];
446 448 unsigned char pa_lfr_asm_blk_nr[2];
447 449 } Header_TM_LFR_SCIENCE_ASM_t;
448 450
449 451 typedef struct {
450 452 unsigned char targetLogicalAddress;
451 453 unsigned char protocolIdentifier;
452 454 unsigned char reserved;
453 455 unsigned char userApplication;
454 456 unsigned char packetID[2];
455 457 unsigned char packetSequenceControl[2];
456 458 unsigned char packetLength[2];
457 459 // DATA FIELD HEADER
458 460 unsigned char spare1_pusVersion_spare2;
459 461 unsigned char serviceType;
460 462 unsigned char serviceSubType;
461 463 unsigned char destinationID;
462 464 unsigned char time[6];
463 465 // AUXILIARY HEADER
464 466 unsigned char sid;
465 467 unsigned char biaStatusInfo;
466 468 unsigned char acquisitionTime[6];
467 469 unsigned char spare_source_data;
468 470 unsigned char pa_lfr_bp_blk_nr[2];
469 } Header_TM_LFR_SCIENCE_BP_t;
471 } Header_TM_LFR_SCIENCE_BP_NORM_t;
472
473 typedef struct {
474 unsigned char targetLogicalAddress;
475 unsigned char protocolIdentifier;
476 unsigned char reserved;
477 unsigned char userApplication;
478 unsigned char packetID[2];
479 unsigned char packetSequenceControl[2];
480 unsigned char packetLength[2];
481 // DATA FIELD HEADER
482 unsigned char spare1_pusVersion_spare2;
483 unsigned char serviceType;
484 unsigned char serviceSubType;
485 unsigned char destinationID;
486 unsigned char time[6];
487 // AUXILIARY HEADER
488 unsigned char sid;
489 unsigned char biaStatusInfo;
490 unsigned char acquisitionTime[6];
491 unsigned char pa_lfr_bp_blk_nr[2];
492 } Header_TM_LFR_SCIENCE_BP_SBM_t;
470 493
471 494 typedef struct {
472 495 //targetLogicalAddress is removed by the grspw module
473 496 unsigned char protocolIdentifier;
474 497 unsigned char reserved;
475 498 unsigned char userApplication;
476 499 unsigned char packetID[2];
477 500 unsigned char packetSequenceControl[2];
478 501 unsigned char packetLength[2];
479 502 // DATA FIELD HEADER
480 503 unsigned char headerFlag_pusVersion_Ack;
481 504 unsigned char serviceType;
482 505 unsigned char serviceSubType;
483 506 unsigned char sourceID;
484 507 unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10];
485 508 } ccsdsTelecommandPacket_t;
486 509
487 510 typedef struct {
488 511 unsigned char targetLogicalAddress;
489 512 unsigned char protocolIdentifier;
490 513 unsigned char reserved;
491 514 unsigned char userApplication;
492 515 unsigned char packetID[2];
493 516 unsigned char packetSequenceControl[2];
494 517 unsigned char packetLength[2];
495 518 unsigned char spare1_pusVersion_spare2;
496 519 unsigned char serviceType;
497 520 unsigned char serviceSubType;
498 521 unsigned char destinationID;
499 522 unsigned char time[6];
500 523 unsigned char sid;
501 524
502 525 //**************
503 526 // HK PARAMETERS
504 527 unsigned char lfr_status_word[2];
505 528 unsigned char lfr_sw_version[4];
506 529 unsigned char lfr_fpga_version[3];
507 530 // ressource statistics
508 531 unsigned char hk_lfr_cpu_load;
509 532 unsigned char hk_lfr_load_max;
510 533 unsigned char hk_lfr_load_aver;
511 534 // tc statistics
512 535 unsigned char hk_lfr_update_info_tc_cnt[2];
513 536 unsigned char hk_lfr_update_time_tc_cnt[2];
514 537 unsigned char hk_lfr_exe_tc_cnt[2];
515 538 unsigned char hk_lfr_rej_tc_cnt[2];
516 539 unsigned char hk_lfr_last_exe_tc_id[2];
517 540 unsigned char hk_lfr_last_exe_tc_type[2];
518 541 unsigned char hk_lfr_last_exe_tc_subtype[2];
519 542 unsigned char hk_lfr_last_exe_tc_time[6];
520 543 unsigned char hk_lfr_last_rej_tc_id[2];
521 544 unsigned char hk_lfr_last_rej_tc_type[2];
522 545 unsigned char hk_lfr_last_rej_tc_subtype[2];
523 546 unsigned char hk_lfr_last_rej_tc_time[6];
524 547 // anomaly statistics
525 548 unsigned char hk_lfr_le_cnt[2];
526 549 unsigned char hk_lfr_me_cnt[2];
527 550 unsigned char hk_lfr_he_cnt[2];
528 551 unsigned char hk_lfr_last_er_rid[2];
529 552 unsigned char hk_lfr_last_er_code;
530 553 unsigned char hk_lfr_last_er_time[6];
531 554 // vhdl_blk_status
532 555 unsigned char hk_lfr_vhdl_aa_sm;
533 556 unsigned char hk_lfr_vhdl_fft_sr;
534 557 unsigned char hk_lfr_vhdl_cic_hk;
535 558 unsigned char hk_lfr_vhdl_iir_cal;
536 559 // spacewire_if_statistics
537 560 unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2];
538 561 unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2];
539 562 unsigned char hk_lfr_dpu_spw_tick_out_cnt;
540 563 unsigned char hk_lfr_dpu_spw_last_timc;
541 564 // ahb error statistics
542 565 unsigned int hk_lfr_last_fail_addr;
543 566 // temperatures
544 567 unsigned char hk_lfr_temp_scm[2];
545 568 unsigned char hk_lfr_temp_pcb[2];
546 569 unsigned char hk_lfr_temp_fpga[2];
547 570 // spacecraft potential
548 571 unsigned char hk_lfr_sc_v_f3[2];
549 572 unsigned char hk_lfr_sc_e1_f3[2];
550 573 unsigned char hk_lfr_sc_e2_f3[2];
551 574 // error counters
552 575 unsigned char hk_lfr_dpu_spw_parity;
553 576 unsigned char hk_lfr_dpu_spw_disconnect;
554 577 unsigned char hk_lfr_dpu_spw_escape;
555 578 unsigned char hk_lfr_dpu_spw_credit;
556 579 unsigned char hk_lfr_dpu_spw_write_sync;
557 580 unsigned char hk_lfr_dpu_spw_rx_ahb;
558 581 unsigned char hk_lfr_dpu_spw_tx_ahb;
559 582 unsigned char hk_lfr_dpu_spw_early_eop;
560 583 unsigned char hk_lfr_dpu_spw_invalid_addr;
561 584 unsigned char hk_lfr_dpu_spw_eep;
562 585 unsigned char hk_lfr_dpu_spw_rx_too_big;
563 586 // timecode
564 587 unsigned char hk_lfr_timecode_erroneous;
565 588 unsigned char hk_lfr_timecode_missing;
566 589 unsigned char hk_lfr_timecode_invalid;
567 590 // time
568 591 unsigned char hk_lfr_time_timecode_it;
569 592 unsigned char hk_lfr_time_not_synchro;
570 593 unsigned char hk_lfr_time_timecode_ctr;
571 594 // hk_lfr_buffer_dpu_
572 595 unsigned char hk_lfr_buffer_dpu_tc_fifo;
573 596 unsigned char hk_lfr_buffer_dpu_tm_fifo;
574 597 // hk_lfr_ahb_
575 598 unsigned char hk_lfr_ahb_correctable;
576 599 unsigned char hk_lfr_ahb_uncorrectable;
577 600 // spare
578 601 unsigned char parameters_spare;
579 602 } Packet_TM_LFR_HK_t;
580 603
581 604 typedef struct {
582 605 unsigned char targetLogicalAddress;
583 606 unsigned char protocolIdentifier;
584 607 unsigned char reserved;
585 608 unsigned char userApplication;
586 609 unsigned char packetID[2];
587 610 unsigned char packetSequenceControl[2];
588 611 unsigned char packetLength[2];
589 612 // DATA FIELD HEADER
590 613 unsigned char spare1_pusVersion_spare2;
591 614 unsigned char serviceType;
592 615 unsigned char serviceSubType;
593 616 unsigned char destinationID;
594 617 unsigned char time[6];
595 618 unsigned char sid;
596 619
597 620 //******************
598 621 // COMMON PARAMETERS
599 622 unsigned char unused0;
600 623 unsigned char bw_sp0_sp1_r0_r1;
601 624
602 625 //******************
603 626 // NORMAL PARAMETERS
604 627 unsigned char sy_lfr_n_swf_l[2];
605 628 unsigned char sy_lfr_n_swf_p[2];
606 629 unsigned char sy_lfr_n_asm_p[2];
607 630 unsigned char sy_lfr_n_bp_p0;
608 631 unsigned char sy_lfr_n_bp_p1;
609 632 unsigned char sy_lfr_n_cwf_long_f3;
610 633 unsigned char lfr_normal_parameters_spare;
611 634
612 635 //*****************
613 636 // BURST PARAMETERS
614 637 unsigned char sy_lfr_b_bp_p0;
615 638 unsigned char sy_lfr_b_bp_p1;
616 639
617 640 //****************
618 641 // SBM1 PARAMETERS
619 642 unsigned char sy_lfr_s1_bp_p0;
620 643 unsigned char sy_lfr_s1_bp_p1;
621 644
622 645 //****************
623 646 // SBM2 PARAMETERS
624 647 unsigned char sy_lfr_s2_bp_p0;
625 648 unsigned char sy_lfr_s2_bp_p1;
626 649
627 650 // SPARE
628 651 unsigned char source_data_spare;
629 652 } Packet_TM_LFR_PARAMETER_DUMP_t;
630 653
631 654
632 655 #endif // CCSDS_TYPES_H_INCLUDED
@@ -1,235 +1,257
1 1 #ifndef FSW_PARAMS_H_INCLUDED
2 2 #define FSW_PARAMS_H_INCLUDED
3 3
4 4 #include "grlib_regs.h"
5 5 #include "fsw_params_processing.h"
6 6 #include "fsw_params_nb_bytes.h"
7 7 #include "tm_byte_positions.h"
8 8 #include "ccsds_types.h"
9 9
10 10 #define GRSPW_DEVICE_NAME "/dev/grspw0"
11 11 #define UART_DEVICE_NAME "/dev/console"
12 12
13 13 typedef struct ring_node
14 14 {
15 15 struct ring_node *previous;
16 16 int buffer_address;
17 17 struct ring_node *next;
18 18 unsigned int status;
19 19 } ring_node;
20 20
21 21 typedef struct ring_node_sm
22 22 {
23 23 struct ring_node_sm *previous;
24 24 int buffer_address;
25 25 struct ring_node_sm *next;
26 26 unsigned int status;
27 27 unsigned int coarseTime;
28 28 unsigned int fineTime;
29 29 } ring_node_sm;
30 30
31 typedef struct ring_node_bp
32 {
33 struct ring_node_bp *previous;
34 struct ring_node_bp *next;
35 unsigned int status;
36 unsigned int coarseTime;
37 unsigned int fineTime;
38 Header_TM_LFR_SCIENCE_BP_SBM_t header;
39 unsigned char data[ 9 * 22 ];
40 } ring_node_bp;
41
42 typedef struct
43 {
44 unsigned int status;
45 unsigned int coarseTime;
46 unsigned int fineTime;
47 Header_TM_LFR_SCIENCE_BP_NORM_t header;
48 unsigned char data[ 9 * 22 ];
49 } ring_node_norm_bp;
50
31 51 //************************
32 52 // flight software version
33 53 // this parameters is handled by the Qt project options
34 54
35 55 #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk
36 56 #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk
37 57 #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688
38 58 #define TIME_OFFSET 2
39 59 #define TIME_OFFSET_IN_BYTES 8
40 60 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
41 61 #define NB_BYTES_SWF_BLK (2 * 6)
42 62 #define NB_WORDS_SWF_BLK 3
43 63 #define NB_BYTES_CWF3_LIGHT_BLK 6
44 64 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
45 65 #define NB_RING_NODES_F0 3 // AT LEAST 3
46 66 #define NB_RING_NODES_F1 5 // AT LEAST 3
47 67 #define NB_RING_NODES_F2 5 // AT LEAST 3
48 68
49 69 //**********
50 70 // LFR MODES
51 71 #define LFR_MODE_STANDBY 0
52 72 #define LFR_MODE_NORMAL 1
53 73 #define LFR_MODE_BURST 2
54 74 #define LFR_MODE_SBM1 3
55 75 #define LFR_MODE_SBM2 4
56 76
57 77 #define TDS_MODE_LFM 5
58 78 #define TDS_MODE_STANDBY 0
59 79 #define TDS_MODE_NORMAL 1
60 80 #define TDS_MODE_BURST 2
61 81 #define TDS_MODE_SBM1 3
62 82 #define TDS_MODE_SBM2 4
63 83
64 84 #define THR_MODE_STANDBY 0
65 85 #define THR_MODE_NORMAL 1
66 86 #define THR_MODE_BURST 2
67 87
68 88 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
69 89 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
70 90 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
71 91 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
72 92 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
73 93 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
74 94 #define RTEMS_EVENT_MODE_NORMAL_SWF_F0 RTEMS_EVENT_6
75 95 #define RTEMS_EVENT_MODE_NORMAL_SWF_F1 RTEMS_EVENT_7
76 96 #define RTEMS_EVENT_MODE_NORMAL_SWF_F2 RTEMS_EVENT_8
77 97
78 98 //****************************
79 99 // LFR DEFAULT MODE PARAMETERS
80 100 // COMMON
81 101 #define DEFAULT_SY_LFR_COMMON0 0x00
82 102 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
83 103 // NORM
84 104 #define SY_LFR_N_SWF_L 2048 // nb sample
85 105 #define SY_LFR_N_SWF_P 300 // sec
86 106 #define SY_LFR_N_ASM_P 3600 // sec
87 107 #define SY_LFR_N_BP_P0 4 // sec
88 108 #define SY_LFR_N_BP_P1 20 // sec
89 109 #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3
90 110 #define MIN_DELTA_SNAPSHOT 16 // sec
91 111 // BURST
92 112 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
93 113 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
94 114 // SBM1
95 115 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
96 116 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
97 117 // SBM2
98 118 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
99 119 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
100 120 // ADDITIONAL PARAMETERS
101 121 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
102 122 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
103 123 // STATUS WORD
104 124 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
105 125 #define DEFAULT_STATUS_WORD_BYTE1 0x00
106 126 //
107 127 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
108 128 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
109 129 //****************************
110 130
111 131 //*****************************
112 132 // APB REGISTERS BASE ADDRESSES
113 133 #define REGS_ADDR_APBUART 0x80000100
114 134 #define REGS_ADDR_GPTIMER 0x80000300
115 135 #define REGS_ADDR_GRSPW 0x80000500
116 136 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
117 137 #define REGS_ADDR_GRGPIO 0x80000b00
118 138
119 139 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
120 140 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f40
121 141
122 142 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
123 143 #define APBUART_CTRL_REG_MASK_TE 0x00000002
124 144 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
125 145
126 146 //**********
127 147 // IRQ LINES
128 148 #define IRQ_SM_SIMULATOR 9
129 149 #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels
130 150 #define IRQ_WAVEFORM_PICKER 14
131 151 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
132 152 #define IRQ_SPECTRAL_MATRIX 6
133 153 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
134 154
135 155 //*****
136 156 // TIME
137 157 #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms
138 158 #define TIMER_SM_SIMULATOR 1
139 159 #define HK_PERIOD 100 // 100 * 10ms => 1s
140 160 #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000
141 161 #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s
142 162
143 163 //**********
144 164 // LPP CODES
145 #define LFR_SUCCESSFUL 0
146 #define LFR_DEFAULT 1
165 #define LFR_SUCCESSFUL 0
166 #define LFR_DEFAULT 1
167 #define LFR_EXE_ERROR 2
147 168
148 169 //******
149 170 // RTEMS
150 171 #define TASKID_RECV 1
151 172 #define TASKID_ACTN 2
152 173 #define TASKID_SPIQ 3
153 174 #define TASKID_SMIQ 4
154 175 #define TASKID_STAT 5
155 176 #define TASKID_AVF0 6
156 177 #define TASKID_SWBD 7
157 178 #define TASKID_WFRM 8
158 179 #define TASKID_DUMB 9
159 180 #define TASKID_HOUS 10
160 181 #define TASKID_MATR 11
161 182 #define TASKID_CWF3 12
162 183 #define TASKID_CWF2 13
163 184 #define TASKID_CWF1 14
164 185 #define TASKID_SEND 15
165 186 #define TASKID_WTDG 16
166 187
167 188 #define TASK_PRIORITY_SPIQ 5
168 189 #define TASK_PRIORITY_SMIQ 10
169 190 #define TASK_PRIORITY_WTDG 20
170 191 #define TASK_PRIORITY_HOUS 30
171 192 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
172 193 #define TASK_PRIORITY_CWF2 35 //
173 194 #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it
174 195 #define TASK_PRIORITY_WFRM 40
175 196 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
176 197 #define TASK_PRIORITY_SEND 45
177 198 #define TASK_PRIORITY_RECV 50
178 199 #define TASK_PRIORITY_ACTN 50
179 200 #define TASK_PRIORITY_AVF0 60
180 201 #define TASK_PRIORITY_BPF0 60
181 202 #define TASK_PRIORITY_MATR 100
182 203 #define TASK_PRIORITY_STAT 200
183 204 #define TASK_PRIORITY_DUMB 200
184 205
185 206 #define ACTION_MSG_QUEUE_COUNT 10
186 207 #define ACTION_MSG_PKTS_COUNT 50
187 #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
208 //#define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
209 #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_TM_LFR_SCIENCE_SBM1_BP1_F0 + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
188 210 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
189 211
190 212 #define QUEUE_RECV 0
191 213 #define QUEUE_SEND 1
192 214
193 215 //*******
194 216 // MACROS
195 217 #ifdef PRINT_MESSAGES_ON_CONSOLE
196 218 #define PRINTF(x) printf(x);
197 219 #define PRINTF1(x,y) printf(x,y);
198 220 #define PRINTF2(x,y,z) printf(x,y,z);
199 221 #else
200 222 #define PRINTF(x) ;
201 223 #define PRINTF1(x,y) ;
202 224 #define PRINTF2(x,y,z) ;
203 225 #endif
204 226
205 227 #ifdef BOOT_MESSAGES
206 228 #define BOOT_PRINTF(x) printf(x);
207 229 #define BOOT_PRINTF1(x,y) printf(x,y);
208 230 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
209 231 #else
210 232 #define BOOT_PRINTF(x) ;
211 233 #define BOOT_PRINTF1(x,y) ;
212 234 #define BOOT_PRINTF2(x,y,z) ;
213 235 #endif
214 236
215 237 #ifdef DEBUG_MESSAGES
216 238 #define DEBUG_PRINTF(x) printf(x);
217 239 #define DEBUG_PRINTF1(x,y) printf(x,y);
218 240 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
219 241 #else
220 242 #define DEBUG_PRINTF(x) ;
221 243 #define DEBUG_PRINTF1(x,y) ;
222 244 #define DEBUG_PRINTF2(x,y,z) ;
223 245 #endif
224 246
225 247 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
226 248
227 249 struct param_local_str{
228 250 unsigned int local_sbm1_nb_cwf_sent;
229 251 unsigned int local_sbm1_nb_cwf_max;
230 252 unsigned int local_sbm2_nb_cwf_sent;
231 253 unsigned int local_sbm2_nb_cwf_max;
232 254 unsigned int local_nb_interrupt_f0_MAX;
233 255 };
234 256
235 257 #endif // FSW_PARAMS_H_INCLUDED
@@ -1,59 +1,53
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 #define TOTAL_SIZE_BP1_F0 99 // 11 * 9 = 99
8 #define TOTAL_SIZE_BP1_F1 117 // 13 * 9 = 117
9 #define TOTAL_SIZE_BP1_F2 108 // 12 * 9 = 108
7 #define TOTAL_SIZE_NORM_BP1_F0 99 // 11 * 9 = 99
8 #define TOTAL_SIZE_NORM_BP1_F1 117 // 13 * 9 = 117
9 #define TOTAL_SIZE_NORM_BP1_F2 108 // 12 * 9 = 108
10 #define TOTAL_SIZE_SBM1_BP1_F0 198 // 22 * 9 = 198
10 11 //
11 #define NB_RING_NODES_ASM_F0 12 // AT LEAST 3
12 #define NB_RING_NODES_ASM_F1 2 // AT LEAST 3
13 #define NB_RING_NODES_ASM_F2 2 // AT LEAST 3
12 #define NB_RING_NODES_ASM_F0 12 // AT LEAST 3
13 #define NB_RING_NODES_ASM_F1 2 // AT LEAST 3
14 #define NB_RING_NODES_ASM_F2 2 // AT LEAST 3
15 #define NB_RING_NODES_BP1_SBM1 10 // AT LEAST 3
14 16 //
15 17 #define NB_BINS_PER_ASM_F0 88
16 18 #define NB_BINS_PER_PKT_ASM_F0 44
17 19 #define TOTAL_SIZE_ASM_F0_IN_BYTES 4400 // 25 * 88 * 2
18 20 #define ASM_F0_INDICE_START 17 // 88 bins
19 21 #define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins
20 22 //
21 23 #define NB_BINS_PER_ASM_F1 104
22 24 #define NB_BINS_PER_PKT_ASM_F1 52
23 25 #define TOTAL_SIZE_ASM_F1 2600 // 25 * 104
24 26 #define ASM_F1_INDICE_START 6 // 104 bins
25 27 #define ASM_F1_INDICE_STOP 109 // 2 packets of 52 bins
26 28 //
27 29 #define NB_BINS_PER_ASM_F2 96
28 30 #define NB_BINS_PER_PKT_ASM_F2 48
29 31 #define TOTAL_SIZE_ASM_F2 2400 // 25 * 96
30 32 #define ASM_F2_INDICE_START 7 // 96 bins
31 33 #define ASM_F2_INDICE_STOP 102 // 2 packets of 48 bins
32 34 //
33 #define NB_BINS_COMPRESSED_SM_F0 11
34 #define NB_BINS_COMPRESSED_SM_F1 13
35 #define NB_BINS_COMPRESSED_SM_F2 12
35 #define NB_BINS_COMPRESSED_SM_F0 11
36 #define NB_BINS_COMPRESSED_SM_F1 13
37 #define NB_BINS_COMPRESSED_SM_F2 12
38 #define NB_BINS_COMPRESSED_SM_SBM1_F0 22
36 39 //
37 40 #define NB_BINS_TO_AVERAGE_ASM_F0 8
38 41 #define NB_BINS_TO_AVERAGE_ASM_F1 8
39 42 #define NB_BINS_TO_AVERAGE_ASM_F2 8
43 #define NB_BINS_TO_AVERAGE_ASM_SBM1_F0 4
40 44 //
41 45 #define TOTAL_SIZE_COMPRESSED_ASM_F0 275 // 11 * 25 WORDS
42 46 #define TOTAL_SIZE_COMPRESSED_ASM_F1 325 // 13 * 25 WORDS
43 47 #define TOTAL_SIZE_COMPRESSED_ASM_F2 300 // 12 * 25 WORDS
44 48 #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
47 #define NB_SM_TO_RECEIVE_BEFORE_AVF0 8
48
49 typedef struct {
50 volatile unsigned char PE[2];
51 volatile unsigned char PB[2];
52 volatile unsigned char V0;
53 volatile unsigned char V1;
54 volatile unsigned char V2_ELLIP_DOP;
55 volatile unsigned char SZ;
56 volatile unsigned char VPHI;
57 } BP1_t;
49 #define NB_AVERAGE_NORMAL_F0 384 // 96 * 4
50 #define NB_AVERAGE_SBM1_F0 24 // 24 matrices at f0 = 0.25 second
51 #define NB_SM_TO_RECEIVE_BEFORE_AVF0 8
58 52
59 53 #endif // FSW_PARAMS_PROCESSING_H
@@ -1,57 +1,64
1 1 #ifndef FSW_PROCESSING_H_INCLUDED
2 2 #define FSW_PROCESSING_H_INCLUDED
3 3
4 4 #include <rtems.h>
5 5 #include <grspw.h>
6 6 #include <math.h>
7 7 #include <stdlib.h> // abs() is in the stdlib
8 8 #include <stdio.h> // printf()
9 9 #include <math.h>
10 10
11 11 #include "fsw_params.h"
12 12 #include "fsw_spacewire.h"
13 13
14 14 extern volatile int sm_f0[ ];
15 15 extern volatile int sm_f1[ ];
16 16 extern volatile int sm_f2[ ];
17 17
18 18 // parameters
19 19 extern struct param_local_str param_local;
20 20
21 21 // registers
22 22 extern time_management_regs_t *time_management_regs;
23 23 extern spectral_matrix_regs_t *spectral_matrix_regs;
24 24
25 25 extern rtems_name misc_name[5];
26 26 extern rtems_id Task_id[20]; /* array of task ids */
27 27
28 28 void init_sm_rings( void );
29 29 void reset_current_sm_ring_nodes( void );
30 30
31 31 // ISR
32 32 void reset_nb_sm_f0( void );
33 33 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
34 34 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
35 35
36 36 // RTEMS TASKS
37 37 rtems_task avf0_task(rtems_task_argument argument);
38 38 rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator
39 39 rtems_task matr_task(rtems_task_argument argument);
40 40
41 void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1);
42 void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat);
43 //
44 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header);
45 void matrix_reset(volatile float *averaged_spec_mat);
41 //*****************************
42 // Spectral matrices processing
43
46 44 void ASM_average(float *averaged_spec_mat_f0, float *averaged_spec_mat_f1,
47 45 ring_node_sm *ring_node_tab[],
48 46 unsigned int firstTimeF0, unsigned int firstTimeF1 );
49 void ASM_reorganize( float *averaged_spec_mat, float *averaged_spec_mat_reorganized );
50 void ASM_compress( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat );
47 void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized,
48 float divider );
49 void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat,
50 float divider,
51 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart);
51 52 void ASM_convert(volatile float *input_matrix, char *output_matrix);
52 53 void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
53 54 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id);
54 void fill_averaged_spectral_matrix( void );
55 void reset_spectral_matrix_regs();
55
56 void BP1_send( ring_node_bp *ring_node_to_send, unsigned int sid, rtems_id queue_id );
57
58 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header);
59 void init_headers_bp_ring_sbm1();
60 void init_header_bp( Header_TM_LFR_SCIENCE_BP_SBM_t *header);
61
62 void reset_spectral_matrix_regs( void );
56 63
57 64 #endif // FSW_PROCESSING_H_INCLUDED
@@ -1,887 +1,704
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 ring_node_sm sm_ring_f0[NB_RING_NODES_ASM_F0];
17 ring_node_sm sm_ring_f1[NB_RING_NODES_ASM_F1];
18 ring_node_sm sm_ring_f2[NB_RING_NODES_ASM_F2];
16 ring_node_sm sm_ring_f0[ NB_RING_NODES_ASM_F0 ];
17 ring_node_sm sm_ring_f1[ NB_RING_NODES_ASM_F1 ];
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 BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ];
24 //**********************
25 // basic parameter rings
26 ring_node_bp *current_node_sbm1_bp1_f0;
27 ring_node_bp bp_ring_sbm1[ NB_RING_NODES_BP1_SBM1 ];
25 28
26 29 //*****
27 30 // NORM
28 31 // F0
29 float averaged_sm_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ];
30 float averaged_sm_f0_reorganized[ TIME_OFFSET + TOTAL_SIZE_SM ];
31 char averaged_sm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
32 float compressed_sm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_F0 ];
32 float asm_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ];
33 float asm_f0_reorganized[ TIME_OFFSET + TOTAL_SIZE_SM ];
34 char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
35 float compressed_sm_f0 [ TIME_OFFSET + TOTAL_SIZE_COMPRESSED_ASM_F0 ];
33 36
34 37 //*****
35 38 // SBM1
36 float averaged_sm_sbm1 [ TIME_OFFSET + TOTAL_SIZE_SM ];
37 float compressed_sm_sbm1 [ TOTAL_SIZE_COMPRESSED_ASM_SBM1 ];
39 float averaged_sm_sbm1 [ TIME_OFFSET + TOTAL_SIZE_SM ];
40 float compressed_sm_sbm1 [ TIME_OFFSET + TOTAL_SIZE_COMPRESSED_ASM_SBM1 ];
38 41
39 unsigned char LFR_BP1_F0[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_BP1_F0 * 2 ];
40 unsigned char LFR_BP1_F1[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_BP1_F1 ];
41 unsigned char LFR_BP1_F2[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_BP1_F2 ];
42 unsigned char LFR_BP1_F0[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_NORM_BP1_F0 * 2 ];
43 unsigned char LFR_BP1_F1[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_NORM_BP1_F1 ];
44 unsigned char LFR_BP1_F2[ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_NORM_BP1_F2 ];
42 45
43 46 unsigned int nb_sm_f0;
44 47
45 48 void init_sm_rings( void )
46 49 {
47 50 unsigned char i;
48 51
49 52 // F0 RING
50 53 sm_ring_f0[0].next = (ring_node_sm*) &sm_ring_f0[1];
51 54 sm_ring_f0[0].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_ASM_F0-1];
52 55 sm_ring_f0[0].buffer_address =
53 56 (int) &sm_f0[ 0 ];
54 57
55 58 sm_ring_f0[NB_RING_NODES_ASM_F0-1].next = (ring_node_sm*) &sm_ring_f0[0];
56 59 sm_ring_f0[NB_RING_NODES_ASM_F0-1].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_ASM_F0-2];
57 60 sm_ring_f0[NB_RING_NODES_ASM_F0-1].buffer_address =
58 61 (int) &sm_f0[ (NB_RING_NODES_ASM_F0-1) * TOTAL_SIZE_SM ];
59 62
60 63 for(i=1; i<NB_RING_NODES_ASM_F0-1; i++)
61 64 {
62 65 sm_ring_f0[i].next = (ring_node_sm*) &sm_ring_f0[i+1];
63 66 sm_ring_f0[i].previous = (ring_node_sm*) &sm_ring_f0[i-1];
64 67 sm_ring_f0[i].buffer_address =
65 68 (int) &sm_f0[ i * TOTAL_SIZE_SM ];
66 69 }
67 70
68 71 // F1 RING
69 72 sm_ring_f1[0].next = (ring_node_sm*) &sm_ring_f1[1];
70 73 sm_ring_f1[0].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_ASM_F1-1];
71 74 sm_ring_f1[0].buffer_address =
72 75 (int) &sm_f1[ 0 ];
73 76
74 77 sm_ring_f1[NB_RING_NODES_ASM_F1-1].next = (ring_node_sm*) &sm_ring_f1[0];
75 78 sm_ring_f1[NB_RING_NODES_ASM_F1-1].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_ASM_F1-2];
76 79 sm_ring_f1[NB_RING_NODES_ASM_F1-1].buffer_address =
77 80 (int) &sm_f1[ (NB_RING_NODES_ASM_F1-1) * TOTAL_SIZE_SM ];
78 81
79 82 for(i=1; i<NB_RING_NODES_ASM_F1-1; i++)
80 83 {
81 84 sm_ring_f1[i].next = (ring_node_sm*) &sm_ring_f1[i+1];
82 85 sm_ring_f1[i].previous = (ring_node_sm*) &sm_ring_f1[i-1];
83 86 sm_ring_f1[i].buffer_address =
84 87 (int) &sm_f1[ i * TOTAL_SIZE_SM ];
85 88 }
86 89
87 90 // F2 RING
88 91 sm_ring_f2[0].next = (ring_node_sm*) &sm_ring_f2[1];
89 92 sm_ring_f2[0].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_ASM_F2-1];
90 93 sm_ring_f2[0].buffer_address =
91 94 (int) &sm_f2[ 0 ];
92 95
93 96 sm_ring_f2[NB_RING_NODES_ASM_F2-1].next = (ring_node_sm*) &sm_ring_f2[0];
94 97 sm_ring_f2[NB_RING_NODES_ASM_F2-1].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_ASM_F2-2];
95 98 sm_ring_f2[NB_RING_NODES_ASM_F2-1].buffer_address =
96 99 (int) &sm_f2[ (NB_RING_NODES_ASM_F2-1) * TOTAL_SIZE_SM ];
97 100
98 101 for(i=1; i<NB_RING_NODES_ASM_F2-1; i++)
99 102 {
100 103 sm_ring_f2[i].next = (ring_node_sm*) &sm_ring_f2[i+1];
101 104 sm_ring_f2[i].previous = (ring_node_sm*) &sm_ring_f2[i-1];
102 105 sm_ring_f2[i].buffer_address =
103 106 (int) &sm_f2[ i * TOTAL_SIZE_SM ];
104 107 }
105 108
106 109 DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0)
107 110 DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1)
108 111 DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2)
109 112
110 113 spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address;
111 114 DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0)
112 115 }
113 116
114 117 void reset_current_sm_ring_nodes( void )
115 118 {
116 119 current_ring_node_sm_f0 = sm_ring_f0;
117 120 current_ring_node_sm_f1 = sm_ring_f1;
118 121 current_ring_node_sm_f2 = sm_ring_f2;
119 122
120 123 ring_node_for_averaging_sm_f0 = sm_ring_f0;
121 124 }
122 125
126 void reset_current_node_sbm1_bp1_f0( void )
127 {
128 current_node_sbm1_bp1_f0 = bp_ring_sbm1;
129 }
130
123 131 //***********************************************************
124 132 // Interrupt Service Routine for spectral matrices processing
125 133 void reset_nb_sm_f0( void )
126 134 {
127 135 nb_sm_f0 = 0;
128 136 }
129 137
130 138 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
131 139 {
132 140 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
133 141
134 142 if ( (spectral_matrix_regs->status & 0x1) == 0x01)
135 143 {
136 144 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
137 145 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
138 146 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110
139 147 nb_sm_f0 = nb_sm_f0 + 1;
140 148 }
141 149 else if ( (spectral_matrix_regs->status & 0x2) == 0x02)
142 150 {
143 151 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
144 152 spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address;
145 153 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101
146 154 nb_sm_f0 = nb_sm_f0 + 1;
147 155 }
148 156
149 157 if ( (spectral_matrix_regs->status & 0x30) != 0x00)
150 158 {
151 159 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
152 160 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111
153 161 }
154 162
155 163 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011
156 164
157 165 if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) )
158 166 {
159 167 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
160 168 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
161 169 {
162 170 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
163 171 }
164 172 nb_sm_f0 = 0;
165 173 }
166 174 else
167 175 {
168 176 nb_sm_f0 = nb_sm_f0 + 1;
169 177 }
170 178 }
171 179
172 180 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
173 181 {
174 182 if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) )
175 183 {
176 184 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
177 185 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
178 186 {
179 187 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
180 188 }
181 189 nb_sm_f0 = 0;
182 190 }
183 191 else
184 192 {
185 193 nb_sm_f0 = nb_sm_f0 + 1;
186 194 }
187 195 }
188 196
189 197 //************
190 198 // RTEMS TASKS
191 199
192 200 rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ
193 201 {
194 202 rtems_event_set event_out;
195 203
196 204 BOOT_PRINTF("in SMIQ *** \n")
197 205
198 206 while(1){
199 207 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
200 208 }
201 209 }
202 210
203 211 rtems_task avf0_task(rtems_task_argument argument)
204 212 {
205 213 int i;
206 214 static unsigned int nb_average_norm_f0;
207 215 static unsigned int nb_average_sbm1_f0;
208 216 rtems_event_set event_out;
209 217 rtems_status_code status;
210 218 ring_node_sm *ring_node_tab[8];
211 219
212 220 nb_average_norm_f0 = 0;
213 221 nb_average_sbm1_f0 = 0;
214 222
215 223 BOOT_PRINTF("in AVFO *** \n")
216 224
217 225 while(1){
218 226 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
219 227 ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0;
220 228 for ( i = 2; i < (NB_SM_TO_RECEIVE_BEFORE_AVF0+1); i++ )
221 229 {
222 230 ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous;
223 231 ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0;
224 232 }
225 233
226 // copy time information in the averaged_sm_f0 buffer
227 averaged_sm_f0[0] = ring_node_tab[7]->coarseTime;
228 averaged_sm_f0[1] = ring_node_tab[7]->fineTime;
234 // copy time information in the asm_f0 buffer
235 asm_f0[0] = ring_node_tab[7]->coarseTime;
236 asm_f0[1] = ring_node_tab[7]->fineTime;
229 237 averaged_sm_sbm1[0] = ring_node_tab[7]->coarseTime;
230 238 averaged_sm_sbm1[1] = ring_node_tab[7]->fineTime;
231 239
232 240 // compute the average and store it in the averaged_sm_f1 buffer
233 ASM_average( averaged_sm_f0, averaged_sm_sbm1,
241 ASM_average( asm_f0, averaged_sm_sbm1,
234 242 ring_node_tab,
235 243 nb_average_norm_f0, nb_average_sbm1_f0 );
236 244
237 245
238 246 // update nb_average
239 247 nb_average_norm_f0 = nb_average_norm_f0 + NB_SM_TO_RECEIVE_BEFORE_AVF0;
240 248 nb_average_sbm1_f0 = nb_average_sbm1_f0 + NB_SM_TO_RECEIVE_BEFORE_AVF0;
241 249
242 250 // launch actions depending on the current mode
243 251
244 252 if (nb_average_sbm1_f0 == NB_AVERAGE_SBM1_F0)
245 253 {
246 254 nb_average_sbm1_f0 = 0;
247 255 if (lfrCurrentMode == LFR_MODE_SBM1)
248 256 {
249 257 status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_MODE_SBM1 ); // sending an event to the task 7, BPF0
250 258 if (status != RTEMS_SUCCESSFUL)
251 259 {
252 260 printf("in AVF0 *** Error sending RTEMS_EVENT_MODE_SBM1, code %d\n", status);
253 261 }
254 262 }
255 263 }
256 264
257 265 if (nb_average_norm_f0 == NB_AVERAGE_NORMAL_F0) {
258 266 nb_average_norm_f0 = 0;
259 267 status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_MODE_NORMAL ); // sending an event to the task 7, BPF0
260 268 if (status != RTEMS_SUCCESSFUL) {
261 269 printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status);
262 270 }
263 271 }
264 272 }
265 273 }
266 274
267 275 rtems_task matr_task(rtems_task_argument argument)
268 276 {
269 277 spw_ioctl_pkt_send spw_ioctl_send_ASM;
270 278 rtems_event_set event_out;
271 279 rtems_status_code status;
272 280 rtems_id queue_id;
273 281 Header_TM_LFR_SCIENCE_ASM_t headerASM;
282 ring_node_norm_bp current_node_norm_bp1_f0;
274 283
275 284 init_header_asm( &headerASM );
285 // init_header_bp( &current_node_norm_bp1_f0.header );
276 286
277 287 status = get_message_queue_id_send( &queue_id );
278 288 if (status != RTEMS_SUCCESSFUL)
279 289 {
280 290 PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status)
281 291 }
282 292
283 293 BOOT_PRINTF("in MATR *** \n")
284 294
285 fill_averaged_spectral_matrix( );
286
287 295 while(1){
288 296 rtems_event_receive( RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1,
289 297 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
290 298 if (event_out==RTEMS_EVENT_MODE_NORMAL)
291 299 {
292 300 // 1) compress the matrix for Basic Parameters calculation
293 ASM_compress( averaged_sm_f0, 0, compressed_sm_f0 );
301 ASM_compress_reorganize_and_divide( asm_f0, compressed_sm_f0,
302 NB_AVERAGE_NORMAL_F0,
303 NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0,
304 ASM_F0_INDICE_START );
294 305 // 2) compute the BP1 set
295 306
296 307 // 3) send the BP1 set
297
298 // 4) convert the float array in a char array
299 ASM_reorganize( averaged_sm_f0, averaged_sm_f0_reorganized );
300 ASM_convert( averaged_sm_f0_reorganized, averaged_sm_f0_char);
301 // 5) send the spectral matrix packets
302 ASM_send( &headerASM, averaged_sm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
308 BP1_send( &current_node_norm_bp1_f0, SID_NORM_BP1_F0, queue_id );
309 // 4) reorganize the ASM and divide
310 ASM_reorganize_and_divide( asm_f0, asm_f0_reorganized, NB_AVERAGE_NORMAL_F0 );
311 // 5) convert the float array in a char array
312 ASM_convert( asm_f0_reorganized, asm_f0_char);
313 // 6) send the spectral matrix packets
314 ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
303 315 }
304 316 else if (event_out==RTEMS_EVENT_MODE_SBM1)
305 317 {
306 318 // 1) compress the matrix for Basic Parameters calculation
307 ASM_compress( averaged_sm_sbm1, 0, compressed_sm_sbm1 );
319 ASM_compress_reorganize_and_divide( averaged_sm_sbm1, compressed_sm_sbm1,
320 NB_AVERAGE_SBM1_F0,
321 NB_BINS_COMPRESSED_SM_SBM1_F0, NB_BINS_TO_AVERAGE_ASM_SBM1_F0,
322 ASM_F0_INDICE_START);
308 323 // 2) compute the BP1 set
309 324
310 325 // 3) send the basic parameters set 1 packet
311
326 BP1_send( current_node_sbm1_bp1_f0, SID_SBM1_BP1_F0, queue_id );
327 // 4) update current_node_sbm1_bp1_f0
328 current_node_sbm1_bp1_f0 = current_node_sbm1_bp1_f0->next;
312 329 }
313 330 else
314 331 {
315 332 PRINTF1("ERR *** in MATR *** unexect event = %x\n", (unsigned int) event_out)
316 333 }
317 334 }
318 335 }
319 336
320 337 //*****************************
321 338 // Spectral matrices processing
322 339
323 void matrix_reset(volatile float *averaged_spec_mat)
324 {
325 int i;
326 for(i=0; i<TOTAL_SIZE_SM; i++){
327 averaged_spec_mat[i] = 0;
328 }
329 }
330
331 340 void ASM_average( float *averaged_spec_mat_f0, float *averaged_spec_mat_f1,
332 341 ring_node_sm *ring_node_tab[],
333 342 unsigned int nbAverageNormF0, unsigned int nbAverageSBM1F0 )
334 343 {
335 344 float sum;
336 345 unsigned int i;
337 346
338 347 for(i=0; i<TOTAL_SIZE_SM; i++)
339 348 {
340 349 sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ]
341 350 + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ]
342 351 + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ]
343 352 + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ]
344 353 + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ]
345 354 + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ]
346 355 + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ]
347 356 + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ];
348 357
349 358 if ( (nbAverageNormF0 == 0) && (nbAverageSBM1F0 == 0) )
350 359 {
351 360 averaged_spec_mat_f0[ TIME_OFFSET + i ] = sum;
352 361 averaged_spec_mat_f1[ TIME_OFFSET + i ] = sum;
353 362 }
354 363 else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 != 0) )
355 364 {
356 365 averaged_spec_mat_f0[ TIME_OFFSET + i ] = ( averaged_spec_mat_f0[ TIME_OFFSET + i ] + sum );
357 366 averaged_spec_mat_f1[ TIME_OFFSET + i ] = ( averaged_spec_mat_f1[ TIME_OFFSET + i ] + sum );
358 367 }
359 368 else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 == 0) )
360 369 {
361 370 averaged_spec_mat_f0[ TIME_OFFSET + i ] = ( averaged_spec_mat_f0[ TIME_OFFSET + i ] + sum );
362 371 averaged_spec_mat_f1[ TIME_OFFSET + i ] = sum;
363 372 }
364 373 else
365 374 {
366 375 PRINTF2("ERR *** in ASM_average *** unexpected parameters %d %d\n", nbAverageNormF0, nbAverageSBM1F0)
367 376 }
368 377 }
369 378 }
370 379
371 void ASM_reorganize( float *averaged_spec_mat, float *averaged_spec_mat_reorganized )
380 void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider )
372 381 {
373 382 int frequencyBin;
374 383 int asmComponent;
375 384
376 385 // copy the time information
377 386 averaged_spec_mat_reorganized[ 0 ] = averaged_spec_mat[ 0 ];
378 387 averaged_spec_mat_reorganized[ 1 ] = averaged_spec_mat[ 1 ];
379 388
380 389 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
381 390 {
382 391 for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ )
383 392 {
384 393 averaged_spec_mat_reorganized[ TIME_OFFSET + frequencyBin * NB_VALUES_PER_SM + asmComponent ] =
385 averaged_spec_mat[ TIME_OFFSET + asmComponent * NB_BINS_PER_SM + frequencyBin ];
394 averaged_spec_mat[ TIME_OFFSET + asmComponent * NB_BINS_PER_SM + frequencyBin ] / divider;
386 395 }
387 396 }
388 397 }
389 398
390 void ASM_compress( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat )
399 void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider,
400 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart )
391 401 {
392 402 int frequencyBin;
393 403 int asmComponent;
394 404 int offsetASM;
395 405 int offsetCompressed;
396 406 int k;
397 407
398 switch (fChannel){
399 case 0:
400 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
408 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
409 {
410 for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ )
401 411 {
402 for( frequencyBin = 0; frequencyBin < NB_BINS_COMPRESSED_SM_F0; frequencyBin++ )
412 offsetCompressed = TIME_OFFSET
413 + frequencyBin * NB_VALUES_PER_SM
414 + asmComponent;
415 offsetASM = TIME_OFFSET
416 + asmComponent * NB_BINS_PER_SM
417 + ASMIndexStart
418 + frequencyBin * nbBinsToAverage;
419 compressed_spec_mat[ offsetCompressed ] = 0;
420 for ( k = 0; k < nbBinsToAverage; k++ )
403 421 {
404 offsetCompressed = TIME_OFFSET
405 + frequencyBin * NB_VALUES_PER_SM
406 + asmComponent;
407 offsetASM = TIME_OFFSET
408 + asmComponent * NB_BINS_PER_SM
409 + ASM_F0_INDICE_START
410 + frequencyBin * NB_BINS_TO_AVERAGE_ASM_F0;
411 compressed_spec_mat[ offsetCompressed ] = 0;
412 for ( k = 0; k < NB_BINS_TO_AVERAGE_ASM_F0; k++ )
413 {
414 compressed_spec_mat[offsetCompressed ] =
415 compressed_spec_mat[ offsetCompressed ]
416 + averaged_spec_mat[ offsetASM + k ];
417 }
422 compressed_spec_mat[offsetCompressed ] =
423 ( compressed_spec_mat[ offsetCompressed ]
424 + averaged_spec_mat[ offsetASM + k ] ) / (divider * nbBinsToAverage);
418 425 }
419 426 }
420 break;
421
422 case 1:
423 // case fChannel = f1 to be completed later
424 break;
425
426 case 2:
427 // case fChannel = f1 to be completed later
428 break;
429
430 default:
431 break;
432 427 }
433 428 }
434 429
435 430 void ASM_convert( volatile float *input_matrix, char *output_matrix)
436 431 {
437 432 unsigned int i;
438 433 unsigned int frequencyBin;
439 434 unsigned int asmComponent;
440 435 char * pt_char_input;
441 436 char * pt_char_output;
442 437
443 438 pt_char_input = (char*) &input_matrix;
444 439 pt_char_output = (char*) &output_matrix;
445 440
446 441 // copy the time information
447 442 for (i=0; i<TIME_OFFSET_IN_BYTES; i++)
448 443 {
449 444 pt_char_output[ i ] = pt_char_output[ i ];
450 445 }
451 446
452 447 // convert all other data
453 448 for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++)
454 449 {
455 450 for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++)
456 451 {
457 452 pt_char_input = (char*) &input_matrix [ (frequencyBin*NB_VALUES_PER_SM) + asmComponent + TIME_OFFSET ];
458 453 pt_char_output = (char*) &output_matrix[ 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) + TIME_OFFSET_IN_BYTES ];
459 454 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
460 455 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
461 456 }
462 457 }
463 458 }
464 459
465 460 void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
466 461 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id)
467 462 {
468 463 unsigned int i;
469 464 unsigned int length = 0;
470 465 rtems_status_code status;
471 466
472 467 for (i=0; i<2; i++)
473 468 {
474 469 // (1) BUILD THE DATA
475 470 switch(sid)
476 471 {
477 472 case SID_NORM_ASM_F0:
478 473 spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2;
479 474 spw_ioctl_send->data = &spectral_matrix[
480 475 ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2
481 476 + TIME_OFFSET_IN_BYTES
482 477 ];
483 478 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0;
484 479 header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB
485 480 header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB
486 481 break;
487 482 case SID_NORM_ASM_F1:
488 483 break;
489 484 case SID_NORM_ASM_F2:
490 485 break;
491 486 default:
492 487 PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid)
493 488 break;
494 489 }
495 490 spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES;
496 491 spw_ioctl_send->hdr = (char *) header;
497 492 spw_ioctl_send->options = 0;
498 493
499 494 // (2) BUILD THE HEADER
500 495 header->packetLength[0] = (unsigned char) (length>>8);
501 496 header->packetLength[1] = (unsigned char) (length);
502 497 header->sid = (unsigned char) sid; // SID
503 498 header->pa_lfr_pkt_cnt_asm = 2;
504 499 header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1);
505 500
506 501 // (3) SET PACKET TIME
507 502 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
508 503 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
509 504 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
510 505 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
511 506 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
512 507 header->time[5] = (unsigned char) (time_management_regs->fine_time);
513 508 //
514 509 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
515 510 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
516 511 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
517 512 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
518 513 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
519 514 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
520 515
521 516 // (4) SEND PACKET
522 517 status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
523 518 if (status != RTEMS_SUCCESSFUL) {
524 519 printf("in ASM_send *** ERR %d\n", (int) status);
525 520 }
526 521 }
527 522 }
528 523
529 void BP1_send()
524 void BP1_send( ring_node_bp *ring_node_to_send, unsigned int sid, rtems_id queue_id )
530 525 {
531
532 }
526 unsigned int length = 0;
527 rtems_status_code status;
528 unsigned char nbBytesTosend;
533 529
534 void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){
535 int i;
536 int j;
537 unsigned char tmp_u_char;
538 unsigned char * pt_char = NULL;
539 float PSDB, PSDE;
540 float NVEC_V0;
541 float NVEC_V1;
542 float NVEC_V2;
543 //float significand;
544 //int exponent;
545 float aux;
546 float tr_SB_SB;
547 float tmp;
548 float sx_re;
549 float sx_im;
550 float nebx_re = 0;
551 float nebx_im = 0;
552 float ny = 0;
553 float nz = 0;
554 float bx_bx_star = 0;
555 for(i=0; i<nb_bins_compressed_spec_mat; i++){
556 //==============================================
557 // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits
558 PSDB = compressed_spec_mat[i*30] // S11
559 + compressed_spec_mat[(i*30) + 10] // S22
560 + compressed_spec_mat[(i*30) + 18]; // S33
561 //significand = frexp(PSDB, &exponent);
562 pt_char = (unsigned char*) &PSDB;
563 LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float
564 LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float
565 //==============================================
566 // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits
567 PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44
568 + compressed_spec_mat[(i*30) + 28] * K55_pe // S55
569 + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45
570 - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45
571 pt_char = (unsigned char*) &PSDE;
572 LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float
573 LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float
574 //==============================================================================
575 // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits
576 // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits
577 // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits
578 tmp = sqrt(
579 compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12
580 +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13
581 +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23
582 );
583 NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23
584 NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13
585 NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12
586 LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127);
587 LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127);
588 pt_char = (unsigned char*) &NVEC_V2;
589 LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2
590 //=======================================================
591 // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits
592 aux = 2*tmp / PSDB; // compute the ellipticity
593 tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity
594 LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char
595 //==============================================================
596 // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits
597 for(j = 0; j<NB_VALUES_PER_SM;j++){
598 tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30]
599 + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10]
600 + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18]
601 + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2]
602 + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3]
603 + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4]
604 + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5]
605 + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12]
606 + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13];
607 }
608 aux = PSDB*PSDB;
609 tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) );
610 tmp_u_char = (unsigned char) (NVEC_V0*(8-1));
611 LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char
612 //=======================================================================================
613 // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1)
614 sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re
615 + compressed_spec_mat[(i*30) + 6] * K14_sx_re
616 + compressed_spec_mat[(i*30) + 8] * K15_sx_re
617 + compressed_spec_mat[(i*30) + 14] * K24_sx_re
618 + compressed_spec_mat[(i*30) + 16] * K25_sx_re
619 + compressed_spec_mat[(i*30) + 22] * K35_sx_re;
620 sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im
621 + compressed_spec_mat[(i*30) + 7] * K14_sx_im
622 + compressed_spec_mat[(i*30) + 9] * K15_sx_im
623 + compressed_spec_mat[(i*30) + 15] * K24_sx_im
624 + compressed_spec_mat[(i*30) + 17] * K25_sx_im
625 + compressed_spec_mat[(i*30) + 23] * K35_sx_im;
626 LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression
627 if ( abs(sx_re) > abs(sx_im) ) {
628 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx
629 }
630 else {
631 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx
632 }
633 //======================================================================
634 // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1)
635 ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2;
636 nz = NVEC_V0;
637 bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22
638 + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33
639 - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23
640 nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re
641 +compressed_spec_mat[(i*30) + 16] * K25_ny_re
642 +compressed_spec_mat[(i*30) + 20] * K34_ny_re
643 +compressed_spec_mat[(i*30) + 22] * K35_ny_re)
644 + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re
645 +compressed_spec_mat[(i*30) + 16] * K25_nz_re
646 +compressed_spec_mat[(i*30) + 20] * K34_nz_re
647 +compressed_spec_mat[(i*30) + 22] * K35_nz_re);
648 nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re
649 +compressed_spec_mat[(i*30) + 17] * K25_ny_re
650 +compressed_spec_mat[(i*30) + 21] * K34_ny_re
651 +compressed_spec_mat[(i*30) + 23] * K35_ny_re)
652 + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im
653 +compressed_spec_mat[(i*30) + 17] * K25_nz_im
654 +compressed_spec_mat[(i*30) + 21] * K34_nz_im
655 +compressed_spec_mat[(i*30) + 23] * K35_nz_im);
656 tmp = nebx_re / bx_bx_star;
657 LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression
658 if ( abs(nebx_re) > abs(nebx_im) ) {
659 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx
660 }
661 else {
662 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx
663 }
530 // (1) BUILD THE DATA
531 switch(sid)
532 {
533 case SID_NORM_BP1_F0:
534 length = PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0;
535 ring_node_to_send->header.packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
536 ring_node_to_send->header.packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
537 ring_node_to_send->header.pa_lfr_bp_blk_nr[0] = (unsigned char) ( (NB_BINS_COMPRESSED_SM_F0) >> 8 ); // BLK_NR MSB
538 ring_node_to_send->header.pa_lfr_bp_blk_nr[1] = (unsigned char) (NB_BINS_COMPRESSED_SM_F0); // BLK_NR LSB
539 nbBytesTosend = PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0
540 + CCSDS_TC_TM_PACKET_OFFSET
541 + CCSDS_PROTOCOLE_EXTRA_BYTES;
542 case SID_SBM1_BP1_F0:
543 length = PACKET_LENGTH_TM_LFR_SCIENCE_SBM1_BP1_F0;
544 ring_node_to_send->header.packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8);
545 ring_node_to_send->header.packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2);
546 ring_node_to_send->header.pa_lfr_bp_blk_nr[0] = (unsigned char) ( (NB_BINS_COMPRESSED_SM_SBM1_F0) >> 8 ); // BLK_NR MSB
547 ring_node_to_send->header.pa_lfr_bp_blk_nr[1] = (unsigned char) (NB_BINS_COMPRESSED_SM_SBM1_F0); // BLK_NR LSB
548 nbBytesTosend = PACKET_LENGTH_TM_LFR_SCIENCE_SBM1_BP1_F0
549 + CCSDS_TC_TM_PACKET_OFFSET
550 + CCSDS_PROTOCOLE_EXTRA_BYTES;
551 break;
552 default:
553 nbBytesTosend = 0;
554 PRINTF1("ERR *** in BP1_send *** unexpected sid %d\n", sid)
555 break;
664 556 }
665 557
666 }
667
668 void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){
669 // BP2 autocorrelation
670 int i;
671 int aux = 0;
558 // (2) BUILD THE HEADER
559 ring_node_to_send->header.packetLength[0] = (unsigned char) (length>>8);
560 ring_node_to_send->header.packetLength[1] = (unsigned char) (length);
561 ring_node_to_send->header.sid = sid;
672 562
673 for(i = 0; i<nb_bins_compressed_spec_mat; i++){
674 // S12
675 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]);
676 compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux;
677 compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux;
678 // S13
679 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]);
680 compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux;
681 compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux;
682 // S23
683 aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]);
684 compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux;
685 compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux;
686 // S45
687 aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]);
688 compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux;
689 compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux;
690 // S14
691 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]);
692 compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux;
693 compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux;
694 // S15
695 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]);
696 compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux;
697 compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux;
698 // S24
699 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]);
700 compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux;
701 compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux;
702 // S25
703 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]);
704 compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux;
705 compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux;
706 // S34
707 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]);
708 compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux;
709 compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux;
710 // S35
711 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]);
712 compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux;
713 compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux;
563 // (3) SET PACKET TIME
564 ring_node_to_send->header.time[0] = (unsigned char) (ring_node_to_send->coarseTime>>24);
565 ring_node_to_send->header.time[1] = (unsigned char) (ring_node_to_send->coarseTime>>16);
566 ring_node_to_send->header.time[2] = (unsigned char) (ring_node_to_send->coarseTime>>8);
567 ring_node_to_send->header.time[3] = (unsigned char) (ring_node_to_send->coarseTime);
568 ring_node_to_send->header.time[4] = (unsigned char) (ring_node_to_send->fineTime>>8);
569 ring_node_to_send->header.time[5] = (unsigned char) (ring_node_to_send->fineTime);
570 //
571 ring_node_to_send->header.acquisitionTime[0] = (unsigned char) (ring_node_to_send->coarseTime>>24);
572 ring_node_to_send->header.acquisitionTime[1] = (unsigned char) (ring_node_to_send->coarseTime>>16);
573 ring_node_to_send->header.acquisitionTime[2] = (unsigned char) (ring_node_to_send->coarseTime>>8);
574 ring_node_to_send->header.acquisitionTime[3] = (unsigned char) (ring_node_to_send->coarseTime);
575 ring_node_to_send->header.acquisitionTime[4] = (unsigned char) (ring_node_to_send->fineTime>>8);
576 ring_node_to_send->header.acquisitionTime[5] = (unsigned char) (ring_node_to_send->fineTime);
577
578 // (4) SEND PACKET
579 status = rtems_message_queue_send( queue_id, &ring_node_to_send->header, nbBytesTosend);
580 if (status != RTEMS_SUCCESSFUL)
581 {
582 printf("ERR *** in BP1_send *** ERR %d\n", (int) status);
714 583 }
715 584 }
716 585
717 586 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header)
718 587 {
719 588 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
720 589 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
721 590 header->reserved = 0x00;
722 591 header->userApplication = CCSDS_USER_APP;
723 592 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
724 593 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
725 594 header->packetSequenceControl[0] = 0xc0;
726 595 header->packetSequenceControl[1] = 0x00;
727 596 header->packetLength[0] = 0x00;
728 597 header->packetLength[1] = 0x00;
729 598 // DATA FIELD HEADER
730 599 header->spare1_pusVersion_spare2 = 0x10;
731 600 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
732 601 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
733 602 header->destinationID = TM_DESTINATION_ID_GROUND;
734 603 // AUXILIARY DATA HEADER
735 604 header->sid = 0x00;
736 605 header->biaStatusInfo = 0x00;
737 606 header->pa_lfr_pkt_cnt_asm = 0x00;
738 607 header->pa_lfr_pkt_nr_asm = 0x00;
739 608 header->time[0] = 0x00;
740 609 header->time[0] = 0x00;
741 610 header->time[0] = 0x00;
742 611 header->time[0] = 0x00;
743 612 header->time[0] = 0x00;
744 613 header->time[0] = 0x00;
745 614 header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB
746 615 header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB
747 616 }
748 617
749 void init_header_bp( Header_TM_LFR_SCIENCE_BP_t *header)
618 void init_bp_ring_sbm1()
619 {
620 unsigned int i;
621
622 //********
623 // F0 RING
624 bp_ring_sbm1[0].next = (ring_node_bp*) &bp_ring_sbm1[1];
625 bp_ring_sbm1[0].previous = (ring_node_bp*) &bp_ring_sbm1[NB_RING_NODES_BP1_SBM1-1];
626
627 bp_ring_sbm1[NB_RING_NODES_BP1_SBM1-1].next = (ring_node_bp*) &bp_ring_sbm1[0];
628 bp_ring_sbm1[NB_RING_NODES_BP1_SBM1-1].previous = (ring_node_bp*) &bp_ring_sbm1[NB_RING_NODES_ASM_F0-2];
629
630 for(i=1; i<NB_RING_NODES_BP1_SBM1-1; i++)
631 {
632 bp_ring_sbm1[i].next = (ring_node_bp*) &bp_ring_sbm1[i+1];
633 bp_ring_sbm1[i].previous = (ring_node_bp*) &bp_ring_sbm1[i-1];
634 }
635 //
636 //********
637
638 for (i=0; i<NB_RING_NODES_BP1_SBM1; i++)
639 {
640 init_header_bp( (Header_TM_LFR_SCIENCE_BP_SBM_t*) &bp_ring_sbm1[ i ] );
641 bp_ring_sbm1[ i ].status = 0;
642 }
643 }
644
645 void init_header_bp(Header_TM_LFR_SCIENCE_BP_SBM_t *header )
750 646 {
751 647 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
752 648 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
753 649 header->reserved = 0x00;
754 650 header->userApplication = CCSDS_USER_APP;
755 // header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
756 // header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
651 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8);
652 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2);
757 653 header->packetSequenceControl[0] = 0xc0;
758 654 header->packetSequenceControl[1] = 0x00;
759 655 header->packetLength[0] = 0x00;
760 656 header->packetLength[1] = 0x00;
761 657 // DATA FIELD HEADER
762 658 header->spare1_pusVersion_spare2 = 0x10;
763 659 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
764 660 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
765 661 header->destinationID = TM_DESTINATION_ID_GROUND;
766 662 // AUXILIARY DATA HEADER
767 663 header->sid = 0x00;
768 664 header->biaStatusInfo = 0x00;
769 665 header->time[0] = 0x00;
770 666 header->time[0] = 0x00;
771 667 header->time[0] = 0x00;
772 668 header->time[0] = 0x00;
773 669 header->time[0] = 0x00;
774 670 header->time[0] = 0x00;
775 671 header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB
776 672 header->pa_lfr_bp_blk_nr[1] = 0x00; // BLK_NR LSB
777 673 }
778 674
779 void fill_averaged_spectral_matrix(void)
780 {
781 /** This function fills spectral matrices related buffers with arbitrary data.
782 *
783 * This function is for testing purpose only.
784 *
785 */
786
787 float offset;
788 float coeff;
789
790 offset = 10.;
791 coeff = 100000.;
792 averaged_sm_f0[ 0 + 25 * 0 ] = 0. + offset;
793 averaged_sm_f0[ 0 + 25 * 1 ] = 1. + offset;
794 averaged_sm_f0[ 0 + 25 * 2 ] = 2. + offset;
795 averaged_sm_f0[ 0 + 25 * 3 ] = 3. + offset;
796 averaged_sm_f0[ 0 + 25 * 4 ] = 4. + offset;
797 averaged_sm_f0[ 0 + 25 * 5 ] = 5. + offset;
798 averaged_sm_f0[ 0 + 25 * 6 ] = 6. + offset;
799 averaged_sm_f0[ 0 + 25 * 7 ] = 7. + offset;
800 averaged_sm_f0[ 0 + 25 * 8 ] = 8. + offset;
801 averaged_sm_f0[ 0 + 25 * 9 ] = 9. + offset;
802 averaged_sm_f0[ 0 + 25 * 10 ] = 10. + offset;
803 averaged_sm_f0[ 0 + 25 * 11 ] = 11. + offset;
804 averaged_sm_f0[ 0 + 25 * 12 ] = 12. + offset;
805 averaged_sm_f0[ 0 + 25 * 13 ] = 13. + offset;
806 averaged_sm_f0[ 0 + 25 * 14 ] = 14. + offset;
807 averaged_sm_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff;
808 averaged_sm_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff;
809 averaged_sm_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff;
810 averaged_sm_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff;
811 averaged_sm_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff;
812 averaged_sm_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff;
813 averaged_sm_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff;
814 averaged_sm_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff;
815 averaged_sm_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff;
816 averaged_sm_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff;
817 averaged_sm_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff;
818 averaged_sm_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff;
819 averaged_sm_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff;
820 averaged_sm_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff;
821 averaged_sm_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff;
822
823 offset = 10000000;
824 averaged_sm_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff;
825 averaged_sm_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff;
826 averaged_sm_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff;
827 averaged_sm_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff;
828 averaged_sm_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff;
829 averaged_sm_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff;
830 averaged_sm_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff;
831 averaged_sm_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff;
832 averaged_sm_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff;
833 averaged_sm_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff;
834 averaged_sm_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff;
835 averaged_sm_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff;
836 averaged_sm_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff;
837 averaged_sm_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff;
838 averaged_sm_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff;
839
840 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_sm_f0[ 0 ];
841 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_sm_f0[ 1 ];
842 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_sm_f0[ 2 ];
843 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_sm_f0[ 3 ];
844 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_sm_f0[ 4 ];
845 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_sm_f0[ 5 ];
846 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_sm_f0[ 6 ];
847 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_sm_f0[ 7 ];
848 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_sm_f0[ 8 ];
849 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_sm_f0[ 9 ];
850 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_sm_f0[ 10 ];
851 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_sm_f0[ 11 ];
852 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_sm_f0[ 12 ];
853 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_sm_f0[ 13 ];
854 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_sm_f0[ 14 ];
855 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_sm_f0[ 15 ];
856 }
857
858 void reset_spectral_matrix_regs()
675 void reset_spectral_matrix_regs( void )
859 676 {
860 677 /** This function resets the spectral matrices module registers.
861 678 *
862 679 * The registers affected by this function are located at the following offset addresses:
863 680 *
864 681 * - 0x00 config
865 682 * - 0x04 status
866 683 * - 0x08 matrixF0_Address0
867 684 * - 0x10 matrixFO_Address1
868 685 * - 0x14 matrixF1_Address
869 686 * - 0x18 matrixF2_Address
870 687 *
871 688 */
872 689
873 690 spectral_matrix_regs->config = 0x00;
874 691 spectral_matrix_regs->status = 0x00;
875 692
876 693 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
877 694 spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address;
878 695 spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address;
879 696 spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address;
880 697 }
881 698
882 699 //******************
883 700 // general functions
884 701
885 702
886 703
887 704
@@ -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 else
845 else if (result == LFR_EXE_ERROR)
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