@@ -1,253 +1,253 | |||
|
1 | 1 | ############################################################################# |
|
2 | 2 | # Makefile for building: bin/fsw |
|
3 |
# Generated by qmake (2.01a) (Qt 4.8.5) on: Tu |
|
|
3 | # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Apr 24 22:14:00 2014 | |
|
4 | 4 | # Project: fsw-qt.pro |
|
5 | 5 | # Template: app |
|
6 | 6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
7 | 7 | ############################################################################# |
|
8 | 8 | |
|
9 | 9 | ####### Compiler, tools and options |
|
10 | 10 | |
|
11 | 11 | CC = sparc-rtems-gcc |
|
12 | 12 | CXX = sparc-rtems-g++ |
|
13 | 13 | DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=6 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS -DBOOT_MESSAGES |
|
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../src/basic_parameters |
|
17 | 17 | LINK = sparc-rtems-g++ |
|
18 | 18 | LFLAGS = |
|
19 | 19 | LIBS = $(SUBLIBS) |
|
20 | 20 | AR = sparc-rtems-ar rcs |
|
21 | 21 | RANLIB = |
|
22 | 22 | QMAKE = /usr/bin/qmake-qt4 |
|
23 | 23 | TAR = tar -cf |
|
24 | 24 | COMPRESS = gzip -9f |
|
25 | 25 | COPY = cp -f |
|
26 | 26 | SED = sed |
|
27 | 27 | COPY_FILE = $(COPY) |
|
28 | 28 | COPY_DIR = $(COPY) -r |
|
29 | 29 | STRIP = sparc-rtems-strip |
|
30 | 30 | INSTALL_FILE = install -m 644 -p |
|
31 | 31 | INSTALL_DIR = $(COPY_DIR) |
|
32 | 32 | INSTALL_PROGRAM = install -m 755 -p |
|
33 | 33 | DEL_FILE = rm -f |
|
34 | 34 | SYMLINK = ln -f -s |
|
35 | 35 | DEL_DIR = rmdir |
|
36 | 36 | MOVE = mv -f |
|
37 | 37 | CHK_DIR_EXISTS= test -d |
|
38 | 38 | MKDIR = mkdir -p |
|
39 | 39 | |
|
40 | 40 | ####### Output directory |
|
41 | 41 | |
|
42 | 42 | OBJECTS_DIR = obj/ |
|
43 | 43 | |
|
44 | 44 | ####### Files |
|
45 | 45 | |
|
46 | 46 | SOURCES = ../src/wf_handler.c \ |
|
47 | 47 | ../src/tc_handler.c \ |
|
48 | 48 | ../src/fsw_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 | ../src/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: ../src/basic_parameters/basic_parameters.c ../src/basic_parameters/basic_parameters.h |
|
244 | 244 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/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,201 +1,201 | |||
|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
|
2 | 2 | <!DOCTYPE QtCreatorProject> |
|
3 |
<!-- Written by QtCreator 3.0.1, 2014-04-2 |
|
|
3 | <!-- Written by QtCreator 3.0.1, 2014-04-24T22:30:22. --> | |
|
4 | 4 | <qtcreator> |
|
5 | 5 | <data> |
|
6 | 6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
7 | 7 | <value type="int">0</value> |
|
8 | 8 | </data> |
|
9 | 9 | <data> |
|
10 | 10 | <variable>ProjectExplorer.Project.EditorSettings</variable> |
|
11 | 11 | <valuemap type="QVariantMap"> |
|
12 | 12 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> |
|
13 | 13 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> |
|
14 | 14 | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> |
|
15 | 15 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> |
|
16 | 16 | <value type="QString" key="language">Cpp</value> |
|
17 | 17 | <valuemap type="QVariantMap" key="value"> |
|
18 | 18 | <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> |
|
19 | 19 | </valuemap> |
|
20 | 20 | </valuemap> |
|
21 | 21 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> |
|
22 | 22 | <value type="QString" key="language">QmlJS</value> |
|
23 | 23 | <valuemap type="QVariantMap" key="value"> |
|
24 | 24 | <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> |
|
25 | 25 | </valuemap> |
|
26 | 26 | </valuemap> |
|
27 | 27 | <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> |
|
28 | 28 | <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> |
|
29 | 29 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> |
|
30 | 30 | <value type="int" key="EditorConfiguration.IndentSize">4</value> |
|
31 | 31 | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> |
|
32 | 32 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> |
|
33 | 33 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> |
|
34 | 34 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> |
|
35 | 35 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> |
|
36 | 36 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> |
|
37 | 37 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> |
|
38 | 38 | <value type="int" key="EditorConfiguration.TabSize">8</value> |
|
39 | 39 | <value type="bool" key="EditorConfiguration.UseGlobal">true</value> |
|
40 | 40 | <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> |
|
41 | 41 | <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> |
|
42 | 42 | <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> |
|
43 | 43 | <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> |
|
44 | 44 | <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> |
|
45 | 45 | </valuemap> |
|
46 | 46 | </data> |
|
47 | 47 | <data> |
|
48 | 48 | <variable>ProjectExplorer.Project.PluginSettings</variable> |
|
49 | 49 | <valuemap type="QVariantMap"/> |
|
50 | 50 | </data> |
|
51 | 51 | <data> |
|
52 | 52 | <variable>ProjectExplorer.Project.Target.0</variable> |
|
53 | 53 | <valuemap type="QVariantMap"> |
|
54 | 54 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.3 in PATH (System)</value> |
|
55 | 55 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.3 in PATH (System)</value> |
|
56 | 56 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{be73cf6a-f9d8-4d5a-8adf-adc2d83e2e44}</value> |
|
57 | 57 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
|
58 | 58 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
|
59 | 59 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
|
60 | 60 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
|
61 | 61 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> |
|
62 | 62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
63 | 63 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
64 | 64 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
65 | 65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
66 | 66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
67 | 67 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
68 | 68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
69 | 69 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> |
|
70 | 70 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
71 | 71 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
72 | 72 | </valuemap> |
|
73 | 73 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
74 | 74 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
75 | 75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
76 | 76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
77 | 77 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
78 | 78 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
79 | 79 | <value type="QString">-w</value> |
|
80 | 80 | <value type="QString">-r</value> |
|
81 | 81 | </valuelist> |
|
82 | 82 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
83 | 83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|
84 | 84 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
85 | 85 | </valuemap> |
|
86 | 86 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
87 | 87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
88 | 88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
89 | 89 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
90 | 90 | </valuemap> |
|
91 | 91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
92 | 92 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
93 | 93 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
94 | 94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
95 | 95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
96 | 96 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
97 | 97 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
98 | 98 | <value type="QString">-w</value> |
|
99 | 99 | <value type="QString">-r</value> |
|
100 | 100 | </valuelist> |
|
101 | 101 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
102 | 102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|
103 | 103 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
104 | 104 | </valuemap> |
|
105 | 105 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
106 | 106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
107 | 107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
108 | 108 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
109 | 109 | </valuemap> |
|
110 | 110 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
111 | 111 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
112 | 112 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
113 | 113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> |
|
114 | 114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
115 | 115 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
116 | 116 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
117 | 117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
|
118 | 118 | </valuemap> |
|
119 | 119 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> |
|
120 | 120 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
121 | 121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
122 | 122 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
123 | 123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
124 | 124 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
125 | 125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|
126 | 126 | </valuemap> |
|
127 | 127 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
128 | 128 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> |
|
129 | 129 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
130 | 130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
131 | 131 | </valuemap> |
|
132 | 132 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
133 | 133 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|
134 | 134 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
135 | 135 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
136 | 136 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
137 | 137 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
138 | 138 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
139 | 139 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
140 | 140 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
141 | 141 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
142 | 142 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
143 | 143 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
144 | 144 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
|
145 | 145 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
146 | 146 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
147 | 147 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
|
148 | 148 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
|
149 | 149 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
|
150 | 150 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
151 | 151 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
152 | 152 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
153 | 153 | <value type="int">0</value> |
|
154 | 154 | <value type="int">1</value> |
|
155 | 155 | <value type="int">2</value> |
|
156 | 156 | <value type="int">3</value> |
|
157 | 157 | <value type="int">4</value> |
|
158 | 158 | <value type="int">5</value> |
|
159 | 159 | <value type="int">6</value> |
|
160 | 160 | <value type="int">7</value> |
|
161 | 161 | <value type="int">8</value> |
|
162 | 162 | <value type="int">9</value> |
|
163 | 163 | <value type="int">10</value> |
|
164 | 164 | <value type="int">11</value> |
|
165 | 165 | <value type="int">12</value> |
|
166 | 166 | <value type="int">13</value> |
|
167 | 167 | <value type="int">14</value> |
|
168 | 168 | </valuelist> |
|
169 | 169 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
170 | 170 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
171 | 171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> |
|
172 | 172 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
173 | 173 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> |
|
174 | 174 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
|
175 | 175 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> |
|
176 | 176 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
|
177 | 177 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> |
|
178 | 178 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> |
|
179 | 179 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
180 | 180 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> |
|
181 | 181 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> |
|
182 | 182 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
183 | 183 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
184 | 184 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
|
185 | 185 | </valuemap> |
|
186 | 186 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> |
|
187 | 187 | </valuemap> |
|
188 | 188 | </data> |
|
189 | 189 | <data> |
|
190 | 190 | <variable>ProjectExplorer.Project.TargetCount</variable> |
|
191 | 191 | <value type="int">1</value> |
|
192 | 192 | </data> |
|
193 | 193 | <data> |
|
194 | 194 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> |
|
195 | 195 | <value type="QByteArray">{cdbf9cdc-1e84-406e-889b-c4feef49e75c}</value> |
|
196 | 196 | </data> |
|
197 | 197 | <data> |
|
198 | 198 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
|
199 | 199 | <value type="int">15</value> |
|
200 | 200 | </data> |
|
201 | 201 | </qtcreator> |
@@ -1,284 +1,283 | |||
|
1 | 1 | #ifndef FSW_PARAMS_H_INCLUDED |
|
2 | 2 | #define FSW_PARAMS_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include "grlib_regs.h" |
|
5 | 5 | #include "fsw_params_processing.h" |
|
6 | 6 | #include "fsw_params_nb_bytes.h" |
|
7 | 7 | #include "tm_byte_positions.h" |
|
8 | 8 | #include "ccsds_types.h" |
|
9 | 9 | |
|
10 | 10 | #define GRSPW_DEVICE_NAME "/dev/grspw0" |
|
11 | 11 | #define UART_DEVICE_NAME "/dev/console" |
|
12 | 12 | |
|
13 | 13 | typedef struct ring_node |
|
14 | 14 | { |
|
15 | 15 | struct ring_node *previous; |
|
16 | 16 | int buffer_address; |
|
17 | 17 | struct ring_node *next; |
|
18 | 18 | unsigned int status; |
|
19 | 19 | } ring_node; |
|
20 | 20 | |
|
21 | 21 | typedef struct { |
|
22 |
unsigned int norm_bp1 |
|
|
23 |
unsigned int norm_bp2 |
|
|
24 |
unsigned int norm_asm |
|
|
25 |
unsigned int burst_sbm_bp1 |
|
|
26 |
unsigned int burst_sbm_bp2 |
|
|
27 |
unsigned int burst_bp1 |
|
|
28 |
unsigned int burst_bp2 |
|
|
29 |
unsigned int sbm1_bp1 |
|
|
30 |
unsigned int sbm1_bp2 |
|
|
31 |
unsigned int sbm2_bp1 |
|
|
32 |
unsigned int sbm2_bp2 |
|
|
22 | unsigned int norm_bp1; | |
|
23 | unsigned int norm_bp2; | |
|
24 | unsigned int norm_asm; | |
|
25 | unsigned int burst_sbm_bp1; | |
|
26 | unsigned int burst_sbm_bp2; | |
|
27 | unsigned int burst_bp1; | |
|
28 | unsigned int burst_bp2; | |
|
29 | unsigned int sbm1_bp1; | |
|
30 | unsigned int sbm1_bp2; | |
|
31 | unsigned int sbm2_bp1; | |
|
32 | unsigned int sbm2_bp2; | |
|
33 | 33 | } nb_sm_before_bp_asm_f0; |
|
34 | 34 | |
|
35 | 35 | typedef struct { |
|
36 | 36 | unsigned int norm_bp1; |
|
37 | 37 | unsigned int norm_bp2; |
|
38 | 38 | unsigned int norm_asm; |
|
39 | 39 | unsigned int burst_sbm_bp1; |
|
40 | 40 | unsigned int burst_sbm_bp2; |
|
41 | 41 | unsigned int burst_bp1; |
|
42 | 42 | unsigned int burst_bp2; |
|
43 | 43 | unsigned int sbm2_bp1; |
|
44 | 44 | unsigned int sbm2_bp2; |
|
45 | 45 | } nb_sm_before_bp_asm_f1; |
|
46 | 46 | |
|
47 | 47 | typedef struct { |
|
48 | 48 | unsigned int norm_bp1_f2; |
|
49 | 49 | unsigned int norm_bp2_f2; |
|
50 | 50 | unsigned int norm_asm_f2; |
|
51 | 51 | unsigned int burst_sbm_bp1_f2; |
|
52 | 52 | unsigned int burst_sbm_bp2_f2; |
|
53 | 53 | unsigned int burst_bp1_f2; |
|
54 | 54 | unsigned int burst_bp2_f2; |
|
55 | 55 | unsigned int sbm2_bp1_f2; |
|
56 | 56 | unsigned int sbm2_bp2_f2; |
|
57 | 57 | } nb_sm_before_bp_asm_f2; |
|
58 | 58 | |
|
59 | 59 | //************************ |
|
60 | 60 | // flight software version |
|
61 | 61 | // this parameters is handled by the Qt project options |
|
62 | 62 | |
|
63 | 63 | #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk |
|
64 | 64 | #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk |
|
65 | 65 | #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688 |
|
66 | 66 | #define TIME_OFFSET 2 |
|
67 | 67 | #define TIME_OFFSET_IN_BYTES 8 |
|
68 | 68 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 |
|
69 | 69 | #define NB_BYTES_SWF_BLK (2 * 6) |
|
70 | 70 | #define NB_WORDS_SWF_BLK 3 |
|
71 | 71 | #define NB_BYTES_CWF3_LIGHT_BLK 6 |
|
72 | 72 | #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 |
|
73 | 73 | #define NB_RING_NODES_F0 3 // AT LEAST 3 |
|
74 | 74 | #define NB_RING_NODES_F1 5 // AT LEAST 3 |
|
75 | 75 | #define NB_RING_NODES_F2 5 // AT LEAST 3 |
|
76 | 76 | |
|
77 | 77 | //********** |
|
78 | 78 | // LFR MODES |
|
79 | 79 | #define LFR_MODE_STANDBY 0 |
|
80 | 80 | #define LFR_MODE_NORMAL 1 |
|
81 | 81 | #define LFR_MODE_BURST 2 |
|
82 | 82 | #define LFR_MODE_SBM1 3 |
|
83 | 83 | #define LFR_MODE_SBM2 4 |
|
84 | 84 | |
|
85 | 85 | #define TDS_MODE_LFM 5 |
|
86 | 86 | #define TDS_MODE_STANDBY 0 |
|
87 | 87 | #define TDS_MODE_NORMAL 1 |
|
88 | 88 | #define TDS_MODE_BURST 2 |
|
89 | 89 | #define TDS_MODE_SBM1 3 |
|
90 | 90 | #define TDS_MODE_SBM2 4 |
|
91 | 91 | |
|
92 | 92 | #define THR_MODE_STANDBY 0 |
|
93 | 93 | #define THR_MODE_NORMAL 1 |
|
94 | 94 | #define THR_MODE_BURST 2 |
|
95 | 95 | |
|
96 | 96 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 |
|
97 | 97 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 |
|
98 | 98 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 |
|
99 | 99 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 |
|
100 | 100 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 |
|
101 | 101 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 |
|
102 | 102 | #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6 |
|
103 | 103 | #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7 |
|
104 | 104 | #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 |
|
105 | 105 | #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9 |
|
106 | 106 | #define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10 |
|
107 | 107 | #define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11 |
|
108 | 108 | #define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12 |
|
109 | 109 | #define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13 |
|
110 | 110 | #define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14 |
|
111 | 111 | #define RTEMS_EVENT_BURST_SBM_BP1_F0 RTEMS_EVENT_15 |
|
112 | 112 | #define RTEMS_EVENT_BURST_SBM_BP2_F0 RTEMS_EVENT_16 |
|
113 | 113 | #define RTEMS_EVENT_BURST_SBM_BP1_F1 RTEMS_EVENT_17 |
|
114 | 114 | #define RTEMS_EVENT_BURST_SBM_BP2_F1 RTEMS_EVENT_18 |
|
115 | 115 | #define RTEMS_EVENT_BURST_SBM_BP1_F2 RTEMS_EVENT_19 |
|
116 | 116 | #define RTEMS_EVENT_BURST_SBM_BP2_F2 RTEMS_EVENT_20 |
|
117 | 117 | |
|
118 | 118 | //**************************** |
|
119 | 119 | // LFR DEFAULT MODE PARAMETERS |
|
120 | 120 | // COMMON |
|
121 | 121 | #define DEFAULT_SY_LFR_COMMON0 0x00 |
|
122 | 122 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 |
|
123 | 123 | // NORM |
|
124 | 124 | #define SY_LFR_N_SWF_L 2048 // nb sample |
|
125 | 125 | #define SY_LFR_N_SWF_P 300 // sec |
|
126 | 126 | #define SY_LFR_N_ASM_P 3600 // sec |
|
127 | 127 | #define SY_LFR_N_BP_P0 4 // sec |
|
128 | 128 | #define SY_LFR_N_BP_P1 20 // sec |
|
129 | 129 | #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3 |
|
130 | 130 | #define MIN_DELTA_SNAPSHOT 16 // sec |
|
131 | 131 | // BURST |
|
132 | 132 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec |
|
133 | 133 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec |
|
134 | 134 | // SBM1 |
|
135 | 135 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec |
|
136 | 136 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec |
|
137 | 137 | // SBM2 |
|
138 | 138 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec |
|
139 | 139 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec |
|
140 | 140 | // ADDITIONAL PARAMETERS |
|
141 | 141 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms |
|
142 | 142 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s |
|
143 | 143 | // STATUS WORD |
|
144 | 144 | #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits |
|
145 | 145 | #define DEFAULT_STATUS_WORD_BYTE1 0x00 |
|
146 | 146 | // |
|
147 | 147 | #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s |
|
148 | 148 | #define SY_LFR_DPU_CONNECT_ATTEMPT 3 |
|
149 | 149 | //**************************** |
|
150 | 150 | |
|
151 | 151 | //***************************** |
|
152 | 152 | // APB REGISTERS BASE ADDRESSES |
|
153 | 153 | #define REGS_ADDR_APBUART 0x80000100 |
|
154 | 154 | #define REGS_ADDR_GPTIMER 0x80000300 |
|
155 | 155 | #define REGS_ADDR_GRSPW 0x80000500 |
|
156 | 156 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 |
|
157 | 157 | #define REGS_ADDR_GRGPIO 0x80000b00 |
|
158 | 158 | |
|
159 | 159 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 |
|
160 | 160 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f40 |
|
161 | 161 | |
|
162 | 162 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
|
163 | 163 | #define APBUART_CTRL_REG_MASK_TE 0x00000002 |
|
164 | 164 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) |
|
165 | 165 | |
|
166 | 166 | //********** |
|
167 | 167 | // IRQ LINES |
|
168 | 168 | #define IRQ_SM_SIMULATOR 9 |
|
169 | 169 | #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels |
|
170 | 170 | #define IRQ_WAVEFORM_PICKER 14 |
|
171 | 171 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels |
|
172 | 172 | #define IRQ_SPECTRAL_MATRIX 6 |
|
173 | 173 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels |
|
174 | 174 | |
|
175 | 175 | //***** |
|
176 | 176 | // TIME |
|
177 | 177 | #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416 |
|
178 | 178 | #define TIMER_SM_SIMULATOR 1 |
|
179 | 179 | #define HK_PERIOD 100 // 100 * 10ms => 1s |
|
180 | 180 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000 |
|
181 | 181 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s |
|
182 | 182 | |
|
183 | 183 | //********** |
|
184 | 184 | // LPP CODES |
|
185 | 185 | #define LFR_SUCCESSFUL 0 |
|
186 | 186 | #define LFR_DEFAULT 1 |
|
187 | 187 | #define LFR_EXE_ERROR 2 |
|
188 | 188 | |
|
189 | 189 | //****** |
|
190 | 190 | // RTEMS |
|
191 | 191 | #define TASKID_RECV 1 |
|
192 | 192 | #define TASKID_ACTN 2 |
|
193 | 193 | #define TASKID_SPIQ 3 |
|
194 | 194 | #define TASKID_STAT 4 |
|
195 | 195 | #define TASKID_AVF0 5 |
|
196 | 196 | #define TASKID_SWBD 6 |
|
197 | 197 | #define TASKID_WFRM 7 |
|
198 | 198 | #define TASKID_DUMB 8 |
|
199 | 199 | #define TASKID_HOUS 9 |
|
200 | 200 | #define TASKID_PRC0 10 |
|
201 | 201 | #define TASKID_CWF3 11 |
|
202 | 202 | #define TASKID_CWF2 12 |
|
203 | 203 | #define TASKID_CWF1 13 |
|
204 | 204 | #define TASKID_SEND 14 |
|
205 | 205 | #define TASKID_WTDG 15 |
|
206 | 206 | #define TASKID_AVF1 16 |
|
207 | 207 | #define TASKID_PRC1 17 |
|
208 | 208 | |
|
209 | 209 | #define TASK_PRIORITY_SPIQ 5 |
|
210 | //#define TASK_PRIORITY_SMIQ 10 | |
|
211 | 210 | #define TASK_PRIORITY_WTDG 20 |
|
212 | 211 | #define TASK_PRIORITY_HOUS 30 |
|
213 | 212 | #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together |
|
214 | 213 | #define TASK_PRIORITY_CWF2 35 // |
|
215 | 214 | #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it |
|
216 | 215 | #define TASK_PRIORITY_WFRM 40 |
|
217 | 216 | #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1 |
|
218 | 217 | #define TASK_PRIORITY_SEND 45 |
|
219 | 218 | #define TASK_PRIORITY_RECV 50 |
|
220 | 219 | #define TASK_PRIORITY_ACTN 50 |
|
221 | 220 | #define TASK_PRIORITY_AVF0 60 |
|
221 | #define TASK_PRIORITY_AVF1 70 | |
|
222 | 222 | #define TASK_PRIORITY_PRC0 100 |
|
223 | 223 | #define TASK_PRIORITY_PRC1 100 |
|
224 | #define TASK_PRIORITY_AVF1 60 | |
|
225 | 224 | #define TASK_PRIORITY_STAT 200 |
|
226 | 225 | #define TASK_PRIORITY_DUMB 200 |
|
227 | 226 | |
|
228 | 227 | #define MSG_QUEUE_COUNT_RECV 10 |
|
229 | 228 | #define MSG_QUEUE_COUNT_SEND 50 |
|
230 | 229 | #define MSG_QUEUE_COUNT_PRC0 10 |
|
231 | 230 | #define MSG_QUEUE_COUNT_PRC1 10 |
|
232 | 231 | #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1 |
|
233 | 232 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options |
|
234 | 233 | #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers |
|
235 | 234 | #define MSG_QUEUE_SIZE_PRC1 20 // two pointers and one rtems_event + 2 integers |
|
236 | 235 | |
|
237 | 236 | #define QUEUE_RECV 0 |
|
238 | 237 | #define QUEUE_SEND 1 |
|
239 | 238 | #define QUEUE_PRC0 2 |
|
240 | 239 | #define QUEUE_PRC1 3 |
|
241 | 240 | |
|
242 | 241 | //******* |
|
243 | 242 | // MACROS |
|
244 | 243 | #ifdef PRINT_MESSAGES_ON_CONSOLE |
|
245 | 244 | #define PRINTF(x) printf(x); |
|
246 | 245 | #define PRINTF1(x,y) printf(x,y); |
|
247 | 246 | #define PRINTF2(x,y,z) printf(x,y,z); |
|
248 | 247 | #else |
|
249 | 248 | #define PRINTF(x) ; |
|
250 | 249 | #define PRINTF1(x,y) ; |
|
251 | 250 | #define PRINTF2(x,y,z) ; |
|
252 | 251 | #endif |
|
253 | 252 | |
|
254 | 253 | #ifdef BOOT_MESSAGES |
|
255 | 254 | #define BOOT_PRINTF(x) printf(x); |
|
256 | 255 | #define BOOT_PRINTF1(x,y) printf(x,y); |
|
257 | 256 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); |
|
258 | 257 | #else |
|
259 | 258 | #define BOOT_PRINTF(x) ; |
|
260 | 259 | #define BOOT_PRINTF1(x,y) ; |
|
261 | 260 | #define BOOT_PRINTF2(x,y,z) ; |
|
262 | 261 | #endif |
|
263 | 262 | |
|
264 | 263 | #ifdef DEBUG_MESSAGES |
|
265 | 264 | #define DEBUG_PRINTF(x) printf(x); |
|
266 | 265 | #define DEBUG_PRINTF1(x,y) printf(x,y); |
|
267 | 266 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); |
|
268 | 267 | #else |
|
269 | 268 | #define DEBUG_PRINTF(x) ; |
|
270 | 269 | #define DEBUG_PRINTF1(x,y) ; |
|
271 | 270 | #define DEBUG_PRINTF2(x,y,z) ; |
|
272 | 271 | #endif |
|
273 | 272 | |
|
274 | 273 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period |
|
275 | 274 | |
|
276 | 275 | struct param_local_str{ |
|
277 | 276 | unsigned int local_sbm1_nb_cwf_sent; |
|
278 | 277 | unsigned int local_sbm1_nb_cwf_max; |
|
279 | 278 | unsigned int local_sbm2_nb_cwf_sent; |
|
280 | 279 | unsigned int local_sbm2_nb_cwf_max; |
|
281 | 280 | unsigned int local_nb_interrupt_f0_MAX; |
|
282 | 281 | }; |
|
283 | 282 | |
|
284 | 283 | #endif // FSW_PARAMS_H_INCLUDED |
@@ -1,73 +1,63 | |||
|
1 | 1 | #ifndef FSW_PARAMS_PROCESSING_H |
|
2 | 2 | #define FSW_PARAMS_PROCESSING_H |
|
3 | 3 | |
|
4 | 4 | #define NB_BINS_PER_SM 128 |
|
5 | 5 | #define NB_VALUES_PER_SM 25 |
|
6 | 6 | #define TOTAL_SIZE_SM 3200 // 25 * 128 |
|
7 | 7 | #define TOTAL_SIZE_NORM_BP1_F0 99 // 11 * 9 = 99 |
|
8 | 8 | #define TOTAL_SIZE_NORM_BP1_F1 117 // 13 * 9 = 117 |
|
9 | 9 | #define TOTAL_SIZE_NORM_BP1_F2 108 // 12 * 9 = 108 |
|
10 | 10 | #define TOTAL_SIZE_SBM1_BP1_F0 198 // 22 * 9 = 198 |
|
11 | 11 | // |
|
12 | 12 | #define NB_RING_NODES_SM_F0 12 // AT LEAST 3 |
|
13 | 13 | #define NB_RING_NODES_ASM_BURST_SBM_F0 10 // AT LEAST 3 |
|
14 | 14 | #define NB_RING_NODES_ASM_NORM_F0 10 // AT LEAST 3 |
|
15 | 15 | #define NB_RING_NODES_SM_F1 3 // AT LEAST 3 |
|
16 | 16 | #define NB_RING_NODES_ASM_BURST_SBM_F1 5 // AT LEAST 3 |
|
17 | 17 | #define NB_RING_NODES_ASM_NORM_F1 5 // AT LEAST 3 |
|
18 | 18 | #define NB_RING_NODES_SM_F2 3 // AT LEAST 3 |
|
19 | 19 | // |
|
20 | 20 | #define NB_BINS_PER_ASM_F0 88 |
|
21 | 21 | #define NB_BINS_PER_PKT_ASM_F0 44 |
|
22 | 22 | #define TOTAL_SIZE_ASM_F0_IN_BYTES 4400 // 25 * 88 * 2 |
|
23 | 23 | #define ASM_F0_INDICE_START 17 // 88 bins |
|
24 | 24 | #define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins |
|
25 | 25 | // |
|
26 | 26 | #define NB_BINS_PER_ASM_F1 104 |
|
27 | 27 | #define NB_BINS_PER_PKT_ASM_F1 52 |
|
28 |
#define TOTAL_SIZE_ASM_F1 2 |
|
|
28 | #define TOTAL_SIZE_ASM_F1_IN_BYTES 5200 // 25 * 104 * 2 | |
|
29 | 29 | #define ASM_F1_INDICE_START 6 // 104 bins |
|
30 | 30 | #define ASM_F1_INDICE_STOP 109 // 2 packets of 52 bins |
|
31 | 31 | // |
|
32 | 32 | #define NB_BINS_PER_ASM_F2 96 |
|
33 | 33 | #define NB_BINS_PER_PKT_ASM_F2 48 |
|
34 |
#define TOTAL_SIZE_ASM_F2 |
|
|
34 | #define TOTAL_SIZE_ASM_F2_IN_BYTES 4800 // 25 * 96 * 2 | |
|
35 | 35 | #define ASM_F2_INDICE_START 7 // 96 bins |
|
36 | 36 | #define ASM_F2_INDICE_STOP 102 // 2 packets of 48 bins |
|
37 | 37 | // |
|
38 | 38 | #define NB_BINS_COMPRESSED_SM_F0 11 |
|
39 | 39 | #define NB_BINS_COMPRESSED_SM_F1 13 |
|
40 | 40 | #define NB_BINS_COMPRESSED_SM_F2 12 |
|
41 | 41 | #define NB_BINS_COMPRESSED_SM_SBM_F0 22 |
|
42 | 42 | #define NB_BINS_COMPRESSED_SM_SBM_F1 26 |
|
43 | 43 | #define NB_BINS_COMPRESSED_SM_SBM_F2 24 |
|
44 | 44 | // |
|
45 | 45 | #define NB_BINS_TO_AVERAGE_ASM_F0 8 |
|
46 | 46 | #define NB_BINS_TO_AVERAGE_ASM_F1 8 |
|
47 | 47 | #define NB_BINS_TO_AVERAGE_ASM_F2 8 |
|
48 | 48 | #define NB_BINS_TO_AVERAGE_ASM_SBM_F0 4 |
|
49 | 49 | #define NB_BINS_TO_AVERAGE_ASM_SBM_F1 4 |
|
50 | 50 | #define NB_BINS_TO_AVERAGE_ASM_SBM_F2 4 |
|
51 | 51 | // |
|
52 | #define TOTAL_SIZE_COMPRESSED_ASM_F0 275 // 11 * 25 WORDS | |
|
53 | #define TOTAL_SIZE_COMPRESSED_ASM_F1 325 // 13 * 25 WORDS | |
|
54 | #define TOTAL_SIZE_COMPRESSED_ASM_F2 300 // 12 * 25 WORDS | |
|
55 |
#define TOTAL_SIZE_COMPRESSED_ASM_SBM |
|
|
52 | #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F0 275 // 11 * 25 WORDS | |
|
53 | #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F1 325 // 13 * 25 WORDS | |
|
54 | #define TOTAL_SIZE_COMPRESSED_ASM_F2 300 // 12 * 25 WORDS | |
|
55 | #define TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 550 // 22 * 25 WORDS | |
|
56 | #define TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 650 // 26 * 25 WORDS | |
|
56 | 57 | // NORM |
|
57 | 58 | #define NB_SM_BEFORE_NORM_BP1_F0 384 // 96 * 4 |
|
58 | #define NB_SM_BEFORE_NORM_BP2_F0 1920 // 96 * 20 | |
|
59 | #define NB_SM_BEFORE_NORM_ASM_F0 384 // 384 matrices at f0 = 4.00 second | |
|
60 | // BURST | |
|
61 | #define NB_SM_BEFORE_BURST_BP1_F0 96 // 96 matrices at f0 = 1.00 second | |
|
62 | #define NB_SM_BEFORE_BURST_BP2_F0 480 // 480 matrices at f0 = 5.00 second | |
|
63 | // SBM1 | |
|
64 | #define NB_SM_BEFORE_SBM1_BP1_F0 24 // 24 matrices at f0 = 0.25 second | |
|
65 | #define NB_SM_BEFORE_SBM1_BP2_F0 96 // 96 matrices at f0 = 1.00 second | |
|
66 | // SBM2 | |
|
67 | #define NB_SM_BEFORE_SBM2_BP1_F0 96 // 96 matrices at f0 = 1.00 second | |
|
68 | #define NB_SM_BEFORE_SBM2_BP2_F0 480 // 480 matrices at f0 = 5.00 second | |
|
69 | 59 | // GENERAL |
|
70 | 60 | #define NB_SM_BEFORE_AVF0 8 |
|
71 | 61 | #define NB_SM_BEFORE_AVF1 8 |
|
72 | 62 | |
|
73 | 63 | #endif // FSW_PARAMS_PROCESSING_H |
@@ -1,1231 +1,1273 | |||
|
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 | unsigned int nb_sm_f0; |
|
15 | unsigned int nb_sm_f0_aux; | |
|
16 | unsigned int nb_sm_f1; | |
|
15 | 17 | |
|
16 | 18 | //************************ |
|
17 | 19 | // spectral matrices rings |
|
18 | 20 | ring_node_sm sm_ring_f0[ NB_RING_NODES_SM_F0 ]; |
|
19 | 21 | ring_node_sm sm_ring_f1[ NB_RING_NODES_SM_F1 ]; |
|
20 | 22 | ring_node_sm sm_ring_f2[ NB_RING_NODES_SM_F2 ]; |
|
21 | 23 | ring_node_sm *current_ring_node_sm_f0; |
|
22 | 24 | ring_node_sm *current_ring_node_sm_f1; |
|
23 | 25 | ring_node_sm *current_ring_node_sm_f2; |
|
24 | 26 | ring_node_sm *ring_node_for_averaging_sm_f0; |
|
25 | 27 | ring_node_sm *ring_node_for_averaging_sm_f1; |
|
26 | 28 | |
|
27 | 29 | ring_node_asm asm_ring_norm_f0 [ NB_RING_NODES_ASM_NORM_F0 ]; |
|
28 | 30 | ring_node_asm asm_ring_burst_sbm_f0[ NB_RING_NODES_ASM_BURST_SBM_F0 ]; |
|
29 | 31 | ring_node_asm asm_ring_norm_f1 [ NB_RING_NODES_ASM_NORM_F1 ]; |
|
30 | 32 | ring_node_asm asm_ring_burst_sbm_f1[ NB_RING_NODES_ASM_BURST_SBM_F1 ]; |
|
31 | 33 | ring_node_asm *current_ring_node_asm_burst_sbm_f0; |
|
32 | 34 | ring_node_asm *current_ring_node_asm_norm_f0; |
|
33 | 35 | ring_node_asm *current_ring_node_asm_burst_sbm_f1; |
|
34 | 36 | ring_node_asm *current_ring_node_asm_norm_f1; |
|
35 | 37 | |
|
36 | 38 | float asm_f0_reorganized [ TOTAL_SIZE_SM ]; |
|
37 | 39 | char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ]; |
|
38 |
float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_F0 |
|
|
39 |
float compressed_sm_sbm |
|
|
40 | float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F0]; | |
|
41 | float compressed_sm_sbm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 ]; | |
|
42 | ||
|
43 | float asm_f1_reorganized [ TOTAL_SIZE_SM ]; | |
|
44 | char asm_f1_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ]; | |
|
45 | float compressed_sm_norm_f1[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F1]; | |
|
46 | float compressed_sm_sbm_f1 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 ]; | |
|
40 | 47 | |
|
41 | 48 | //*********************************************************** |
|
42 | 49 | // Interrupt Service Routine for spectral matrices processing |
|
43 | 50 | |
|
44 | 51 | void reset_nb_sm_f0( unsigned char lfrMode ) |
|
45 | 52 | { |
|
46 | 53 | nb_sm_f0 = 0; |
|
54 | nb_sm_f0_aux = 0; | |
|
47 | 55 | |
|
48 |
nb_sm_before_f0.norm_bp1 |
|
|
49 |
nb_sm_before_f0.norm_bp2 |
|
|
50 |
nb_sm_before_f0.norm_asm |
|
|
51 |
nb_sm_before_f0.sbm1_bp1 |
|
|
52 |
nb_sm_before_f0.sbm1_bp2 |
|
|
53 |
nb_sm_before_f0.sbm2_bp1 |
|
|
54 |
nb_sm_before_f0.sbm2_bp2 |
|
|
55 |
nb_sm_before_f0.burst_bp1 |
|
|
56 |
nb_sm_before_f0.burst_bp2 |
|
|
56 | nb_sm_before_f0.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 96; | |
|
57 | nb_sm_before_f0.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 96; | |
|
58 | nb_sm_before_f0.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 96; | |
|
59 | nb_sm_before_f0.sbm1_bp1 = parameter_dump_packet.sy_lfr_s1_bp_p0 * 24; | |
|
60 | nb_sm_before_f0.sbm1_bp2 = parameter_dump_packet.sy_lfr_s1_bp_p1 * 96; | |
|
61 | nb_sm_before_f0.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 96; | |
|
62 | nb_sm_before_f0.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 96; | |
|
63 | nb_sm_before_f0.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 96; | |
|
64 | nb_sm_before_f0.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 96; | |
|
57 | 65 | |
|
58 | 66 | if (lfrMode == LFR_MODE_SBM1) |
|
59 | 67 | { |
|
60 |
nb_sm_before_f0.burst_sbm_bp1 |
|
|
61 |
nb_sm_before_f0.burst_sbm_bp2 |
|
|
68 | nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm1_bp1; | |
|
69 | nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm1_bp2; | |
|
62 | 70 | } |
|
63 | 71 | else if (lfrMode == LFR_MODE_SBM2) |
|
64 | 72 | { |
|
65 |
nb_sm_before_f0.burst_sbm_bp1 |
|
|
66 |
nb_sm_before_f0.burst_sbm_bp2 |
|
|
73 | nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm2_bp1; | |
|
74 | nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm2_bp2; | |
|
67 | 75 | } |
|
68 | 76 | else if (lfrMode == LFR_MODE_BURST) |
|
69 | 77 | { |
|
70 |
nb_sm_before_f0.burst_sbm_bp1 |
|
|
71 |
nb_sm_before_f0.burst_sbm_bp2 |
|
|
78 | nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1; | |
|
79 | nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2; | |
|
72 | 80 | } |
|
73 | 81 | else |
|
74 | 82 | { |
|
75 |
nb_sm_before_f0.burst_sbm_bp1 |
|
|
76 |
nb_sm_before_f0.burst_sbm_bp2 |
|
|
83 | nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1; | |
|
84 | nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2; | |
|
77 | 85 | } |
|
78 | 86 | } |
|
79 | 87 | |
|
80 | 88 | void reset_nb_sm_f1( unsigned char lfrMode ) |
|
81 | 89 | { |
|
90 | nb_sm_f1 = 0; | |
|
91 | ||
|
82 | 92 | nb_sm_before_f1.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 16; |
|
83 | 93 | nb_sm_before_f1.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 16; |
|
84 | 94 | nb_sm_before_f1.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 16; |
|
85 | 95 | nb_sm_before_f1.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 16; |
|
86 | 96 | nb_sm_before_f1.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 16; |
|
87 | 97 | nb_sm_before_f1.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 16; |
|
88 | 98 | nb_sm_before_f1.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 16; |
|
89 | 99 | |
|
90 | 100 | if (lfrMode == LFR_MODE_SBM2) |
|
91 | 101 | { |
|
92 | 102 | nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.sbm2_bp1; |
|
93 | 103 | nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.sbm2_bp2; |
|
94 | 104 | } |
|
95 | 105 | else if (lfrMode == LFR_MODE_BURST) |
|
96 | 106 | { |
|
97 | 107 | nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1; |
|
98 | 108 | nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2; |
|
99 | 109 | } |
|
100 | 110 | else |
|
101 | 111 | { |
|
102 | 112 | nb_sm_before_f1.burst_sbm_bp1 = nb_sm_before_f1.burst_bp1; |
|
103 | 113 | nb_sm_before_f1.burst_sbm_bp2 = nb_sm_before_f1.burst_bp2; |
|
104 | 114 | } |
|
105 | 115 | } |
|
106 | 116 | |
|
107 | 117 | void reset_nb_sm_f2( unsigned char lfrMode ) |
|
108 | 118 | { |
|
109 | 119 | nb_sm_before_f2.norm_bp1_f2 = parameter_dump_packet.sy_lfr_n_bp_p0; |
|
110 | 120 | nb_sm_before_f2.norm_bp2_f2 = parameter_dump_packet.sy_lfr_n_bp_p1; |
|
111 | 121 | nb_sm_before_f2.norm_asm_f2 = parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]; |
|
112 | 122 | nb_sm_before_f2.sbm2_bp1_f2 = parameter_dump_packet.sy_lfr_s2_bp_p0; |
|
113 | 123 | nb_sm_before_f2.sbm2_bp2_f2 = parameter_dump_packet.sy_lfr_s2_bp_p1; |
|
114 | 124 | nb_sm_before_f2.burst_bp1_f2 = parameter_dump_packet.sy_lfr_b_bp_p0; |
|
115 | 125 | nb_sm_before_f2.burst_bp2_f2 = parameter_dump_packet.sy_lfr_b_bp_p1; |
|
116 | 126 | |
|
117 | 127 | if (lfrMode == LFR_MODE_SBM2) |
|
118 | 128 | { |
|
119 | 129 | nb_sm_before_f2.burst_sbm_bp1_f2 = nb_sm_before_f2.sbm2_bp1_f2; |
|
120 | 130 | nb_sm_before_f2.burst_sbm_bp2_f2 = nb_sm_before_f2.sbm2_bp2_f2; |
|
121 | 131 | } |
|
122 | 132 | else if (lfrMode == LFR_MODE_BURST) |
|
123 | 133 | { |
|
124 | 134 | nb_sm_before_f2.burst_sbm_bp1_f2 = nb_sm_before_f2.burst_bp1_f2; |
|
125 | 135 | nb_sm_before_f2.burst_sbm_bp2_f2 = nb_sm_before_f2.burst_bp2_f2; |
|
126 | 136 | } |
|
127 | 137 | else |
|
128 | 138 | { |
|
129 | 139 | nb_sm_before_f2.burst_sbm_bp1_f2 = nb_sm_before_f2.burst_bp1_f2; |
|
130 | 140 | nb_sm_before_f2.burst_sbm_bp2_f2 = nb_sm_before_f2.burst_bp2_f2; |
|
131 | 141 | } |
|
132 | 142 | } |
|
133 | 143 | |
|
134 | 144 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
135 | 145 | { |
|
136 | 146 | ring_node_sm *previous_ring_node_sm_f0; |
|
137 | 147 | |
|
138 | 148 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
139 | 149 | |
|
140 | 150 | previous_ring_node_sm_f0 = current_ring_node_sm_f0; |
|
141 | 151 | |
|
142 | 152 | if ( (spectral_matrix_regs->status & 0x2) == 0x02) // check ready matrix bit f0_1 |
|
143 | 153 | { |
|
144 | 154 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
145 | 155 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
146 | 156 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 |
|
147 | 157 | nb_sm_f0 = nb_sm_f0 + 1; |
|
148 | 158 | } |
|
149 | 159 | |
|
150 | 160 | //************************ |
|
151 | 161 | // reset status error bits |
|
152 | 162 | if ( (spectral_matrix_regs->status & 0x30) != 0x00) |
|
153 | 163 | { |
|
154 | 164 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
155 | 165 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111 |
|
156 | 166 | } |
|
157 | 167 | |
|
158 | 168 | //************************************** |
|
159 | 169 | // reset ready matrix bits for f0_0, f1 and f2 |
|
160 | 170 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff2; // 0010 |
|
161 | 171 | |
|
162 | 172 | if (nb_sm_f0 == NB_SM_BEFORE_AVF0) |
|
163 | 173 | { |
|
164 | 174 | ring_node_for_averaging_sm_f0 = previous_ring_node_sm_f0; |
|
165 | 175 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
166 | 176 | { |
|
167 | 177 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
168 | 178 | } |
|
169 | 179 | nb_sm_f0 = 0; |
|
170 | 180 | } |
|
171 | 181 | |
|
172 | 182 | } |
|
173 | 183 | |
|
174 | 184 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) |
|
175 | 185 | { |
|
176 | if (nb_sm_f0 == (NB_SM_BEFORE_AVF0-1) ) | |
|
186 | //*** | |
|
187 | // F0 | |
|
188 | nb_sm_f0 = nb_sm_f0 + 1; | |
|
189 | if (nb_sm_f0 == NB_SM_BEFORE_AVF0 ) | |
|
177 | 190 | { |
|
178 | 191 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; |
|
179 | 192 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
180 | 193 | { |
|
181 | 194 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
182 | 195 | } |
|
183 | 196 | nb_sm_f0 = 0; |
|
184 | 197 | } |
|
185 | else | |
|
198 | ||
|
199 | //*** | |
|
200 | // F1 | |
|
201 | nb_sm_f0_aux = nb_sm_f0_aux + 1; | |
|
202 | if (nb_sm_f0_aux == 6) | |
|
186 | 203 | { |
|
187 |
nb_sm_f0 = |
|
|
204 | nb_sm_f0_aux = 0; | |
|
205 | nb_sm_f1 = nb_sm_f1 + 1; | |
|
206 | } | |
|
207 | if (nb_sm_f1 == NB_SM_BEFORE_AVF1 ) | |
|
208 | { | |
|
209 | ring_node_for_averaging_sm_f1 = current_ring_node_sm_f1; | |
|
210 | if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
|
211 | { | |
|
212 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
|
213 | } | |
|
214 | nb_sm_f1 = 0; | |
|
188 | 215 | } |
|
189 | 216 | } |
|
190 | 217 | |
|
191 | 218 | //************ |
|
192 | 219 | // RTEMS TASKS |
|
193 | 220 | |
|
194 | 221 | //***************** |
|
195 | 222 | // PROCESSING AT F0 |
|
196 | 223 | |
|
197 | 224 | rtems_task avf0_task( rtems_task_argument lfrRequestedMode ) |
|
198 | 225 | { |
|
199 | 226 | int i; |
|
200 | 227 | |
|
201 | 228 | rtems_event_set event_out; |
|
202 | 229 | rtems_status_code status; |
|
203 | 230 | rtems_id queue_id_prc0; |
|
204 | 231 | asm_msg msgForMATR; |
|
205 | 232 | ring_node_sm *ring_node_tab[8]; |
|
206 | 233 | |
|
207 |
|
|
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
|
211 |
|
|
|
234 | unsigned int nb_norm_bp1; | |
|
235 | unsigned int nb_norm_bp2; | |
|
236 | unsigned int nb_norm_asm; | |
|
237 | unsigned int nb_sbm_bp1; | |
|
238 | unsigned int nb_sbm_bp2; | |
|
212 | 239 | |
|
213 | 240 | nb_norm_bp1 = 0; |
|
214 | 241 | nb_norm_bp2 = 0; |
|
215 | 242 | nb_norm_asm = 0; |
|
216 | 243 | nb_sbm_bp1 = 0; |
|
217 | 244 | nb_sbm_bp2 = 0; |
|
218 | 245 | |
|
219 | 246 | reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions |
|
220 | 247 | |
|
221 | 248 | BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) |
|
222 | 249 | |
|
223 | 250 | status = get_message_queue_id_prc0( &queue_id_prc0 ); |
|
224 | 251 | if (status != RTEMS_SUCCESSFUL) |
|
225 | 252 | { |
|
226 | 253 | PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status) |
|
227 | 254 | } |
|
228 | 255 | |
|
229 | 256 | while(1){ |
|
230 | 257 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
231 | 258 | ring_node_tab[NB_SM_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0; |
|
232 | 259 | for ( i = 2; i < (NB_SM_BEFORE_AVF0+1); i++ ) |
|
233 | 260 | { |
|
234 | 261 | ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous; |
|
235 | 262 | ring_node_tab[NB_SM_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0; |
|
236 | 263 | } |
|
237 | 264 | |
|
238 | 265 | // compute the average and store it in the averaged_sm_f1 buffer |
|
239 | 266 | SM_average( current_ring_node_asm_norm_f0->matrix, |
|
240 | 267 | current_ring_node_asm_burst_sbm_f0->matrix, |
|
241 | 268 | ring_node_tab, |
|
242 | 269 | nb_norm_bp1, nb_sbm_bp1 ); |
|
243 | 270 | |
|
244 | 271 | // update nb_average |
|
245 | 272 | nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF0; |
|
246 | 273 | nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF0; |
|
247 | 274 | nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF0; |
|
248 | 275 | nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF0; |
|
249 | 276 | nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF0; |
|
250 | 277 | |
|
251 | 278 | //**************************************** |
|
252 | 279 | // initialize the mesage for the MATR task |
|
253 | 280 | msgForMATR.event = 0x00; // this composite event will be sent to the MATR task |
|
254 | 281 | msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f0; |
|
255 | 282 | msgForMATR.norm = current_ring_node_asm_norm_f0; |
|
256 | msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; | |
|
257 | msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; | |
|
283 | // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; | |
|
284 | // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; | |
|
285 | msgForMATR.coarseTime = time_management_regs->coarse_time; | |
|
286 | msgForMATR.fineTime = time_management_regs->fine_time; | |
|
258 | 287 | |
|
259 |
if (nb_sbm_bp1 == nb_sm_before_f0.burst_sbm_bp1 |
|
|
288 | if (nb_sbm_bp1 == nb_sm_before_f0.burst_sbm_bp1) | |
|
260 | 289 | { |
|
261 | 290 | nb_sbm_bp1 = 0; |
|
262 | 291 | // set another ring for the ASM storage |
|
263 | 292 | current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next; |
|
264 | 293 | if ( (lfrCurrentMode == LFR_MODE_BURST) |
|
265 | 294 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
266 | 295 | { |
|
267 | 296 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F0; |
|
268 | 297 | } |
|
269 | 298 | } |
|
270 | 299 | |
|
271 |
if (nb_sbm_bp2 == nb_sm_before_f0.burst_sbm_bp2 |
|
|
300 | if (nb_sbm_bp2 == nb_sm_before_f0.burst_sbm_bp2) | |
|
272 | 301 | { |
|
273 | 302 | nb_sbm_bp2 = 0; |
|
274 | 303 | if ( (lfrCurrentMode == LFR_MODE_BURST) |
|
275 | 304 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
276 | 305 | { |
|
277 | 306 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F0; |
|
278 | 307 | } |
|
279 | 308 | } |
|
280 | 309 | |
|
281 |
if (nb_norm_bp1 == nb_sm_before_f0.norm_bp1 |
|
|
310 | if (nb_norm_bp1 == nb_sm_before_f0.norm_bp1) | |
|
282 | 311 | { |
|
283 | 312 | nb_norm_bp1 = 0; |
|
284 | 313 | // set another ring for the ASM storage |
|
285 | 314 | current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next; |
|
286 | 315 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
287 | 316 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
288 | 317 | { |
|
289 | 318 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F0; |
|
290 | 319 | } |
|
291 | 320 | } |
|
292 | 321 | |
|
293 |
if (nb_norm_bp2 == nb_sm_before_f0.norm_bp2 |
|
|
322 | if (nb_norm_bp2 == nb_sm_before_f0.norm_bp2) | |
|
294 | 323 | { |
|
295 | 324 | nb_norm_bp2 = 0; |
|
296 | 325 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
297 | 326 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
298 | 327 | { |
|
299 | 328 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F0; |
|
300 | 329 | } |
|
301 | 330 | } |
|
302 | 331 | |
|
303 |
if (nb_norm_asm == nb_sm_before_f0.norm_asm |
|
|
332 | if (nb_norm_asm == nb_sm_before_f0.norm_asm) | |
|
304 | 333 | { |
|
305 | 334 | nb_norm_asm = 0; |
|
306 | 335 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
307 | 336 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
308 | 337 | { |
|
309 | 338 | // PRINTF1("%lld\n", localTime) |
|
310 | 339 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F0; |
|
311 | 340 | } |
|
312 | 341 | } |
|
313 | 342 | |
|
314 | 343 | //************************* |
|
315 | 344 | // send the message to MATR |
|
316 | 345 | if (msgForMATR.event != 0x00) |
|
317 | 346 | { |
|
318 | 347 | status = rtems_message_queue_send( queue_id_prc0, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0); |
|
319 | 348 | } |
|
320 | 349 | |
|
321 | 350 | if (status != RTEMS_SUCCESSFUL) { |
|
322 | 351 | printf("in AVF0 *** Error sending message to MATR, code %d\n", status); |
|
323 | 352 | } |
|
324 | 353 | } |
|
325 | 354 | } |
|
326 | 355 | |
|
327 | 356 | rtems_task prc0_task( rtems_task_argument lfrRequestedMode ) |
|
328 | 357 | { |
|
329 | 358 | char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer |
|
330 | 359 | size_t size; // size of the incoming TC packet |
|
331 | 360 | asm_msg *incomingMsg; |
|
332 | 361 | // |
|
333 | 362 | spw_ioctl_pkt_send spw_ioctl_send_ASM; |
|
334 | 363 | rtems_status_code status; |
|
335 | 364 | rtems_id queue_id; |
|
336 | 365 | rtems_id queue_id_q_p0; |
|
337 | 366 | Header_TM_LFR_SCIENCE_ASM_t headerASM; |
|
338 | 367 | bp_packet_with_spare packet_norm_bp1_f0; |
|
339 | 368 | bp_packet packet_norm_bp2_f0; |
|
340 | 369 | bp_packet packet_sbm_bp1_f0; |
|
341 | 370 | bp_packet packet_sbm_bp2_f0; |
|
342 | 371 | |
|
343 | 372 | unsigned long long int localTime; |
|
344 | 373 | |
|
345 | 374 | ASM_init_header( &headerASM ); |
|
346 | 375 | |
|
347 | 376 | //************* |
|
348 | 377 | // NORM headers |
|
349 | 378 | BP_init_header_with_spare( &packet_norm_bp1_f0.header, |
|
350 | 379 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0, |
|
351 | 380 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 ); |
|
352 | 381 | BP_init_header( &packet_norm_bp2_f0.header, |
|
353 | 382 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0, |
|
354 | 383 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0); |
|
355 | 384 | |
|
356 | 385 | //**************************** |
|
357 | 386 | // BURST SBM1 and SBM2 headers |
|
358 | 387 | if ( lfrRequestedMode == LFR_MODE_BURST ) |
|
359 | 388 | { |
|
360 | 389 | BP_init_header( &packet_sbm_bp1_f0.header, |
|
361 | 390 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0, |
|
362 | 391 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); |
|
363 | 392 | BP_init_header( &packet_sbm_bp2_f0.header, |
|
364 | 393 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0, |
|
365 | 394 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); |
|
366 | 395 | } |
|
367 | 396 | else if ( lfrRequestedMode == LFR_MODE_SBM1 ) |
|
368 | 397 | { |
|
369 | 398 | BP_init_header( &packet_sbm_bp1_f0.header, |
|
370 | 399 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0, |
|
371 | 400 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); |
|
372 | 401 | BP_init_header( &packet_sbm_bp2_f0.header, |
|
373 | 402 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0, |
|
374 | 403 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); |
|
375 | 404 | } |
|
376 | 405 | else if ( lfrRequestedMode == LFR_MODE_SBM2 ) |
|
377 | 406 | { |
|
378 | 407 | BP_init_header( &packet_sbm_bp1_f0.header, |
|
379 | 408 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0, |
|
380 | 409 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); |
|
381 | 410 | BP_init_header( &packet_sbm_bp2_f0.header, |
|
382 | 411 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0, |
|
383 | 412 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); |
|
384 | 413 | } |
|
385 | 414 | else |
|
386 | 415 | { |
|
387 | 416 | PRINTF1("in PRC0 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode) |
|
388 | 417 | } |
|
389 | 418 | |
|
390 | 419 | status = get_message_queue_id_send( &queue_id ); |
|
391 | 420 | if (status != RTEMS_SUCCESSFUL) |
|
392 | 421 | { |
|
393 | 422 | PRINTF1("in PRC0 *** ERR get_message_queue_id_send %d\n", status) |
|
394 | 423 | } |
|
395 | 424 | status = get_message_queue_id_prc0( &queue_id_q_p0); |
|
396 | 425 | if (status != RTEMS_SUCCESSFUL) |
|
397 | 426 | { |
|
398 | 427 | PRINTF1("in PRC0 *** ERR get_message_queue_id_prc0 %d\n", status) |
|
399 | 428 | } |
|
400 | 429 | |
|
401 | 430 | BOOT_PRINTF1("in PRC0 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) |
|
402 | 431 | |
|
403 | 432 | while(1){ |
|
404 | 433 | status = rtems_message_queue_receive( queue_id_q_p0, incomingData, &size, //************************************ |
|
405 | 434 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0 |
|
406 | 435 | |
|
407 | 436 | incomingMsg = (asm_msg*) incomingData; |
|
408 | 437 | |
|
409 | 438 | localTime = getTimeAsUnsignedLongLongInt( ); |
|
410 | 439 | //**************** |
|
411 | 440 | //**************** |
|
412 | 441 | // BURST SBM1 SBM2 |
|
413 | 442 | //**************** |
|
414 | 443 | //**************** |
|
415 | 444 | if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F0 ) |
|
416 | 445 | { |
|
417 | 446 | // 1) compress the matrix for Basic Parameters calculation |
|
418 | ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm, | |
|
419 |
nb_sm_before_f0.burst_sbm_bp1 |
|
|
447 | ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm_f0, | |
|
448 | nb_sm_before_f0.burst_sbm_bp1, | |
|
420 | 449 | NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0, |
|
421 | 450 | ASM_F0_INDICE_START); |
|
422 | 451 | // 2) compute the BP1 set |
|
423 | 452 | |
|
424 | 453 | // 3) send the BP1 set |
|
425 | 454 | set_time( packet_sbm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
426 | 455 | set_time( packet_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); |
|
427 | 456 | BP_send( (char *) &packet_sbm_bp1_f0.header, queue_id, |
|
428 | 457 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA); |
|
429 | 458 | // 4) compute the BP2 set if needed |
|
430 | 459 | if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F0 ) |
|
431 | 460 | { |
|
432 | 461 | // 1) compute the BP2 set |
|
433 | 462 | |
|
434 | 463 | // 2) send the BP2 set |
|
435 | 464 | set_time( packet_sbm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
436 | 465 | set_time( packet_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); |
|
437 | 466 | BP_send( (char *) &packet_sbm_bp2_f0.header, queue_id, |
|
438 | 467 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA); |
|
439 | 468 | } |
|
440 | 469 | } |
|
441 | 470 | |
|
442 | 471 | //***** |
|
443 | 472 | //***** |
|
444 | 473 | // NORM |
|
445 | 474 | //***** |
|
446 | 475 | //***** |
|
447 | 476 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0) |
|
448 | 477 | { |
|
449 | 478 | // 1) compress the matrix for Basic Parameters calculation |
|
450 | 479 | ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0, |
|
451 |
nb_sm_before_f0.norm_bp1 |
|
|
480 | nb_sm_before_f0.norm_bp1, | |
|
452 | 481 | NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0, |
|
453 | 482 | ASM_F0_INDICE_START ); |
|
454 | 483 | // 2) compute the BP1 set |
|
455 | 484 | |
|
456 | 485 | // 3) send the BP1 set |
|
457 | 486 | set_time( packet_norm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
458 | 487 | set_time( packet_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); |
|
459 | 488 | BP_send( (char *) &packet_norm_bp1_f0.header, queue_id, |
|
460 | 489 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA); |
|
461 | 490 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0) |
|
462 | 491 | { |
|
463 | // 1) compute the BP2 set | |
|
492 | // 1) compute the BP2 set using the same ASM as the one used for BP1 | |
|
464 | 493 | |
|
465 | 494 | // 2) send the BP2 set |
|
466 | 495 | set_time( packet_norm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
467 | 496 | set_time( packet_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); |
|
468 | 497 | BP_send( (char *) &packet_norm_bp2_f0.header, queue_id, |
|
469 | 498 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA); |
|
470 | 499 | } |
|
471 | 500 | } |
|
472 | 501 | |
|
473 | 502 | if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0) |
|
474 | 503 | { |
|
475 | 504 | // 1) reorganize the ASM and divide |
|
476 |
ASM_reorganize_and_divide( incomingMsg->norm->matrix, |
|
|
505 | ASM_reorganize_and_divide( incomingMsg->norm->matrix, | |
|
506 | asm_f0_reorganized, | |
|
507 | nb_sm_before_f0.norm_bp1 ); | |
|
477 | 508 | // 2) convert the float array in a char array |
|
478 | 509 | ASM_convert( asm_f0_reorganized, asm_f0_char); |
|
479 | 510 | // 3) send the spectral matrix packets |
|
480 | 511 | set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime ); |
|
481 | 512 | set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); |
|
482 | 513 | ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); |
|
483 | 514 | } |
|
484 | 515 | |
|
485 | 516 | } |
|
486 | 517 | } |
|
487 | 518 | |
|
488 | 519 | //***************** |
|
489 | 520 | // PROCESSING AT F1 |
|
490 | 521 | |
|
491 | 522 | rtems_task avf1_task( rtems_task_argument lfrRequestedMode ) |
|
492 | 523 | { |
|
493 | 524 | int i; |
|
494 | 525 | |
|
495 | 526 | rtems_event_set event_out; |
|
496 | 527 | rtems_status_code status; |
|
497 | 528 | rtems_id queue_id_prc1; |
|
498 | 529 | asm_msg msgForMATR; |
|
499 | 530 | ring_node_sm *ring_node_tab[8]; |
|
500 | 531 | |
|
501 |
|
|
|
502 |
|
|
|
503 |
|
|
|
504 |
|
|
|
505 |
|
|
|
532 | unsigned int nb_norm_bp1; | |
|
533 | unsigned int nb_norm_bp2; | |
|
534 | unsigned int nb_norm_asm; | |
|
535 | unsigned int nb_sbm_bp1; | |
|
536 | unsigned int nb_sbm_bp2; | |
|
506 | 537 | |
|
507 | 538 | nb_norm_bp1 = 0; |
|
508 | 539 | nb_norm_bp2 = 0; |
|
509 | 540 | nb_norm_asm = 0; |
|
510 | 541 | nb_sbm_bp1 = 0; |
|
511 | 542 | nb_sbm_bp2 = 0; |
|
512 | 543 | |
|
513 | 544 | reset_nb_sm_f1( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions |
|
514 | 545 | |
|
515 | 546 | BOOT_PRINTF1("in AVF1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) |
|
516 | 547 | |
|
517 | 548 | status = get_message_queue_id_prc1( &queue_id_prc1 ); |
|
518 | 549 | if (status != RTEMS_SUCCESSFUL) |
|
519 | 550 | { |
|
520 | 551 | PRINTF1("in AVF1 *** ERR get_message_queue_id_prc1 %d\n", status) |
|
521 | 552 | } |
|
522 | 553 | |
|
523 | 554 | while(1){ |
|
524 | 555 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
525 | 556 | ring_node_tab[NB_SM_BEFORE_AVF1-1] = ring_node_for_averaging_sm_f1; |
|
526 | 557 | for ( i = 2; i < (NB_SM_BEFORE_AVF1+1); i++ ) |
|
527 | 558 | { |
|
528 | 559 | ring_node_for_averaging_sm_f1 = ring_node_for_averaging_sm_f1->previous; |
|
529 | 560 | ring_node_tab[NB_SM_BEFORE_AVF1-i] = ring_node_for_averaging_sm_f1; |
|
530 | 561 | } |
|
531 | 562 | |
|
532 | 563 | // compute the average and store it in the averaged_sm_f1 buffer |
|
533 | 564 | SM_average( current_ring_node_asm_norm_f1->matrix, |
|
534 | 565 | current_ring_node_asm_burst_sbm_f1->matrix, |
|
535 | 566 | ring_node_tab, |
|
536 | 567 | nb_norm_bp1, nb_sbm_bp1 ); |
|
537 | 568 | |
|
538 | 569 | // update nb_average |
|
539 | 570 | nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF1; |
|
540 | 571 | nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF1; |
|
541 | 572 | nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF1; |
|
542 | 573 | nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF1; |
|
543 | 574 | nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF1; |
|
544 | 575 | |
|
545 | 576 | //**************************************** |
|
546 | 577 | // initialize the mesage for the MATR task |
|
547 | 578 | msgForMATR.event = 0x00; // this composite event will be sent to the PRC1 task |
|
548 | 579 | msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f1; |
|
549 | 580 | msgForMATR.norm = current_ring_node_asm_norm_f1; |
|
550 | msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; | |
|
551 | msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; | |
|
581 | // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; | |
|
582 | // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; | |
|
583 | msgForMATR.coarseTime = time_management_regs->coarse_time; | |
|
584 | msgForMATR.fineTime = time_management_regs->fine_time; | |
|
552 | 585 | |
|
553 | 586 | if (nb_sbm_bp1 == nb_sm_before_f1.burst_sbm_bp1) |
|
554 | 587 | { |
|
555 | 588 | nb_sbm_bp1 = 0; |
|
556 | 589 | // set another ring for the ASM storage |
|
557 | 590 | current_ring_node_asm_burst_sbm_f1 = current_ring_node_asm_burst_sbm_f1->next; |
|
558 | 591 | if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
559 | 592 | { |
|
560 | 593 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F1; |
|
561 | 594 | } |
|
562 | 595 | } |
|
563 | 596 | |
|
564 | 597 | if (nb_sbm_bp2 == nb_sm_before_f1.burst_sbm_bp2) |
|
565 | 598 | { |
|
566 | 599 | nb_sbm_bp2 = 0; |
|
567 | 600 | if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
568 | 601 | { |
|
569 | 602 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F1; |
|
570 | 603 | } |
|
571 | 604 | } |
|
572 | 605 | |
|
573 | 606 | if (nb_norm_bp1 == nb_sm_before_f1.norm_bp1) |
|
574 | 607 | { |
|
575 | 608 | nb_norm_bp1 = 0; |
|
576 | 609 | // set another ring for the ASM storage |
|
577 | 610 | current_ring_node_asm_norm_f1 = current_ring_node_asm_norm_f1->next; |
|
578 | 611 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
579 | 612 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
580 | 613 | { |
|
581 |
msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F |
|
|
614 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F1; | |
|
582 | 615 | } |
|
583 | 616 | } |
|
584 | 617 | |
|
585 | 618 | if (nb_norm_bp2 == nb_sm_before_f1.norm_bp2) |
|
586 | 619 | { |
|
587 | 620 | nb_norm_bp2 = 0; |
|
588 | 621 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
589 | 622 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
590 | 623 | { |
|
591 | 624 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F1; |
|
592 | 625 | } |
|
593 | 626 | } |
|
594 | 627 | |
|
595 | 628 | if (nb_norm_asm == nb_sm_before_f1.norm_asm) |
|
596 | 629 | { |
|
597 | 630 | nb_norm_asm = 0; |
|
598 | 631 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
599 | 632 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
600 | 633 | { |
|
601 | 634 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F1; |
|
602 | 635 | } |
|
603 | 636 | } |
|
604 | 637 | |
|
605 | 638 | //************************* |
|
606 | 639 | // send the message to MATR |
|
607 | 640 | if (msgForMATR.event != 0x00) |
|
608 | 641 | { |
|
609 | 642 | status = rtems_message_queue_send( queue_id_prc1, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC1); |
|
610 | 643 | } |
|
611 | 644 | |
|
612 | 645 | if (status != RTEMS_SUCCESSFUL) { |
|
613 | 646 | printf("in AVF1 *** Error sending message to PRC1, code %d\n", status); |
|
614 | 647 | } |
|
615 | 648 | } |
|
616 | 649 | } |
|
617 | 650 | |
|
618 | 651 | rtems_task prc1_task( rtems_task_argument lfrRequestedMode ) |
|
619 | 652 | { |
|
620 | 653 | char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer |
|
621 | 654 | size_t size; // size of the incoming TC packet |
|
622 | 655 | asm_msg *incomingMsg; |
|
623 | 656 | // |
|
624 | 657 | spw_ioctl_pkt_send spw_ioctl_send_ASM; |
|
625 | 658 | rtems_status_code status; |
|
626 | rtems_id queue_id; | |
|
659 | rtems_id queue_id_send; | |
|
627 | 660 | rtems_id queue_id_q_p1; |
|
628 | 661 | Header_TM_LFR_SCIENCE_ASM_t headerASM; |
|
629 | 662 | bp_packet_with_spare packet_norm_bp1; |
|
630 | 663 | bp_packet packet_norm_bp2; |
|
631 | 664 | bp_packet packet_sbm_bp1; |
|
632 | 665 | bp_packet packet_sbm_bp2; |
|
633 | 666 | |
|
634 | 667 | unsigned long long int localTime; |
|
635 | 668 | |
|
636 | 669 | ASM_init_header( &headerASM ); |
|
637 | 670 | |
|
638 | 671 | //************* |
|
639 | 672 | // NORM headers |
|
640 | 673 | BP_init_header_with_spare( &packet_norm_bp1.header, |
|
641 | 674 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F1, |
|
642 | 675 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1, NB_BINS_COMPRESSED_SM_F1 ); |
|
643 | 676 | BP_init_header( &packet_norm_bp2.header, |
|
644 | 677 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F1, |
|
645 | 678 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1, NB_BINS_COMPRESSED_SM_F1); |
|
646 | 679 | |
|
647 | 680 | //*********************** |
|
648 | 681 | // BURST and SBM2 headers |
|
649 | 682 | if ( lfrRequestedMode == LFR_MODE_BURST ) |
|
650 | 683 | { |
|
651 | 684 | BP_init_header( &packet_sbm_bp1.header, |
|
652 | 685 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F1, |
|
653 | 686 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F1); |
|
654 | 687 | BP_init_header( &packet_sbm_bp2.header, |
|
655 | 688 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F1, |
|
656 | 689 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F1); |
|
657 | 690 | } |
|
658 | 691 | else if ( lfrRequestedMode == LFR_MODE_SBM2 ) |
|
659 | 692 | { |
|
660 | 693 | BP_init_header( &packet_sbm_bp1.header, |
|
661 | 694 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F1, |
|
662 | 695 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1, NB_BINS_COMPRESSED_SM_SBM_F1); |
|
663 | 696 | BP_init_header( &packet_sbm_bp2.header, |
|
664 | 697 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F1, |
|
665 | 698 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1, NB_BINS_COMPRESSED_SM_SBM_F1); |
|
666 | 699 | } |
|
667 | 700 | else |
|
668 | 701 | { |
|
669 |
PRINTF1(" |
|
|
702 | PRINTF1("in PRC1 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode) | |
|
670 | 703 | } |
|
671 | 704 | |
|
672 |
status = |
|
|
705 | status = get_message_queue_id_send( &queue_id_send ); | |
|
673 | 706 | if (status != RTEMS_SUCCESSFUL) |
|
674 | 707 | { |
|
675 | 708 | PRINTF1("in PRC1 *** ERR get_message_queue_id_send %d\n", status) |
|
676 | 709 | } |
|
677 | 710 | status = get_message_queue_id_prc1( &queue_id_q_p1); |
|
678 | 711 | if (status != RTEMS_SUCCESSFUL) |
|
679 | 712 | { |
|
680 | 713 | PRINTF1("in PRC1 *** ERR get_message_queue_id_prc1 %d\n", status) |
|
681 | 714 | } |
|
682 | 715 | |
|
683 | 716 | BOOT_PRINTF1("in PRC1 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode) |
|
684 | 717 | |
|
685 | 718 | while(1){ |
|
686 | 719 | status = rtems_message_queue_receive( queue_id_q_p1, incomingData, &size, //************************************ |
|
687 | 720 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0 |
|
688 | 721 | |
|
689 | 722 | incomingMsg = (asm_msg*) incomingData; |
|
690 | 723 | |
|
691 | 724 | localTime = getTimeAsUnsignedLongLongInt( ); |
|
692 | 725 | //*********** |
|
693 | 726 | //*********** |
|
694 | 727 | // BURST SBM2 |
|
695 | 728 | //*********** |
|
696 | 729 | //*********** |
|
697 | 730 | if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F1 ) |
|
698 | 731 | { |
|
699 | 732 | // 1) compress the matrix for Basic Parameters calculation |
|
700 | ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm, | |
|
733 | ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm_f1, | |
|
701 | 734 | nb_sm_before_f1.burst_sbm_bp1, |
|
702 | 735 | NB_BINS_COMPRESSED_SM_SBM_F1, NB_BINS_TO_AVERAGE_ASM_SBM_F1, |
|
703 | 736 | ASM_F1_INDICE_START); |
|
704 | 737 | // 2) compute the BP1 set |
|
705 | 738 | |
|
706 | 739 | // 3) send the BP1 set |
|
707 | 740 | set_time( packet_sbm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
708 | 741 | set_time( packet_sbm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); |
|
709 | BP_send( (char *) &packet_sbm_bp1.header, queue_id, | |
|
742 | BP_send( (char *) &packet_sbm_bp1.header, queue_id_send, | |
|
710 | 743 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 + PACKET_LENGTH_DELTA); |
|
711 | 744 | // 4) compute the BP2 set if needed |
|
712 | 745 | if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F1 ) |
|
713 | 746 | { |
|
714 | 747 | // 1) compute the BP2 set |
|
715 | 748 | |
|
716 | 749 | // 2) send the BP2 set |
|
717 | 750 | set_time( packet_sbm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
718 | 751 | set_time( packet_sbm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); |
|
719 | BP_send( (char *) &packet_sbm_bp2.header, queue_id, | |
|
752 | BP_send( (char *) &packet_sbm_bp2.header, queue_id_send, | |
|
720 | 753 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 + PACKET_LENGTH_DELTA); |
|
721 | 754 | } |
|
722 | 755 | } |
|
723 | 756 | |
|
724 | 757 | //***** |
|
725 | 758 | //***** |
|
726 | 759 | // NORM |
|
727 | 760 | //***** |
|
728 | 761 | //***** |
|
729 | 762 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F1) |
|
730 | 763 | { |
|
731 | 764 | // 1) compress the matrix for Basic Parameters calculation |
|
732 |
ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f |
|
|
733 |
nb_sm_before_f0.norm_bp1 |
|
|
765 | ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f1, | |
|
766 | nb_sm_before_f0.norm_bp1, | |
|
734 | 767 | NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0, |
|
735 | 768 | ASM_F0_INDICE_START ); |
|
736 | 769 | // 2) compute the BP1 set |
|
737 | 770 | |
|
738 | 771 | // 3) send the BP1 set |
|
739 | 772 | set_time( packet_norm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
740 | 773 | set_time( packet_norm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); |
|
741 | BP_send( (char *) &packet_norm_bp1.header, queue_id, | |
|
774 | BP_send( (char *) &packet_norm_bp1.header, queue_id_send, | |
|
742 | 775 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 + PACKET_LENGTH_DELTA); |
|
743 | 776 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F1) |
|
744 | 777 | { |
|
745 | 778 | // 1) compute the BP2 set |
|
746 | 779 | |
|
747 | 780 | // 2) send the BP2 set |
|
748 | 781 | set_time( packet_norm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime ); |
|
749 | 782 | set_time( packet_norm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); |
|
750 | BP_send( (char *) &packet_norm_bp2.header, queue_id, | |
|
783 | BP_send( (char *) &packet_norm_bp2.header, queue_id_send, | |
|
751 | 784 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 + PACKET_LENGTH_DELTA); |
|
752 | 785 | } |
|
753 | 786 | } |
|
754 | 787 | |
|
755 | 788 | if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F1) |
|
756 | 789 | { |
|
757 | 790 | // 1) reorganize the ASM and divide |
|
758 |
ASM_reorganize_and_divide( incomingMsg->norm->matrix, |
|
|
791 | ASM_reorganize_and_divide( incomingMsg->norm->matrix, | |
|
792 | asm_f1_reorganized, | |
|
793 | nb_sm_before_f0.norm_bp1 ); | |
|
759 | 794 | // 2) convert the float array in a char array |
|
760 |
ASM_convert( asm_f |
|
|
795 | ASM_convert( asm_f1_reorganized, asm_f1_char); | |
|
761 | 796 | // 3) send the spectral matrix packets |
|
762 | 797 | set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime ); |
|
763 | 798 | set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); |
|
764 |
ASM_send( &headerASM, asm_f |
|
|
799 | ASM_send( &headerASM, asm_f1_char, SID_NORM_ASM_F1, &spw_ioctl_send_ASM, queue_id_send); | |
|
765 | 800 | } |
|
766 | 801 | |
|
767 | 802 | } |
|
768 | 803 | } |
|
769 | 804 | |
|
770 | 805 | //****************** |
|
771 | 806 | // Spectral Matrices |
|
772 | 807 | |
|
773 | 808 | void SM_init_rings( void ) |
|
774 | 809 | { |
|
775 | 810 | unsigned char i; |
|
776 | 811 | |
|
777 | 812 | // F0 RING |
|
778 | 813 | sm_ring_f0[0].next = (ring_node_sm*) &sm_ring_f0[1]; |
|
779 | 814 | sm_ring_f0[0].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-1]; |
|
780 | 815 | sm_ring_f0[0].buffer_address = |
|
781 | 816 | (int) &sm_f0[ 0 ]; |
|
782 | 817 | |
|
783 | 818 | sm_ring_f0[NB_RING_NODES_SM_F0-1].next = (ring_node_sm*) &sm_ring_f0[0]; |
|
784 | 819 | sm_ring_f0[NB_RING_NODES_SM_F0-1].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-2]; |
|
785 | 820 | sm_ring_f0[NB_RING_NODES_SM_F0-1].buffer_address = |
|
786 | 821 | (int) &sm_f0[ (NB_RING_NODES_SM_F0-1) * TOTAL_SIZE_SM ]; |
|
787 | 822 | |
|
788 | 823 | for(i=1; i<NB_RING_NODES_SM_F0-1; i++) |
|
789 | 824 | { |
|
790 | 825 | sm_ring_f0[i].next = (ring_node_sm*) &sm_ring_f0[i+1]; |
|
791 | 826 | sm_ring_f0[i].previous = (ring_node_sm*) &sm_ring_f0[i-1]; |
|
792 | 827 | sm_ring_f0[i].buffer_address = |
|
793 | 828 | (int) &sm_f0[ i * TOTAL_SIZE_SM ]; |
|
794 | 829 | } |
|
795 | 830 | |
|
796 | 831 | // F1 RING |
|
797 | 832 | sm_ring_f1[0].next = (ring_node_sm*) &sm_ring_f1[1]; |
|
798 | 833 | sm_ring_f1[0].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-1]; |
|
799 | 834 | sm_ring_f1[0].buffer_address = |
|
800 | 835 | (int) &sm_f1[ 0 ]; |
|
801 | 836 | |
|
802 | 837 | sm_ring_f1[NB_RING_NODES_SM_F1-1].next = (ring_node_sm*) &sm_ring_f1[0]; |
|
803 | 838 | sm_ring_f1[NB_RING_NODES_SM_F1-1].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-2]; |
|
804 | 839 | sm_ring_f1[NB_RING_NODES_SM_F1-1].buffer_address = |
|
805 | 840 | (int) &sm_f1[ (NB_RING_NODES_SM_F1-1) * TOTAL_SIZE_SM ]; |
|
806 | 841 | |
|
807 | 842 | for(i=1; i<NB_RING_NODES_SM_F1-1; i++) |
|
808 | 843 | { |
|
809 | 844 | sm_ring_f1[i].next = (ring_node_sm*) &sm_ring_f1[i+1]; |
|
810 | 845 | sm_ring_f1[i].previous = (ring_node_sm*) &sm_ring_f1[i-1]; |
|
811 | 846 | sm_ring_f1[i].buffer_address = |
|
812 | 847 | (int) &sm_f1[ i * TOTAL_SIZE_SM ]; |
|
813 | 848 | } |
|
814 | 849 | |
|
815 | 850 | // F2 RING |
|
816 | 851 | sm_ring_f2[0].next = (ring_node_sm*) &sm_ring_f2[1]; |
|
817 | 852 | sm_ring_f2[0].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-1]; |
|
818 | 853 | sm_ring_f2[0].buffer_address = |
|
819 | 854 | (int) &sm_f2[ 0 ]; |
|
820 | 855 | |
|
821 | 856 | sm_ring_f2[NB_RING_NODES_SM_F2-1].next = (ring_node_sm*) &sm_ring_f2[0]; |
|
822 | 857 | sm_ring_f2[NB_RING_NODES_SM_F2-1].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-2]; |
|
823 | 858 | sm_ring_f2[NB_RING_NODES_SM_F2-1].buffer_address = |
|
824 | 859 | (int) &sm_f2[ (NB_RING_NODES_SM_F2-1) * TOTAL_SIZE_SM ]; |
|
825 | 860 | |
|
826 | 861 | for(i=1; i<NB_RING_NODES_SM_F2-1; i++) |
|
827 | 862 | { |
|
828 | 863 | sm_ring_f2[i].next = (ring_node_sm*) &sm_ring_f2[i+1]; |
|
829 | 864 | sm_ring_f2[i].previous = (ring_node_sm*) &sm_ring_f2[i-1]; |
|
830 | 865 | sm_ring_f2[i].buffer_address = |
|
831 | 866 | (int) &sm_f2[ i * TOTAL_SIZE_SM ]; |
|
832 | 867 | } |
|
833 | 868 | |
|
834 | 869 | DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) |
|
835 | 870 | DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1) |
|
836 | 871 | DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2) |
|
837 | 872 | |
|
838 | 873 | spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address; |
|
839 | 874 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0) |
|
840 | 875 | } |
|
841 | 876 | |
|
842 | 877 | void ASM_init_rings( void ) |
|
843 | 878 | { |
|
844 | 879 | //*** |
|
845 | 880 | // F0 |
|
846 | 881 | // NORM |
|
847 | 882 | ASM_generic_init_ring( asm_ring_norm_f0, NB_RING_NODES_ASM_NORM_F0 ); |
|
848 | 883 | // BURST_SBM |
|
849 | 884 | ASM_generic_init_ring( asm_ring_burst_sbm_f0, NB_RING_NODES_ASM_BURST_SBM_F0 ); |
|
850 | 885 | |
|
851 | 886 | //*** |
|
852 | 887 | // F1 |
|
853 | 888 | //***** |
|
854 | 889 | // NORM |
|
855 | 890 | ASM_generic_init_ring( asm_ring_norm_f1, NB_RING_NODES_ASM_NORM_F1 ); |
|
856 | 891 | // BURST_SBM |
|
857 | 892 | ASM_generic_init_ring( asm_ring_burst_sbm_f1, NB_RING_NODES_ASM_BURST_SBM_F1 ); |
|
858 | 893 | } |
|
859 | 894 | |
|
860 | 895 | void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes ) |
|
861 | 896 | { |
|
862 | 897 | unsigned char i; |
|
863 | 898 | |
|
864 | 899 | ring[ nbNodes - 1 ].next |
|
865 | 900 | = (ring_node_asm*) &ring[ 0 ]; |
|
866 | 901 | |
|
867 | 902 | for(i=0; i<nbNodes-1; i++) |
|
868 | 903 | { |
|
869 | 904 | ring[ i ].next = (ring_node_asm*) &ring[ i + 1 ]; |
|
870 | 905 | } |
|
871 | 906 | } |
|
872 | 907 | |
|
873 | 908 | void SM_reset_current_ring_nodes( void ) |
|
874 | 909 | { |
|
875 | 910 | current_ring_node_sm_f0 = sm_ring_f0; |
|
876 | 911 | current_ring_node_sm_f1 = sm_ring_f1; |
|
877 | 912 | current_ring_node_sm_f2 = sm_ring_f2; |
|
878 | 913 | |
|
879 | 914 | ring_node_for_averaging_sm_f0 = sm_ring_f0; |
|
880 | 915 | } |
|
881 | 916 | |
|
882 | 917 | void ASM_reset_current_ring_nodes( void ) |
|
883 | 918 | { |
|
884 | 919 | current_ring_node_asm_norm_f0 = asm_ring_norm_f0; |
|
885 | 920 | current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0; |
|
886 | 921 | |
|
887 | 922 | current_ring_node_asm_norm_f1 = asm_ring_norm_f1; |
|
888 | 923 | current_ring_node_asm_burst_sbm_f1 = asm_ring_burst_sbm_f1; |
|
889 | 924 | } |
|
890 | 925 | |
|
891 | 926 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header) |
|
892 | 927 | { |
|
893 | 928 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
894 | 929 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
895 | 930 | header->reserved = 0x00; |
|
896 | 931 | header->userApplication = CCSDS_USER_APP; |
|
897 | 932 | header->packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); |
|
898 | 933 | header->packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); |
|
899 | 934 | header->packetSequenceControl[0] = 0xc0; |
|
900 | 935 | header->packetSequenceControl[1] = 0x00; |
|
901 | 936 | header->packetLength[0] = 0x00; |
|
902 | 937 | header->packetLength[1] = 0x00; |
|
903 | 938 | // DATA FIELD HEADER |
|
904 | 939 | header->spare1_pusVersion_spare2 = 0x10; |
|
905 | 940 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
906 | 941 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
907 | 942 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
908 | 943 | // AUXILIARY DATA HEADER |
|
909 | 944 | header->sid = 0x00; |
|
910 | 945 | header->biaStatusInfo = 0x00; |
|
911 | 946 | header->pa_lfr_pkt_cnt_asm = 0x00; |
|
912 | 947 | header->pa_lfr_pkt_nr_asm = 0x00; |
|
913 | 948 | header->time[0] = 0x00; |
|
914 | 949 | header->time[0] = 0x00; |
|
915 | 950 | header->time[0] = 0x00; |
|
916 | 951 | header->time[0] = 0x00; |
|
917 | 952 | header->time[0] = 0x00; |
|
918 | 953 | header->time[0] = 0x00; |
|
919 | 954 | header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB |
|
920 | 955 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB |
|
921 | 956 | } |
|
922 | 957 | |
|
923 | 958 | void SM_average( float *averaged_spec_mat_f0, float *averaged_spec_mat_f1, |
|
924 | 959 | ring_node_sm *ring_node_tab[], |
|
925 | 960 | unsigned int nbAverageNormF0, unsigned int nbAverageSBM1F0 ) |
|
926 | 961 | { |
|
927 | 962 | float sum; |
|
928 | 963 | unsigned int i; |
|
929 | 964 | |
|
930 | 965 | for(i=0; i<TOTAL_SIZE_SM; i++) |
|
931 | 966 | { |
|
932 | 967 | sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ] |
|
933 | 968 | + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ] |
|
934 | 969 | + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ] |
|
935 | 970 | + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ] |
|
936 | 971 | + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ] |
|
937 | 972 | + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ] |
|
938 | 973 | + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ] |
|
939 | 974 | + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ]; |
|
940 | 975 | |
|
941 | 976 | if ( (nbAverageNormF0 == 0) && (nbAverageSBM1F0 == 0) ) |
|
942 | 977 | { |
|
943 | 978 | averaged_spec_mat_f0[ i ] = sum; |
|
944 | 979 | averaged_spec_mat_f1[ i ] = sum; |
|
945 | 980 | } |
|
946 | 981 | else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 != 0) ) |
|
947 | 982 | { |
|
948 | 983 | averaged_spec_mat_f0[ i ] = ( averaged_spec_mat_f0[ i ] + sum ); |
|
949 | 984 | averaged_spec_mat_f1[ i ] = ( averaged_spec_mat_f1[ i ] + sum ); |
|
950 | 985 | } |
|
951 | 986 | else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 == 0) ) |
|
952 | 987 | { |
|
953 | 988 | averaged_spec_mat_f0[ i ] = ( averaged_spec_mat_f0[ i ] + sum ); |
|
954 | 989 | averaged_spec_mat_f1[ i ] = sum; |
|
955 | 990 | } |
|
956 | 991 | else |
|
957 | 992 | { |
|
958 | 993 | PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNormF0, nbAverageSBM1F0) |
|
959 | 994 | } |
|
960 | 995 | } |
|
961 | 996 | } |
|
962 | 997 | |
|
963 | 998 | void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider ) |
|
964 | 999 | { |
|
965 | 1000 | int frequencyBin; |
|
966 | 1001 | int asmComponent; |
|
967 | 1002 | unsigned int offsetAveragedSpecMatReorganized; |
|
968 | 1003 | unsigned int offsetAveragedSpecMat; |
|
969 | 1004 | |
|
970 | 1005 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) |
|
971 | 1006 | { |
|
972 | 1007 | for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ ) |
|
973 | 1008 | { |
|
974 | 1009 | offsetAveragedSpecMatReorganized = |
|
975 | 1010 | frequencyBin * NB_VALUES_PER_SM |
|
976 | 1011 | + asmComponent; |
|
977 | 1012 | offsetAveragedSpecMat = |
|
978 | 1013 | asmComponent * NB_BINS_PER_SM |
|
979 | 1014 | + frequencyBin; |
|
980 | 1015 | averaged_spec_mat_reorganized[offsetAveragedSpecMatReorganized ] = |
|
981 | 1016 | averaged_spec_mat[ offsetAveragedSpecMat ] / divider; |
|
982 | 1017 | } |
|
983 | 1018 | } |
|
984 | 1019 | } |
|
985 | 1020 | |
|
986 | 1021 | void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider, |
|
987 | 1022 | unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart ) |
|
988 | 1023 | { |
|
989 | 1024 | int frequencyBin; |
|
990 | 1025 | int asmComponent; |
|
991 | 1026 | int offsetASM; |
|
992 | 1027 | int offsetCompressed; |
|
993 | 1028 | int k; |
|
994 | 1029 | |
|
995 | 1030 | // build data |
|
996 | 1031 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) |
|
997 | 1032 | { |
|
998 | 1033 | for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ ) |
|
999 | 1034 | { |
|
1000 | 1035 | offsetCompressed = // NO TIME OFFSET |
|
1001 | 1036 | frequencyBin * NB_VALUES_PER_SM |
|
1002 | 1037 | + asmComponent; |
|
1003 | 1038 | offsetASM = // NO TIME OFFSET |
|
1004 | 1039 | asmComponent * NB_BINS_PER_SM |
|
1005 | 1040 | + ASMIndexStart |
|
1006 | 1041 | + frequencyBin * nbBinsToAverage; |
|
1007 | 1042 | compressed_spec_mat[ offsetCompressed ] = 0; |
|
1008 | 1043 | for ( k = 0; k < nbBinsToAverage; k++ ) |
|
1009 | 1044 | { |
|
1010 | 1045 | compressed_spec_mat[offsetCompressed ] = |
|
1011 | 1046 | ( compressed_spec_mat[ offsetCompressed ] |
|
1012 | 1047 | + averaged_spec_mat[ offsetASM + k ] ) / (divider * nbBinsToAverage); |
|
1013 | 1048 | } |
|
1014 | 1049 | } |
|
1015 | 1050 | } |
|
1016 | 1051 | } |
|
1017 | 1052 | |
|
1018 | 1053 | void ASM_convert( volatile float *input_matrix, char *output_matrix) |
|
1019 | 1054 | { |
|
1020 | 1055 | unsigned int frequencyBin; |
|
1021 | 1056 | unsigned int asmComponent; |
|
1022 | 1057 | char * pt_char_input; |
|
1023 | 1058 | char * pt_char_output; |
|
1024 | 1059 | unsigned int offsetInput; |
|
1025 | 1060 | unsigned int offsetOutput; |
|
1026 | 1061 | |
|
1027 | 1062 | pt_char_input = (char*) &input_matrix; |
|
1028 | 1063 | pt_char_output = (char*) &output_matrix; |
|
1029 | 1064 | |
|
1030 | 1065 | // convert all other data |
|
1031 | 1066 | for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++) |
|
1032 | 1067 | { |
|
1033 | 1068 | for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++) |
|
1034 | 1069 | { |
|
1035 | 1070 | offsetInput = (frequencyBin*NB_VALUES_PER_SM) + asmComponent ; |
|
1036 | 1071 | offsetOutput = 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) ; |
|
1037 | 1072 | pt_char_input = (char*) &input_matrix [ offsetInput ]; |
|
1038 | 1073 | pt_char_output = (char*) &output_matrix[ offsetOutput ]; |
|
1039 | 1074 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float |
|
1040 | 1075 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float |
|
1041 | 1076 | } |
|
1042 | 1077 | } |
|
1043 | 1078 | } |
|
1044 | 1079 | |
|
1045 | 1080 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
1046 | 1081 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) |
|
1047 | 1082 | { |
|
1048 | 1083 | unsigned int i; |
|
1049 | 1084 | unsigned int length = 0; |
|
1050 | 1085 | rtems_status_code status; |
|
1051 | 1086 | |
|
1052 | 1087 | for (i=0; i<2; i++) |
|
1053 | 1088 | { |
|
1054 | 1089 | // (1) BUILD THE DATA |
|
1055 | 1090 | switch(sid) |
|
1056 | 1091 | { |
|
1057 | 1092 | case SID_NORM_ASM_F0: |
|
1058 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; | |
|
1093 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; // 2 packets will be sent | |
|
1059 | 1094 | spw_ioctl_send->data = &spectral_matrix[ |
|
1060 | 1095 | ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2 |
|
1061 | 1096 | ]; |
|
1062 | 1097 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; |
|
1063 | 1098 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB |
|
1064 | 1099 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB |
|
1065 | 1100 | break; |
|
1066 | 1101 | case SID_NORM_ASM_F1: |
|
1102 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F1_IN_BYTES / 2; // 2 packets will be sent | |
|
1103 | spw_ioctl_send->data = &spectral_matrix[ | |
|
1104 | ( (ASM_F1_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F1) ) * NB_VALUES_PER_SM ) * 2 | |
|
1105 | ]; | |
|
1106 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1; | |
|
1107 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F1) >> 8 ); // BLK_NR MSB | |
|
1108 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F1); // BLK_NR LSB | |
|
1067 | 1109 | break; |
|
1068 | 1110 | case SID_NORM_ASM_F2: |
|
1069 | 1111 | break; |
|
1070 | 1112 | default: |
|
1071 | 1113 | PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid) |
|
1072 | 1114 | break; |
|
1073 | 1115 | } |
|
1074 | 1116 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
1075 | 1117 | spw_ioctl_send->hdr = (char *) header; |
|
1076 | 1118 | spw_ioctl_send->options = 0; |
|
1077 | 1119 | |
|
1078 | 1120 | // (2) BUILD THE HEADER |
|
1079 | 1121 | header->packetLength[0] = (unsigned char) (length>>8); |
|
1080 | 1122 | header->packetLength[1] = (unsigned char) (length); |
|
1081 | 1123 | header->sid = (unsigned char) sid; // SID |
|
1082 | 1124 | header->pa_lfr_pkt_cnt_asm = 2; |
|
1083 | 1125 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); |
|
1084 | 1126 | |
|
1085 | 1127 | // (3) SET PACKET TIME |
|
1086 | 1128 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
1087 | 1129 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
1088 | 1130 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
1089 | 1131 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
1090 | 1132 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
1091 | 1133 | header->time[5] = (unsigned char) (time_management_regs->fine_time); |
|
1092 | 1134 | // |
|
1093 | 1135 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
1094 | 1136 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
1095 | 1137 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
1096 | 1138 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); |
|
1097 | 1139 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
1098 | 1140 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); |
|
1099 | 1141 | |
|
1100 | 1142 | // (4) SEND PACKET |
|
1101 | 1143 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
1102 | 1144 | if (status != RTEMS_SUCCESSFUL) { |
|
1103 | 1145 | printf("in ASM_send *** ERR %d\n", (int) status); |
|
1104 | 1146 | } |
|
1105 | 1147 | } |
|
1106 | 1148 | } |
|
1107 | 1149 | |
|
1108 | 1150 | //***************** |
|
1109 | 1151 | // Basic Parameters |
|
1110 | 1152 | |
|
1111 | 1153 | void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header, |
|
1112 | 1154 | unsigned int apid, unsigned char sid, |
|
1113 | 1155 | unsigned int packetLength, unsigned char blkNr ) |
|
1114 | 1156 | { |
|
1115 | 1157 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
1116 | 1158 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
1117 | 1159 | header->reserved = 0x00; |
|
1118 | 1160 | header->userApplication = CCSDS_USER_APP; |
|
1119 | 1161 | header->packetID[0] = (unsigned char) (apid >> 8); |
|
1120 | 1162 | header->packetID[1] = (unsigned char) (apid); |
|
1121 | 1163 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
1122 | 1164 | header->packetSequenceControl[1] = 0x00; |
|
1123 | 1165 | header->packetLength[0] = (unsigned char) (packetLength >> 8); |
|
1124 | 1166 | header->packetLength[1] = (unsigned char) (packetLength); |
|
1125 | 1167 | // DATA FIELD HEADER |
|
1126 | 1168 | header->spare1_pusVersion_spare2 = 0x10; |
|
1127 | 1169 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
1128 | 1170 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
1129 | 1171 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
1130 | 1172 | // AUXILIARY DATA HEADER |
|
1131 | 1173 | header->sid = sid; |
|
1132 | 1174 | header->biaStatusInfo = 0x00; |
|
1133 | 1175 | header->time[0] = 0x00; |
|
1134 | 1176 | header->time[0] = 0x00; |
|
1135 | 1177 | header->time[0] = 0x00; |
|
1136 | 1178 | header->time[0] = 0x00; |
|
1137 | 1179 | header->time[0] = 0x00; |
|
1138 | 1180 | header->time[0] = 0x00; |
|
1139 | 1181 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB |
|
1140 | 1182 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB |
|
1141 | 1183 | } |
|
1142 | 1184 | |
|
1143 | 1185 | void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header, |
|
1144 | 1186 | unsigned int apid, unsigned char sid, |
|
1145 | 1187 | unsigned int packetLength , unsigned char blkNr) |
|
1146 | 1188 | { |
|
1147 | 1189 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
1148 | 1190 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
1149 | 1191 | header->reserved = 0x00; |
|
1150 | 1192 | header->userApplication = CCSDS_USER_APP; |
|
1151 | 1193 | header->packetID[0] = (unsigned char) (apid >> 8); |
|
1152 | 1194 | header->packetID[1] = (unsigned char) (apid); |
|
1153 | 1195 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
1154 | 1196 | header->packetSequenceControl[1] = 0x00; |
|
1155 | 1197 | header->packetLength[0] = (unsigned char) (packetLength >> 8); |
|
1156 | 1198 | header->packetLength[1] = (unsigned char) (packetLength); |
|
1157 | 1199 | // DATA FIELD HEADER |
|
1158 | 1200 | header->spare1_pusVersion_spare2 = 0x10; |
|
1159 | 1201 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
1160 | 1202 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
1161 | 1203 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
1162 | 1204 | // AUXILIARY DATA HEADER |
|
1163 | 1205 | header->sid = sid; |
|
1164 | 1206 | header->biaStatusInfo = 0x00; |
|
1165 | 1207 | header->time[0] = 0x00; |
|
1166 | 1208 | header->time[0] = 0x00; |
|
1167 | 1209 | header->time[0] = 0x00; |
|
1168 | 1210 | header->time[0] = 0x00; |
|
1169 | 1211 | header->time[0] = 0x00; |
|
1170 | 1212 | header->time[0] = 0x00; |
|
1171 | 1213 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB |
|
1172 | 1214 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB |
|
1173 | 1215 | } |
|
1174 | 1216 | |
|
1175 | 1217 | void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend ) |
|
1176 | 1218 | { |
|
1177 | 1219 | rtems_status_code status; |
|
1178 | 1220 | |
|
1179 | 1221 | // SEND PACKET |
|
1180 | 1222 | status = rtems_message_queue_send( queue_id, data, nbBytesToSend); |
|
1181 | 1223 | if (status != RTEMS_SUCCESSFUL) |
|
1182 | 1224 | { |
|
1183 | 1225 | printf("ERR *** in BP_send *** ERR %d\n", (int) status); |
|
1184 | 1226 | } |
|
1185 | 1227 | } |
|
1186 | 1228 | |
|
1187 | 1229 | //****************** |
|
1188 | 1230 | // general functions |
|
1189 | 1231 | |
|
1190 | 1232 | void reset_spectral_matrix_regs( void ) |
|
1191 | 1233 | { |
|
1192 | 1234 | /** This function resets the spectral matrices module registers. |
|
1193 | 1235 | * |
|
1194 | 1236 | * The registers affected by this function are located at the following offset addresses: |
|
1195 | 1237 | * |
|
1196 | 1238 | * - 0x00 config |
|
1197 | 1239 | * - 0x04 status |
|
1198 | 1240 | * - 0x08 matrixF0_Address0 |
|
1199 | 1241 | * - 0x10 matrixFO_Address1 |
|
1200 | 1242 | * - 0x14 matrixF1_Address |
|
1201 | 1243 | * - 0x18 matrixF2_Address |
|
1202 | 1244 | * |
|
1203 | 1245 | */ |
|
1204 | 1246 | |
|
1205 | 1247 | spectral_matrix_regs->config = 0x00; |
|
1206 | 1248 | spectral_matrix_regs->status = 0x00; |
|
1207 | 1249 | |
|
1208 | 1250 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
1209 | 1251 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; |
|
1210 | 1252 | spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address; |
|
1211 | 1253 | spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address; |
|
1212 | 1254 | } |
|
1213 | 1255 | |
|
1214 | 1256 | void set_time( unsigned char *time, unsigned char * timeInBuffer ) |
|
1215 | 1257 | { |
|
1216 | 1258 | // time[0] = timeInBuffer[2]; |
|
1217 | 1259 | // time[1] = timeInBuffer[3]; |
|
1218 | 1260 | // time[2] = timeInBuffer[0]; |
|
1219 | 1261 | // time[3] = timeInBuffer[1]; |
|
1220 | 1262 | // time[4] = timeInBuffer[6]; |
|
1221 | 1263 | // time[5] = timeInBuffer[7]; |
|
1222 | 1264 | |
|
1223 | 1265 | time[0] = timeInBuffer[0]; |
|
1224 | 1266 | time[1] = timeInBuffer[1]; |
|
1225 | 1267 | time[2] = timeInBuffer[2]; |
|
1226 | 1268 | time[3] = timeInBuffer[3]; |
|
1227 | 1269 | time[4] = timeInBuffer[6]; |
|
1228 | 1270 | time[5] = timeInBuffer[7]; |
|
1229 | 1271 | } |
|
1230 | 1272 | |
|
1231 | 1273 |
@@ -1,921 +1,921 | |||
|
1 | 1 | /** Functions and tasks related to TeleCommand handling. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * A group of functions to handle TeleCommands:\n |
|
7 | 7 | * action launching\n |
|
8 | 8 | * TC parsing\n |
|
9 | 9 | * ... |
|
10 | 10 | * |
|
11 | 11 | */ |
|
12 | 12 | |
|
13 | 13 | #include "tc_handler.h" |
|
14 | 14 | |
|
15 | 15 | //*********** |
|
16 | 16 | // RTEMS TASK |
|
17 | 17 | |
|
18 | 18 | rtems_task actn_task( rtems_task_argument unused ) |
|
19 | 19 | { |
|
20 | 20 | /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands. |
|
21 | 21 | * |
|
22 | 22 | * @param unused is the starting argument of the RTEMS task |
|
23 | 23 | * |
|
24 | 24 | * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending |
|
25 | 25 | * on the incoming TeleCommand. |
|
26 | 26 | * |
|
27 | 27 | */ |
|
28 | 28 | |
|
29 | 29 | int result; |
|
30 | 30 | rtems_status_code status; // RTEMS status code |
|
31 | 31 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task |
|
32 | 32 | size_t size; // size of the incoming TC packet |
|
33 | 33 | unsigned char subtype; // subtype of the current TC packet |
|
34 | 34 | unsigned char time[6]; |
|
35 | 35 | rtems_id queue_rcv_id; |
|
36 | 36 | rtems_id queue_snd_id; |
|
37 | 37 | |
|
38 | 38 | status = get_message_queue_id_recv( &queue_rcv_id ); |
|
39 | 39 | if (status != RTEMS_SUCCESSFUL) |
|
40 | 40 | { |
|
41 | 41 | PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status) |
|
42 | 42 | } |
|
43 | 43 | |
|
44 | 44 | status = get_message_queue_id_send( &queue_snd_id ); |
|
45 | 45 | if (status != RTEMS_SUCCESSFUL) |
|
46 | 46 | { |
|
47 | 47 | PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status) |
|
48 | 48 | } |
|
49 | 49 | |
|
50 | 50 | result = LFR_SUCCESSFUL; |
|
51 | 51 | subtype = 0; // subtype of the current TC packet |
|
52 | 52 | |
|
53 | 53 | BOOT_PRINTF("in ACTN *** \n") |
|
54 | 54 | |
|
55 | 55 | while(1) |
|
56 | 56 | { |
|
57 | 57 | status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size, |
|
58 | 58 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); |
|
59 | 59 | getTime( time ); // set time to the current time |
|
60 | 60 | if (status!=RTEMS_SUCCESSFUL) |
|
61 | 61 | { |
|
62 | 62 | PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) |
|
63 | 63 | } |
|
64 | 64 | else |
|
65 | 65 | { |
|
66 | 66 | subtype = TC.serviceSubType; |
|
67 | 67 | switch(subtype) |
|
68 | 68 | { |
|
69 | 69 | case TC_SUBTYPE_RESET: |
|
70 | 70 | result = action_reset( &TC, queue_snd_id, time ); |
|
71 | 71 | close_action( &TC, result, queue_snd_id ); |
|
72 | 72 | break; |
|
73 | 73 | // |
|
74 | 74 | case TC_SUBTYPE_LOAD_COMM: |
|
75 | 75 | result = action_load_common_par( &TC ); |
|
76 | 76 | close_action( &TC, result, queue_snd_id ); |
|
77 | 77 | break; |
|
78 | 78 | // |
|
79 | 79 | case TC_SUBTYPE_LOAD_NORM: |
|
80 | 80 | result = action_load_normal_par( &TC, queue_snd_id, time ); |
|
81 | 81 | close_action( &TC, result, queue_snd_id ); |
|
82 | 82 | break; |
|
83 | 83 | // |
|
84 | 84 | case TC_SUBTYPE_LOAD_BURST: |
|
85 | 85 | result = action_load_burst_par( &TC, queue_snd_id, time ); |
|
86 | 86 | close_action( &TC, result, queue_snd_id ); |
|
87 | 87 | break; |
|
88 | 88 | // |
|
89 | 89 | case TC_SUBTYPE_LOAD_SBM1: |
|
90 | 90 | result = action_load_sbm1_par( &TC, queue_snd_id, time ); |
|
91 | 91 | close_action( &TC, result, queue_snd_id ); |
|
92 | 92 | break; |
|
93 | 93 | // |
|
94 | 94 | case TC_SUBTYPE_LOAD_SBM2: |
|
95 | 95 | result = action_load_sbm2_par( &TC, queue_snd_id, time ); |
|
96 | 96 | close_action( &TC, result, queue_snd_id ); |
|
97 | 97 | break; |
|
98 | 98 | // |
|
99 | 99 | case TC_SUBTYPE_DUMP: |
|
100 | 100 | result = action_dump_par( queue_snd_id ); |
|
101 | 101 | close_action( &TC, result, queue_snd_id ); |
|
102 | 102 | break; |
|
103 | 103 | // |
|
104 | 104 | case TC_SUBTYPE_ENTER: |
|
105 | 105 | result = action_enter_mode( &TC, queue_snd_id ); |
|
106 | 106 | close_action( &TC, result, queue_snd_id ); |
|
107 | 107 | break; |
|
108 | 108 | // |
|
109 | 109 | case TC_SUBTYPE_UPDT_INFO: |
|
110 | 110 | result = action_update_info( &TC, queue_snd_id ); |
|
111 | 111 | close_action( &TC, result, queue_snd_id ); |
|
112 | 112 | break; |
|
113 | 113 | // |
|
114 | 114 | case TC_SUBTYPE_EN_CAL: |
|
115 | 115 | result = action_enable_calibration( &TC, queue_snd_id, time ); |
|
116 | 116 | close_action( &TC, result, queue_snd_id ); |
|
117 | 117 | break; |
|
118 | 118 | // |
|
119 | 119 | case TC_SUBTYPE_DIS_CAL: |
|
120 | 120 | result = action_disable_calibration( &TC, queue_snd_id, time ); |
|
121 | 121 | close_action( &TC, result, queue_snd_id ); |
|
122 | 122 | break; |
|
123 | 123 | // |
|
124 | 124 | case TC_SUBTYPE_UPDT_TIME: |
|
125 | 125 | result = action_update_time( &TC ); |
|
126 | 126 | close_action( &TC, result, queue_snd_id ); |
|
127 | 127 | break; |
|
128 | 128 | // |
|
129 | 129 | default: |
|
130 | 130 | break; |
|
131 | 131 | } |
|
132 | 132 | } |
|
133 | 133 | } |
|
134 | 134 | } |
|
135 | 135 | |
|
136 | 136 | //*********** |
|
137 | 137 | // TC ACTIONS |
|
138 | 138 | |
|
139 | 139 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
140 | 140 | { |
|
141 | 141 | /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received. |
|
142 | 142 | * |
|
143 | 143 | * @param TC points to the TeleCommand packet that is being processed |
|
144 | 144 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
145 | 145 | * |
|
146 | 146 | */ |
|
147 | 147 | |
|
148 | 148 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
149 | 149 | return LFR_DEFAULT; |
|
150 | 150 | } |
|
151 | 151 | |
|
152 | 152 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
153 | 153 | { |
|
154 | 154 | /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received. |
|
155 | 155 | * |
|
156 | 156 | * @param TC points to the TeleCommand packet that is being processed |
|
157 | 157 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
158 | 158 | * |
|
159 | 159 | */ |
|
160 | 160 | |
|
161 | 161 | rtems_status_code status; |
|
162 | 162 | unsigned char requestedMode; |
|
163 | 163 | unsigned int *transitionCoarseTime_ptr; |
|
164 | 164 | unsigned int transitionCoarseTime; |
|
165 | 165 | unsigned char * bytePosPtr; |
|
166 | 166 | |
|
167 | 167 | bytePosPtr = (unsigned char *) &TC->packetID; |
|
168 | 168 | |
|
169 | 169 | requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ]; |
|
170 | 170 | transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] ); |
|
171 | 171 | transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff; |
|
172 | 172 | |
|
173 | 173 | status = check_mode_value( requestedMode ); |
|
174 | 174 | |
|
175 | 175 | if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent |
|
176 | 176 | { |
|
177 | 177 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode ); |
|
178 | 178 | } |
|
179 | 179 | else // the mode value is consistent, check the transition |
|
180 | 180 | { |
|
181 | 181 | status = check_mode_transition(requestedMode); |
|
182 | 182 | if (status != LFR_SUCCESSFUL) |
|
183 | 183 | { |
|
184 | 184 | PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n") |
|
185 | 185 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
186 | 186 | } |
|
187 | 187 | } |
|
188 | 188 | |
|
189 | 189 | if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode |
|
190 | 190 | { |
|
191 | 191 | status = check_transition_date( transitionCoarseTime ); |
|
192 | 192 | if (status != LFR_SUCCESSFUL) |
|
193 | 193 | { |
|
194 | 194 | PRINTF("ERR *** in action_enter_mode *** check_transition_date\n") |
|
195 | 195 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, |
|
196 | 196 | BYTE_POS_CP_LFR_ENTER_MODE_TIME, |
|
197 | 197 | bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] ); |
|
198 | 198 | } |
|
199 | 199 | } |
|
200 | 200 | |
|
201 | 201 | if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode |
|
202 | 202 | { |
|
203 | 203 | PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode); |
|
204 | 204 | status = enter_mode( requestedMode, transitionCoarseTime ); |
|
205 | 205 | } |
|
206 | 206 | |
|
207 | 207 | return status; |
|
208 | 208 | } |
|
209 | 209 | |
|
210 | 210 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
211 | 211 | { |
|
212 | 212 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. |
|
213 | 213 | * |
|
214 | 214 | * @param TC points to the TeleCommand packet that is being processed |
|
215 | 215 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
216 | 216 | * |
|
217 | 217 | * @return LFR directive status code: |
|
218 | 218 | * - LFR_DEFAULT |
|
219 | 219 | * - LFR_SUCCESSFUL |
|
220 | 220 | * |
|
221 | 221 | */ |
|
222 | 222 | |
|
223 | 223 | unsigned int val; |
|
224 | 224 | int result; |
|
225 | 225 | unsigned int status; |
|
226 | 226 | unsigned char mode; |
|
227 | 227 | unsigned char * bytePosPtr; |
|
228 | 228 | |
|
229 | 229 | bytePosPtr = (unsigned char *) &TC->packetID; |
|
230 | 230 | |
|
231 | 231 | // check LFR mode |
|
232 | 232 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1; |
|
233 | 233 | status = check_update_info_hk_lfr_mode( mode ); |
|
234 | 234 | if (status == LFR_SUCCESSFUL) // check TDS mode |
|
235 | 235 | { |
|
236 | 236 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4; |
|
237 | 237 | status = check_update_info_hk_tds_mode( mode ); |
|
238 | 238 | } |
|
239 | 239 | if (status == LFR_SUCCESSFUL) // check THR mode |
|
240 | 240 | { |
|
241 | 241 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f); |
|
242 | 242 | status = check_update_info_hk_thr_mode( mode ); |
|
243 | 243 | } |
|
244 | 244 | if (status == LFR_SUCCESSFUL) // if the parameter check is successful |
|
245 | 245 | { |
|
246 | 246 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 |
|
247 | 247 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; |
|
248 | 248 | val++; |
|
249 | 249 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); |
|
250 | 250 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); |
|
251 | 251 | } |
|
252 | 252 | |
|
253 | 253 | result = status; |
|
254 | 254 | |
|
255 | 255 | return result; |
|
256 | 256 | } |
|
257 | 257 | |
|
258 | 258 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
259 | 259 | { |
|
260 | 260 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. |
|
261 | 261 | * |
|
262 | 262 | * @param TC points to the TeleCommand packet that is being processed |
|
263 | 263 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
264 | 264 | * |
|
265 | 265 | */ |
|
266 | 266 | |
|
267 | 267 | int result; |
|
268 | 268 | unsigned char lfrMode; |
|
269 | 269 | |
|
270 | 270 | result = LFR_DEFAULT; |
|
271 | 271 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
272 | 272 | |
|
273 | 273 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
274 | 274 | result = LFR_DEFAULT; |
|
275 | 275 | |
|
276 | 276 | return result; |
|
277 | 277 | } |
|
278 | 278 | |
|
279 | 279 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
280 | 280 | { |
|
281 | 281 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. |
|
282 | 282 | * |
|
283 | 283 | * @param TC points to the TeleCommand packet that is being processed |
|
284 | 284 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
285 | 285 | * |
|
286 | 286 | */ |
|
287 | 287 | |
|
288 | 288 | int result; |
|
289 | 289 | unsigned char lfrMode; |
|
290 | 290 | |
|
291 | 291 | result = LFR_DEFAULT; |
|
292 | 292 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
293 | 293 | |
|
294 | 294 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
295 | 295 | result = LFR_DEFAULT; |
|
296 | 296 | |
|
297 | 297 | return result; |
|
298 | 298 | } |
|
299 | 299 | |
|
300 | 300 | int action_update_time(ccsdsTelecommandPacket_t *TC) |
|
301 | 301 | { |
|
302 | 302 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. |
|
303 | 303 | * |
|
304 | 304 | * @param TC points to the TeleCommand packet that is being processed |
|
305 | 305 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
306 | 306 | * |
|
307 | 307 | * @return LFR_SUCCESSFUL |
|
308 | 308 | * |
|
309 | 309 | */ |
|
310 | 310 | |
|
311 | 311 | unsigned int val; |
|
312 | 312 | |
|
313 | 313 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) |
|
314 | 314 | + (TC->dataAndCRC[1] << 16) |
|
315 | 315 | + (TC->dataAndCRC[2] << 8) |
|
316 | 316 | + TC->dataAndCRC[3]; |
|
317 | 317 | |
|
318 | 318 | PRINTF1("time received: %x\n", time_management_regs->coarse_time_load) |
|
319 | 319 | |
|
320 | 320 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 |
|
321 | 321 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; |
|
322 | 322 | val++; |
|
323 | 323 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); |
|
324 | 324 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); |
|
325 | 325 | // time_management_regs->ctrl = time_management_regs->ctrl | 1; // force tick |
|
326 | 326 | |
|
327 | 327 | return LFR_SUCCESSFUL; |
|
328 | 328 | } |
|
329 | 329 | |
|
330 | 330 | //******************* |
|
331 | 331 | // ENTERING THE MODES |
|
332 | 332 | int check_mode_value( unsigned char requestedMode ) |
|
333 | 333 | { |
|
334 | 334 | int status; |
|
335 | 335 | |
|
336 | 336 | if ( (requestedMode != LFR_MODE_STANDBY) |
|
337 | 337 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) |
|
338 | 338 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) |
|
339 | 339 | { |
|
340 | 340 | status = LFR_DEFAULT; |
|
341 | 341 | } |
|
342 | 342 | else |
|
343 | 343 | { |
|
344 | 344 | status = LFR_SUCCESSFUL; |
|
345 | 345 | } |
|
346 | 346 | |
|
347 | 347 | return status; |
|
348 | 348 | } |
|
349 | 349 | |
|
350 | 350 | int check_mode_transition( unsigned char requestedMode ) |
|
351 | 351 | { |
|
352 | 352 | /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE. |
|
353 | 353 | * |
|
354 | 354 | * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE |
|
355 | 355 | * |
|
356 | 356 | * @return LFR directive status codes: |
|
357 | 357 | * - LFR_SUCCESSFUL - the transition is authorized |
|
358 | 358 | * - LFR_DEFAULT - the transition is not authorized |
|
359 | 359 | * |
|
360 | 360 | */ |
|
361 | 361 | |
|
362 | 362 | int status; |
|
363 | 363 | |
|
364 | 364 | switch (requestedMode) |
|
365 | 365 | { |
|
366 | 366 | case LFR_MODE_STANDBY: |
|
367 | 367 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { |
|
368 | 368 | status = LFR_DEFAULT; |
|
369 | 369 | } |
|
370 | 370 | else |
|
371 | 371 | { |
|
372 | 372 | status = LFR_SUCCESSFUL; |
|
373 | 373 | } |
|
374 | 374 | break; |
|
375 | 375 | case LFR_MODE_NORMAL: |
|
376 | 376 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { |
|
377 | 377 | status = LFR_DEFAULT; |
|
378 | 378 | } |
|
379 | 379 | else { |
|
380 | 380 | status = LFR_SUCCESSFUL; |
|
381 | 381 | } |
|
382 | 382 | break; |
|
383 | 383 | case LFR_MODE_BURST: |
|
384 | 384 | if ( lfrCurrentMode == LFR_MODE_BURST ) { |
|
385 | 385 | status = LFR_DEFAULT; |
|
386 | 386 | } |
|
387 | 387 | else { |
|
388 | 388 | status = LFR_SUCCESSFUL; |
|
389 | 389 | } |
|
390 | 390 | break; |
|
391 | 391 | case LFR_MODE_SBM1: |
|
392 | 392 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { |
|
393 | 393 | status = LFR_DEFAULT; |
|
394 | 394 | } |
|
395 | 395 | else { |
|
396 | 396 | status = LFR_SUCCESSFUL; |
|
397 | 397 | } |
|
398 | 398 | break; |
|
399 | 399 | case LFR_MODE_SBM2: |
|
400 | 400 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { |
|
401 | 401 | status = LFR_DEFAULT; |
|
402 | 402 | } |
|
403 | 403 | else { |
|
404 | 404 | status = LFR_SUCCESSFUL; |
|
405 | 405 | } |
|
406 | 406 | break; |
|
407 | 407 | default: |
|
408 | 408 | status = LFR_DEFAULT; |
|
409 | 409 | break; |
|
410 | 410 | } |
|
411 | 411 | |
|
412 | 412 | return status; |
|
413 | 413 | } |
|
414 | 414 | |
|
415 | 415 | int check_transition_date( unsigned int transitionCoarseTime ) |
|
416 | 416 | { |
|
417 | 417 | int status; |
|
418 | 418 | unsigned int localCoarseTime; |
|
419 | 419 | unsigned int deltaCoarseTime; |
|
420 | 420 | |
|
421 | 421 | status = LFR_SUCCESSFUL; |
|
422 | 422 | |
|
423 | 423 | if (transitionCoarseTime == 0) // transition time = 0 means an instant transition |
|
424 | 424 | { |
|
425 | 425 | status = LFR_SUCCESSFUL; |
|
426 | 426 | } |
|
427 | 427 | else |
|
428 | 428 | { |
|
429 | 429 | localCoarseTime = time_management_regs->coarse_time & 0x7fffffff; |
|
430 | 430 | |
|
431 | 431 | if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322 |
|
432 | 432 | { |
|
433 | 433 | status = LFR_DEFAULT; |
|
434 | 434 | PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime) |
|
435 | 435 | } |
|
436 | 436 | |
|
437 | 437 | if (status == LFR_SUCCESSFUL) |
|
438 | 438 | { |
|
439 | 439 | deltaCoarseTime = transitionCoarseTime - localCoarseTime; |
|
440 | 440 | if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323 |
|
441 | 441 | { |
|
442 | 442 | status = LFR_DEFAULT; |
|
443 | 443 | PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime) |
|
444 | 444 | } |
|
445 | 445 | } |
|
446 | 446 | } |
|
447 | 447 | |
|
448 | 448 | return status; |
|
449 | 449 | } |
|
450 | 450 | |
|
451 | 451 | int stop_current_mode( void ) |
|
452 | 452 | { |
|
453 | 453 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. |
|
454 | 454 | * |
|
455 | 455 | * @return RTEMS directive status codes: |
|
456 | 456 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
457 | 457 | * - RTEMS_INVALID_ID - task id invalid |
|
458 | 458 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
459 | 459 | * |
|
460 | 460 | */ |
|
461 | 461 | |
|
462 | 462 | rtems_status_code status; |
|
463 | 463 | |
|
464 | 464 | status = RTEMS_SUCCESSFUL; |
|
465 | 465 | |
|
466 | 466 | // (1) mask interruptions |
|
467 | 467 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt |
|
468 | 468 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
469 | 469 | |
|
470 | 470 | // (2) clear interruptions |
|
471 | 471 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt |
|
472 | 472 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
473 | 473 | |
|
474 | 474 | // (3) reset waveform picker registers |
|
475 | 475 | reset_wfp_burst_enable(); // reset burst and enable bits |
|
476 | 476 | reset_wfp_status(); // reset all the status bits |
|
477 | 477 | |
|
478 | 478 | // (4) reset spectral matrices registers |
|
479 | 479 | set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices |
|
480 | 480 | set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0 |
|
481 | 481 | reset_extractSWF(); // reset the extractSWF flag to false |
|
482 | 482 | |
|
483 | 483 | // <Spectral Matrices simulator> |
|
484 | 484 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator |
|
485 | 485 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
486 | 486 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator |
|
487 | 487 | // </Spectral Matrices simulator> |
|
488 | 488 | |
|
489 | 489 | // suspend several tasks |
|
490 | 490 | if (lfrCurrentMode != LFR_MODE_STANDBY) { |
|
491 | 491 | status = suspend_science_tasks(); |
|
492 | 492 | } |
|
493 | 493 | |
|
494 | 494 | if (status != RTEMS_SUCCESSFUL) |
|
495 | 495 | { |
|
496 | 496 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
497 | 497 | } |
|
498 | 498 | |
|
499 | 499 | return status; |
|
500 | 500 | } |
|
501 | 501 | |
|
502 | 502 | int enter_mode( unsigned char mode, unsigned int transitionCoarseTime ) |
|
503 | 503 | { |
|
504 | 504 | /** This function is launched after a mode transition validation. |
|
505 | 505 | * |
|
506 | 506 | * @param mode is the mode in which LFR will be put. |
|
507 | 507 | * |
|
508 | 508 | * @return RTEMS directive status codes: |
|
509 | 509 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully |
|
510 | 510 | * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully |
|
511 | 511 | * |
|
512 | 512 | */ |
|
513 | 513 | |
|
514 | 514 | rtems_status_code status; |
|
515 | 515 | |
|
516 | 516 | //********************** |
|
517 | 517 | // STOP THE CURRENT MODE |
|
518 | 518 | status = stop_current_mode(); |
|
519 | 519 | if (status != RTEMS_SUCCESSFUL) |
|
520 | 520 | { |
|
521 | 521 | PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode) |
|
522 | 522 | } |
|
523 | 523 | |
|
524 | 524 | //************************* |
|
525 | 525 | // ENTER THE REQUESTED MODE |
|
526 | 526 | if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST) |
|
527 | 527 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) ) |
|
528 | 528 | { |
|
529 | 529 | #ifdef PRINT_TASK_STATISTICS |
|
530 | 530 | rtems_cpu_usage_reset(); |
|
531 | 531 | maxCount = 0; |
|
532 | 532 | #endif |
|
533 | 533 | status = restart_science_tasks( mode ); |
|
534 | 534 | launch_waveform_picker( mode, transitionCoarseTime ); |
|
535 | 535 | // launch_spectral_matrix( ); |
|
536 |
|
|
|
536 | launch_spectral_matrix_simu( ); | |
|
537 | 537 | } |
|
538 | 538 | else if ( mode == LFR_MODE_STANDBY ) |
|
539 | 539 | { |
|
540 | 540 | #ifdef PRINT_TASK_STATISTICS |
|
541 | 541 | rtems_cpu_usage_report(); |
|
542 | 542 | #endif |
|
543 | 543 | |
|
544 | 544 | #ifdef PRINT_STACK_REPORT |
|
545 | 545 | PRINTF("stack report selected\n") |
|
546 | 546 | rtems_stack_checker_report_usage(); |
|
547 | 547 | #endif |
|
548 | 548 | PRINTF1("maxCount = %d\n", maxCount) |
|
549 | 549 | } |
|
550 | 550 | else |
|
551 | 551 | { |
|
552 | 552 | status = RTEMS_UNSATISFIED; |
|
553 | 553 | } |
|
554 | 554 | |
|
555 | 555 | if (status != RTEMS_SUCCESSFUL) |
|
556 | 556 | { |
|
557 | 557 | PRINTF1("ERR *** in enter_mode *** status = %d\n", status) |
|
558 | 558 | status = RTEMS_UNSATISFIED; |
|
559 | 559 | } |
|
560 | 560 | |
|
561 | 561 | return status; |
|
562 | 562 | } |
|
563 | 563 | |
|
564 | 564 | int restart_science_tasks(unsigned char lfrRequestedMode ) |
|
565 | 565 | { |
|
566 | 566 | /** This function is used to restart all science tasks. |
|
567 | 567 | * |
|
568 | 568 | * @return RTEMS directive status codes: |
|
569 | 569 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
570 | 570 | * - RTEMS_INVALID_ID - task id invalid |
|
571 | 571 | * - RTEMS_INCORRECT_STATE - task never started |
|
572 | 572 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task |
|
573 | 573 | * |
|
574 | 574 | * Science tasks are AVF0, PRC0, WFRM, CWF3, CW2, CWF1 |
|
575 | 575 | * |
|
576 | 576 | */ |
|
577 | 577 | |
|
578 | 578 | rtems_status_code status[8]; |
|
579 | 579 | rtems_status_code ret; |
|
580 | 580 | |
|
581 | 581 | ret = RTEMS_SUCCESSFUL; |
|
582 | 582 | |
|
583 | 583 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode ); |
|
584 | 584 | if (status[0] != RTEMS_SUCCESSFUL) |
|
585 | 585 | { |
|
586 | 586 | PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[0]) |
|
587 | 587 | } |
|
588 | 588 | |
|
589 | 589 | status[1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode ); |
|
590 | 590 | if (status[1] != RTEMS_SUCCESSFUL) |
|
591 | 591 | { |
|
592 | 592 | PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[1]) |
|
593 | 593 | } |
|
594 | 594 | |
|
595 | 595 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); |
|
596 | 596 | if (status[2] != RTEMS_SUCCESSFUL) |
|
597 | 597 | { |
|
598 | 598 | PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[2]) |
|
599 | 599 | } |
|
600 | 600 | |
|
601 | 601 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); |
|
602 | 602 | if (status[3] != RTEMS_SUCCESSFUL) |
|
603 | 603 | { |
|
604 | 604 | PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[3]) |
|
605 | 605 | } |
|
606 | 606 | |
|
607 | 607 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); |
|
608 | 608 | if (status[4] != RTEMS_SUCCESSFUL) |
|
609 | 609 | { |
|
610 | 610 | PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[4]) |
|
611 | 611 | } |
|
612 | 612 | |
|
613 | 613 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); |
|
614 | 614 | if (status[5] != RTEMS_SUCCESSFUL) |
|
615 | 615 | { |
|
616 | 616 | PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[5]) |
|
617 | 617 | } |
|
618 | 618 | |
|
619 | 619 | status[6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode ); |
|
620 | 620 | if (status[6] != RTEMS_SUCCESSFUL) |
|
621 | 621 | { |
|
622 | 622 | PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[6]) |
|
623 | 623 | } |
|
624 | 624 | |
|
625 | 625 | status[7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode ); |
|
626 | 626 | if (status[7] != RTEMS_SUCCESSFUL) |
|
627 | 627 | { |
|
628 | 628 | PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7]) |
|
629 | 629 | } |
|
630 | 630 | |
|
631 | 631 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || |
|
632 | 632 | (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) || |
|
633 | 633 | (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) || |
|
634 | 634 | (status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) ) |
|
635 | 635 | { |
|
636 | 636 | ret = RTEMS_UNSATISFIED; |
|
637 | 637 | } |
|
638 | 638 | |
|
639 | 639 | return ret; |
|
640 | 640 | } |
|
641 | 641 | |
|
642 | 642 | int suspend_science_tasks() |
|
643 | 643 | { |
|
644 | 644 | /** This function suspends the science tasks. |
|
645 | 645 | * |
|
646 | 646 | * @return RTEMS directive status codes: |
|
647 | 647 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
648 | 648 | * - RTEMS_INVALID_ID - task id invalid |
|
649 | 649 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
650 | 650 | * |
|
651 | 651 | */ |
|
652 | 652 | |
|
653 | 653 | rtems_status_code status; |
|
654 | 654 | |
|
655 | 655 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0 |
|
656 | 656 | if (status != RTEMS_SUCCESSFUL) |
|
657 | 657 | { |
|
658 | 658 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) |
|
659 | 659 | } |
|
660 | 660 | if (status == RTEMS_SUCCESSFUL) // suspend PRC0 |
|
661 | 661 | { |
|
662 | 662 | status = rtems_task_suspend( Task_id[TASKID_PRC0] ); |
|
663 | 663 | if (status != RTEMS_SUCCESSFUL) |
|
664 | 664 | { |
|
665 | 665 | PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status) |
|
666 | 666 | } |
|
667 | 667 | } |
|
668 | 668 | if (status == RTEMS_SUCCESSFUL) // suspend AVF1 |
|
669 | 669 | { |
|
670 | 670 | status = rtems_task_suspend( Task_id[TASKID_AVF1] ); |
|
671 | 671 | if (status != RTEMS_SUCCESSFUL) |
|
672 | 672 | { |
|
673 | 673 | PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status) |
|
674 | 674 | } |
|
675 | 675 | } |
|
676 | 676 | if (status == RTEMS_SUCCESSFUL) // suspend PRC1 |
|
677 | 677 | { |
|
678 | 678 | status = rtems_task_suspend( Task_id[TASKID_PRC1] ); |
|
679 | 679 | if (status != RTEMS_SUCCESSFUL) |
|
680 | 680 | { |
|
681 | 681 | PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status) |
|
682 | 682 | } |
|
683 | 683 | } |
|
684 | 684 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM |
|
685 | 685 | { |
|
686 | 686 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
687 | 687 | if (status != RTEMS_SUCCESSFUL) |
|
688 | 688 | { |
|
689 | 689 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) |
|
690 | 690 | } |
|
691 | 691 | } |
|
692 | 692 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 |
|
693 | 693 | { |
|
694 | 694 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); |
|
695 | 695 | if (status != RTEMS_SUCCESSFUL) |
|
696 | 696 | { |
|
697 | 697 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) |
|
698 | 698 | } |
|
699 | 699 | } |
|
700 | 700 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 |
|
701 | 701 | { |
|
702 | 702 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); |
|
703 | 703 | if (status != RTEMS_SUCCESSFUL) |
|
704 | 704 | { |
|
705 | 705 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) |
|
706 | 706 | } |
|
707 | 707 | } |
|
708 | 708 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 |
|
709 | 709 | { |
|
710 | 710 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
|
711 | 711 | if (status != RTEMS_SUCCESSFUL) |
|
712 | 712 | { |
|
713 | 713 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) |
|
714 | 714 | } |
|
715 | 715 | } |
|
716 | 716 | |
|
717 | 717 | return status; |
|
718 | 718 | } |
|
719 | 719 | |
|
720 | 720 | void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime ) |
|
721 | 721 | { |
|
722 | 722 | reset_current_ring_nodes(); |
|
723 | 723 | reset_waveform_picker_regs(); |
|
724 | 724 | set_wfp_burst_enable_register( mode ); |
|
725 | 725 | |
|
726 | 726 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
727 | 727 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
728 | 728 | |
|
729 | 729 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] |
|
730 | 730 | if (transitionCoarseTime == 0) |
|
731 | 731 | { |
|
732 | 732 | waveform_picker_regs->start_date = time_management_regs->coarse_time; |
|
733 | 733 | } |
|
734 | 734 | else |
|
735 | 735 | { |
|
736 | 736 | waveform_picker_regs->start_date = transitionCoarseTime; |
|
737 | 737 | } |
|
738 | 738 | } |
|
739 | 739 | |
|
740 | 740 | void launch_spectral_matrix( void ) |
|
741 | 741 | { |
|
742 | 742 | SM_reset_current_ring_nodes(); |
|
743 | 743 | ASM_reset_current_ring_nodes(); |
|
744 | 744 | reset_spectral_matrix_regs(); |
|
745 | 745 | |
|
746 | 746 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; |
|
747 | 747 | grgpio_regs->io_port_direction_register = |
|
748 | 748 | grgpio_regs->io_port_direction_register | 0x01; // [0000 0001], 0 = output disabled, 1 = output enabled |
|
749 | 749 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfffffffe; // set the bit 0 to 0 |
|
750 | 750 | set_irq_on_new_ready_matrix( 1 ); |
|
751 | 751 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
752 | 752 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
753 | 753 | set_run_matrix_spectral( 1 ); |
|
754 | 754 | |
|
755 | 755 | } |
|
756 | 756 | |
|
757 | 757 | void launch_spectral_matrix_simu( void ) |
|
758 | 758 | { |
|
759 | 759 | SM_reset_current_ring_nodes(); |
|
760 | 760 | ASM_reset_current_ring_nodes(); |
|
761 | 761 | reset_spectral_matrix_regs(); |
|
762 | 762 | |
|
763 | 763 | // Spectral Matrices simulator |
|
764 | 764 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
765 | 765 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); |
|
766 | 766 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); |
|
767 | 767 | set_local_nb_interrupt_f0_MAX(); |
|
768 | 768 | } |
|
769 | 769 | |
|
770 | 770 | void set_irq_on_new_ready_matrix( unsigned char value ) |
|
771 | 771 | { |
|
772 | 772 | if (value == 1) |
|
773 | 773 | { |
|
774 | 774 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; |
|
775 | 775 | } |
|
776 | 776 | else |
|
777 | 777 | { |
|
778 | 778 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 |
|
779 | 779 | } |
|
780 | 780 | } |
|
781 | 781 | |
|
782 | 782 | void set_run_matrix_spectral( unsigned char value ) |
|
783 | 783 | { |
|
784 | 784 | if (value == 1) |
|
785 | 785 | { |
|
786 | 786 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1 |
|
787 | 787 | } |
|
788 | 788 | else |
|
789 | 789 | { |
|
790 | 790 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0 |
|
791 | 791 | } |
|
792 | 792 | } |
|
793 | 793 | |
|
794 | 794 | //**************** |
|
795 | 795 | // CLOSING ACTIONS |
|
796 | 796 | void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time ) |
|
797 | 797 | { |
|
798 | 798 | /** This function is used to update the HK packets statistics after a successful TC execution. |
|
799 | 799 | * |
|
800 | 800 | * @param TC points to the TC being processed |
|
801 | 801 | * @param time is the time used to date the TC execution |
|
802 | 802 | * |
|
803 | 803 | */ |
|
804 | 804 | |
|
805 | 805 | unsigned int val; |
|
806 | 806 | |
|
807 | 807 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; |
|
808 | 808 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; |
|
809 | 809 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; |
|
810 | 810 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; |
|
811 | 811 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; |
|
812 | 812 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; |
|
813 | 813 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0]; |
|
814 | 814 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1]; |
|
815 | 815 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2]; |
|
816 | 816 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3]; |
|
817 | 817 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4]; |
|
818 | 818 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5]; |
|
819 | 819 | |
|
820 | 820 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; |
|
821 | 821 | val++; |
|
822 | 822 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); |
|
823 | 823 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); |
|
824 | 824 | } |
|
825 | 825 | |
|
826 | 826 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time ) |
|
827 | 827 | { |
|
828 | 828 | /** This function is used to update the HK packets statistics after a TC rejection. |
|
829 | 829 | * |
|
830 | 830 | * @param TC points to the TC being processed |
|
831 | 831 | * @param time is the time used to date the TC rejection |
|
832 | 832 | * |
|
833 | 833 | */ |
|
834 | 834 | |
|
835 | 835 | unsigned int val; |
|
836 | 836 | |
|
837 | 837 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; |
|
838 | 838 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; |
|
839 | 839 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; |
|
840 | 840 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; |
|
841 | 841 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; |
|
842 | 842 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; |
|
843 | 843 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0]; |
|
844 | 844 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1]; |
|
845 | 845 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2]; |
|
846 | 846 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3]; |
|
847 | 847 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4]; |
|
848 | 848 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5]; |
|
849 | 849 | |
|
850 | 850 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; |
|
851 | 851 | val++; |
|
852 | 852 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); |
|
853 | 853 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); |
|
854 | 854 | } |
|
855 | 855 | |
|
856 | 856 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ) |
|
857 | 857 | { |
|
858 | 858 | /** This function is the last step of the TC execution workflow. |
|
859 | 859 | * |
|
860 | 860 | * @param TC points to the TC being processed |
|
861 | 861 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) |
|
862 | 862 | * @param queue_id is the id of the RTEMS message queue used to send TM packets |
|
863 | 863 | * @param time is the time used to date the TC execution |
|
864 | 864 | * |
|
865 | 865 | */ |
|
866 | 866 | |
|
867 | 867 | unsigned char requestedMode; |
|
868 | 868 | |
|
869 | 869 | if (result == LFR_SUCCESSFUL) |
|
870 | 870 | { |
|
871 | 871 | if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
872 | 872 | & |
|
873 | 873 | !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
874 | 874 | ) |
|
875 | 875 | { |
|
876 | 876 | send_tm_lfr_tc_exe_success( TC, queue_id ); |
|
877 | 877 | } |
|
878 | 878 | if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) ) |
|
879 | 879 | { |
|
880 | 880 | //********************************** |
|
881 | 881 | // UPDATE THE LFRMODE LOCAL VARIABLE |
|
882 | 882 | requestedMode = TC->dataAndCRC[1]; |
|
883 | 883 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d); |
|
884 | 884 | updateLFRCurrentMode(); |
|
885 | 885 | } |
|
886 | 886 | } |
|
887 | 887 | else if (result == LFR_EXE_ERROR) |
|
888 | 888 | { |
|
889 | 889 | send_tm_lfr_tc_exe_error( TC, queue_id ); |
|
890 | 890 | } |
|
891 | 891 | } |
|
892 | 892 | |
|
893 | 893 | //*************************** |
|
894 | 894 | // Interrupt Service Routines |
|
895 | 895 | rtems_isr commutation_isr1( rtems_vector_number vector ) |
|
896 | 896 | { |
|
897 | 897 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
898 | 898 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); |
|
899 | 899 | } |
|
900 | 900 | } |
|
901 | 901 | |
|
902 | 902 | rtems_isr commutation_isr2( rtems_vector_number vector ) |
|
903 | 903 | { |
|
904 | 904 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
905 | 905 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); |
|
906 | 906 | } |
|
907 | 907 | } |
|
908 | 908 | |
|
909 | 909 | //**************** |
|
910 | 910 | // OTHER FUNCTIONS |
|
911 | 911 | void updateLFRCurrentMode() |
|
912 | 912 | { |
|
913 | 913 | /** This function updates the value of the global variable lfrCurrentMode. |
|
914 | 914 | * |
|
915 | 915 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. |
|
916 | 916 | * |
|
917 | 917 | */ |
|
918 | 918 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure |
|
919 | 919 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
920 | 920 | } |
|
921 | 921 |
General Comments 0
You need to be logged in to leave comments.
Login now