##// END OF EJS Templates
Sync
paul -
r99:ef2b18a5a9ab 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: Mon Feb 17 07:55:25 2014
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Wed Feb 19 13:04:42 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=1 -DPRINT_MESSAGES_ON_CONSOLE
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=2 -DPRINT_MESSAGES_ON_CONSOLE -DDEBUG_MESSAGES -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,78 +1,78
1 1 TEMPLATE = app
2 2 # CONFIG += console v8 sim
3 3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report
4 CONFIG += console verbose
4 CONFIG += console verbose cpu_usage_report debug_messages
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=1 # internal
14 DEFINES += SW_VERSION_N4=2 # internal
15 15
16 16 contains( CONFIG, verbose ) {
17 17 DEFINES += PRINT_MESSAGES_ON_CONSOLE
18 18 }
19 19
20 20 contains( CONFIG, debug_messages ) {
21 21 DEFINES += DEBUG_MESSAGES
22 22 }
23 23
24 24 contains( CONFIG, cpu_usage_report ) {
25 25 DEFINES += PRINT_TASK_STATISTICS
26 26 }
27 27
28 28 contains( CONFIG, stack_report ) {
29 29 DEFINES += PRINT_STACK_REPORT
30 30 }
31 31
32 32 contains( CONFIG, boot_messages ) {
33 33 DEFINES += BOOT_MESSAGES
34 34 }
35 35
36 36 #doxygen.target = doxygen
37 37 #doxygen.commands = doxygen ../doc/Doxyfile
38 38 #QMAKE_EXTRA_TARGETS += doxygen
39 39
40 40 TARGET = fsw
41 41
42 42 INCLUDEPATH += \
43 43 ../src \
44 44 ../header \
45 45 ../../LFR_basic-parameters
46 46
47 47 SOURCES += \
48 48 ../src/wf_handler.c \
49 49 ../src/tc_handler.c \
50 50 ../src/fsw_processing.c \
51 51 ../src/fsw_misc.c \
52 52 ../src/fsw_init.c \
53 53 ../src/fsw_globals.c \
54 54 ../src/fsw_spacewire.c \
55 55 ../src/tc_load_dump_parameters.c \
56 56 ../src/tm_lfr_tc_exe.c \
57 57 ../src/tc_acceptance.c \
58 58 ../../LFR_basic-parameters/basic_parameters.c
59 59
60 60
61 61 HEADERS += \
62 62 ../header/wf_handler.h \
63 63 ../header/tc_handler.h \
64 64 ../header/grlib_regs.h \
65 65 ../header/fsw_processing.h \
66 66 ../header/fsw_params.h \
67 67 ../header/fsw_misc.h \
68 68 ../header/fsw_init.h \
69 69 ../header/ccsds_types.h \
70 70 ../header/fsw_params_processing.h \
71 71 ../header/fsw_spacewire.h \
72 72 ../header/tm_byte_positions.h \
73 73 ../header/tc_load_dump_parameters.h \
74 74 ../header/tm_lfr_tc_exe.h \
75 75 ../header/tc_acceptance.h \
76 76 ../header/fsw_params_nb_bytes.h \
77 77 ../../LFR_basic-parameters/basic_parameters.h
78 78
@@ -1,339 +1,339
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 3.0.0, 2014-02-14T07:07:03. -->
3 <!-- Written by QtCreator 3.0.0, 2014-02-19T07:19:44. -->
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,605 +1,612
1 1 #ifndef CCSDS_TYPES_H_INCLUDED
2 2 #define CCSDS_TYPES_H_INCLUDED
3 3
4 #include "fsw_params_processing.h"
5
4 6 #define CCSDS_PROTOCOLE_EXTRA_BYTES 4
5 7 #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4
6 8 #define CCSDS_TM_PKT_MAX_SIZE 4412
7 9 #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4
8 10 #define CCSDS_TC_PKT_MAX_SIZE 256
9 11 #define CCSDS_TC_PKT_MIN_SIZE 16
10 12 #define CCSDS_TC_TM_PACKET_OFFSET 7
11 13 #define CCSDS_PROCESS_ID 76
12 14 #define CCSDS_PACKET_CATEGORY 12
13 15 #define CCSDS_NODE_ADDRESS 0xfe
14 16 #define CCSDS_USER_APP 0x00
15 17
16 18 #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10
17 19 #define DEFAULT_RESERVED 0x00
18 20 #define DEFAULT_HKBIA 0x1e // 0001 1110
19 21
20 22 // PACKET ID
21 23 #define TM_PACKET_ID_TC_EXE 0x0cc1 // PID 76 CAT 1
22 24 #define TM_PACKET_ID_HK 0x0cc4 // PID 76 CAT 4
23 25 #define TM_PACKET_ID_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9
24 26 #define TM_PACKET_ID_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12
25 27 #define TM_PACKET_ID_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12
26 28 #define TM_PACKET_PID_DEFAULT 76
27 29 #define TM_PACKET_PID_BURST_SBM1_SBM2 79
28 30 #define TM_PACKET_CAT_TC_EXE 1
29 31 #define TM_PACKET_CAT_HK 4
30 32 #define TM_PACKET_CAT_PARAMETER_DUMP 9
31 33 #define TM_PACKET_CAT_SCIENCE 12
32 34
33 35 // PACKET SEQUENCE CONTROL
34 36 #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000]
35 37 #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000]
36 38 #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000]
37 39 #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000]
38 40 #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000]
39 41
40 42 // DESTINATION ID
41 43 #define TM_DESTINATION_ID_GROUND 0
42 44 #define TM_DESTINATION_ID_MISSION_TIMELINE 110
43 45 #define TM_DESTINATION_ID_TC_SEQUENCES 111
44 46 #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112
45 47 #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113
46 48 #define TM_DESTINATION_ID_DIRECT_CMD 120
47 49 #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121
48 50 #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122
49 51 #define TM_DESTINATION_ID_OBCP 15
50 52 #define TM_DESTINATION_ID_SYSTEM_CONTROL 14
51 53 #define TM_DESTINATION_ID_AOCS 11
52 54
53 55 #define CCSDS_DESTINATION_ID 0x01
54 56 #define CCSDS_PROTOCOLE_ID 0x02
55 57 #define CCSDS_RESERVED 0x00
56 58 #define CCSDS_USER_APP 0x00
57 59
58 60 #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24
59 61 #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32
60 62 #define SIZE_HK_PARAMETERS 112
61 63
62 64 // TC TYPES
63 65 #define TC_TYPE_GEN 181
64 66 #define TC_TYPE_TIME 9
65 67
66 68 // TC SUBTYPES
67 69 #define TC_SUBTYPE_RESET 1
68 70 #define TC_SUBTYPE_LOAD_COMM 11
69 71 #define TC_SUBTYPE_LOAD_NORM 13
70 72 #define TC_SUBTYPE_LOAD_BURST 19
71 73 #define TC_SUBTYPE_LOAD_SBM1 25
72 74 #define TC_SUBTYPE_LOAD_SBM2 27
73 75 #define TC_SUBTYPE_DUMP 31
74 76 #define TC_SUBTYPE_ENTER 41
75 77 #define TC_SUBTYPE_UPDT_INFO 51
76 78 #define TC_SUBTYPE_EN_CAL 61
77 79 #define TC_SUBTYPE_DIS_CAL 63
78 80 #define TC_SUBTYPE_UPDT_TIME 129
79 81
80 82 // TC LEN
81 83 #define TC_LEN_RESET 12
82 84 #define TC_LEN_LOAD_COMM 14
83 85 #define TC_LEN_LOAD_NORM 22
84 86 #define TC_LEN_LOAD_BURST 14
85 87 #define TC_LEN_LOAD_SBM1 14
86 88 #define TC_LEN_LOAD_SBM2 14
87 89 #define TC_LEN_DUMP 12
88 90 #define TC_LEN_ENTER 20
89 91 #define TC_LEN_UPDT_INFO 46
90 92 #define TC_LEN_EN_CAL 12
91 93 #define TC_LEN_DIS_CAL 12
92 94 #define TC_LEN_UPDT_TIME 18
93 95
94 96 // TM TYPES
95 97 #define TM_TYPE_TC_EXE 1
96 98 #define TM_TYPE_HK 3
97 99 #define TM_TYPE_PARAMETER_DUMP 3
98 100 #define TM_TYPE_LFR_SCIENCE 21
99 101
100 102 // TM SUBTYPES
101 103 #define TM_SUBTYPE_EXE_OK 7
102 104 #define TM_SUBTYPE_EXE_NOK 8
103 105 #define TM_SUBTYPE_HK 25
104 106 #define TM_SUBTYPE_PARAMETER_DUMP 25
105 107 #define TM_SUBTYPE_SCIENCE 3
106 108 #define TM_SUBTYPE_LFR_SCIENCE 3
107 109
108 110 // FAILURE CODES
109 111 #define ILLEGAL_APID 0
110 112 #define WRONG_LEN_PKT 1
111 113 #define INCOR_CHECKSUM 2
112 114 #define ILL_TYPE 3
113 115 #define ILL_SUBTYPE 4
114 116 #define WRONG_APP_DATA 5 // 0x00 0x05
115 117 #define TC_NOT_EXE 42000 // 0xa4 0x10
116 118 #define WRONG_SRC_ID 42001 // 0xa4 0x11
117 119 #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12
118 120 #define FAIL_DETECTED 42003 // 0xa4 0x13
119 121 #define NOT_ALLOWED 42004 // 0xa4 0x14
120 122 #define CORRUPTED 42005 // 0xa4 0x15
121 123 #define CCSDS_TM_VALID 7
122 124
123 125 // TC SID
124 126 #define SID_TC_GROUND 0
125 127 #define SID_TC_MISSION_TIMELINE 110
126 128 #define SID_TC_TC_SEQUENCES 111
127 129 #define SID_TC_RECOVERY_ACTION_CMD 112
128 130 #define SID_TC_BACKUP_MISSION_TIMELINE 113
129 131 #define SID_TC_DIRECT_CMD 120
130 132 #define SID_TC_SPARE_GRD_SRC1 121
131 133 #define SID_TC_SPARE_GRD_SRC2 122
132 134 #define SID_TC_OBCP 15
133 135 #define SID_TC_SYSTEM_CONTROL 14
134 136 #define SID_TC_AOCS 11
135 137 #define SID_TC_RPW_INTERNAL 254
136 138
137 139 enum apid_destid{
138 140 GROUND,
139 141 MISSION_TIMELINE,
140 142 TC_SEQUENCES,
141 143 RECOVERY_ACTION_CMD,
142 144 BACKUP_MISSION_TIMELINE,
143 145 DIRECT_CMD,
144 146 SPARE_GRD_SRC1,
145 147 SPARE_GRD_SRC2,
146 148 OBCP,
147 149 SYSTEM_CONTROL,
148 150 AOCS,
149 151 RPW_INTERNAL
150 152 };
151 153 // SEQUENCE COUNTERS
152 154 #define SEQ_CNT_MAX 16383
153 155 #define SEQ_CNT_NB_DEST_ID 12
154 156
155 157 // TM SID
156 158 #define SID_HK 1
157 159 #define SID_PARAMETER_DUMP 10
158 160
159 161 #define SID_NORM_SWF_F0 3
160 162 #define SID_NORM_SWF_F1 4
161 163 #define SID_NORM_SWF_F2 5
162 164 #define SID_NORM_CWF_F3 1
163 165 #define SID_BURST_CWF_F2 2
164 166 #define SID_SBM1_CWF_F1 24
165 167 #define SID_SBM2_CWF_F2 25
166 168 #define SID_NORM_ASM_F0 11
167 169 #define SID_NORM_ASM_F1 12
168 170 #define SID_NORM_ASM_F2 13
169 171 #define SID_NORM_BP1_F0 14
170 172 #define SID_NORM_BP1_F1 15
171 173 #define SID_NORM_BP1_F2 16
172 174 #define SID_NORM_BP2_F0 19
173 175 #define SID_NORM_BP2_F1 20
174 176 #define SID_NORM_BP2_F2 21
175 177 #define SID_BURST_BP1_F0 17
176 178 #define SID_BURST_BP2_F0 22
177 179 #define SID_BURST_BP1_F1 18
178 180 #define SID_BURST_BP2_F1 23
179 181 #define SID_SBM1_BP1_F0 28
180 182 #define SID_SBM1_BP2_F0 31
181 183 #define SID_SBM2_BP1_F0 29
182 184 #define SID_SBM2_BP2_F0 32
183 185 #define SID_SBM2_BP1_F1 30
184 186 #define SID_SBM2_BP2_F1 33
185 187 #define SID_NORM_CWF_LONG_F3 34
186 188
187 189 // LENGTH (BYTES)
188 190 #define LENGTH_TM_LFR_TC_EXE_MAX 32
189 191 #define LENGTH_TM_LFR_HK 126
190 192
191 193 // HEADER_LENGTH
192 194 #define TM_HEADER_LEN 16
193 195 #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28
194 196 // PACKET_LENGTH
195 197 #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET)
196 198 #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET)
197 199 #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET)
198 200 #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET)
199 201 #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET)
200 202 #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET)
201 #define PACKET_LENGTH_HK (126 - CCSDS_TC_TM_PACKET_OFFSET)
202 #define PACKET_LENGTH_PARAMETER_DUMP (34 - CCSDS_TC_TM_PACKET_OFFSET)
203 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM (TOTAL_SIZE_SM + HEADER_LENGTH_TM_LFR_SCIENCE_ASM - CCSDS_TC_TM_PACKET_OFFSET)
203 #define PACKET_LENGTH_HK (124 - CCSDS_TC_TM_PACKET_OFFSET)
204 #define PACKET_LENGTH_PARAMETER_DUMP (36 - CCSDS_TC_TM_PACKET_OFFSET)
205 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 (TOTAL_SIZE_ASM_F0 + HEADER_LENGTH_TM_LFR_SCIENCE_ASM - CCSDS_TC_TM_PACKET_OFFSET)
206 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 (TOTAL_SIZE_ASM_F1 + HEADER_LENGTH_TM_LFR_SCIENCE_ASM - CCSDS_TC_TM_PACKET_OFFSET)
207 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 (TOTAL_SIZE_ASM_F2 + HEADER_LENGTH_TM_LFR_SCIENCE_ASM - CCSDS_TC_TM_PACKET_OFFSET)
204 208
205 209 #define SPARE1_PUSVERSION_SPARE2 0x10
206 210
207 211 #define LEN_TM_LFR_HK 130 // 126 + 4
208 212 #define LEN_TM_LFR_TC_EXE_NOT_IMP 28 // 24 + 4
209 213
210 214 // R1
211 215 #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1
212 216 #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1
213 217 #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1
214 218 #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1
215 219 #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1
216 220 #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1
217 221 // R2
218 222 #define TM_LEN_SCI_SWF_304 3669 // 304 * 12 + 10 + 12 - 1
219 223 #define TM_LEN_SCI_SWF_224 2709 // 224 * 12 + 10 + 12 - 1
220 224 #define TM_LEN_SCI_CWF_336 4051 // 336 * 12 + 10 + 10 - 1
221 225 #define TM_LEN_SCI_CWF_672 4051 // 672 * 6 + 10 + 10 - 1
222 226 //
223 227 #define DEFAULT_PKTCNT 0x07
224 228 #define BLK_NR_304 0x0130
225 229 #define BLK_NR_224 0x00e0
226 230 #define BLK_NR_CWF 0x0150 // 336
227 231 #define BLK_NR_CWF_SHORT_F3 0x02a0 // 672
228 232
229 233 enum TM_TYPE{
230 234 TM_LFR_TC_EXE_OK,
231 235 TM_LFR_TC_EXE_ERR,
232 236 TM_LFR_HK,
233 237 TM_LFR_SCI,
234 238 TM_LFR_SCI_SBM,
235 239 TM_LFR_PAR_DUMP
236 240 };
237 241
238 242 typedef struct {
239 243 unsigned char targetLogicalAddress;
240 244 unsigned char protocolIdentifier;
241 245 unsigned char reserved;
242 246 unsigned char userApplication;
243 247 // PACKET HEADER
244 248 unsigned char packetID[2];
245 249 unsigned char packetSequenceControl[2];
246 250 unsigned char packetLength[2];
247 251 // DATA FIELD HEADER
248 252 unsigned char spare1_pusVersion_spare2;
249 253 unsigned char serviceType;
250 254 unsigned char serviceSubType;
251 255 unsigned char destinationID;
252 256 unsigned char time[6];
253 257 //
254 258 unsigned char telecommand_pkt_id[2];
255 259 unsigned char pkt_seq_control[2];
256 260 } Packet_TM_LFR_TC_EXE_SUCCESS_t;
257 261
258 262 typedef struct {
259 263 unsigned char targetLogicalAddress;
260 264 unsigned char protocolIdentifier;
261 265 unsigned char reserved;
262 266 unsigned char userApplication;
263 267 // PACKET HEADER
264 268 unsigned char packetID[2];
265 269 unsigned char packetSequenceControl[2];
266 270 unsigned char packetLength[2];
267 271 // DATA FIELD HEADER
268 272 unsigned char spare1_pusVersion_spare2;
269 273 unsigned char serviceType;
270 274 unsigned char serviceSubType;
271 275 unsigned char destinationID;
272 276 unsigned char time[6];
273 277 //
274 278 unsigned char tc_failure_code[2];
275 279 unsigned char telecommand_pkt_id[2];
276 280 unsigned char pkt_seq_control[2];
277 281 unsigned char tc_service;
278 282 unsigned char tc_subtype;
279 283 unsigned char byte_position;
280 284 unsigned char rcv_value;
281 285 } Packet_TM_LFR_TC_EXE_INCONSISTENT_t;
282 286
283 287 typedef struct {
284 288 unsigned char targetLogicalAddress;
285 289 unsigned char protocolIdentifier;
286 290 unsigned char reserved;
287 291 unsigned char userApplication;
288 292 // PACKET HEADER
289 293 unsigned char packetID[2];
290 294 unsigned char packetSequenceControl[2];
291 295 unsigned char packetLength[2];
292 296 // DATA FIELD HEADER
293 297 unsigned char spare1_pusVersion_spare2;
294 298 unsigned char serviceType;
295 299 unsigned char serviceSubType;
296 300 unsigned char destinationID;
297 301 unsigned char time[6];
298 302 //
299 303 unsigned char tc_failure_code[2];
300 304 unsigned char telecommand_pkt_id[2];
301 305 unsigned char pkt_seq_control[2];
302 306 unsigned char tc_service;
303 307 unsigned char tc_subtype;
304 308 unsigned char lfr_status_word[2];
305 309 } Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t;
306 310
307 311 typedef struct {
308 312 unsigned char targetLogicalAddress;
309 313 unsigned char protocolIdentifier;
310 314 unsigned char reserved;
311 315 unsigned char userApplication;
312 316 // PACKET HEADER
313 317 unsigned char packetID[2];
314 318 unsigned char packetSequenceControl[2];
315 319 unsigned char packetLength[2];
316 320 // DATA FIELD HEADER
317 321 unsigned char spare1_pusVersion_spare2;
318 322 unsigned char serviceType;
319 323 unsigned char serviceSubType;
320 324 unsigned char destinationID;
321 325 unsigned char time[6];
322 326 //
323 327 unsigned char tc_failure_code[2];
324 328 unsigned char telecommand_pkt_id[2];
325 329 unsigned char pkt_seq_control[2];
326 330 unsigned char tc_service;
327 331 unsigned char tc_subtype;
328 332 } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t;
329 333
330 334 typedef struct {
331 335 unsigned char targetLogicalAddress;
332 336 unsigned char protocolIdentifier;
333 337 unsigned char reserved;
334 338 unsigned char userApplication;
335 339 // PACKET HEADER
336 340 unsigned char packetID[2];
337 341 unsigned char packetSequenceControl[2];
338 342 unsigned char packetLength[2];
339 343 // DATA FIELD HEADER
340 344 unsigned char spare1_pusVersion_spare2;
341 345 unsigned char serviceType;
342 346 unsigned char serviceSubType;
343 347 unsigned char destinationID;
344 348 unsigned char time[6];
345 349 //
346 350 unsigned char tc_failure_code[2];
347 351 unsigned char telecommand_pkt_id[2];
348 352 unsigned char pkt_seq_control[2];
349 353 unsigned char tc_service;
350 354 unsigned char tc_subtype;
351 355 } Packet_TM_LFR_TC_EXE_ERROR_t;
352 356
353 357 typedef struct {
354 358 unsigned char targetLogicalAddress;
355 359 unsigned char protocolIdentifier;
356 360 unsigned char reserved;
357 361 unsigned char userApplication;
358 362 // PACKET HEADER
359 363 unsigned char packetID[2];
360 364 unsigned char packetSequenceControl[2];
361 365 unsigned char packetLength[2];
362 366 // DATA FIELD HEADER
363 367 unsigned char spare1_pusVersion_spare2;
364 368 unsigned char serviceType;
365 369 unsigned char serviceSubType;
366 370 unsigned char destinationID;
367 371 unsigned char time[6];
368 372 //
369 373 unsigned char tc_failure_code[2];
370 374 unsigned char telecommand_pkt_id[2];
371 375 unsigned char pkt_seq_control[2];
372 376 unsigned char tc_service;
373 377 unsigned char tc_subtype;
374 378 unsigned char pkt_len_rcv_value[2];
375 379 unsigned char pkt_datafieldsize_cnt[2];
376 380 unsigned char rcv_crc[2];
377 381 unsigned char computed_crc[2];
378 382 } Packet_TM_LFR_TC_EXE_CORRUPTED_t;
379 383
380 384 typedef struct {
381 385 unsigned char targetLogicalAddress;
382 386 unsigned char protocolIdentifier;
383 387 unsigned char reserved;
384 388 unsigned char userApplication;
385 389 unsigned char packetID[2];
386 390 unsigned char packetSequenceControl[2];
387 391 unsigned char packetLength[2];
388 392 // DATA FIELD HEADER
389 393 unsigned char spare1_pusVersion_spare2;
390 394 unsigned char serviceType;
391 395 unsigned char serviceSubType;
392 396 unsigned char destinationID;
393 397 unsigned char time[6];
394 398 // AUXILIARY HEADER
395 399 unsigned char sid;
396 400 unsigned char hkBIA;
397 401 unsigned char pktCnt;
398 402 unsigned char pktNr;
399 403 unsigned char acquisitionTime[6];
400 404 unsigned char blkNr[2];
401 405 } Header_TM_LFR_SCIENCE_SWF_t;
402 406
403 407 typedef struct {
404 408 unsigned char targetLogicalAddress;
405 409 unsigned char protocolIdentifier;
406 410 unsigned char reserved;
407 411 unsigned char userApplication;
408 412 unsigned char packetID[2];
409 413 unsigned char packetSequenceControl[2];
410 414 unsigned char packetLength[2];
411 415 // DATA FIELD HEADER
412 416 unsigned char spare1_pusVersion_spare2;
413 417 unsigned char serviceType;
414 418 unsigned char serviceSubType;
415 419 unsigned char destinationID;
416 420 unsigned char time[6];
417 421 // AUXILIARY DATA HEADER
418 422 unsigned char sid;
419 423 unsigned char hkBIA;
420 424 unsigned char acquisitionTime[6];
421 425 unsigned char blkNr[2];
422 426 } Header_TM_LFR_SCIENCE_CWF_t;
423 427
424 428 typedef struct {
425 429 unsigned char targetLogicalAddress;
426 430 unsigned char protocolIdentifier;
427 431 unsigned char reserved;
428 432 unsigned char userApplication;
429 433 unsigned char packetID[2];
430 434 unsigned char packetSequenceControl[2];
431 435 unsigned char packetLength[2];
432 436 // DATA FIELD HEADER
433 437 unsigned char spare1_pusVersion_spare2;
434 438 unsigned char serviceType;
435 439 unsigned char serviceSubType;
436 440 unsigned char destinationID;
437 441 unsigned char time[6];
438 442 // AUXILIARY HEADER
439 443 unsigned char sid;
440 444 unsigned char biaStatusInfo;
441 unsigned char cntASM;
442 unsigned char nrASM;
445 unsigned char pa_lfr_pkt_cnt_asm;
446 unsigned char pa_lfr_pkt_nr_asm;
443 447 unsigned char acquisitionTime[6];
444 unsigned char blkNr[2];
448 unsigned char pa_lfr_asm_blk_nr[2];
445 449 } Header_TM_LFR_SCIENCE_ASM_t;
446 450
447 451 typedef struct {
448 452 //targetLogicalAddress is removed by the grspw module
449 453 unsigned char protocolIdentifier;
450 454 unsigned char reserved;
451 455 unsigned char userApplication;
452 456 unsigned char packetID[2];
453 457 unsigned char packetSequenceControl[2];
454 458 unsigned char packetLength[2];
455 459 // DATA FIELD HEADER
456 460 unsigned char headerFlag_pusVersion_Ack;
457 461 unsigned char serviceType;
458 462 unsigned char serviceSubType;
459 463 unsigned char sourceID;
460 464 unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10];
461 465 } ccsdsTelecommandPacket_t;
462 466
463 467 typedef struct {
464 468 unsigned char targetLogicalAddress;
465 469 unsigned char protocolIdentifier;
466 470 unsigned char reserved;
467 471 unsigned char userApplication;
468 472 unsigned char packetID[2];
469 473 unsigned char packetSequenceControl[2];
470 474 unsigned char packetLength[2];
471 475 unsigned char spare1_pusVersion_spare2;
472 476 unsigned char serviceType;
473 477 unsigned char serviceSubType;
474 478 unsigned char destinationID;
475 479 unsigned char time[6];
476 480 unsigned char sid;
477 481
478 482 //**************
479 483 // HK PARAMETERS
480 484 unsigned char lfr_status_word[2];
481 485 unsigned char lfr_sw_version[4];
482 486 unsigned char lfr_fpga_version[3];
483 487 // ressource statistics
484 488 unsigned char hk_lfr_cpu_load;
485 489 unsigned char hk_lfr_load_max;
486 490 unsigned char hk_lfr_load_aver;
487 491 // tc statistics
488 492 unsigned char hk_lfr_update_info_tc_cnt[2];
489 493 unsigned char hk_lfr_update_time_tc_cnt[2];
490 494 unsigned char hk_lfr_exe_tc_cnt[2];
491 495 unsigned char hk_lfr_rej_tc_cnt[2];
492 496 unsigned char hk_lfr_last_exe_tc_id[2];
493 497 unsigned char hk_lfr_last_exe_tc_type[2];
494 498 unsigned char hk_lfr_last_exe_tc_subtype[2];
495 499 unsigned char hk_lfr_last_exe_tc_time[6];
496 500 unsigned char hk_lfr_last_rej_tc_id[2];
497 501 unsigned char hk_lfr_last_rej_tc_type[2];
498 502 unsigned char hk_lfr_last_rej_tc_subtype[2];
499 503 unsigned char hk_lfr_last_rej_tc_time[6];
500 504 // anomaly statistics
501 505 unsigned char hk_lfr_le_cnt[2];
502 506 unsigned char hk_lfr_me_cnt[2];
503 507 unsigned char hk_lfr_he_cnt[2];
504 508 unsigned char hk_lfr_last_er_rid[2];
505 509 unsigned char hk_lfr_last_er_code;
506 510 unsigned char hk_lfr_last_er_time[6];
507 511 // vhdl_blk_status
508 512 unsigned char hk_lfr_vhdl_aa_sm;
509 513 unsigned char hk_lfr_vhdl_fft_sr;
510 514 unsigned char hk_lfr_vhdl_cic_hk;
511 515 unsigned char hk_lfr_vhdl_iir_cal;
512 516 // spacewire_if_statistics
513 517 unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2];
514 518 unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2];
515 519 unsigned char hk_lfr_dpu_spw_tick_out_cnt;
516 520 unsigned char hk_lfr_dpu_spw_last_timc;
517 521 // ahb error statistics
518 522 unsigned int hk_lfr_last_fail_addr;
519 523 // temperatures
520 524 unsigned char hk_lfr_temp_scm[2];
521 525 unsigned char hk_lfr_temp_pcb[2];
522 526 unsigned char hk_lfr_temp_fpga[2];
523 527 // spacecraft potential
524 528 unsigned char hk_lfr_sc_v_f3[2];
525 529 unsigned char hk_lfr_sc_e1_f3[2];
526 530 unsigned char hk_lfr_sc_e2_f3[2];
527 531 // error counters
528 532 unsigned char hk_lfr_dpu_spw_parity;
529 533 unsigned char hk_lfr_dpu_spw_disconnect;
530 534 unsigned char hk_lfr_dpu_spw_escape;
531 535 unsigned char hk_lfr_dpu_spw_credit;
532 536 unsigned char hk_lfr_dpu_spw_write_sync;
533 537 unsigned char hk_lfr_dpu_spw_rx_ahb;
534 538 unsigned char hk_lfr_dpu_spw_tx_ahb;
535 539 unsigned char hk_lfr_dpu_spw_early_eop;
536 540 unsigned char hk_lfr_dpu_spw_invalid_addr;
537 541 unsigned char hk_lfr_dpu_spw_eep;
538 542 unsigned char hk_lfr_dpu_spw_rx_too_big;
539 543 // timecode
540 544 unsigned char hk_lfr_timecode_erroneous;
541 545 unsigned char hk_lfr_timecode_missing;
542 546 unsigned char hk_lfr_timecode_invalid;
543 547 // time
544 548 unsigned char hk_lfr_time_timecode_it;
545 549 unsigned char hk_lfr_time_not_synchro;
546 550 unsigned char hk_lfr_time_timecode_ctr;
547 551 // hk_lfr_buffer_dpu_
548 552 unsigned char hk_lfr_buffer_dpu_tc_fifo;
549 553 unsigned char hk_lfr_buffer_dpu_tm_fifo;
550 554 // hk_lfr_ahb_
551 555 unsigned char hk_lfr_ahb_correctable;
552 556 unsigned char hk_lfr_ahb_uncorrectable;
553 557 // spare
554 558 unsigned char parameters_spare;
555 559 } Packet_TM_LFR_HK_t;
556 560
557 561 typedef struct {
558 562 unsigned char targetLogicalAddress;
559 563 unsigned char protocolIdentifier;
560 564 unsigned char reserved;
561 565 unsigned char userApplication;
562 566 unsigned char packetID[2];
563 567 unsigned char packetSequenceControl[2];
564 568 unsigned char packetLength[2];
565 569 // DATA FIELD HEADER
566 570 unsigned char spare1_pusVersion_spare2;
567 571 unsigned char serviceType;
568 572 unsigned char serviceSubType;
569 573 unsigned char destinationID;
570 574 unsigned char time[6];
571 575 unsigned char sid;
572 576
573 577 //******************
574 578 // COMMON PARAMETERS
575 579 unsigned char unused0;
576 580 unsigned char bw_sp0_sp1_r0_r1;
577 581
578 582 //******************
579 583 // NORMAL PARAMETERS
580 584 unsigned char sy_lfr_n_swf_l[2];
581 585 unsigned char sy_lfr_n_swf_p[2];
582 586 unsigned char sy_lfr_n_asm_p[2];
583 587 unsigned char sy_lfr_n_bp_p0;
584 588 unsigned char sy_lfr_n_bp_p1;
585 589 unsigned char sy_lfr_n_cwf_long_f3;
586 590 unsigned char lfr_normal_parameters_spare;
587 591
588 592 //*****************
589 593 // BURST PARAMETERS
590 594 unsigned char sy_lfr_b_bp_p0;
591 595 unsigned char sy_lfr_b_bp_p1;
592 596
593 597 //****************
594 598 // SBM1 PARAMETERS
595 599 unsigned char sy_lfr_s1_bp_p0;
596 600 unsigned char sy_lfr_s1_bp_p1;
597 601
598 602 //****************
599 603 // SBM2 PARAMETERS
600 604 unsigned char sy_lfr_s2_bp_p0;
601 605 unsigned char sy_lfr_s2_bp_p1;
606
607 // SPARE
608 unsigned char source_data_spare;
602 609 } Packet_TM_LFR_PARAMETER_DUMP_t;
603 610
604 611
605 612 #endif // CCSDS_TYPES_H_INCLUDED
@@ -1,228 +1,212
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 "tm_byte_positions.h"
7 7 #include "ccsds_types.h"
8 8
9 9 #define GRSPW_DEVICE_NAME "/dev/grspw0"
10 10 #define UART_DEVICE_NAME "/dev/console"
11 11
12 12 typedef struct ring_node
13 13 {
14 14 struct ring_node *previous;
15 15 int buffer_address;
16 16 struct ring_node *next;
17 17 unsigned int status;
18 18 } ring_node;
19 19
20 typedef struct ring_node_sm
21 {
22 struct ring_node *previous;
23 volatile int *buffer_address;
24 struct ring_node *next;
25 unsigned int status;
26 } ring_node_sm;
27
28 20 //************************
29 21 // flight software version
30 22 // this parameters is handled by the Qt project options
31 23
32 24 #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk
33 25 #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk
34 26 #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688
35 27 #define TIME_OFFSET 2
36 28 #define TIME_OFFSET_IN_BYTES 8
37 29 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
38 30 #define NB_BYTES_SWF_BLK (2 * 6)
39 31 #define NB_WORDS_SWF_BLK 3
40 32 #define NB_BYTES_CWF3_LIGHT_BLK 6
41 33 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
42 34 #define NB_RING_NODES_F0 3 // AT LEAST 3
43 35 #define NB_RING_NODES_F1 5 // AT LEAST 3
44 36 #define NB_RING_NODES_F2 5 // AT LEAST 3
45 37 #define NB_RING_NODES_ASM_F0 12 // AT LEAST 3
46 38 #define NB_RING_NODES_ASM_F1 2 // AT LEAST 3
47 39 #define NB_RING_NODES_ASM_F2 2 // AT LEAST 3
48 40
49 41 //**********
50 42 // LFR MODES
51 43 #define LFR_MODE_STANDBY 0
52 44 #define LFR_MODE_NORMAL 1
53 45 #define LFR_MODE_BURST 2
54 46 #define LFR_MODE_SBM1 3
55 47 #define LFR_MODE_SBM2 4
56 48 #define LFR_MODE_NORMAL_CWF_F3 5
57 49
58 50 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
59 51 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
60 52 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
61 53 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
62 54 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
63 55 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
64 56 #define RTEMS_EVENT_MODE_NORMAL_SWF_F0 RTEMS_EVENT_6
65 57 #define RTEMS_EVENT_MODE_NORMAL_SWF_F1 RTEMS_EVENT_7
66 58 #define RTEMS_EVENT_MODE_NORMAL_SWF_F2 RTEMS_EVENT_8
67 59
68 60 //****************************
69 61 // LFR DEFAULT MODE PARAMETERS
70 62 // COMMON
71 63 #define DEFAULT_SY_LFR_COMMON0 0x00
72 64 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
73 65 // NORM
74 66 #define SY_LFR_N_SWF_L 2048 // nb sample
75 67 #define SY_LFR_N_SWF_P 300 // sec
76 68 #define SY_LFR_N_ASM_P 3600 // sec
77 69 #define SY_LFR_N_BP_P0 4 // sec
78 70 #define SY_LFR_N_BP_P1 20 // sec
79 71 #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3
80 72 #define MIN_DELTA_SNAPSHOT 16 // sec
81 73 // BURST
82 74 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
83 75 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
84 76 // SBM1
85 77 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
86 78 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
87 79 // SBM2
88 80 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
89 81 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
90 82 // ADDITIONAL PARAMETERS
91 83 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
92 84 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
93 85 // STATUS WORD
94 86 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
95 87 #define DEFAULT_STATUS_WORD_BYTE1 0x00
96 88 //
97 89 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
98 90 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
99 91 //****************************
100 92
101 93 //*****************************
102 94 // APB REGISTERS BASE ADDRESSES
103 95 #define REGS_ADDR_APBUART 0x80000100
104 96 #define REGS_ADDR_GPTIMER 0x80000300
105 97 #define REGS_ADDR_GRSPW 0x80000500
106 98 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
107 99 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
108 100 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20
109 101
110 102 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
111 103 #define APBUART_CTRL_REG_MASK_TE 0x00000002
112 104 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
113 105
114 106 //**********
115 107 // IRQ LINES
116 #define IRQ_SM 9
117 #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels
118 #define IRQ_WF 10
119 #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels
120 #define IRQ_TIME1 12
121 #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels
122 #define IRQ_TIME2 13
123 #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels
108 #define IRQ_SM_SIMULATOR 9
109 #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels
124 110 #define IRQ_WAVEFORM_PICKER 14
125 111 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
126 112 #define IRQ_SPECTRAL_MATRIX 6
127 113 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
128 114
129 115 //*****
130 116 // TIME
131 117 #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms
132 #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s
133 118 #define TIMER_SM_SIMULATOR 1
134 #define TIMER_WF_SIMULATOR 2
135 119 #define HK_PERIOD 100 // 100 * 10ms => 1sec
136 120
137 121 //**********
138 122 // LPP CODES
139 123 #define LFR_SUCCESSFUL 0
140 124 #define LFR_DEFAULT 1
141 125
142 126 //******
143 127 // RTEMS
144 128 #define TASKID_RECV 1
145 129 #define TASKID_ACTN 2
146 130 #define TASKID_SPIQ 3
147 131 #define TASKID_SMIQ 4
148 132 #define TASKID_STAT 5
149 133 #define TASKID_AVF0 6
150 134 #define TASKID_BPF0 7
151 135 #define TASKID_WFRM 8
152 136 #define TASKID_DUMB 9
153 137 #define TASKID_HOUS 10
154 138 #define TASKID_MATR 11
155 139 #define TASKID_CWF3 12
156 140 #define TASKID_CWF2 13
157 141 #define TASKID_CWF1 14
158 142 #define TASKID_SEND 15
159 143 #define TASKID_WTDG 16
160 144
161 145 #define TASK_PRIORITY_SPIQ 5
162 146 #define TASK_PRIORITY_SMIQ 10
163 147 #define TASK_PRIORITY_WTDG 20
164 148 #define TASK_PRIORITY_HOUS 30
165 149 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
166 150 #define TASK_PRIORITY_CWF2 35 //
167 151 #define TASK_PRIORITY_WFRM 40
168 152 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
169 153 #define TASK_PRIORITY_SEND 45
170 154 #define TASK_PRIORITY_RECV 50
171 155 #define TASK_PRIORITY_ACTN 50
172 156 #define TASK_PRIORITY_AVF0 60
173 157 #define TASK_PRIORITY_BPF0 60
174 158 #define TASK_PRIORITY_MATR 100
175 159 #define TASK_PRIORITY_STAT 200
176 160 #define TASK_PRIORITY_DUMB 200
177 161
178 162 #define ACTION_MSG_QUEUE_COUNT 10
179 163 #define ACTION_MSG_PKTS_COUNT 50
180 164 #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
181 165 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
182 166
183 167 #define QUEUE_RECV 0
184 168 #define QUEUE_SEND 1
185 169
186 170 //*******
187 171 // MACROS
188 172 #ifdef PRINT_MESSAGES_ON_CONSOLE
189 173 #define PRINTF(x) printf(x);
190 174 #define PRINTF1(x,y) printf(x,y);
191 175 #define PRINTF2(x,y,z) printf(x,y,z);
192 176 #else
193 177 #define PRINTF(x) ;
194 178 #define PRINTF1(x,y) ;
195 179 #define PRINTF2(x,y,z) ;
196 180 #endif
197 181
198 182 #ifdef BOOT_MESSAGES
199 183 #define BOOT_PRINTF(x) printf(x);
200 184 #define BOOT_PRINTF1(x,y) printf(x,y);
201 185 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
202 186 #else
203 187 #define BOOT_PRINTF(x) ;
204 188 #define BOOT_PRINTF1(x,y) ;
205 189 #define BOOT_PRINTF2(x,y,z) ;
206 190 #endif
207 191
208 192 #ifdef DEBUG_MESSAGES
209 193 #define DEBUG_PRINTF(x) printf(x);
210 194 #define DEBUG_PRINTF1(x,y) printf(x,y);
211 195 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
212 196 #else
213 197 #define DEBUG_PRINTF(x) ;
214 198 #define DEBUG_PRINTF1(x,y) ;
215 199 #define DEBUG_PRINTF2(x,y,z) ;
216 200 #endif
217 201
218 202 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
219 203
220 204 struct param_local_str{
221 205 unsigned int local_sbm1_nb_cwf_sent;
222 206 unsigned int local_sbm1_nb_cwf_max;
223 207 unsigned int local_sbm2_nb_cwf_sent;
224 208 unsigned int local_sbm2_nb_cwf_max;
225 209 unsigned int local_nb_interrupt_f0_MAX;
226 210 };
227 211
228 212 #endif // FSW_PARAMS_H_INCLUDED
@@ -1,26 +1,42
1 1 #ifndef FSW_PARAMS_PROCESSING_H
2 2 #define FSW_PARAMS_PROCESSING_H
3 3
4 4 #define NB_BINS_PER_SM 128 //
5 5 #define NB_VALUES_PER_SM 25 //
6 6 #define TOTAL_SIZE_SM 3200 // 25 * 128
7 7 #define SM_HEADER 0 //
8
8 //
9 #define NB_BINS_PER_ASM_F0 88
10 #define TOTAL_SIZE_ASM_F0 2200 // 25 * 88
11 #define ASM_F0_INDICE_START 17 // 88 bins
12 #define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins
13 //
14 #define NB_BINS_PER_ASM_F1 104
15 #define TOTAL_SIZE_ASM_F1 2600 // 25 * 104
16 #define ASM_F1_INDICE_START 6 // 104 bins
17 #define ASM_F1_INDICE_STOP 109 // 2 packets of 52 bins
18 //
19 #define NB_BINS_PER_ASM_F2 96
20 #define TOTAL_SIZE_ASM_F2 2400 // 25 * 96
21 #define ASM_F2_INDICE_START 7 // 96 bins
22 #define ASM_F2_INDICE_STOP 102 // 2 packets of 48 bins
23 //
9 24 #define NB_BINS_COMPRESSED_SM_F0 11
10 25 #define NB_BINS_COMPRESSED_SM_F1 13
11 26 #define NB_BINS_COMPRESSED_SM_F2 12
27 //
12 28 #define TOTAL_SIZE_COMPRESSED_MATRIX_f0 (NB_BINS_COMPRESSED_SM_F0 * NB_VALUES_PER_SM)
13 29 #define NB_AVERAGE_NORMAL_f0 96*4
14 30 #define NB_SM_TO_RECEIVE_BEFORE_AVF0 8
15 31
16 32 typedef struct {
17 33 volatile unsigned char PE[2];
18 34 volatile unsigned char PB[2];
19 35 volatile unsigned char V0;
20 36 volatile unsigned char V1;
21 37 volatile unsigned char V2_ELLIP_DOP;
22 38 volatile unsigned char SZ;
23 39 volatile unsigned char VPHI;
24 40 } BP1_t;
25 41
26 42 #endif // FSW_PARAMS_PROCESSING_H
@@ -1,56 +1,56
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 #include "basic_parameters.h"
14 14
15 15 extern volatile int sm_f0[ ][ SM_HEADER + TOTAL_SIZE_SM ];
16 16 extern volatile int sm_f1[ ][ SM_HEADER + TOTAL_SIZE_SM ];
17 17 extern volatile int sm_f2[ ][ SM_HEADER + TOTAL_SIZE_SM ];
18 18
19 19 // parameters
20 20 extern struct param_local_str param_local;
21 21
22 22 // registers
23 23 extern time_management_regs_t *time_management_regs;
24 24 extern spectral_matrix_regs_t *spectral_matrix_regs;
25 25
26 26 extern rtems_name misc_name[5];
27 27 extern rtems_id Task_id[20]; /* array of task ids */
28 28
29 //
30 29 void init_sm_rings( void );
31 30 void reset_current_sm_ring_nodes( void );
32 31
33 32 // ISR
33 void reset_nb_sm_f0( void );
34 34 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
35 35 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
36 36
37 37 // RTEMS TASKS
38 38 rtems_task spw_bppr_task(rtems_task_argument argument);
39 39 rtems_task avf0_task(rtems_task_argument argument);
40 40 rtems_task bpf0_task(rtems_task_argument argument);
41 41 rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator
42 42 rtems_task matr_task(rtems_task_argument argument);
43 43
44 44 void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat);
45 45 void matrix_reset(volatile float *averaged_spec_mat);
46 46 void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1);
47 47 void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat);
48 48 //
49 49 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header);
50 50 void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
51 51 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id);
52 52 void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix);
53 53 void fill_averaged_spectral_matrix( void );
54 54 void reset_spectral_matrix_regs();
55 55
56 56 #endif // FSW_PROCESSING_H_INCLUDED
@@ -1,611 +1,610
1 1 /** This is the RTEMS initialization module.
2 2 *
3 3 * @file
4 4 * @author P. LEROY
5 5 *
6 6 * This module contains two very different information:
7 7 * - specific instructions to configure the compilation of the RTEMS executive
8 8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
9 9 *
10 10 */
11 11
12 12 //*************************
13 13 // GPL reminder to be added
14 14 //*************************
15 15
16 16 #include <rtems.h>
17 17
18 18 /* configuration information */
19 19
20 20 #define CONFIGURE_INIT
21 21
22 22 #include <bsp.h> /* for device driver prototypes */
23 23
24 24 /* configuration information */
25 25
26 26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
27 27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
28 28
29 29 #define CONFIGURE_MAXIMUM_TASKS 20
30 30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
31 31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
32 32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
33 33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
34 34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
35 35 #define CONFIGURE_MAXIMUM_DRIVERS 16
36 36 #define CONFIGURE_MAXIMUM_PERIODS 5
37 37 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
38 38 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2
39 39 #ifdef PRINT_STACK_REPORT
40 40 #define CONFIGURE_STACK_CHECKER_ENABLED
41 41 #endif
42 42
43 43 #include <rtems/confdefs.h>
44 44
45 45 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
46 46 #ifdef RTEMS_DRVMGR_STARTUP
47 47 #ifdef LEON3
48 48 /* Add Timer and UART Driver */
49 49 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
50 50 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
51 51 #endif
52 52 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
53 53 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
54 54 #endif
55 55 #endif
56 56 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
57 57 #include <drvmgr/drvmgr_confdefs.h>
58 58 #endif
59 59
60 60 #include "fsw_init.h"
61 61 #include "fsw_config.c"
62 62
63 63 rtems_task Init( rtems_task_argument ignored )
64 64 {
65 65 /** This is the RTEMS INIT taks, it the first task launched by the system.
66 66 *
67 67 * @param unused is the starting argument of the RTEMS task
68 68 *
69 69 * The INIT task create and run all other RTEMS tasks.
70 70 *
71 71 */
72 72
73 73
74 74 rtems_status_code status;
75 75 rtems_status_code status_spw;
76 76 rtems_isr_entry old_isr_handler;
77 77
78 78 // UART settings
79 79 send_console_outputs_on_apbuart_port();
80 80 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
81 81 enable_apbuart_transmitter();
82 82 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
83 83
84 84 PRINTF("\n\n\n\n\n")
85 85 PRINTF("*************************\n")
86 86 PRINTF("** LFR Flight Software **\n")
87 87 PRINTF1("** %d.", SW_VERSION_N1)
88 88 PRINTF1("%d.", SW_VERSION_N2)
89 89 PRINTF1("%d.", SW_VERSION_N3)
90 PRINTF1("%d\n", SW_VERSION_N4)
90 PRINTF1("%d **\n", SW_VERSION_N4)
91 91 PRINTF("*************************\n")
92 92 PRINTF("\n\n")
93 93
94 94 reset_wfp_burst_enable(); // stop the waveform picker if it was running
95 95 init_waveform_rings(); // initialize the waveform rings
96 96 init_sm_rings();
97 97
98 98 init_parameter_dump();
99 99 init_local_mode_parameters();
100 100 init_housekeeping_parameters();
101 101
102 102 updateLFRCurrentMode();
103 103
104 104 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
105 105
106 106 create_names(); // create all names
107 107
108 108 status = create_message_queues(); // create message queues
109 109 if (status != RTEMS_SUCCESSFUL)
110 110 {
111 111 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
112 112 }
113 113
114 114 status = create_all_tasks(); // create all tasks
115 115 if (status != RTEMS_SUCCESSFUL)
116 116 {
117 117 PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status)
118 118 }
119 119
120 120 // **************************
121 121 // <SPACEWIRE INITIALIZATION>
122 122 grspw_timecode_callback = &timecode_irq_handler;
123 123
124 124 status_spw = spacewire_open_link(); // (1) open the link
125 125 if ( status_spw != RTEMS_SUCCESSFUL )
126 126 {
127 127 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
128 128 }
129 129
130 130 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
131 131 {
132 132 status_spw = spacewire_configure_link( fdSPW );
133 133 if ( status_spw != RTEMS_SUCCESSFUL )
134 134 {
135 135 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
136 136 }
137 137 }
138 138
139 139 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
140 140 {
141 141 status_spw = spacewire_start_link( fdSPW );
142 142 if ( status_spw != RTEMS_SUCCESSFUL )
143 143 {
144 144 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
145 145 }
146 146 }
147 147 // </SPACEWIRE INITIALIZATION>
148 148 // ***************************
149 149
150 150 status = start_all_tasks(); // start all tasks
151 151 if (status != RTEMS_SUCCESSFUL)
152 152 {
153 153 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
154 154 }
155 155
156 156 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
157 157 status = start_recv_send_tasks();
158 158 if ( status != RTEMS_SUCCESSFUL )
159 159 {
160 160 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
161 161 }
162 162
163 163 // suspend science tasks. they will be restarted later depending on the mode
164 164 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
165 165 if (status != RTEMS_SUCCESSFUL)
166 166 {
167 167 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
168 168 }
169 169
170
171 170 //******************************
172 171 // <SPECTRAL MATRICES SIMULATOR>
173 LEON_Mask_interrupt( IRQ_SM );
172 LEON_Mask_interrupt( IRQ_SM_SIMULATOR );
174 173 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
175 IRQ_SPARC_SM, spectral_matrices_isr_simu );
174 IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu );
176 175 // </SPECTRAL MATRICES SIMULATOR>
177 176 //*******************************
178 177
179 178 // configure IRQ handling for the waveform picker unit
180 179 status = rtems_interrupt_catch( waveforms_isr,
181 180 IRQ_SPARC_WAVEFORM_PICKER,
182 181 &old_isr_handler) ;
183 182
184 183 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
185 184 if ( status_spw != RTEMS_SUCCESSFUL )
186 185 {
187 186 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
188 187 if ( status != RTEMS_SUCCESSFUL ) {
189 188 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
190 189 }
191 190 }
192 191
193 192 BOOT_PRINTF("delete INIT\n")
194 193
195 194 status = rtems_task_delete(RTEMS_SELF);
196 195
197 196 }
198 197
199 198 void init_local_mode_parameters( void )
200 199 {
201 200 /** This function initialize the param_local global variable with default values.
202 201 *
203 202 */
204 203
205 204 unsigned int i;
206 205
207 206 // LOCAL PARAMETERS
208 207 set_local_nb_interrupt_f0_MAX();
209 208
210 209 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
211 210 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
212 211 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
213 212
214 213 // init sequence counters
215 214
216 215 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
217 216 {
218 217 sequenceCounters_TC_EXE[i] = 0x00;
219 218 }
220 219 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
221 220 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
222 221 }
223 222
224 223 void create_names( void ) // create all names for tasks and queues
225 224 {
226 225 /** This function creates all RTEMS names used in the software for tasks and queues.
227 226 *
228 227 * @return RTEMS directive status codes:
229 228 * - RTEMS_SUCCESSFUL - successful completion
230 229 *
231 230 */
232 231
233 232 // task names
234 233 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
235 234 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
236 235 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
237 236 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
238 237 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
239 238 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
240 239 Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' );
241 240 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
242 241 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
243 242 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
244 243 Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' );
245 244 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
246 245 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
247 246 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
248 247 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
249 248 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
250 249
251 250 // rate monotonic period names
252 251 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
253 252
254 253 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
255 254 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
256 255 }
257 256
258 257 int create_all_tasks( void ) // create all tasks which run in the software
259 258 {
260 259 /** This function creates all RTEMS tasks used in the software.
261 260 *
262 261 * @return RTEMS directive status codes:
263 262 * - RTEMS_SUCCESSFUL - task created successfully
264 263 * - RTEMS_INVALID_ADDRESS - id is NULL
265 264 * - RTEMS_INVALID_NAME - invalid task name
266 265 * - RTEMS_INVALID_PRIORITY - invalid task priority
267 266 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
268 267 * - RTEMS_TOO_MANY - too many tasks created
269 268 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
270 269 * - RTEMS_TOO_MANY - too many global objects
271 270 *
272 271 */
273 272
274 273 rtems_status_code status;
275 274
276 275 // RECV
277 276 status = rtems_task_create(
278 277 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
279 278 RTEMS_DEFAULT_MODES,
280 279 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
281 280 );
282 281
283 282 if (status == RTEMS_SUCCESSFUL) // ACTN
284 283 {
285 284 status = rtems_task_create(
286 285 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
287 286 RTEMS_DEFAULT_MODES,
288 287 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
289 288 );
290 289 }
291 290 if (status == RTEMS_SUCCESSFUL) // SPIQ
292 291 {
293 292 status = rtems_task_create(
294 293 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
295 294 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
296 295 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
297 296 );
298 297 }
299 298 if (status == RTEMS_SUCCESSFUL) // SMIQ
300 299 {
301 300 status = rtems_task_create(
302 301 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE,
303 302 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
304 303 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
305 304 );
306 305 }
307 306 if (status == RTEMS_SUCCESSFUL) // STAT
308 307 {
309 308 status = rtems_task_create(
310 309 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
311 310 RTEMS_DEFAULT_MODES,
312 311 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
313 312 );
314 313 }
315 314 if (status == RTEMS_SUCCESSFUL) // AVF0
316 315 {
317 316 status = rtems_task_create(
318 317 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
319 318 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
320 319 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
321 320 );
322 321 }
323 322 if (status == RTEMS_SUCCESSFUL) // BPF0
324 323 {
325 324 status = rtems_task_create(
326 325 Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE,
327 326 RTEMS_DEFAULT_MODES,
328 327 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0]
329 328 );
330 329 }
331 330 if (status == RTEMS_SUCCESSFUL) // WFRM
332 331 {
333 332 status = rtems_task_create(
334 333 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
335 334 RTEMS_DEFAULT_MODES,
336 335 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
337 336 );
338 337 }
339 338 if (status == RTEMS_SUCCESSFUL) // DUMB
340 339 {
341 340 status = rtems_task_create(
342 341 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
343 342 RTEMS_DEFAULT_MODES,
344 343 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
345 344 );
346 345 }
347 346 if (status == RTEMS_SUCCESSFUL) // HOUS
348 347 {
349 348 status = rtems_task_create(
350 349 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
351 350 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
352 351 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
353 352 );
354 353 }
355 354 if (status == RTEMS_SUCCESSFUL) // MATR
356 355 {
357 356 status = rtems_task_create(
358 357 Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE,
359 358 RTEMS_DEFAULT_MODES,
360 359 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR]
361 360 );
362 361 }
363 362 if (status == RTEMS_SUCCESSFUL) // CWF3
364 363 {
365 364 status = rtems_task_create(
366 365 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
367 366 RTEMS_DEFAULT_MODES,
368 367 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3]
369 368 );
370 369 }
371 370 if (status == RTEMS_SUCCESSFUL) // CWF2
372 371 {
373 372 status = rtems_task_create(
374 373 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
375 374 RTEMS_DEFAULT_MODES,
376 375 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2]
377 376 );
378 377 }
379 378 if (status == RTEMS_SUCCESSFUL) // CWF1
380 379 {
381 380 status = rtems_task_create(
382 381 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
383 382 RTEMS_DEFAULT_MODES,
384 383 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1]
385 384 );
386 385 }
387 386 if (status == RTEMS_SUCCESSFUL) // SEND
388 387 {
389 388 status = rtems_task_create(
390 389 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
391 390 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
392 391 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
393 392 );
394 393 }
395 394 if (status == RTEMS_SUCCESSFUL) // WTDG
396 395 {
397 396 status = rtems_task_create(
398 397 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
399 398 RTEMS_DEFAULT_MODES,
400 399 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
401 400 );
402 401 }
403 402
404 403 return status;
405 404 }
406 405
407 406 int start_recv_send_tasks( void )
408 407 {
409 408 rtems_status_code status;
410 409
411 410 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
412 411 if (status!=RTEMS_SUCCESSFUL) {
413 412 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
414 413 }
415 414
416 415 if (status == RTEMS_SUCCESSFUL) // SEND
417 416 {
418 417 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
419 418 if (status!=RTEMS_SUCCESSFUL) {
420 419 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
421 420 }
422 421 }
423 422
424 423 return status;
425 424 }
426 425
427 426 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
428 427 {
429 428 /** This function starts all RTEMS tasks used in the software.
430 429 *
431 430 * @return RTEMS directive status codes:
432 431 * - RTEMS_SUCCESSFUL - ask started successfully
433 432 * - RTEMS_INVALID_ADDRESS - invalid task entry point
434 433 * - RTEMS_INVALID_ID - invalid task id
435 434 * - RTEMS_INCORRECT_STATE - task not in the dormant state
436 435 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
437 436 *
438 437 */
439 438 // starts all the tasks fot eh flight software
440 439
441 440 rtems_status_code status;
442 441
443 442 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
444 443 if (status!=RTEMS_SUCCESSFUL) {
445 444 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
446 445 }
447 446
448 447 if (status == RTEMS_SUCCESSFUL) // WTDG
449 448 {
450 449 status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 );
451 450 if (status!=RTEMS_SUCCESSFUL) {
452 451 BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n")
453 452 }
454 453 }
455 454
456 455 if (status == RTEMS_SUCCESSFUL) // SMIQ
457 456 {
458 457 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
459 458 if (status!=RTEMS_SUCCESSFUL) {
460 459 BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n")
461 460 }
462 461 }
463 462
464 463 if (status == RTEMS_SUCCESSFUL) // ACTN
465 464 {
466 465 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
467 466 if (status!=RTEMS_SUCCESSFUL) {
468 467 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
469 468 }
470 469 }
471 470
472 471 if (status == RTEMS_SUCCESSFUL) // STAT
473 472 {
474 473 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
475 474 if (status!=RTEMS_SUCCESSFUL) {
476 475 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
477 476 }
478 477 }
479 478
480 479 if (status == RTEMS_SUCCESSFUL) // AVF0
481 480 {
482 481 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
483 482 if (status!=RTEMS_SUCCESSFUL) {
484 483 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
485 484 }
486 485 }
487 486
488 487 if (status == RTEMS_SUCCESSFUL) // BPF0
489 488 {
490 489 status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 );
491 490 if (status!=RTEMS_SUCCESSFUL) {
492 491 BOOT_PRINTF("in INIT *** Error starting TASK_BPF0\n")
493 492 }
494 493 }
495 494
496 495 if (status == RTEMS_SUCCESSFUL) // WFRM
497 496 {
498 497 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
499 498 if (status!=RTEMS_SUCCESSFUL) {
500 499 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
501 500 }
502 501 }
503 502
504 503 if (status == RTEMS_SUCCESSFUL) // DUMB
505 504 {
506 505 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
507 506 if (status!=RTEMS_SUCCESSFUL) {
508 507 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
509 508 }
510 509 }
511 510
512 511 if (status == RTEMS_SUCCESSFUL) // HOUS
513 512 {
514 513 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
515 514 if (status!=RTEMS_SUCCESSFUL) {
516 515 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
517 516 }
518 517 }
519 518
520 519 if (status == RTEMS_SUCCESSFUL) // MATR
521 520 {
522 521 status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 );
523 522 if (status!=RTEMS_SUCCESSFUL) {
524 523 BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n")
525 524 }
526 525 }
527 526
528 527 if (status == RTEMS_SUCCESSFUL) // CWF3
529 528 {
530 529 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
531 530 if (status!=RTEMS_SUCCESSFUL) {
532 531 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
533 532 }
534 533 }
535 534
536 535 if (status == RTEMS_SUCCESSFUL) // CWF2
537 536 {
538 537 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
539 538 if (status!=RTEMS_SUCCESSFUL) {
540 539 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
541 540 }
542 541 }
543 542
544 543 if (status == RTEMS_SUCCESSFUL) // CWF1
545 544 {
546 545 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
547 546 if (status!=RTEMS_SUCCESSFUL) {
548 547 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
549 548 }
550 549 }
551 550 return status;
552 551 }
553 552
554 553 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
555 554 {
556 555 rtems_status_code status_recv;
557 556 rtems_status_code status_send;
558 557 rtems_status_code ret;
559 558 rtems_id queue_id;
560 559
561 560 // create the queue for handling valid TCs
562 561 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
563 562 ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE,
564 563 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
565 564 if ( status_recv != RTEMS_SUCCESSFUL ) {
566 565 PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv)
567 566 }
568 567
569 568 // create the queue for handling TM packet sending
570 569 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
571 570 ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE,
572 571 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
573 572 if ( status_send != RTEMS_SUCCESSFUL ) {
574 573 PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send)
575 574 }
576 575
577 576 if ( status_recv != RTEMS_SUCCESSFUL )
578 577 {
579 578 ret = status_recv;
580 579 }
581 580 else
582 581 {
583 582 ret = status_send;
584 583 }
585 584
586 585 return ret;
587 586 }
588 587
589 588 rtems_status_code get_message_queue_id_send( rtems_id *queue_id )
590 589 {
591 590 rtems_status_code status;
592 591 rtems_name queue_name;
593 592
594 593 queue_name = rtems_build_name( 'Q', '_', 'S', 'D' );
595 594
596 595 status = rtems_message_queue_ident( queue_name, 0, queue_id );
597 596
598 597 return status;
599 598 }
600 599
601 600 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id )
602 601 {
603 602 rtems_status_code status;
604 603 rtems_name queue_name;
605 604
606 605 queue_name = rtems_build_name( 'Q', '_', 'R', 'V' );
607 606
608 607 status = rtems_message_queue_ident( queue_name, 0, queue_id );
609 608
610 609 return status;
611 610 }
@@ -1,658 +1,687
1 1 /** Functions related to data processing.
2 2 *
3 3 * @file
4 4 * @author P. LEROY
5 5 *
6 6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
7 7 *
8 8 */
9 9
10 10 #include <fsw_processing.h>
11 11
12 12 #include "fsw_processing_globals.c"
13 13
14 14 //************************
15 15 // spectral matrices rings
16 16 ring_node sm_ring_f0[NB_RING_NODES_ASM_F0];
17 17 ring_node sm_ring_f1[NB_RING_NODES_ASM_F1];
18 18 ring_node sm_ring_f2[NB_RING_NODES_ASM_F2];
19 19 ring_node *current_ring_node_sm_f0;
20 20 ring_node *ring_node_for_averaging_sm_f0;
21 21 ring_node *current_ring_node_sm_f1;
22 22 ring_node *current_ring_node_sm_f2;
23 23
24 24 BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ];
25 25 float averaged_sm_f0[ TOTAL_SIZE_SM ];
26 26 char averaged_sm_f0_char[ TOTAL_SIZE_SM * 2 ];
27 27 float compressed_sm_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
28 28
29 unsigned int nb_sm_f0;
30
29 31 void init_sm_rings( void )
30 32 {
31 33 unsigned char i;
32 34
33 35 // F0 RING
34 36 sm_ring_f0[0].next = (ring_node*) &sm_ring_f0[1];
35 37 sm_ring_f0[0].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-1];
36 38 sm_ring_f0[0].buffer_address = (int) &sm_f0[0][0];
37 39
38 40 sm_ring_f0[NB_RING_NODES_ASM_F0-1].next = (ring_node*) &sm_ring_f0[0];
39 41 sm_ring_f0[NB_RING_NODES_ASM_F0-1].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-2];
40 42 sm_ring_f0[NB_RING_NODES_ASM_F0-1].buffer_address = (int) &sm_f0[NB_RING_NODES_ASM_F0-1][0];
41 43
42 44 for(i=1; i<NB_RING_NODES_ASM_F0-1; i++)
43 45 {
44 46 sm_ring_f0[i].next = (ring_node*) &sm_ring_f0[i+1];
45 47 sm_ring_f0[i].previous = (ring_node*) &sm_ring_f0[i-1];
46 48 sm_ring_f0[i].buffer_address = (int) &sm_f0[i][0];
47 49 }
48 50
49 51 DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0)
50 52
53 spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address;
54 DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0)
51 55 }
52 56
53 57 void reset_current_sm_ring_nodes( void )
54 58 {
55 59 current_ring_node_sm_f0 = sm_ring_f0;
56 60 ring_node_for_averaging_sm_f0 = sm_ring_f0;
57 61 }
58 62
59 63 //***********************************************************
60 64 // Interrupt Service Routine for spectral matrices processing
65 void reset_nb_sm_f0( void )
66 {
67 nb_sm_f0 = 0;
68 }
69
61 70 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
62 71 {
63 unsigned char status;
64 unsigned char i;
65 static unsigned int nb_interrupt_f0 = 0;
72 // unsigned char status;
73 // unsigned char i;
66 74
67 status = spectral_matrix_regs->status; //[f2 f1 f0_1 f0_0]
68 for (i=0; i<4; i++)
69 {
70 if ( ( (status >> i) & 0x01) == 1) // (1) buffer rotation
71 {
72 switch(i)
73 {
74 case 0:
75 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
76 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
77 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe;
78 nb_interrupt_f0 = nb_interrupt_f0 + 1;
79 if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){
80 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
81 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
82 {
83 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
84 }
85 nb_interrupt_f0 = 0;
86 }
87 break;
88 case 1:
89 break;
90 case 2:
91 break;
92 default:
93 break;
94 }
95 }
96 }
75 // status = spectral_matrix_regs->status; //[f2 f1 f0_1 f0_0]
76 // for (i=0; i<4; i++)
77 // {
78 // if ( ( (status >> i) & 0x01) == 1) // (1) buffer rotation
79 // {
80 // switch(i)
81 // {
82 // case 0:
83 // current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
84 // spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
85 // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe;
86 // nb_interrupt_f0 = nb_interrupt_f0 + 1;
87 // if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){
88 // ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
89 // if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
90 // {
91 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
92 // }
93 // nb_interrupt_f0 = 0;
94 // }
95 // break;
96 // case 1:
97 // break;
98 // case 2:
99 // break;
100 // default:
101 // break;
102 // }
103 // }
104 // }
97 105
98 // reset error codes to 0
99 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // [1100 1111]
106 // // reset error codes to 0
107 // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // [1100 1111]
100 108 }
101 109
102 110 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
103 111 {
104 static unsigned int nb_interrupt_f0 = 0;
105
106 112 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
107 113 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
108 114 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe;
109 nb_interrupt_f0 = nb_interrupt_f0 + 1;
110 if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 )
111 {
112 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
113 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
114 {
115 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
116 }
117 nb_interrupt_f0 = 0;
118 }
115
116 rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 );
117 // if (nb_sm_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 )
118 // {
119 // ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
120 // if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
121 // {
122 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
123 // }
124 // nb_sm_f0 = 0;
125 // }
126 // else
127 // {
128 // nb_sm_f0 = nb_sm_f0 + 1;
129 // }
119 130 }
120 131
121 132 //************
122 133 // RTEMS TASKS
123 134
124 135 rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ
125 136 {
126 137 rtems_event_set event_out;
127 138
128 139 BOOT_PRINTF("in SMIQ *** \n")
129 140
130 141 while(1){
131 142 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
132 143 }
133 144 }
134 145
135 146 rtems_task spw_bppr_task(rtems_task_argument argument)
136 147 {
137 148 rtems_status_code status;
138 149 rtems_event_set event_out;
139 150
140 151 BOOT_PRINTF("in BPPR ***\n");
141 152
142 153 while( true ){ // wait for an event to begin with the processing
143 154 status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out);
144 155 }
145 156 }
146 157
147 158 rtems_task avf0_task(rtems_task_argument argument)
148 159 {
149 160 int i;
150 161 static int nb_average;
151 162 rtems_event_set event_out;
152 163 rtems_status_code status;
164 ring_node *ring_node_tab[8];
153 165
154 166 nb_average = 0;
155 167
156 168 BOOT_PRINTF("in AVFO *** \n")
157 169
158 170 while(1){
159 171 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
160 for (i=0; i<NB_SM_TO_RECEIVE_BEFORE_AVF0; i++)
172 PRINTF("avf0\n")
173 ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0;
174 for (i=0; i<NB_SM_TO_RECEIVE_BEFORE_AVF0-1; i++)
161 175 {
162 176 ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous;
177 ring_node_tab[i] = ring_node_for_averaging_sm_f0;
163 178 }
164 for(i=0; i<TOTAL_SIZE_SM; i++){
165 averaged_sm_f0[i] = ( (int *) (ring_node_for_averaging_sm_f0[0].buffer_address) )[i]
166 + ( (int *) (ring_node_for_averaging_sm_f0[1].buffer_address) )[i]
167 + ( (int *) (ring_node_for_averaging_sm_f0[2].buffer_address) )[i]
168 + ( (int *) (ring_node_for_averaging_sm_f0[3].buffer_address) )[i]
169 + ( (int *) (ring_node_for_averaging_sm_f0[4].buffer_address) )[i]
170 + ( (int *) (ring_node_for_averaging_sm_f0[5].buffer_address) )[i]
171 + ( (int *) (ring_node_for_averaging_sm_f0[6].buffer_address) )[i]
172 + ( (int *) (ring_node_for_averaging_sm_f0[7].buffer_address) )[i];
179 for(i=0; i<TOTAL_SIZE_SM; i++)
180 {
181 averaged_sm_f0[i] = ( (int *) (ring_node_tab[0]->buffer_address) ) [i]
182 + ( (int *) (ring_node_tab[1]->buffer_address) ) [i]
183 + ( (int *) (ring_node_tab[2]->buffer_address) ) [i]
184 + ( (int *) (ring_node_tab[3]->buffer_address) ) [i]
185 + ( (int *) (ring_node_tab[4]->buffer_address) ) [i]
186 + ( (int *) (ring_node_tab[5]->buffer_address) ) [i]
187 + ( (int *) (ring_node_tab[6]->buffer_address) ) [i]
188 + ( (int *) (ring_node_tab[7]->buffer_address) ) [i];
173 189 }
174 190 nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0;
175 191 if (nb_average == NB_AVERAGE_NORMAL_f0) {
176 192 nb_average = 0;
177 193 status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0
178 194 if (status != RTEMS_SUCCESSFUL) {
179 195 printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status);
180 196 }
181 197 }
182 198 }
183 199 }
184 200
185 201 rtems_task bpf0_task(rtems_task_argument argument)
186 202 {
187 203 rtems_event_set event_out;
188 204 static unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_SM_F0 * 9 ];
189 205
190 206 BOOT_PRINTF("in BPFO *** \n")
191 207
192 208 while(1){
193 209 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
194 210 matrix_compression(averaged_sm_f0, 0, compressed_sm_f0);
195 211 BP1_set(compressed_sm_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0);
196 212 }
197 213 }
198 214
199 215 rtems_task matr_task(rtems_task_argument argument)
200 216 {
201 217 spw_ioctl_pkt_send spw_ioctl_send_ASM;
202 218 rtems_event_set event_out;
203 219 rtems_status_code status;
204 220 rtems_id queue_id;
205 221 Header_TM_LFR_SCIENCE_ASM_t headerASM;
206 222
207 223 init_header_asm( &headerASM );
208 224
209 225 status = get_message_queue_id_send( &queue_id );
210 226 if (status != RTEMS_SUCCESSFUL)
211 227 {
212 228 PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status)
213 229 }
214 230
215 231 BOOT_PRINTF("in MATR *** \n")
216 232
217 233 fill_averaged_spectral_matrix( );
218 234
219 235 while(1){
220 236 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
221 237 // 1) convert the float array in a char array
222 238 convert_averaged_spectral_matrix( averaged_sm_f0, averaged_sm_f0_char);
223 239 // 2) send the spectral matrix packets
224 240 send_spectral_matrix( &headerASM, averaged_sm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
225 241 }
226 242 }
227 243
228 244 //*****************************
229 245 // Spectral matrices processing
230 246
231 247 void matrix_reset(volatile float *averaged_spec_mat)
232 248 {
233 249 int i;
234 250 for(i=0; i<TOTAL_SIZE_SM; i++){
235 251 averaged_spec_mat[i] = 0;
236 252 }
237 253 }
238 254
239 255 void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat)
240 256 {
241 257 int i;
242 258 int j;
243 259 switch (fChannel){
244 260 case 0:
245 261 for(i=0;i<NB_BINS_COMPRESSED_SM_F0;i++){
246 262 j = 17 + (i * 8);
247 263 compressed_spec_mat[i] = (averaged_spec_mat[j]
248 264 + averaged_spec_mat[j+1]
249 265 + averaged_spec_mat[j+2]
250 266 + averaged_spec_mat[j+3]
251 267 + averaged_spec_mat[j+4]
252 268 + averaged_spec_mat[j+5]
253 269 + averaged_spec_mat[j+6]
254 270 + averaged_spec_mat[j+7])/(8*NB_AVERAGE_NORMAL_f0);
255 271 }
256 272 break;
257 273 case 1:
258 274 // case fChannel = f1 to be completed later
259 275 break;
260 276 case 2:
261 277 // case fChannel = f1 to be completed later
262 278 break;
263 279 default:
264 280 break;
265 281 }
266 282 }
267 283
268 284 void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){
269 285 int i;
270 286 int j;
271 287 unsigned char tmp_u_char;
272 288 unsigned char * pt_char = NULL;
273 289 float PSDB, PSDE;
274 290 float NVEC_V0;
275 291 float NVEC_V1;
276 292 float NVEC_V2;
277 293 //float significand;
278 294 //int exponent;
279 295 float aux;
280 296 float tr_SB_SB;
281 297 float tmp;
282 298 float sx_re;
283 299 float sx_im;
284 300 float nebx_re = 0;
285 301 float nebx_im = 0;
286 302 float ny = 0;
287 303 float nz = 0;
288 304 float bx_bx_star = 0;
289 305 for(i=0; i<nb_bins_compressed_spec_mat; i++){
290 306 //==============================================
291 307 // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits
292 308 PSDB = compressed_spec_mat[i*30] // S11
293 309 + compressed_spec_mat[(i*30) + 10] // S22
294 310 + compressed_spec_mat[(i*30) + 18]; // S33
295 311 //significand = frexp(PSDB, &exponent);
296 312 pt_char = (unsigned char*) &PSDB;
297 313 LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float
298 314 LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float
299 315 //==============================================
300 316 // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits
301 317 PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44
302 318 + compressed_spec_mat[(i*30) + 28] * K55_pe // S55
303 319 + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45
304 320 - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45
305 321 pt_char = (unsigned char*) &PSDE;
306 322 LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float
307 323 LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float
308 324 //==============================================================================
309 325 // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits
310 326 // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits
311 327 // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits
312 328 tmp = sqrt(
313 329 compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12
314 330 +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13
315 331 +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23
316 332 );
317 333 NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23
318 334 NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13
319 335 NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12
320 336 LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127);
321 337 LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127);
322 338 pt_char = (unsigned char*) &NVEC_V2;
323 339 LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2
324 340 //=======================================================
325 341 // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits
326 342 aux = 2*tmp / PSDB; // compute the ellipticity
327 343 tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity
328 344 LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char
329 345 //==============================================================
330 346 // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits
331 347 for(j = 0; j<NB_VALUES_PER_SM;j++){
332 348 tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30]
333 349 + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10]
334 350 + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18]
335 351 + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2]
336 352 + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3]
337 353 + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4]
338 354 + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5]
339 355 + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12]
340 356 + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13];
341 357 }
342 358 aux = PSDB*PSDB;
343 359 tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) );
344 360 tmp_u_char = (unsigned char) (NVEC_V0*(8-1));
345 361 LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char
346 362 //=======================================================================================
347 363 // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1)
348 364 sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re
349 365 + compressed_spec_mat[(i*30) + 6] * K14_sx_re
350 366 + compressed_spec_mat[(i*30) + 8] * K15_sx_re
351 367 + compressed_spec_mat[(i*30) + 14] * K24_sx_re
352 368 + compressed_spec_mat[(i*30) + 16] * K25_sx_re
353 369 + compressed_spec_mat[(i*30) + 22] * K35_sx_re;
354 370 sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im
355 371 + compressed_spec_mat[(i*30) + 7] * K14_sx_im
356 372 + compressed_spec_mat[(i*30) + 9] * K15_sx_im
357 373 + compressed_spec_mat[(i*30) + 15] * K24_sx_im
358 374 + compressed_spec_mat[(i*30) + 17] * K25_sx_im
359 375 + compressed_spec_mat[(i*30) + 23] * K35_sx_im;
360 376 LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression
361 377 if ( abs(sx_re) > abs(sx_im) ) {
362 378 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx
363 379 }
364 380 else {
365 381 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx
366 382 }
367 383 //======================================================================
368 384 // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1)
369 385 ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2;
370 386 nz = NVEC_V0;
371 387 bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22
372 388 + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33
373 389 - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23
374 390 nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re
375 391 +compressed_spec_mat[(i*30) + 16] * K25_ny_re
376 392 +compressed_spec_mat[(i*30) + 20] * K34_ny_re
377 393 +compressed_spec_mat[(i*30) + 22] * K35_ny_re)
378 394 + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re
379 395 +compressed_spec_mat[(i*30) + 16] * K25_nz_re
380 396 +compressed_spec_mat[(i*30) + 20] * K34_nz_re
381 397 +compressed_spec_mat[(i*30) + 22] * K35_nz_re);
382 398 nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re
383 399 +compressed_spec_mat[(i*30) + 17] * K25_ny_re
384 400 +compressed_spec_mat[(i*30) + 21] * K34_ny_re
385 401 +compressed_spec_mat[(i*30) + 23] * K35_ny_re)
386 402 + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im
387 403 +compressed_spec_mat[(i*30) + 17] * K25_nz_im
388 404 +compressed_spec_mat[(i*30) + 21] * K34_nz_im
389 405 +compressed_spec_mat[(i*30) + 23] * K35_nz_im);
390 406 tmp = nebx_re / bx_bx_star;
391 407 LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression
392 408 if ( abs(nebx_re) > abs(nebx_im) ) {
393 409 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx
394 410 }
395 411 else {
396 412 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx
397 413 }
398 414 }
399 415
400 416 }
401 417
402 418 void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){
403 419 // BP2 autocorrelation
404 420 int i;
405 421 int aux = 0;
406 422
407 423 for(i = 0; i<nb_bins_compressed_spec_mat; i++){
408 424 // S12
409 425 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]);
410 426 compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux;
411 427 compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux;
412 428 // S13
413 429 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]);
414 430 compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux;
415 431 compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux;
416 432 // S23
417 433 aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]);
418 434 compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux;
419 435 compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux;
420 436 // S45
421 437 aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]);
422 438 compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux;
423 439 compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux;
424 440 // S14
425 441 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]);
426 442 compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux;
427 443 compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux;
428 444 // S15
429 445 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]);
430 446 compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux;
431 447 compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux;
432 448 // S24
433 449 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]);
434 450 compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux;
435 451 compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux;
436 452 // S25
437 453 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]);
438 454 compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux;
439 455 compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux;
440 456 // S34
441 457 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]);
442 458 compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux;
443 459 compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux;
444 460 // S35
445 461 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]);
446 462 compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux;
447 463 compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux;
448 464 }
449 465 }
450 466
451 467 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header)
452 468 {
453 469 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
454 470 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
455 471 header->reserved = 0x00;
456 472 header->userApplication = CCSDS_USER_APP;
457 473 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
458 474 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
459 475 header->packetSequenceControl[0] = 0xc0;
460 476 header->packetSequenceControl[1] = 0x00;
461 477 header->packetLength[0] = 0x00;
462 478 header->packetLength[1] = 0x00;
463 479 // DATA FIELD HEADER
464 480 header->spare1_pusVersion_spare2 = 0x10;
465 481 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
466 482 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
467 483 header->destinationID = TM_DESTINATION_ID_GROUND;
468 484 // AUXILIARY DATA HEADER
469 485 header->sid = 0x00;
470 486 header->biaStatusInfo = 0x00;
471 header->cntASM = 0x00;
472 header->nrASM = 0x00;
487 header->pa_lfr_pkt_cnt_asm = 0x00;
488 header->pa_lfr_pkt_nr_asm = 0x00;
473 489 header->time[0] = 0x00;
474 490 header->time[0] = 0x00;
475 491 header->time[0] = 0x00;
476 492 header->time[0] = 0x00;
477 493 header->time[0] = 0x00;
478 494 header->time[0] = 0x00;
479 header->blkNr[0] = 0x00; // BLK_NR MSB
480 header->blkNr[1] = 0x00; // BLK_NR LSB
495 header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB
496 header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB
481 497 }
482 498
483 499 void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
484 500 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id)
485 501 {
486 502 unsigned int i;
487 503 unsigned int length = 0;
488 504 rtems_status_code status;
489 505
490 header->sid = (unsigned char) sid;
491
492 506 for (i=0; i<2; i++)
493 507 {
494 // BUILD THE DATA
495 spw_ioctl_send->dlen = TOTAL_SIZE_SM;
496 spw_ioctl_send->data = &spectral_matrix[ i * TOTAL_SIZE_SM];
508 // (1) BUILD THE DATA
509 switch(sid)
510 {
511 case SID_NORM_ASM_F0:
512 spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0 / 2;
513 spw_ioctl_send->data = &spectral_matrix[ ASM_F0_INDICE_START + i * (TOTAL_SIZE_ASM_F0/2)];
514 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0;
515 header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_ASM_F0/2) >> 8 ); // BLK_NR MSB
516 header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_ASM_F0/2); // BLK_NR LSB
517 break;
518 case SID_NORM_ASM_F1:
519 break;
520 case SID_NORM_ASM_F2:
521 break;
522 default:
523 PRINTF1("ERR *** in send_spectral_matrix *** unexpected sid %d\n", sid)
524 break;
525 }
497 526 spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES;
498 527 spw_ioctl_send->hdr = (char *) header;
499 528 spw_ioctl_send->options = 0;
500 529
501 // BUILD THE HEADER
502 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM;
530 // (2) BUILD THE HEADER
503 531 header->packetLength[0] = (unsigned char) (length>>8);
504 532 header->packetLength[1] = (unsigned char) (length);
505 533 header->sid = (unsigned char) sid; // SID
506 header->cntASM = 2;
507 header->nrASM = (unsigned char) (i+1);
508 header->blkNr[0] =(unsigned char) ( (NB_BINS_PER_SM/2) >> 8 ); // BLK_NR MSB
509 header->blkNr[1] = (unsigned char) (NB_BINS_PER_SM/2); // BLK_NR LSB
510 // SET PACKET TIME
534 header->pa_lfr_pkt_cnt_asm = 2;
535 header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1);
536
537 // (3) SET PACKET TIME
511 538 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
512 539 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
513 540 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
514 541 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
515 542 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
516 543 header->time[5] = (unsigned char) (time_management_regs->fine_time);
544 //
517 545 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
518 546 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
519 547 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
520 548 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
521 549 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
522 550 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
523 // SEND PACKET
551
552 // (4) SEND PACKET
524 553 status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
525 554 if (status != RTEMS_SUCCESSFUL) {
526 555 printf("in send_spectral_matrix *** ERR %d\n", (int) status);
527 556 }
528 557 }
529 558 }
530 559
531 560 void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix)
532 561 {
533 562 unsigned int i;
534 563 unsigned int j;
535 564 char * pt_char_input;
536 565 char * pt_char_output;
537 566
538 567 pt_char_input = NULL;
539 568 pt_char_output = NULL;
540 569
541 570 for( i=0; i<NB_BINS_PER_SM; i++)
542 571 {
543 572 for ( j=0; j<NB_VALUES_PER_SM; j++)
544 573 {
545 574 pt_char_input = (char*) &input_matrix [ (i*NB_VALUES_PER_SM) + j ];
546 575 pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ];
547 576 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
548 577 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
549 578 }
550 579 }
551 580 }
552 581
553 582 void fill_averaged_spectral_matrix(void)
554 583 {
555 584 /** This function fills spectral matrices related buffers with arbitrary data.
556 585 *
557 586 * This function is for testing purpose only.
558 587 *
559 588 */
560 589
561 590 float offset;
562 591 float coeff;
563 592
564 593 offset = 10.;
565 594 coeff = 100000.;
566 595 averaged_sm_f0[ 0 + 25 * 0 ] = 0. + offset;
567 596 averaged_sm_f0[ 0 + 25 * 1 ] = 1. + offset;
568 597 averaged_sm_f0[ 0 + 25 * 2 ] = 2. + offset;
569 598 averaged_sm_f0[ 0 + 25 * 3 ] = 3. + offset;
570 599 averaged_sm_f0[ 0 + 25 * 4 ] = 4. + offset;
571 600 averaged_sm_f0[ 0 + 25 * 5 ] = 5. + offset;
572 601 averaged_sm_f0[ 0 + 25 * 6 ] = 6. + offset;
573 602 averaged_sm_f0[ 0 + 25 * 7 ] = 7. + offset;
574 603 averaged_sm_f0[ 0 + 25 * 8 ] = 8. + offset;
575 604 averaged_sm_f0[ 0 + 25 * 9 ] = 9. + offset;
576 605 averaged_sm_f0[ 0 + 25 * 10 ] = 10. + offset;
577 606 averaged_sm_f0[ 0 + 25 * 11 ] = 11. + offset;
578 607 averaged_sm_f0[ 0 + 25 * 12 ] = 12. + offset;
579 608 averaged_sm_f0[ 0 + 25 * 13 ] = 13. + offset;
580 609 averaged_sm_f0[ 0 + 25 * 14 ] = 14. + offset;
581 610 averaged_sm_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff;
582 611 averaged_sm_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff;
583 612 averaged_sm_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff;
584 613 averaged_sm_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff;
585 614 averaged_sm_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff;
586 615 averaged_sm_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff;
587 616 averaged_sm_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff;
588 617 averaged_sm_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff;
589 618 averaged_sm_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff;
590 619 averaged_sm_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff;
591 620 averaged_sm_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff;
592 621 averaged_sm_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff;
593 622 averaged_sm_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff;
594 623 averaged_sm_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff;
595 624 averaged_sm_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff;
596 625
597 626 offset = 10000000;
598 627 averaged_sm_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff;
599 628 averaged_sm_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff;
600 629 averaged_sm_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff;
601 630 averaged_sm_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff;
602 631 averaged_sm_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff;
603 632 averaged_sm_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff;
604 633 averaged_sm_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff;
605 634 averaged_sm_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff;
606 635 averaged_sm_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff;
607 636 averaged_sm_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff;
608 637 averaged_sm_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff;
609 638 averaged_sm_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff;
610 639 averaged_sm_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff;
611 640 averaged_sm_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff;
612 641 averaged_sm_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff;
613 642
614 643 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_sm_f0[ 0 ];
615 644 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_sm_f0[ 1 ];
616 645 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_sm_f0[ 2 ];
617 646 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_sm_f0[ 3 ];
618 647 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_sm_f0[ 4 ];
619 648 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_sm_f0[ 5 ];
620 649 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_sm_f0[ 6 ];
621 650 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_sm_f0[ 7 ];
622 651 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_sm_f0[ 8 ];
623 652 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_sm_f0[ 9 ];
624 653 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_sm_f0[ 10 ];
625 654 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_sm_f0[ 11 ];
626 655 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_sm_f0[ 12 ];
627 656 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_sm_f0[ 13 ];
628 657 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_sm_f0[ 14 ];
629 658 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_sm_f0[ 15 ];
630 659 }
631 660
632 661 void reset_spectral_matrix_regs()
633 662 {
634 663 /** This function resets the spectral matrices module registers.
635 664 *
636 665 * The registers affected by this function are located at the following offset addresses:
637 666 *
638 667 * - 0x00 config
639 668 * - 0x04 status
640 669 * - 0x08 matrixF0_Address0
641 670 * - 0x10 matrixFO_Address1
642 671 * - 0x14 matrixF1_Address
643 672 * - 0x18 matrixF2_Address
644 673 *
645 674 */
646 675
647 676 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
648 677 spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address;
649 678 spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address;
650 679 spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address;
651 680 }
652 681
653 682 //******************
654 683 // general functions
655 684
656 685
657 686
658 687
@@ -1,748 +1,748
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, time );
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, time );
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, time );
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, time );
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, time );
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, time );
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, time );
102 102 break;
103 103 //
104 104 case TC_SUBTYPE_ENTER:
105 105 result = action_enter_mode( &TC, queue_snd_id, time );
106 106 close_action( &TC, result, queue_snd_id, time );
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, time );
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, time );
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, time );
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, time );
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, unsigned char *time)
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
164 164 requestedMode = TC->dataAndCRC[1];
165 165
166 166 if ( (requestedMode != LFR_MODE_STANDBY)
167 167 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
168 168 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
169 169 {
170 170 status = RTEMS_UNSATISFIED;
171 171 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode, time );
172 172 }
173 173 else
174 174 {
175 175 printf("in action_enter_mode *** enter mode %d\n", requestedMode);
176 176
177 #ifdef PRINT_TASK_STATISTICS
178 if (requestedMode != LFR_MODE_STANDBY)
179 {
180 rtems_cpu_usage_reset();
181 maxCount = 0;
182 }
183 #endif
184
185 177 status = transition_validation(requestedMode);
186 178
187 179 if ( status == LFR_SUCCESSFUL ) {
188 180 if ( lfrCurrentMode != LFR_MODE_STANDBY)
189 181 {
190 182 status = stop_current_mode();
191 183 }
192 184 if (status != RTEMS_SUCCESSFUL)
193 185 {
194 186 PRINTF("ERR *** in action_enter *** stop_current_mode\n")
195 187 }
196 188 status = enter_mode( requestedMode );
197 189 }
198 190 else
199 191 {
200 192 PRINTF("ERR *** in action_enter *** transition rejected\n")
201 193 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
202 194 }
203 195 }
204 196
205 197 return status;
206 198 }
207 199
208 200 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
209 201 {
210 202 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
211 203 *
212 204 * @param TC points to the TeleCommand packet that is being processed
213 205 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
214 206 *
215 207 * @return LFR directive status code:
216 208 * - LFR_DEFAULT
217 209 * - LFR_SUCCESSFUL
218 210 *
219 211 */
220 212
221 213 unsigned int val;
222 214 int result;
223 215
224 216 result = LFR_SUCCESSFUL;
225 217
226 218 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
227 219 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
228 220 val++;
229 221 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
230 222 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
231 223
232 224 return result;
233 225 }
234 226
235 227 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
236 228 {
237 229 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
238 230 *
239 231 * @param TC points to the TeleCommand packet that is being processed
240 232 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
241 233 *
242 234 */
243 235
244 236 int result;
245 237 unsigned char lfrMode;
246 238
247 239 result = LFR_DEFAULT;
248 240 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
249 241
250 242 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
251 243 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
252 244 result = LFR_DEFAULT;
253 245 }
254 246 else {
255 247 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
256 248 result = LFR_DEFAULT;
257 249 }
258 250 return result;
259 251 }
260 252
261 253 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
262 254 {
263 255 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
264 256 *
265 257 * @param TC points to the TeleCommand packet that is being processed
266 258 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
267 259 *
268 260 */
269 261
270 262 int result;
271 263 unsigned char lfrMode;
272 264
273 265 result = LFR_DEFAULT;
274 266 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
275 267
276 268 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
277 269 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
278 270 result = LFR_DEFAULT;
279 271 }
280 272 else {
281 273 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
282 274 result = LFR_DEFAULT;
283 275 }
284 276 return result;
285 277 }
286 278
287 279 int action_update_time(ccsdsTelecommandPacket_t *TC)
288 280 {
289 281 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
290 282 *
291 283 * @param TC points to the TeleCommand packet that is being processed
292 284 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
293 285 *
294 286 * @return LFR_SUCCESSFUL
295 287 *
296 288 */
297 289
298 290 unsigned int val;
299 291
300 292 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
301 293 + (TC->dataAndCRC[1] << 16)
302 294 + (TC->dataAndCRC[2] << 8)
303 295 + TC->dataAndCRC[3];
304 296 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
305 297 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
306 298 val++;
307 299 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
308 300 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
309 301 time_management_regs->ctrl = time_management_regs->ctrl | 1;
310 302
311 303 return LFR_SUCCESSFUL;
312 304 }
313 305
314 306 //*******************
315 307 // ENTERING THE MODES
316 308
317 309 int transition_validation(unsigned char requestedMode)
318 310 {
319 311 /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
320 312 *
321 313 * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
322 314 *
323 315 * @return LFR directive status codes:
324 316 * - LFR_SUCCESSFUL - the transition is authorized
325 317 * - LFR_DEFAULT - the transition is not authorized
326 318 *
327 319 */
328 320
329 321 int status;
330 322
331 323 switch (requestedMode)
332 324 {
333 325 case LFR_MODE_STANDBY:
334 326 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
335 327 status = LFR_DEFAULT;
336 328 }
337 329 else
338 330 {
339 331 status = LFR_SUCCESSFUL;
340 332 }
341 333 break;
342 334 case LFR_MODE_NORMAL:
343 335 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
344 336 status = LFR_DEFAULT;
345 337 }
346 338 else {
347 339 status = LFR_SUCCESSFUL;
348 340 }
349 341 break;
350 342 case LFR_MODE_BURST:
351 343 if ( lfrCurrentMode == LFR_MODE_BURST ) {
352 344 status = LFR_DEFAULT;
353 345 }
354 346 else {
355 347 status = LFR_SUCCESSFUL;
356 348 }
357 349 break;
358 350 case LFR_MODE_SBM1:
359 351 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
360 352 status = LFR_DEFAULT;
361 353 }
362 354 else {
363 355 status = LFR_SUCCESSFUL;
364 356 }
365 357 break;
366 358 case LFR_MODE_SBM2:
367 359 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
368 360 status = LFR_DEFAULT;
369 361 }
370 362 else {
371 363 status = LFR_SUCCESSFUL;
372 364 }
373 365 break;
374 366 default:
375 367 status = LFR_DEFAULT;
376 368 break;
377 369 }
378 370
379 371 return status;
380 372 }
381 373
382 374 int stop_current_mode(void)
383 375 {
384 376 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
385 377 *
386 378 * @return RTEMS directive status codes:
387 379 * - RTEMS_SUCCESSFUL - task restarted successfully
388 380 * - RTEMS_INVALID_ID - task id invalid
389 381 * - RTEMS_ALREADY_SUSPENDED - task already suspended
390 382 *
391 383 */
392 384
393 385 rtems_status_code status;
394 386
395 387 status = RTEMS_SUCCESSFUL;
396 388
397 // mask interruptions
389 // (1) mask interruptions
398 390 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
399 391 //LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
400 LEON_Mask_interrupt( IRQ_SM ); // mask spectral matrix interrupt simulator
401 // reset registers
392
393 // (2) clear interruptions
394 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
395 //LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
396
397 // (3) reset registers
402 398 reset_wfp_burst_enable(); // reset burst and enable bits
403 399 reset_wfp_status(); // reset all the status bits
404 // clear interruptions
405 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
406 //LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
407 LEON_Clear_interrupt( IRQ_SM ); // clear spectral matrix interrupt simulator
408 //**********************
400
401 // <Spectral Matrices simulator>
402 LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator
403 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
404 LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator
405 // </Spectral Matrices simulator>
406
409 407 // suspend several tasks
410 408 if (lfrCurrentMode != LFR_MODE_STANDBY) {
411 409 status = suspend_science_tasks();
412 410 }
413 411
414 412 if (status != RTEMS_SUCCESSFUL)
415 413 {
416 414 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
417 415 }
418 416
419 417 return status;
420 418 }
421 419
422 420 int enter_mode(unsigned char mode )
423 421 {
424 422 /** This function is launched after a mode transition validation.
425 423 *
426 424 * @param mode is the mode in which LFR will be put.
427 425 *
428 426 * @return RTEMS directive status codes:
429 427 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
430 428 * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully
431 429 *
432 430 */
433 431
434 432 rtems_status_code status;
435 433
436 434 status = RTEMS_UNSATISFIED;
437 435
438 436 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d);
439 437 updateLFRCurrentMode();
440 438
441 439 if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST)
442 440 || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) )
443 441 {
442 #ifdef PRINT_TASK_STATISTICS
443 rtems_cpu_usage_reset();
444 maxCount = 0;
445 #endif
444 446 status = restart_science_tasks();
445 447 launch_waveform_picker( mode );
446 // launch_spectral_matrix( mode );
448 launch_spectral_matrix( mode );
447 449 }
448 450 else if ( mode == LFR_MODE_STANDBY )
449 451 {
450 status = stop_current_mode();
451 }
452 else
453 {
454 status = RTEMS_UNSATISFIED;
455 }
456
457 if (mode == LFR_MODE_STANDBY)
458 {
459 PRINTF1("maxCount = %d\n", maxCount)
460 452 #ifdef PRINT_TASK_STATISTICS
461 453 rtems_cpu_usage_report();
462 454 #endif
463 455
464 456 #ifdef PRINT_STACK_REPORT
465 457 rtems_stack_checker_report_usage();
466 458 #endif
459 status = stop_current_mode();
460 PRINTF1("maxCount = %d\n", maxCount)
461 }
462 else
463 {
464 status = RTEMS_UNSATISFIED;
467 465 }
468 466
469 467 if (status != RTEMS_SUCCESSFUL)
470 468 {
471 469 PRINTF1("in enter_mode *** ERR = %d\n", status)
472 470 status = RTEMS_UNSATISFIED;
473 471 }
474 472
475 473 return status;
476 474 }
477 475
478 476 int restart_science_tasks()
479 477 {
480 478 /** This function is used to restart all science tasks.
481 479 *
482 480 * @return RTEMS directive status codes:
483 481 * - RTEMS_SUCCESSFUL - task restarted successfully
484 482 * - RTEMS_INVALID_ID - task id invalid
485 483 * - RTEMS_INCORRECT_STATE - task never started
486 484 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
487 485 *
488 486 * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1
489 487 *
490 488 */
491 489
492 490 rtems_status_code status[6];
493 491 rtems_status_code ret;
494 492
495 493 ret = RTEMS_SUCCESSFUL;
496 494
497 495 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 );
498 496 if (status[0] != RTEMS_SUCCESSFUL)
499 497 {
500 498 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
501 499 }
502 500
503 501 status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 );
504 502 if (status[1] != RTEMS_SUCCESSFUL)
505 503 {
506 504 PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1])
507 505 }
508 506
509 507 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
510 508 if (status[2] != RTEMS_SUCCESSFUL)
511 509 {
512 510 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
513 511 }
514 512
515 513 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
516 514 if (status[3] != RTEMS_SUCCESSFUL)
517 515 {
518 516 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
519 517 }
520 518
521 519 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
522 520 if (status[4] != RTEMS_SUCCESSFUL)
523 521 {
524 522 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
525 523 }
526 524
527 525 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
528 526 if (status[5] != RTEMS_SUCCESSFUL)
529 527 {
530 528 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
531 529 }
532 530
533 531 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
534 532 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
535 533 {
536 534 ret = RTEMS_UNSATISFIED;
537 535 }
538 536
539 537 return ret;
540 538 }
541 539
542 540 int suspend_science_tasks()
543 541 {
544 542 /** This function suspends the science tasks.
545 543 *
546 544 * @return RTEMS directive status codes:
547 545 * - RTEMS_SUCCESSFUL - task restarted successfully
548 546 * - RTEMS_INVALID_ID - task id invalid
549 547 * - RTEMS_ALREADY_SUSPENDED - task already suspended
550 548 *
551 549 */
552 550
553 551 rtems_status_code status;
554 552
555 553 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
556 554 if (status != RTEMS_SUCCESSFUL)
557 555 {
558 556 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
559 557 }
560 558
561 559 if (status == RTEMS_SUCCESSFUL) // suspend BPF0
562 560 {
563 561 status = rtems_task_suspend( Task_id[TASKID_BPF0] );
564 562 if (status != RTEMS_SUCCESSFUL)
565 563 {
566 564 PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status)
567 565 }
568 566 }
569 567
570 568 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
571 569 {
572 570 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
573 571 if (status != RTEMS_SUCCESSFUL)
574 572 {
575 573 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
576 574 }
577 575 }
578 576
579 577 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
580 578 {
581 579 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
582 580 if (status != RTEMS_SUCCESSFUL)
583 581 {
584 582 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
585 583 }
586 584 }
587 585
588 586 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
589 587 {
590 588 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
591 589 if (status != RTEMS_SUCCESSFUL)
592 590 {
593 591 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
594 592 }
595 593 }
596 594
597 595 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
598 596 {
599 597 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
600 598 if (status != RTEMS_SUCCESSFUL)
601 599 {
602 600 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
603 601 }
604 602 }
605 603
606 604 return status;
607 605 }
608 606
609 607 void launch_waveform_picker( unsigned char mode )
610 608 {
611 609 int startDate;
612 610
613 611 reset_current_ring_nodes();
614 612 reset_waveform_picker_regs();
615 613 set_wfp_burst_enable_register( mode );
616 614 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
617 615 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
618 616 startDate = time_management_regs->coarse_time + 2;
619 617 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000]
620 618 waveform_picker_regs->start_date = startDate;
621 619 }
622 620
623 621 void launch_spectral_matrix( unsigned char mode )
624 622 {
623 reset_nb_sm_f0();
625 624 reset_current_sm_ring_nodes();
626 625 reset_spectral_matrix_regs();
626
627 627 // Spectral Matrices simulator
628 628 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
629 LEON_Clear_interrupt( IRQ_SM_SIMULATOR );
630 LEON_Unmask_interrupt( IRQ_SM_SIMULATOR );
629 631 set_local_nb_interrupt_f0_MAX();
630 LEON_Clear_interrupt( IRQ_SM );
631 LEON_Unmask_interrupt( IRQ_SM );
632 632 }
633 633
634 634 //****************
635 635 // CLOSING ACTIONS
636 636 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time)
637 637 {
638 638 /** This function is used to update the HK packets statistics after a successful TC execution.
639 639 *
640 640 * @param TC points to the TC being processed
641 641 * @param time is the time used to date the TC execution
642 642 *
643 643 */
644 644
645 645 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
646 646 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
647 647 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
648 648 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
649 649 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
650 650 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
651 651 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
652 652 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
653 653 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
654 654 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
655 655 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
656 656 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
657 657 }
658 658
659 659 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time)
660 660 {
661 661 /** This function is used to update the HK packets statistics after a TC rejection.
662 662 *
663 663 * @param TC points to the TC being processed
664 664 * @param time is the time used to date the TC rejection
665 665 *
666 666 */
667 667
668 668 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
669 669 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
670 670 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
671 671 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
672 672 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
673 673 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
674 674 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
675 675 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
676 676 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
677 677 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
678 678 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
679 679 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
680 680 }
681 681
682 682 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time)
683 683 {
684 684 /** This function is the last step of the TC execution workflow.
685 685 *
686 686 * @param TC points to the TC being processed
687 687 * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
688 688 * @param queue_id is the id of the RTEMS message queue used to send TM packets
689 689 * @param time is the time used to date the TC execution
690 690 *
691 691 */
692 692
693 693 unsigned int val = 0;
694 694
695 695 if (result == LFR_SUCCESSFUL)
696 696 {
697 697 if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
698 698 &&
699 699 !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
700 700 )
701 701 {
702 702 send_tm_lfr_tc_exe_success( TC, queue_id, time );
703 703 }
704 704 update_last_TC_exe( TC, time );
705 705 val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1];
706 706 val++;
707 707 housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8);
708 708 housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val);
709 709 }
710 710 else
711 711 {
712 712 update_last_TC_rej( TC, time );
713 713 val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1];
714 714 val++;
715 715 housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8);
716 716 housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val);
717 717 }
718 718 }
719 719
720 720 //***************************
721 721 // Interrupt Service Routines
722 722 rtems_isr commutation_isr1( rtems_vector_number vector )
723 723 {
724 724 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
725 725 printf("In commutation_isr1 *** Error sending event to DUMB\n");
726 726 }
727 727 }
728 728
729 729 rtems_isr commutation_isr2( rtems_vector_number vector )
730 730 {
731 731 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
732 732 printf("In commutation_isr2 *** Error sending event to DUMB\n");
733 733 }
734 734 }
735 735
736 736 //****************
737 737 // OTHER FUNCTIONS
738 738 void updateLFRCurrentMode()
739 739 {
740 740 /** This function updates the value of the global variable lfrCurrentMode.
741 741 *
742 742 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
743 743 *
744 744 */
745 745 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
746 746 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
747 747 }
748 748
General Comments 0
You need to be logged in to leave comments. Login now