@@ -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 17 09:53:23 2014 | |
|
4 | 4 | # Project: fsw-qt.pro |
|
5 | 5 | # Template: app |
|
6 | 6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
7 | 7 | ############################################################################# |
|
8 | 8 | |
|
9 | 9 | ####### Compiler, tools and options |
|
10 | 10 | |
|
11 | 11 | CC = sparc-rtems-gcc |
|
12 | 12 | CXX = sparc-rtems-g++ |
|
13 | DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=6 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS | |
|
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,85 +1,85 | |||
|
1 | 1 | TEMPLATE = app |
|
2 | 2 | # CONFIG += console v8 sim |
|
3 | 3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch |
|
4 | CONFIG += console verbose cpu_usage_report | |
|
4 | CONFIG += console verbose cpu_usage_report boot_messages | |
|
5 | 5 | CONFIG -= qt |
|
6 | 6 | |
|
7 | 7 | include(./sparc.pri) |
|
8 | 8 | |
|
9 | 9 | # flight software version |
|
10 | 10 | SWVERSION=-1-0 |
|
11 | 11 | DEFINES += SW_VERSION_N1=1 # major |
|
12 | 12 | DEFINES += SW_VERSION_N2=0 # minor |
|
13 | 13 | DEFINES += SW_VERSION_N3=0 # patch |
|
14 | 14 | DEFINES += SW_VERSION_N4=6 # internal |
|
15 | 15 | |
|
16 | 16 | contains( CONFIG, debug_tch ) { |
|
17 | 17 | DEFINES += DEBUG_TCH |
|
18 | 18 | } |
|
19 | 19 | |
|
20 | 20 | contains( CONFIG, vhdl_dev ) { |
|
21 | 21 | DEFINES += VHDL_DEV |
|
22 | 22 | } |
|
23 | 23 | |
|
24 | 24 | contains( CONFIG, verbose ) { |
|
25 | 25 | DEFINES += PRINT_MESSAGES_ON_CONSOLE |
|
26 | 26 | } |
|
27 | 27 | |
|
28 | 28 | contains( CONFIG, debug_messages ) { |
|
29 | 29 | DEFINES += DEBUG_MESSAGES |
|
30 | 30 | } |
|
31 | 31 | |
|
32 | 32 | contains( CONFIG, cpu_usage_report ) { |
|
33 | 33 | DEFINES += PRINT_TASK_STATISTICS |
|
34 | 34 | } |
|
35 | 35 | |
|
36 | 36 | contains( CONFIG, stack_report ) { |
|
37 | 37 | DEFINES += PRINT_STACK_REPORT |
|
38 | 38 | } |
|
39 | 39 | |
|
40 | 40 | contains( CONFIG, boot_messages ) { |
|
41 | 41 | DEFINES += BOOT_MESSAGES |
|
42 | 42 | } |
|
43 | 43 | |
|
44 | 44 | #doxygen.target = doxygen |
|
45 | 45 | #doxygen.commands = doxygen ../doc/Doxyfile |
|
46 | 46 | #QMAKE_EXTRA_TARGETS += doxygen |
|
47 | 47 | |
|
48 | 48 | TARGET = fsw |
|
49 | 49 | |
|
50 | 50 | INCLUDEPATH += \ |
|
51 | 51 | ../src \ |
|
52 | 52 | ../header \ |
|
53 | 53 | ../src/basic_parameters |
|
54 | 54 | |
|
55 | 55 | SOURCES += \ |
|
56 | 56 | ../src/wf_handler.c \ |
|
57 | 57 | ../src/tc_handler.c \ |
|
58 | 58 | ../src/fsw_processing.c \ |
|
59 | 59 | ../src/fsw_misc.c \ |
|
60 | 60 | ../src/fsw_init.c \ |
|
61 | 61 | ../src/fsw_globals.c \ |
|
62 | 62 | ../src/fsw_spacewire.c \ |
|
63 | 63 | ../src/tc_load_dump_parameters.c \ |
|
64 | 64 | ../src/tm_lfr_tc_exe.c \ |
|
65 | 65 | ../src/tc_acceptance.c \ |
|
66 | 66 | ../src/basic_parameters/basic_parameters.c |
|
67 | 67 | |
|
68 | 68 | |
|
69 | 69 | HEADERS += \ |
|
70 | 70 | ../header/wf_handler.h \ |
|
71 | 71 | ../header/tc_handler.h \ |
|
72 | 72 | ../header/grlib_regs.h \ |
|
73 | 73 | ../header/fsw_processing.h \ |
|
74 | 74 | ../header/fsw_params.h \ |
|
75 | 75 | ../header/fsw_misc.h \ |
|
76 | 76 | ../header/fsw_init.h \ |
|
77 | 77 | ../header/ccsds_types.h \ |
|
78 | 78 | ../header/fsw_params_processing.h \ |
|
79 | 79 | ../header/fsw_spacewire.h \ |
|
80 | 80 | ../header/tc_load_dump_parameters.h \ |
|
81 | 81 | ../header/tm_lfr_tc_exe.h \ |
|
82 | 82 | ../header/tc_acceptance.h \ |
|
83 | 83 | ../header/fsw_params_nb_bytes.h \ |
|
84 | 84 | ../src/basic_parameters/basic_parameters.h |
|
85 | 85 |
@@ -1,339 +1,201 | |||
|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
|
2 | 2 | <!DOCTYPE QtCreatorProject> |
|
3 |
<!-- Written by QtCreator 3.0.1, 2014-04-1 |
|
|
3 | <!-- Written by QtCreator 3.0.1, 2014-04-17T09:46:14. --> | |
|
4 | 4 | <qtcreator> |
|
5 | 5 | <data> |
|
6 | 6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
7 |
<value type="int"> |
|
|
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 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value> | |
|
55 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value> | |
|
56 |
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{ |
|
|
57 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> | |
|
58 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> | |
|
59 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> | |
|
60 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> | |
|
61 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> | |
|
62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
|
63 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
|
64 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
|
65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> | |
|
66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
|
67 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> | |
|
68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> | |
|
69 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> | |
|
70 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> | |
|
71 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> | |
|
72 | </valuemap> | |
|
73 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> | |
|
74 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
|
75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
|
76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
|
77 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
|
78 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
|
79 | <value type="QString">-w</value> | |
|
80 | <value type="QString">-r</value> | |
|
81 | </valuelist> | |
|
82 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> | |
|
83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> | |
|
84 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
|
85 | </valuemap> | |
|
86 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> | |
|
87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> | |
|
88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
|
89 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> | |
|
90 | </valuemap> | |
|
91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> | |
|
92 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> | |
|
93 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> | |
|
94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> | |
|
95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
|
96 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> | |
|
97 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> | |
|
98 | <value type="QString">-w</value> | |
|
99 | <value type="QString">-r</value> | |
|
100 | </valuelist> | |
|
101 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> | |
|
102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> | |
|
103 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> | |
|
104 | </valuemap> | |
|
105 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> | |
|
106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> | |
|
107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
|
108 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> | |
|
109 | </valuemap> | |
|
110 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> | |
|
111 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> | |
|
112 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> | |
|
113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> | |
|
114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
|
115 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> | |
|
116 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> | |
|
117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> | |
|
118 | </valuemap> | |
|
119 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> | |
|
120 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> | |
|
121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> | |
|
122 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> | |
|
123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> | |
|
124 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
|
125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> | |
|
126 | </valuemap> | |
|
127 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> | |
|
128 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> | |
|
129 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
|
130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> | |
|
131 | </valuemap> | |
|
132 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> | |
|
133 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> | |
|
134 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> | |
|
135 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> | |
|
136 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> | |
|
137 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> | |
|
138 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> | |
|
139 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> | |
|
140 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> | |
|
141 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> | |
|
142 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> | |
|
143 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> | |
|
144 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> | |
|
145 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> | |
|
146 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> | |
|
147 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> | |
|
148 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> | |
|
149 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> | |
|
150 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> | |
|
151 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> | |
|
152 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> | |
|
153 | <value type="int">0</value> | |
|
154 | <value type="int">1</value> | |
|
155 | <value type="int">2</value> | |
|
156 | <value type="int">3</value> | |
|
157 | <value type="int">4</value> | |
|
158 | <value type="int">5</value> | |
|
159 | <value type="int">6</value> | |
|
160 | <value type="int">7</value> | |
|
161 | <value type="int">8</value> | |
|
162 | <value type="int">9</value> | |
|
163 | <value type="int">10</value> | |
|
164 | <value type="int">11</value> | |
|
165 | <value type="int">12</value> | |
|
166 | <value type="int">13</value> | |
|
167 | <value type="int">14</value> | |
|
168 | </valuelist> | |
|
169 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> | |
|
170 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> | |
|
171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> | |
|
172 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> | |
|
173 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> | |
|
174 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> | |
|
175 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> | |
|
176 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> | |
|
177 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> | |
|
178 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> | |
|
179 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> | |
|
180 | <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> | |
|
181 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> | |
|
182 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> | |
|
183 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> | |
|
184 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> | |
|
185 | </valuemap> | |
|
186 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> | |
|
187 | </valuemap> | |
|
188 | </data> | |
|
189 | <data> | |
|
190 | <variable>ProjectExplorer.Project.Target.1</variable> | |
|
191 | <valuemap type="QVariantMap"> | |
|
192 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> | |
|
193 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> | |
|
194 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value> | |
|
54 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.3 in PATH (System)</value> | |
|
55 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.3 in PATH (System)</value> | |
|
56 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{be73cf6a-f9d8-4d5a-8adf-adc2d83e2e44}</value> | |
|
195 | 57 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
|
196 | 58 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
|
197 | 59 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
|
198 | 60 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
|
199 | 61 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> |
|
200 | 62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
201 | 63 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
202 | 64 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
203 | 65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
204 | 66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
205 | 67 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
206 | 68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
207 | 69 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> |
|
208 | 70 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
209 | 71 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
210 | 72 | </valuemap> |
|
211 | 73 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
212 | 74 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
213 | 75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
214 | 76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
215 | 77 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
216 | 78 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
217 | 79 | <value type="QString">-w</value> |
|
218 | 80 | <value type="QString">-r</value> |
|
219 | 81 | </valuelist> |
|
220 | 82 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
221 | 83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|
222 | 84 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
223 | 85 | </valuemap> |
|
224 | 86 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
225 | 87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
226 | 88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
227 | 89 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
228 | 90 | </valuemap> |
|
229 | 91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
230 | 92 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
231 | 93 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
232 | 94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
233 | 95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
234 | 96 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
235 | 97 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
236 | 98 | <value type="QString">-w</value> |
|
237 | 99 | <value type="QString">-r</value> |
|
238 | 100 | </valuelist> |
|
239 | 101 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
240 | 102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|
241 | 103 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
242 | 104 | </valuemap> |
|
243 | 105 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
244 | 106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
245 | 107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
246 | 108 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
247 | 109 | </valuemap> |
|
248 | 110 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
249 | 111 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
250 | 112 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
251 | 113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> |
|
252 | 114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
253 | 115 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
254 | 116 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
255 | 117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
|
256 | 118 | </valuemap> |
|
257 | 119 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> |
|
258 | 120 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
259 | 121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
260 | 122 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
261 | 123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
262 | 124 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
263 | 125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|
264 | 126 | </valuemap> |
|
265 | 127 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
266 | 128 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> |
|
267 | 129 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
268 | 130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
269 | 131 | </valuemap> |
|
270 | 132 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
271 | 133 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|
272 | 134 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
273 | 135 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
274 | 136 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
275 | 137 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
276 | 138 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
277 | 139 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
278 | 140 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
279 | 141 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
280 | 142 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
281 | 143 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
282 | 144 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
|
283 | 145 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
284 | 146 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
285 | 147 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
|
286 | 148 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
|
287 | 149 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
|
288 | 150 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
289 | 151 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
290 | 152 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
291 | 153 | <value type="int">0</value> |
|
292 | 154 | <value type="int">1</value> |
|
293 | 155 | <value type="int">2</value> |
|
294 | 156 | <value type="int">3</value> |
|
295 | 157 | <value type="int">4</value> |
|
296 | 158 | <value type="int">5</value> |
|
297 | 159 | <value type="int">6</value> |
|
298 | 160 | <value type="int">7</value> |
|
299 | 161 | <value type="int">8</value> |
|
300 | 162 | <value type="int">9</value> |
|
301 | 163 | <value type="int">10</value> |
|
302 | 164 | <value type="int">11</value> |
|
303 | 165 | <value type="int">12</value> |
|
304 | 166 | <value type="int">13</value> |
|
305 | 167 | <value type="int">14</value> |
|
306 | 168 | </valuelist> |
|
307 | 169 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
308 | 170 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
309 | 171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> |
|
310 | 172 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
311 | 173 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> |
|
312 | 174 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
|
313 | 175 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> |
|
314 | 176 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
|
315 | 177 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> |
|
316 | 178 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> |
|
317 | 179 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
318 | 180 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> |
|
319 | 181 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> |
|
320 | 182 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
321 | 183 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
322 | 184 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
|
323 | 185 | </valuemap> |
|
324 | 186 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> |
|
325 | 187 | </valuemap> |
|
326 | 188 | </data> |
|
327 | 189 | <data> |
|
328 | 190 | <variable>ProjectExplorer.Project.TargetCount</variable> |
|
329 |
<value type="int"> |
|
|
191 | <value type="int">1</value> | |
|
330 | 192 | </data> |
|
331 | 193 | <data> |
|
332 | 194 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> |
|
333 |
<value type="QByteArray">{ |
|
|
195 | <value type="QByteArray">{cdbf9cdc-1e84-406e-889b-c4feef49e75c}</value> | |
|
334 | 196 | </data> |
|
335 | 197 | <data> |
|
336 | 198 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
|
337 | 199 | <value type="int">15</value> |
|
338 | 200 | </data> |
|
339 | 201 | </qtcreator> |
@@ -1,42 +1,43 | |||
|
1 | 1 | #ifndef FSW_INIT_H_INCLUDED |
|
2 | 2 | #define FSW_INIT_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include <rtems.h> |
|
5 | 5 | #include <leon.h> |
|
6 | 6 | |
|
7 | 7 | #include "fsw_params.h" |
|
8 | 8 | #include "fsw_misc.h" |
|
9 | 9 | #include "fsw_processing.h" |
|
10 | 10 | #include "tc_handler.h" |
|
11 | 11 | #include "wf_handler.h" |
|
12 | 12 | |
|
13 | 13 | #include "fsw_spacewire.h" |
|
14 | 14 | |
|
15 | 15 | extern rtems_name Task_name[20]; /* array of task names */ |
|
16 | 16 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
17 | 17 | |
|
18 | 18 | // RTEMS TASKS |
|
19 | 19 | rtems_task Init( rtems_task_argument argument); |
|
20 | 20 | |
|
21 | 21 | // OTHER functions |
|
22 | 22 | void create_names( void ); |
|
23 | 23 | int create_all_tasks( void ); |
|
24 | 24 | int start_all_tasks( void ); |
|
25 | 25 | // |
|
26 | 26 | rtems_status_code create_message_queues( void ); |
|
27 | 27 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); |
|
28 | 28 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); |
|
29 |
rtems_status_code get_message_queue_id_ |
|
|
29 | rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id ); | |
|
30 | rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id ); | |
|
30 | 31 | // |
|
31 | 32 | int start_recv_send_tasks( void ); |
|
32 | 33 | // |
|
33 | 34 | void init_local_mode_parameters( void ); |
|
34 | 35 | void reset_local_time( void ); |
|
35 | 36 | |
|
36 | 37 | extern int rtems_cpu_usage_report( void ); |
|
37 | 38 | extern int rtems_cpu_usage_reset( void ); |
|
38 | 39 | extern void rtems_stack_checker_report_usage( void ); |
|
39 | 40 | |
|
40 | 41 | extern int sched_yield( void ); |
|
41 | 42 | |
|
42 | 43 | #endif // FSW_INIT_H_INCLUDED |
@@ -1,255 +1,307 | |||
|
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 | // F0 | |
|
22 | 23 | unsigned int f0; |
|
23 | 24 | unsigned int norm_bp1_f0; |
|
24 | 25 | unsigned int norm_bp2_f0; |
|
25 | 26 | unsigned int norm_asm_f0; |
|
26 | 27 | unsigned int sbm_bp1_f0; |
|
27 | 28 | unsigned int sbm_bp2_f0; |
|
29 | // F1 | |
|
30 | unsigned int f1; | |
|
31 | unsigned int norm_bp1_f1; | |
|
32 | unsigned int norm_bp2_f1; | |
|
33 | unsigned int norm_asm_f1; | |
|
34 | unsigned int sbm_bp1_f1; | |
|
35 | unsigned int sbm_bp2_f1; | |
|
36 | // F2 | |
|
37 | unsigned int f2; | |
|
38 | unsigned int norm_bp1_f2; | |
|
39 | unsigned int norm_bp2_f2; | |
|
40 | unsigned int norm_asm_f2; | |
|
41 | unsigned int sbm_bp1_f2; | |
|
42 | unsigned int sbm_bp2_f2; | |
|
28 | 43 | } nb_sm_t; |
|
29 | 44 | |
|
30 | 45 | typedef struct { |
|
31 | 46 | unsigned int norm_bp1_f0; |
|
32 | 47 | unsigned int norm_bp2_f0; |
|
33 | 48 | unsigned int norm_asm_f0; |
|
34 | 49 | unsigned int burst_sbm_bp1_f0; |
|
35 | 50 | unsigned int burst_sbm_bp2_f0; |
|
36 | 51 | unsigned int burst_bp1_f0; |
|
37 | 52 | unsigned int burst_bp2_f0; |
|
38 | 53 | unsigned int sbm1_bp1_f0; |
|
39 | 54 | unsigned int sbm1_bp2_f0; |
|
40 | 55 | unsigned int sbm2_bp1_f0; |
|
41 | 56 | unsigned int sbm2_bp2_f0; |
|
42 |
} nb_sm_before_bp_ |
|
|
57 | } nb_sm_before_bp_asm_f0; | |
|
58 | ||
|
59 | typedef struct { | |
|
60 | unsigned int norm_bp1_f1; | |
|
61 | unsigned int norm_bp2_f1; | |
|
62 | unsigned int norm_asm_f1; | |
|
63 | unsigned int burst_sbm_bp1_f1; | |
|
64 | unsigned int burst_sbm_bp2_f1; | |
|
65 | unsigned int burst_bp1_f1; | |
|
66 | unsigned int burst_bp2_f1; | |
|
67 | unsigned int sbm2_bp1_f1; | |
|
68 | unsigned int sbm2_bp2_f1; | |
|
69 | } nb_sm_before_bp_asm_f1; | |
|
70 | ||
|
71 | typedef struct { | |
|
72 | unsigned int norm_bp1_f2; | |
|
73 | unsigned int norm_bp2_f2; | |
|
74 | unsigned int norm_asm_f2; | |
|
75 | unsigned int burst_sbm_bp1_f2; | |
|
76 | unsigned int burst_sbm_bp2_f2; | |
|
77 | unsigned int burst_bp1_f2; | |
|
78 | unsigned int burst_bp2_f2; | |
|
79 | unsigned int sbm2_bp1_f2; | |
|
80 | unsigned int sbm2_bp2_f2; | |
|
81 | } nb_sm_before_bp_asm_f2; | |
|
43 | 82 | |
|
44 | 83 | //************************ |
|
45 | 84 | // flight software version |
|
46 | 85 | // this parameters is handled by the Qt project options |
|
47 | 86 | |
|
48 | 87 | #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk |
|
49 | 88 | #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk |
|
50 | 89 | #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688 |
|
51 | 90 | #define TIME_OFFSET 2 |
|
52 | 91 | #define TIME_OFFSET_IN_BYTES 8 |
|
53 | 92 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 |
|
54 | 93 | #define NB_BYTES_SWF_BLK (2 * 6) |
|
55 | 94 | #define NB_WORDS_SWF_BLK 3 |
|
56 | 95 | #define NB_BYTES_CWF3_LIGHT_BLK 6 |
|
57 | 96 | #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 |
|
58 | 97 | #define NB_RING_NODES_F0 3 // AT LEAST 3 |
|
59 | 98 | #define NB_RING_NODES_F1 5 // AT LEAST 3 |
|
60 | 99 | #define NB_RING_NODES_F2 5 // AT LEAST 3 |
|
61 | 100 | |
|
62 | 101 | //********** |
|
63 | 102 | // LFR MODES |
|
64 | 103 | #define LFR_MODE_STANDBY 0 |
|
65 | 104 | #define LFR_MODE_NORMAL 1 |
|
66 | 105 | #define LFR_MODE_BURST 2 |
|
67 | 106 | #define LFR_MODE_SBM1 3 |
|
68 | 107 | #define LFR_MODE_SBM2 4 |
|
69 | 108 | |
|
70 | 109 | #define TDS_MODE_LFM 5 |
|
71 | 110 | #define TDS_MODE_STANDBY 0 |
|
72 | 111 | #define TDS_MODE_NORMAL 1 |
|
73 | 112 | #define TDS_MODE_BURST 2 |
|
74 | 113 | #define TDS_MODE_SBM1 3 |
|
75 | 114 | #define TDS_MODE_SBM2 4 |
|
76 | 115 | |
|
77 | 116 | #define THR_MODE_STANDBY 0 |
|
78 | 117 | #define THR_MODE_NORMAL 1 |
|
79 | 118 | #define THR_MODE_BURST 2 |
|
80 | 119 | |
|
81 | 120 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 |
|
82 | 121 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 |
|
83 | 122 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 |
|
84 | 123 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 |
|
85 | 124 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 |
|
86 | 125 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 |
|
87 | 126 | #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6 |
|
88 | 127 | #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7 |
|
89 | 128 | #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 |
|
90 |
#define RTEMS_EVENT_ |
|
|
91 |
#define RTEMS_EVENT_ |
|
|
129 | #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9 | |
|
130 | #define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10 | |
|
131 | #define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11 | |
|
132 | #define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12 | |
|
133 | #define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13 | |
|
134 | #define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14 | |
|
135 | #define RTEMS_EVENT_BURST_SBM_BP1_F0 RTEMS_EVENT_15 | |
|
136 | #define RTEMS_EVENT_BURST_SBM_BP2_F0 RTEMS_EVENT_16 | |
|
137 | #define RTEMS_EVENT_BURST_SBM_BP1_F1 RTEMS_EVENT_17 | |
|
138 | #define RTEMS_EVENT_BURST_SBM_BP2_F1 RTEMS_EVENT_18 | |
|
139 | #define RTEMS_EVENT_BURST_SBM_BP1_F2 RTEMS_EVENT_19 | |
|
140 | #define RTEMS_EVENT_BURST_SBM_BP2_F2 RTEMS_EVENT_20 | |
|
92 | 141 | |
|
93 | 142 | //**************************** |
|
94 | 143 | // LFR DEFAULT MODE PARAMETERS |
|
95 | 144 | // COMMON |
|
96 | 145 | #define DEFAULT_SY_LFR_COMMON0 0x00 |
|
97 | 146 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 |
|
98 | 147 | // NORM |
|
99 | 148 | #define SY_LFR_N_SWF_L 2048 // nb sample |
|
100 | 149 | #define SY_LFR_N_SWF_P 300 // sec |
|
101 | 150 | #define SY_LFR_N_ASM_P 3600 // sec |
|
102 | 151 | #define SY_LFR_N_BP_P0 4 // sec |
|
103 | 152 | #define SY_LFR_N_BP_P1 20 // sec |
|
104 | 153 | #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3 |
|
105 | 154 | #define MIN_DELTA_SNAPSHOT 16 // sec |
|
106 | 155 | // BURST |
|
107 | 156 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec |
|
108 | 157 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec |
|
109 | 158 | // SBM1 |
|
110 | 159 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec |
|
111 | 160 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec |
|
112 | 161 | // SBM2 |
|
113 | 162 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec |
|
114 | 163 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec |
|
115 | 164 | // ADDITIONAL PARAMETERS |
|
116 | 165 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms |
|
117 | 166 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s |
|
118 | 167 | // STATUS WORD |
|
119 | 168 | #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits |
|
120 | 169 | #define DEFAULT_STATUS_WORD_BYTE1 0x00 |
|
121 | 170 | // |
|
122 | 171 | #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s |
|
123 | 172 | #define SY_LFR_DPU_CONNECT_ATTEMPT 3 |
|
124 | 173 | //**************************** |
|
125 | 174 | |
|
126 | 175 | //***************************** |
|
127 | 176 | // APB REGISTERS BASE ADDRESSES |
|
128 | 177 | #define REGS_ADDR_APBUART 0x80000100 |
|
129 | 178 | #define REGS_ADDR_GPTIMER 0x80000300 |
|
130 | 179 | #define REGS_ADDR_GRSPW 0x80000500 |
|
131 | 180 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 |
|
132 | 181 | #define REGS_ADDR_GRGPIO 0x80000b00 |
|
133 | 182 | |
|
134 | 183 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 |
|
135 | 184 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f40 |
|
136 | 185 | |
|
137 | 186 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
|
138 | 187 | #define APBUART_CTRL_REG_MASK_TE 0x00000002 |
|
139 | 188 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) |
|
140 | 189 | |
|
141 | 190 | //********** |
|
142 | 191 | // IRQ LINES |
|
143 | 192 | #define IRQ_SM_SIMULATOR 9 |
|
144 | 193 | #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels |
|
145 | 194 | #define IRQ_WAVEFORM_PICKER 14 |
|
146 | 195 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels |
|
147 | 196 | #define IRQ_SPECTRAL_MATRIX 6 |
|
148 | 197 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels |
|
149 | 198 | |
|
150 | 199 | //***** |
|
151 | 200 | // TIME |
|
152 | 201 | #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416 |
|
153 | 202 | #define TIMER_SM_SIMULATOR 1 |
|
154 | 203 | #define HK_PERIOD 100 // 100 * 10ms => 1s |
|
155 | 204 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000 |
|
156 | 205 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s |
|
157 | 206 | |
|
158 | 207 | //********** |
|
159 | 208 | // LPP CODES |
|
160 | 209 | #define LFR_SUCCESSFUL 0 |
|
161 | 210 | #define LFR_DEFAULT 1 |
|
162 | 211 | #define LFR_EXE_ERROR 2 |
|
163 | 212 | |
|
164 | 213 | //****** |
|
165 | 214 | // RTEMS |
|
166 | 215 | #define TASKID_RECV 1 |
|
167 | 216 | #define TASKID_ACTN 2 |
|
168 | 217 | #define TASKID_SPIQ 3 |
|
169 | 218 | #define TASKID_SMIQ 4 |
|
170 | 219 | #define TASKID_STAT 5 |
|
171 | 220 | #define TASKID_AVF0 6 |
|
172 | 221 | #define TASKID_SWBD 7 |
|
173 | 222 | #define TASKID_WFRM 8 |
|
174 | 223 | #define TASKID_DUMB 9 |
|
175 | 224 | #define TASKID_HOUS 10 |
|
176 |
#define TASKID_ |
|
|
225 | #define TASKID_PRC0 11 | |
|
177 | 226 | #define TASKID_CWF3 12 |
|
178 | 227 | #define TASKID_CWF2 13 |
|
179 | 228 | #define TASKID_CWF1 14 |
|
180 | 229 | #define TASKID_SEND 15 |
|
181 | 230 | #define TASKID_WTDG 16 |
|
182 | 231 | |
|
183 | 232 | #define TASK_PRIORITY_SPIQ 5 |
|
184 | 233 | #define TASK_PRIORITY_SMIQ 10 |
|
185 | 234 | #define TASK_PRIORITY_WTDG 20 |
|
186 | 235 | #define TASK_PRIORITY_HOUS 30 |
|
187 | 236 | #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together |
|
188 | 237 | #define TASK_PRIORITY_CWF2 35 // |
|
189 | 238 | #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it |
|
190 | 239 | #define TASK_PRIORITY_WFRM 40 |
|
191 | 240 | #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1 |
|
192 | 241 | #define TASK_PRIORITY_SEND 45 |
|
193 | 242 | #define TASK_PRIORITY_RECV 50 |
|
194 | 243 | #define TASK_PRIORITY_ACTN 50 |
|
195 | 244 | #define TASK_PRIORITY_AVF0 60 |
|
196 | 245 | #define TASK_PRIORITY_BPF0 60 |
|
197 |
#define TASK_PRIORITY_ |
|
|
246 | #define TASK_PRIORITY_PRC0 100 | |
|
198 | 247 | #define TASK_PRIORITY_STAT 200 |
|
199 | 248 | #define TASK_PRIORITY_DUMB 200 |
|
200 | 249 | |
|
201 | 250 | #define MSG_QUEUE_COUNT_RECV 10 |
|
202 | 251 |
#define MSG_QUEUE_COUNT_SEND |
|
203 |
#define MSG_QUEUE_COUNT_ |
|
|
252 | #define MSG_QUEUE_COUNT_PRC0 10 | |
|
253 | #define MSG_QUEUE_COUNT_PRC1 10 | |
|
204 | 254 | //#define MSG_QUEUE_SIZE_SEND (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES) |
|
205 | 255 | #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1 |
|
206 | 256 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options |
|
207 |
#define MSG_QUEUE_SIZE_ |
|
|
257 | #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers | |
|
258 | #define MSG_QUEUE_SIZE_PRC1 20 // two pointers and one rtems_event + 2 integers | |
|
208 | 259 | |
|
209 | 260 | #define QUEUE_RECV 0 |
|
210 | 261 | #define QUEUE_SEND 1 |
|
211 |
#define QUEUE_ |
|
|
262 | #define QUEUE_PRC0 2 | |
|
263 | #define QUEUE_PRC1 3 | |
|
212 | 264 | |
|
213 | 265 | //******* |
|
214 | 266 | // MACROS |
|
215 | 267 | #ifdef PRINT_MESSAGES_ON_CONSOLE |
|
216 | 268 | #define PRINTF(x) printf(x); |
|
217 | 269 | #define PRINTF1(x,y) printf(x,y); |
|
218 | 270 | #define PRINTF2(x,y,z) printf(x,y,z); |
|
219 | 271 | #else |
|
220 | 272 | #define PRINTF(x) ; |
|
221 | 273 | #define PRINTF1(x,y) ; |
|
222 | 274 | #define PRINTF2(x,y,z) ; |
|
223 | 275 | #endif |
|
224 | 276 | |
|
225 | 277 | #ifdef BOOT_MESSAGES |
|
226 | 278 | #define BOOT_PRINTF(x) printf(x); |
|
227 | 279 | #define BOOT_PRINTF1(x,y) printf(x,y); |
|
228 | 280 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); |
|
229 | 281 | #else |
|
230 | 282 | #define BOOT_PRINTF(x) ; |
|
231 | 283 | #define BOOT_PRINTF1(x,y) ; |
|
232 | 284 | #define BOOT_PRINTF2(x,y,z) ; |
|
233 | 285 | #endif |
|
234 | 286 | |
|
235 | 287 | #ifdef DEBUG_MESSAGES |
|
236 | 288 | #define DEBUG_PRINTF(x) printf(x); |
|
237 | 289 | #define DEBUG_PRINTF1(x,y) printf(x,y); |
|
238 | 290 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); |
|
239 | 291 | #else |
|
240 | 292 | #define DEBUG_PRINTF(x) ; |
|
241 | 293 | #define DEBUG_PRINTF1(x,y) ; |
|
242 | 294 | #define DEBUG_PRINTF2(x,y,z) ; |
|
243 | 295 | #endif |
|
244 | 296 | |
|
245 | 297 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period |
|
246 | 298 | |
|
247 | 299 | struct param_local_str{ |
|
248 | 300 | unsigned int local_sbm1_nb_cwf_sent; |
|
249 | 301 | unsigned int local_sbm1_nb_cwf_max; |
|
250 | 302 | unsigned int local_sbm2_nb_cwf_sent; |
|
251 | 303 | unsigned int local_sbm2_nb_cwf_max; |
|
252 | 304 | unsigned int local_nb_interrupt_f0_MAX; |
|
253 | 305 | }; |
|
254 | 306 | |
|
255 | 307 | #endif // FSW_PARAMS_H_INCLUDED |
@@ -1,67 +1,68 | |||
|
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_SM_F1 3 // AT LEAST 3 |
|
14 | 14 | #define NB_RING_NODES_SM_F2 3 // AT LEAST 3 |
|
15 | 15 | #define NB_RING_NODES_ASM_BURST_SBM_F0 10 // AT LEAST 3 |
|
16 | 16 | #define NB_RING_NODES_ASM_NORM_F0 10 // AT LEAST 3 |
|
17 | 17 | // |
|
18 | 18 | #define NB_BINS_PER_ASM_F0 88 |
|
19 | 19 | #define NB_BINS_PER_PKT_ASM_F0 44 |
|
20 | 20 | #define TOTAL_SIZE_ASM_F0_IN_BYTES 4400 // 25 * 88 * 2 |
|
21 | 21 | #define ASM_F0_INDICE_START 17 // 88 bins |
|
22 | 22 | #define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins |
|
23 | 23 | // |
|
24 | 24 | #define NB_BINS_PER_ASM_F1 104 |
|
25 | 25 | #define NB_BINS_PER_PKT_ASM_F1 52 |
|
26 | 26 | #define TOTAL_SIZE_ASM_F1 2600 // 25 * 104 |
|
27 | 27 | #define ASM_F1_INDICE_START 6 // 104 bins |
|
28 | 28 | #define ASM_F1_INDICE_STOP 109 // 2 packets of 52 bins |
|
29 | 29 | // |
|
30 | 30 | #define NB_BINS_PER_ASM_F2 96 |
|
31 | 31 | #define NB_BINS_PER_PKT_ASM_F2 48 |
|
32 | 32 | #define TOTAL_SIZE_ASM_F2 2400 // 25 * 96 |
|
33 | 33 | #define ASM_F2_INDICE_START 7 // 96 bins |
|
34 | 34 | #define ASM_F2_INDICE_STOP 102 // 2 packets of 48 bins |
|
35 | 35 | // |
|
36 | 36 | #define NB_BINS_COMPRESSED_SM_F0 11 |
|
37 | 37 | #define NB_BINS_COMPRESSED_SM_F1 13 |
|
38 | 38 | #define NB_BINS_COMPRESSED_SM_F2 12 |
|
39 | 39 | #define NB_BINS_COMPRESSED_SM_SBM_F0 22 |
|
40 | 40 | |
|
41 | 41 | // |
|
42 | 42 | #define NB_BINS_TO_AVERAGE_ASM_F0 8 |
|
43 | 43 | #define NB_BINS_TO_AVERAGE_ASM_F1 8 |
|
44 | 44 | #define NB_BINS_TO_AVERAGE_ASM_F2 8 |
|
45 | 45 | #define NB_BINS_TO_AVERAGE_ASM_SBM_F0 4 |
|
46 | 46 | // |
|
47 | 47 | #define TOTAL_SIZE_COMPRESSED_ASM_F0 275 // 11 * 25 WORDS |
|
48 | 48 | #define TOTAL_SIZE_COMPRESSED_ASM_F1 325 // 13 * 25 WORDS |
|
49 | 49 | #define TOTAL_SIZE_COMPRESSED_ASM_F2 300 // 12 * 25 WORDS |
|
50 | 50 | #define TOTAL_SIZE_COMPRESSED_ASM_SBM1 550 // 22 * 25 WORDS |
|
51 | 51 | // NORM |
|
52 | 52 | #define NB_SM_BEFORE_NORM_BP1_F0 384 // 96 * 4 |
|
53 | 53 | #define NB_SM_BEFORE_NORM_BP2_F0 1920 // 96 * 20 |
|
54 | 54 | #define NB_SM_BEFORE_NORM_ASM_F0 384 // 384 matrices at f0 = 4.00 second |
|
55 | 55 | // BURST |
|
56 | 56 | #define NB_SM_BEFORE_BURST_BP1_F0 96 // 96 matrices at f0 = 1.00 second |
|
57 | 57 | #define NB_SM_BEFORE_BURST_BP2_F0 480 // 480 matrices at f0 = 5.00 second |
|
58 | 58 | // SBM1 |
|
59 | 59 | #define NB_SM_BEFORE_SBM1_BP1_F0 24 // 24 matrices at f0 = 0.25 second |
|
60 | 60 | #define NB_SM_BEFORE_SBM1_BP2_F0 96 // 96 matrices at f0 = 1.00 second |
|
61 | 61 | // SBM2 |
|
62 | 62 | #define NB_SM_BEFORE_SBM2_BP1_F0 96 // 96 matrices at f0 = 1.00 second |
|
63 | 63 | #define NB_SM_BEFORE_SBM2_BP2_F0 480 // 480 matrices at f0 = 5.00 second |
|
64 | 64 | // GENERAL |
|
65 | 65 | #define NB_SM_BEFORE_AVF0 8 |
|
66 | #define NB_SM_BEFORE_AVF1 8 | |
|
66 | 67 | |
|
67 | 68 | #endif // FSW_PARAMS_PROCESSING_H |
@@ -1,120 +1,123 | |||
|
1 | 1 | #ifndef FSW_PROCESSING_H_INCLUDED |
|
2 | 2 | #define FSW_PROCESSING_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include <rtems.h> |
|
5 | 5 | #include <grspw.h> |
|
6 | 6 | #include <math.h> |
|
7 | 7 | #include <stdlib.h> // abs() is in the stdlib |
|
8 | 8 | #include <stdio.h> // printf() |
|
9 | 9 | #include <math.h> |
|
10 | 10 | |
|
11 | 11 | #include "fsw_params.h" |
|
12 | 12 | #include "fsw_spacewire.h" |
|
13 | 13 | |
|
14 | 14 | typedef struct ring_node_sm |
|
15 | 15 | { |
|
16 | 16 | struct ring_node_sm *previous; |
|
17 | 17 | struct ring_node_sm *next; |
|
18 | 18 | int buffer_address; |
|
19 | 19 | unsigned int status; |
|
20 | 20 | unsigned int coarseTime; |
|
21 | 21 | unsigned int fineTime; |
|
22 | 22 | } ring_node_sm; |
|
23 | 23 | |
|
24 | 24 | typedef struct ring_node_asm |
|
25 | 25 | { |
|
26 | 26 | struct ring_node_asm *previous; |
|
27 | 27 | struct ring_node_asm *next; |
|
28 | 28 | float matrix[ TOTAL_SIZE_SM ]; |
|
29 | 29 | unsigned int status; |
|
30 | 30 | } ring_node_asm; |
|
31 | 31 | |
|
32 | 32 | typedef struct bp_packet |
|
33 | 33 | { |
|
34 | 34 | Header_TM_LFR_SCIENCE_BP_t header; |
|
35 | 35 | unsigned char data[ 30 * 22 ]; // MAX size is 22 * 30 [TM_LFR_SCIENCE_BURST_BP2_F1] |
|
36 | 36 | } bp_packet; |
|
37 | 37 | |
|
38 | 38 | typedef struct bp_packet_with_spare |
|
39 | 39 | { |
|
40 | 40 | Header_TM_LFR_SCIENCE_BP_with_spare_t header; |
|
41 | 41 | unsigned char data[ 9 * 13 ]; // only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1 |
|
42 | 42 | } bp_packet_with_spare; |
|
43 | 43 | |
|
44 | 44 | typedef struct asm_msg |
|
45 | 45 | { |
|
46 |
ring_node_asm *norm |
|
|
47 |
ring_node_asm *burst_sbm |
|
|
46 | ring_node_asm *norm; | |
|
47 | ring_node_asm *burst_sbm; | |
|
48 | 48 | rtems_event_set event; |
|
49 | 49 | unsigned int coarseTime; |
|
50 | 50 | unsigned int fineTime; |
|
51 | 51 | } asm_msg; |
|
52 | 52 | |
|
53 | 53 | extern nb_sm_t nb_sm; |
|
54 |
extern nb_sm_before_bp_ |
|
|
54 | extern nb_sm_before_bp_asm_f0 nb_sm_before_f0; | |
|
55 | extern nb_sm_before_bp_asm_f1 nb_sm_before_f1; | |
|
56 | extern nb_sm_before_bp_asm_f2 nb_sm_before_f2; | |
|
55 | 57 | |
|
56 | 58 | extern volatile int sm_f0[ ]; |
|
57 | 59 | extern volatile int sm_f1[ ]; |
|
58 | 60 | extern volatile int sm_f2[ ]; |
|
59 | 61 | |
|
60 | 62 | // parameters |
|
61 | 63 | extern struct param_local_str param_local; |
|
62 | 64 | |
|
63 | 65 | // registers |
|
64 | 66 | extern time_management_regs_t *time_management_regs; |
|
65 | 67 | extern spectral_matrix_regs_t *spectral_matrix_regs; |
|
66 | 68 | |
|
67 | 69 | extern rtems_name misc_name[5]; |
|
68 | 70 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
69 | 71 | |
|
70 | 72 | // ISR |
|
71 | 73 | void reset_nb_sm_f0( unsigned char lfrMode ); |
|
72 | 74 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ); |
|
73 | 75 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ); |
|
74 | 76 | |
|
75 | 77 | // RTEMS TASKS |
|
76 | 78 | rtems_task smiq_task( rtems_task_argument argument ); // added to test the spectral matrix simulator |
|
77 | 79 | rtems_task avf0_task( rtems_task_argument lfrRequestedMode ); |
|
78 |
rtems_task |
|
|
80 | rtems_task prc0_task( rtems_task_argument lfrRequestedMode ); | |
|
79 | 81 | |
|
80 | 82 | //****************** |
|
81 | 83 | // Spectral Matrices |
|
82 | 84 | void SM_init_rings( void ); |
|
83 | 85 | void ASM_init_rings( void ); |
|
84 | 86 | void SM_reset_current_ring_nodes( void ); |
|
85 | 87 | void ASM_reset_current_ring_node( void ); |
|
86 | 88 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header); |
|
87 | 89 | void SM_average(float *averaged_spec_mat_f0, float *averaged_spec_mat_f1, |
|
88 | 90 | ring_node_sm *ring_node_tab[], |
|
89 | 91 | unsigned int firstTimeF0, unsigned int firstTimeF1 ); |
|
90 | 92 | void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized, |
|
91 | 93 | float divider ); |
|
92 | 94 | void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat, |
|
93 | 95 | float divider, |
|
94 | 96 | unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart); |
|
95 | 97 | void ASM_convert(volatile float *input_matrix, char *output_matrix); |
|
96 | 98 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
97 | 99 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id); |
|
98 | 100 | |
|
99 | 101 | //***************** |
|
100 | 102 | // Basic Parameters |
|
101 | 103 | |
|
102 | 104 | void BP_reset_current_ring_nodes( void ); |
|
103 | 105 | void BP_init_header(Header_TM_LFR_SCIENCE_BP_t *header, |
|
104 | 106 | unsigned int apid, unsigned char sid, |
|
105 | 107 | unsigned int packetLength , unsigned char blkNr); |
|
106 | 108 | void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header, |
|
107 | 109 | unsigned int apid, unsigned char sid, |
|
108 | 110 | unsigned int packetLength, unsigned char blkNr ); |
|
109 | 111 | void BP_send(char *data, |
|
110 | 112 | rtems_id queue_id , |
|
111 | 113 | unsigned int nbBytesToSend ); |
|
112 | 114 | |
|
113 | 115 | //****************** |
|
114 | 116 | // general functions |
|
115 | 117 | void reset_spectral_matrix_regs( void ); |
|
116 | 118 | void set_time(unsigned char *time, unsigned char *timeInBuffer ); |
|
117 | 119 | |
|
118 |
extern rtems_status_code get_message_queue_id_ |
|
|
120 | extern rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id ); | |
|
121 | extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id ); | |
|
119 | 122 | |
|
120 | 123 | #endif // FSW_PROCESSING_H_INCLUDED |
@@ -1,49 +1,51 | |||
|
1 | 1 | #ifndef TC_LOAD_DUMP_PARAMETERS_H |
|
2 | 2 | #define TC_LOAD_DUMP_PARAMETERS_H |
|
3 | 3 | |
|
4 | 4 | #include <rtems.h> |
|
5 | 5 | #include <stdio.h> |
|
6 | 6 | |
|
7 | 7 | #include "fsw_params.h" |
|
8 | 8 | #include "wf_handler.h" |
|
9 | 9 | #include "tm_lfr_tc_exe.h" |
|
10 | 10 | #include "fsw_misc.h" |
|
11 | 11 | |
|
12 | 12 | extern nb_sm_t nb_sm; |
|
13 |
extern nb_sm_before_bp_ |
|
|
13 | extern nb_sm_before_bp_asm_f0 nb_sm_before_f0; | |
|
14 | extern nb_sm_before_bp_asm_f1 nb_sm_before_f1; | |
|
15 | extern nb_sm_before_bp_asm_f2 nb_sm_before_f2; | |
|
14 | 16 | |
|
15 | 17 | int action_load_common_par( ccsdsTelecommandPacket_t *TC ); |
|
16 | 18 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
17 | 19 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
18 | 20 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
19 | 21 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
20 | 22 | int action_dump_par(rtems_id queue_id ); |
|
21 | 23 | |
|
22 | 24 | // NORMAL |
|
23 | 25 | int set_sy_lfr_n_swf_l(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
24 | 26 | int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); |
|
25 | 27 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
26 | 28 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
27 | 29 | int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
28 | 30 | int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
29 | 31 | |
|
30 | 32 | // BURST |
|
31 | 33 | int set_sy_lfr_b_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
32 | 34 | int set_sy_lfr_b_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
33 | 35 | |
|
34 | 36 | // SBM1 |
|
35 | 37 | int set_sy_lfr_s1_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
36 | 38 | int set_sy_lfr_s1_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
37 | 39 | |
|
38 | 40 | // SBM2 |
|
39 | 41 | int set_sy_lfr_s2_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
40 | 42 | int set_sy_lfr_s2_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
41 | 43 | |
|
42 | 44 | // TC_LFR_UPDATE_INFO |
|
43 | 45 | unsigned int check_update_info_hk_lfr_mode( unsigned char mode ); |
|
44 | 46 | unsigned int check_update_info_hk_tds_mode( unsigned char mode ); |
|
45 | 47 | unsigned int check_update_info_hk_thr_mode( unsigned char mode ); |
|
46 | 48 | |
|
47 | 49 | void init_parameter_dump( void ); |
|
48 | 50 | |
|
49 | 51 | #endif // TC_LOAD_DUMP_PARAMETERS_H |
@@ -1,78 +1,80 | |||
|
1 | 1 | /** Global variables of the LFR flight software. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * Among global variables, there are: |
|
7 | 7 | * - RTEMS names and id. |
|
8 | 8 | * - APB configuration registers. |
|
9 | 9 | * - waveforms global buffers, used by the waveform picker hardware module to store data. |
|
10 | 10 | * - spectral matrices buffesr, used by the hardware module to store data. |
|
11 | 11 | * - variable related to LFR modes parameters. |
|
12 | 12 | * - the global HK packet buffer. |
|
13 | 13 | * - the global dump parameter buffer. |
|
14 | 14 | * |
|
15 | 15 | */ |
|
16 | 16 | |
|
17 | 17 | #include <rtems.h> |
|
18 | 18 | #include <grspw.h> |
|
19 | 19 | |
|
20 | 20 | #include "ccsds_types.h" |
|
21 | 21 | #include "grlib_regs.h" |
|
22 | 22 | #include "fsw_params.h" |
|
23 | 23 | |
|
24 | 24 | // RTEMS GLOBAL VARIABLES |
|
25 | 25 | rtems_name misc_name[5]; |
|
26 | 26 | rtems_id misc_id[5]; |
|
27 | 27 | rtems_name Task_name[20]; /* array of task names */ |
|
28 | 28 | rtems_id Task_id[20]; /* array of task ids */ |
|
29 | 29 | unsigned int maxCount; |
|
30 | 30 | int fdSPW = 0; |
|
31 | 31 | int fdUART = 0; |
|
32 | 32 | unsigned char lfrCurrentMode; |
|
33 | 33 | |
|
34 | 34 | // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584 |
|
35 | 35 | // 97 * 256 = 24832 => delta = 248 bytes = 62 words |
|
36 | 36 | // WAVEFORMS GLOBAL VARIABLES // 2688 * 3 * 4 + 2 * 4 = 32256 + 8 bytes = 32264 |
|
37 | 37 | // 127 * 256 = 32512 => delta = 248 bytes = 62 words |
|
38 | 38 | // F0 |
|
39 | 39 | volatile int wf_snap_f0[ NB_RING_NODES_F0 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100))); |
|
40 | 40 | // F1 F2 |
|
41 | 41 | volatile int wf_snap_f1[ NB_RING_NODES_F1 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100))); |
|
42 | 42 | volatile int wf_snap_f2[ NB_RING_NODES_F2 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ] __attribute__((aligned(0x100))); |
|
43 | 43 | // F3 |
|
44 | 44 | volatile int wf_cont_f3_a [ (NB_SAMPLES_PER_SNAPSHOT) * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100))); |
|
45 | 45 | volatile int wf_cont_f3_b [ (NB_SAMPLES_PER_SNAPSHOT) * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100))); |
|
46 | 46 | char wf_cont_f3_light[ (NB_SAMPLES_PER_SNAPSHOT) * NB_BYTES_CWF3_LIGHT_BLK + TIME_OFFSET_IN_BYTES ] __attribute__((aligned(0x100))); |
|
47 | 47 | |
|
48 | 48 | //*********************************** |
|
49 | 49 | // SPECTRAL MATRICES GLOBAL VARIABLES |
|
50 | 50 | |
|
51 | 51 | nb_sm_t nb_sm; |
|
52 |
nb_sm_before_bp_ |
|
|
52 | nb_sm_before_bp_asm_f0 nb_sm_before_f0; | |
|
53 | nb_sm_before_bp_asm_f1 nb_sm_before_f1; | |
|
54 | nb_sm_before_bp_asm_f2 nb_sm_before_f2; | |
|
53 | 55 | |
|
54 | 56 | // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00 |
|
55 | 57 | volatile int sm_f0[ NB_RING_NODES_SM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); |
|
56 | 58 | volatile int sm_f1[ NB_RING_NODES_SM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); |
|
57 | 59 | volatile int sm_f2[ NB_RING_NODES_SM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); |
|
58 | 60 | |
|
59 | 61 | // APB CONFIGURATION REGISTERS |
|
60 | 62 | time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT; |
|
61 | 63 | gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER; |
|
62 | 64 | waveform_picker_regs_new_t *waveform_picker_regs = (waveform_picker_regs_new_t*) REGS_ADDR_WAVEFORM_PICKER; |
|
63 | 65 | spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX; |
|
64 | 66 | |
|
65 | 67 | // MODE PARAMETERS |
|
66 | 68 | Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
67 | 69 | struct param_local_str param_local; |
|
68 | 70 | |
|
69 | 71 | // HK PACKETS |
|
70 | 72 | Packet_TM_LFR_HK_t housekeeping_packet; |
|
71 | 73 | // sequence counters are incremented by APID (PID + CAT) and destination ID |
|
72 | 74 | unsigned short sequenceCounters_SCIENCE_NORMAL_BURST; |
|
73 | 75 | unsigned short sequenceCounters_SCIENCE_SBM1_SBM2; |
|
74 | 76 | unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID]; |
|
75 | 77 | spw_stats spacewire_stats; |
|
76 | 78 | spw_stats spacewire_stats_backup; |
|
77 | 79 | |
|
78 | 80 |
@@ -1,674 +1,696 | |||
|
1 | 1 | /** This is the RTEMS initialization module. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * This module contains two very different information: |
|
7 | 7 | * - specific instructions to configure the compilation of the RTEMS executive |
|
8 | 8 | * - functions related to the fligth softwre initialization, especially the INIT RTEMS task |
|
9 | 9 | * |
|
10 | 10 | */ |
|
11 | 11 | |
|
12 | 12 | //************************* |
|
13 | 13 | // GPL reminder to be added |
|
14 | 14 | //************************* |
|
15 | 15 | |
|
16 | 16 | #include <rtems.h> |
|
17 | 17 | |
|
18 | 18 | /* configuration information */ |
|
19 | 19 | |
|
20 | 20 | #define CONFIGURE_INIT |
|
21 | 21 | |
|
22 | 22 | #include <bsp.h> /* for device driver prototypes */ |
|
23 | 23 | |
|
24 | 24 | /* configuration information */ |
|
25 | 25 | |
|
26 | 26 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
27 | 27 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
28 | 28 | |
|
29 | 29 | #define CONFIGURE_MAXIMUM_TASKS 20 |
|
30 | 30 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
|
31 | 31 | #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) |
|
32 | 32 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 |
|
33 | 33 | #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100 |
|
34 | 34 | #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT) |
|
35 | 35 | #define CONFIGURE_MAXIMUM_DRIVERS 16 |
|
36 | 36 | #define CONFIGURE_MAXIMUM_PERIODS 5 |
|
37 | 37 | #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s) |
|
38 |
#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES |
|
|
38 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 4 | |
|
39 | 39 | #ifdef PRINT_STACK_REPORT |
|
40 | 40 | #define CONFIGURE_STACK_CHECKER_ENABLED |
|
41 | 41 | #endif |
|
42 | 42 | |
|
43 | 43 | #include <rtems/confdefs.h> |
|
44 | 44 | |
|
45 | 45 | /* If --drvmgr was enabled during the configuration of the RTEMS kernel */ |
|
46 | 46 | #ifdef RTEMS_DRVMGR_STARTUP |
|
47 | 47 | #ifdef LEON3 |
|
48 | 48 | /* Add Timer and UART Driver */ |
|
49 | 49 | #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
50 | 50 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER |
|
51 | 51 | #endif |
|
52 | 52 | #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
53 | 53 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART |
|
54 | 54 | #endif |
|
55 | 55 | #endif |
|
56 | 56 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */ |
|
57 | 57 | #include <drvmgr/drvmgr_confdefs.h> |
|
58 | 58 | #endif |
|
59 | 59 | |
|
60 | 60 | #include "fsw_init.h" |
|
61 | 61 | #include "fsw_config.c" |
|
62 | 62 | |
|
63 | 63 | rtems_task Init( rtems_task_argument ignored ) |
|
64 | 64 | { |
|
65 | 65 | /** This is the RTEMS INIT taks, it the first task launched by the system. |
|
66 | 66 | * |
|
67 | 67 | * @param unused is the starting argument of the RTEMS task |
|
68 | 68 | * |
|
69 | 69 | * The INIT task create and run all other RTEMS tasks. |
|
70 | 70 | * |
|
71 | 71 | */ |
|
72 | 72 | |
|
73 | 73 | reset_local_time(); |
|
74 | 74 | |
|
75 | 75 | rtems_status_code status; |
|
76 | 76 | rtems_status_code status_spw; |
|
77 | 77 | rtems_isr_entry old_isr_handler; |
|
78 | 78 | |
|
79 | 79 | // UART settings |
|
80 | 80 | send_console_outputs_on_apbuart_port(); |
|
81 | 81 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); |
|
82 | 82 | enable_apbuart_transmitter(); |
|
83 | 83 | DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") |
|
84 | 84 | |
|
85 | 85 | PRINTF("\n\n\n\n\n") |
|
86 | 86 | PRINTF("*************************\n") |
|
87 | 87 | PRINTF("** LFR Flight Software **\n") |
|
88 | 88 | PRINTF1("** %d.", SW_VERSION_N1) |
|
89 | 89 | PRINTF1("%d.", SW_VERSION_N2) |
|
90 | 90 | PRINTF1("%d.", SW_VERSION_N3) |
|
91 | 91 | PRINTF1("%d **\n", SW_VERSION_N4) |
|
92 | 92 | PRINTF("*************************\n") |
|
93 | 93 | PRINTF("\n\n") |
|
94 | 94 | |
|
95 | 95 | init_parameter_dump(); |
|
96 | 96 | init_local_mode_parameters(); |
|
97 | 97 | init_housekeeping_parameters(); |
|
98 | 98 | |
|
99 | 99 | init_waveform_rings(); // initialize the waveform rings |
|
100 | 100 | SM_init_rings(); // initialize spectral matrices rings |
|
101 | 101 | ASM_init_rings(); // initialize the average spectral matrix ring (just for burst, sbm1 and sbm2 asm @ f0 storage) |
|
102 | 102 | |
|
103 | 103 | reset_wfp_burst_enable(); |
|
104 | 104 | reset_wfp_status(); |
|
105 | 105 | set_wfp_data_shaping(); |
|
106 | 106 | |
|
107 | 107 | updateLFRCurrentMode(); |
|
108 | 108 | |
|
109 | 109 | BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) |
|
110 | 110 | |
|
111 | 111 | create_names(); // create all names |
|
112 | 112 | |
|
113 | 113 | status = create_message_queues(); // create message queues |
|
114 | 114 | if (status != RTEMS_SUCCESSFUL) |
|
115 | 115 | { |
|
116 | 116 | PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) |
|
117 | 117 | } |
|
118 | 118 | |
|
119 | 119 | status = create_all_tasks(); // create all tasks |
|
120 | 120 | if (status != RTEMS_SUCCESSFUL) |
|
121 | 121 | { |
|
122 | 122 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status) |
|
123 | 123 | } |
|
124 | 124 | |
|
125 | 125 | // ************************** |
|
126 | 126 | // <SPACEWIRE INITIALIZATION> |
|
127 | 127 | grspw_timecode_callback = &timecode_irq_handler; |
|
128 | 128 | |
|
129 | 129 | status_spw = spacewire_open_link(); // (1) open the link |
|
130 | 130 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
131 | 131 | { |
|
132 | 132 | PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) |
|
133 | 133 | } |
|
134 | 134 | |
|
135 | 135 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link |
|
136 | 136 | { |
|
137 | 137 | status_spw = spacewire_configure_link( fdSPW ); |
|
138 | 138 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
139 | 139 | { |
|
140 | 140 | PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) |
|
141 | 141 | } |
|
142 | 142 | } |
|
143 | 143 | |
|
144 | 144 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link |
|
145 | 145 | { |
|
146 | 146 | status_spw = spacewire_start_link( fdSPW ); |
|
147 | 147 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
148 | 148 | { |
|
149 | 149 | PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) |
|
150 | 150 | } |
|
151 | 151 | } |
|
152 | 152 | // </SPACEWIRE INITIALIZATION> |
|
153 | 153 | // *************************** |
|
154 | 154 | |
|
155 | 155 | status = start_all_tasks(); // start all tasks |
|
156 | 156 | if (status != RTEMS_SUCCESSFUL) |
|
157 | 157 | { |
|
158 | 158 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) |
|
159 | 159 | } |
|
160 | 160 | |
|
161 | 161 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization |
|
162 | 162 | status = start_recv_send_tasks(); |
|
163 | 163 | if ( status != RTEMS_SUCCESSFUL ) |
|
164 | 164 | { |
|
165 | 165 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) |
|
166 | 166 | } |
|
167 | 167 | |
|
168 | 168 | // suspend science tasks, they will be restarted later depending on the mode |
|
169 | 169 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) |
|
170 | 170 | if (status != RTEMS_SUCCESSFUL) |
|
171 | 171 | { |
|
172 | 172 | PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
173 | 173 | } |
|
174 | 174 | |
|
175 | 175 | //****************************** |
|
176 | 176 | // <SPECTRAL MATRICES SIMULATOR> |
|
177 | 177 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); |
|
178 | 178 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, |
|
179 | 179 | IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu ); |
|
180 | 180 | // </SPECTRAL MATRICES SIMULATOR> |
|
181 | 181 | //******************************* |
|
182 | 182 | |
|
183 | 183 | // configure IRQ handling for the waveform picker unit |
|
184 | 184 | status = rtems_interrupt_catch( waveforms_isr, |
|
185 | 185 | IRQ_SPARC_WAVEFORM_PICKER, |
|
186 | 186 | &old_isr_handler) ; |
|
187 | 187 | // configure IRQ handling for the spectral matrices unit |
|
188 | 188 | status = rtems_interrupt_catch( spectral_matrices_isr, |
|
189 | 189 | IRQ_SPARC_SPECTRAL_MATRIX, |
|
190 | 190 | &old_isr_handler) ; |
|
191 | 191 | |
|
192 | 192 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery |
|
193 | 193 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
194 | 194 | { |
|
195 | 195 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); |
|
196 | 196 | if ( status != RTEMS_SUCCESSFUL ) { |
|
197 | 197 | PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) |
|
198 | 198 | } |
|
199 | 199 | } |
|
200 | 200 | |
|
201 | 201 | BOOT_PRINTF("delete INIT\n") |
|
202 | 202 | |
|
203 | 203 | send_dumb_hk(); |
|
204 | 204 | |
|
205 | 205 | status = rtems_task_delete(RTEMS_SELF); |
|
206 | 206 | |
|
207 | 207 | } |
|
208 | 208 | |
|
209 | 209 | void init_local_mode_parameters( void ) |
|
210 | 210 | { |
|
211 | 211 | /** This function initialize the param_local global variable with default values. |
|
212 | 212 | * |
|
213 | 213 | */ |
|
214 | 214 | |
|
215 | 215 | unsigned int i; |
|
216 | 216 | |
|
217 | 217 | // LOCAL PARAMETERS |
|
218 | 218 | set_local_nb_interrupt_f0_MAX(); |
|
219 | 219 | |
|
220 | 220 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
221 | 221 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
222 | 222 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
223 | 223 | |
|
224 | 224 | // init sequence counters |
|
225 | 225 | |
|
226 | 226 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) |
|
227 | 227 | { |
|
228 | 228 | sequenceCounters_TC_EXE[i] = 0x00; |
|
229 | 229 | } |
|
230 | 230 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; |
|
231 | 231 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; |
|
232 | 232 | } |
|
233 | 233 | |
|
234 | 234 | void reset_local_time( void ) |
|
235 | 235 | { |
|
236 | 236 | time_management_regs->ctrl = 0x02; // software reset, coarse time = 0x80000000 |
|
237 | 237 | } |
|
238 | 238 | |
|
239 | 239 | void create_names( void ) // create all names for tasks and queues |
|
240 | 240 | { |
|
241 | 241 | /** This function creates all RTEMS names used in the software for tasks and queues. |
|
242 | 242 | * |
|
243 | 243 | * @return RTEMS directive status codes: |
|
244 | 244 | * - RTEMS_SUCCESSFUL - successful completion |
|
245 | 245 | * |
|
246 | 246 | */ |
|
247 | 247 | |
|
248 | 248 | // task names |
|
249 | 249 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); |
|
250 | 250 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); |
|
251 | 251 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
|
252 | 252 | Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' ); |
|
253 | 253 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); |
|
254 | 254 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); |
|
255 | 255 | Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' ); |
|
256 | 256 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
257 | 257 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); |
|
258 | 258 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
259 |
Task_name[TASKID_ |
|
|
259 | Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' ); | |
|
260 | 260 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); |
|
261 | 261 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); |
|
262 | 262 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); |
|
263 | 263 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); |
|
264 | 264 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); |
|
265 | 265 | |
|
266 | 266 | // rate monotonic period names |
|
267 | 267 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
268 | 268 | |
|
269 | 269 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
270 | 270 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
271 |
misc_name[QUEUE_ |
|
|
271 | misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' ); | |
|
272 | misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' ); | |
|
272 | 273 | } |
|
273 | 274 | |
|
274 | 275 | int create_all_tasks( void ) // create all tasks which run in the software |
|
275 | 276 | { |
|
276 | 277 | /** This function creates all RTEMS tasks used in the software. |
|
277 | 278 | * |
|
278 | 279 | * @return RTEMS directive status codes: |
|
279 | 280 | * - RTEMS_SUCCESSFUL - task created successfully |
|
280 | 281 | * - RTEMS_INVALID_ADDRESS - id is NULL |
|
281 | 282 | * - RTEMS_INVALID_NAME - invalid task name |
|
282 | 283 | * - RTEMS_INVALID_PRIORITY - invalid task priority |
|
283 | 284 | * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured |
|
284 | 285 | * - RTEMS_TOO_MANY - too many tasks created |
|
285 | 286 | * - RTEMS_UNSATISFIED - not enough memory for stack/FP context |
|
286 | 287 | * - RTEMS_TOO_MANY - too many global objects |
|
287 | 288 | * |
|
288 | 289 | */ |
|
289 | 290 | |
|
290 | 291 | rtems_status_code status; |
|
291 | 292 | |
|
292 | 293 | //********** |
|
293 | 294 | // SPACEWIRE |
|
294 | 295 | // RECV |
|
295 | 296 | status = rtems_task_create( |
|
296 | 297 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, |
|
297 | 298 | RTEMS_DEFAULT_MODES, |
|
298 | 299 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] |
|
299 | 300 | ); |
|
300 | 301 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
301 | 302 | { |
|
302 | 303 | status = rtems_task_create( |
|
303 | 304 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, |
|
304 | 305 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
305 | 306 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] |
|
306 | 307 | ); |
|
307 | 308 | } |
|
308 | 309 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
309 | 310 | { |
|
310 | 311 | status = rtems_task_create( |
|
311 | 312 | Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE, |
|
312 | 313 | RTEMS_DEFAULT_MODES, |
|
313 | 314 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG] |
|
314 | 315 | ); |
|
315 | 316 | } |
|
316 | 317 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
317 | 318 | { |
|
318 | 319 | status = rtems_task_create( |
|
319 | 320 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, |
|
320 | 321 | RTEMS_DEFAULT_MODES, |
|
321 | 322 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] |
|
322 | 323 | ); |
|
323 | 324 | } |
|
324 | 325 | if (status == RTEMS_SUCCESSFUL) // SPIQ |
|
325 | 326 | { |
|
326 | 327 | status = rtems_task_create( |
|
327 | 328 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
328 | 329 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
329 | 330 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] |
|
330 | 331 | ); |
|
331 | 332 | } |
|
332 | 333 | |
|
333 | 334 | //****************** |
|
334 | 335 | // SPECTRAL MATRICES |
|
335 | 336 | if (status == RTEMS_SUCCESSFUL) // SMIQ |
|
336 | 337 | { |
|
337 | 338 | status = rtems_task_create( |
|
338 | 339 | Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
339 | 340 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
340 | 341 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ] |
|
341 | 342 | ); |
|
342 | 343 | } |
|
343 | 344 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
344 | 345 | { |
|
345 | 346 | status = rtems_task_create( |
|
346 | 347 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, |
|
347 | 348 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
348 | 349 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] |
|
349 | 350 | ); |
|
350 | 351 | } |
|
351 | 352 | if (status == RTEMS_SUCCESSFUL) // MATR |
|
352 | 353 | { |
|
353 | 354 | status = rtems_task_create( |
|
354 |
Task_name[TASKID_ |
|
|
355 | Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2, | |
|
355 | 356 | RTEMS_DEFAULT_MODES, |
|
356 |
RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ |
|
|
357 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0] | |
|
357 | 358 | ); |
|
358 | 359 | } |
|
359 | 360 | |
|
360 | 361 | //**************** |
|
361 | 362 | // WAVEFORM PICKER |
|
362 | 363 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
363 | 364 | { |
|
364 | 365 | status = rtems_task_create( |
|
365 | 366 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, |
|
366 | 367 | RTEMS_DEFAULT_MODES, |
|
367 | 368 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] |
|
368 | 369 | ); |
|
369 | 370 | } |
|
370 | 371 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
371 | 372 | { |
|
372 | 373 | status = rtems_task_create( |
|
373 | 374 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, |
|
374 | 375 | RTEMS_DEFAULT_MODES, |
|
375 | 376 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3] |
|
376 | 377 | ); |
|
377 | 378 | } |
|
378 | 379 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
379 | 380 | { |
|
380 | 381 | status = rtems_task_create( |
|
381 | 382 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, |
|
382 | 383 | RTEMS_DEFAULT_MODES, |
|
383 | 384 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2] |
|
384 | 385 | ); |
|
385 | 386 | } |
|
386 | 387 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
387 | 388 | { |
|
388 | 389 | status = rtems_task_create( |
|
389 | 390 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, |
|
390 | 391 | RTEMS_DEFAULT_MODES, |
|
391 | 392 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1] |
|
392 | 393 | ); |
|
393 | 394 | } |
|
394 | 395 | if (status == RTEMS_SUCCESSFUL) // SWBD |
|
395 | 396 | { |
|
396 | 397 | status = rtems_task_create( |
|
397 | 398 | Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE, |
|
398 | 399 | RTEMS_DEFAULT_MODES, |
|
399 | 400 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD] |
|
400 | 401 | ); |
|
401 | 402 | } |
|
402 | 403 | |
|
403 | 404 | //***** |
|
404 | 405 | // MISC |
|
405 | 406 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
406 | 407 | { |
|
407 | 408 | status = rtems_task_create( |
|
408 | 409 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, |
|
409 | 410 | RTEMS_DEFAULT_MODES, |
|
410 | 411 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] |
|
411 | 412 | ); |
|
412 | 413 | } |
|
413 | 414 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
414 | 415 | { |
|
415 | 416 | status = rtems_task_create( |
|
416 | 417 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, |
|
417 | 418 | RTEMS_DEFAULT_MODES, |
|
418 | 419 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] |
|
419 | 420 | ); |
|
420 | 421 | } |
|
421 | 422 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
422 | 423 | { |
|
423 | 424 | status = rtems_task_create( |
|
424 | 425 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, |
|
425 | 426 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
426 | 427 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] |
|
427 | 428 | ); |
|
428 | 429 | } |
|
429 | 430 | |
|
430 | 431 | return status; |
|
431 | 432 | } |
|
432 | 433 | |
|
433 | 434 | int start_recv_send_tasks( void ) |
|
434 | 435 | { |
|
435 | 436 | rtems_status_code status; |
|
436 | 437 | |
|
437 | 438 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); |
|
438 | 439 | if (status!=RTEMS_SUCCESSFUL) { |
|
439 | 440 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") |
|
440 | 441 | } |
|
441 | 442 | |
|
442 | 443 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
443 | 444 | { |
|
444 | 445 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); |
|
445 | 446 | if (status!=RTEMS_SUCCESSFUL) { |
|
446 | 447 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") |
|
447 | 448 | } |
|
448 | 449 | } |
|
449 | 450 | |
|
450 | 451 | return status; |
|
451 | 452 | } |
|
452 | 453 | |
|
453 | 454 | int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS |
|
454 | 455 | { |
|
455 | 456 | /** This function starts all RTEMS tasks used in the software. |
|
456 | 457 | * |
|
457 | 458 | * @return RTEMS directive status codes: |
|
458 | 459 | * - RTEMS_SUCCESSFUL - ask started successfully |
|
459 | 460 | * - RTEMS_INVALID_ADDRESS - invalid task entry point |
|
460 | 461 | * - RTEMS_INVALID_ID - invalid task id |
|
461 | 462 | * - RTEMS_INCORRECT_STATE - task not in the dormant state |
|
462 | 463 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task |
|
463 | 464 | * |
|
464 | 465 | */ |
|
465 | 466 | // starts all the tasks fot eh flight software |
|
466 | 467 | |
|
467 | 468 | rtems_status_code status; |
|
468 | 469 | |
|
469 | 470 | //********** |
|
470 | 471 | // SPACEWIRE |
|
471 | 472 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); |
|
472 | 473 | if (status!=RTEMS_SUCCESSFUL) { |
|
473 | 474 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") |
|
474 | 475 | } |
|
475 | 476 | |
|
476 | 477 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
477 | 478 | { |
|
478 | 479 | status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 ); |
|
479 | 480 | if (status!=RTEMS_SUCCESSFUL) { |
|
480 | 481 | BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n") |
|
481 | 482 | } |
|
482 | 483 | } |
|
483 | 484 | |
|
484 | 485 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
485 | 486 | { |
|
486 | 487 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); |
|
487 | 488 | if (status!=RTEMS_SUCCESSFUL) { |
|
488 | 489 | BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") |
|
489 | 490 | } |
|
490 | 491 | } |
|
491 | 492 | |
|
492 | 493 | //****************** |
|
493 | 494 | // SPECTRAL MATRICES |
|
494 | 495 | if (status == RTEMS_SUCCESSFUL) // SMIQ |
|
495 | 496 | { |
|
496 | 497 | status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 ); |
|
497 | 498 | if (status!=RTEMS_SUCCESSFUL) { |
|
498 | 499 | BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n") |
|
499 | 500 | } |
|
500 | 501 | } |
|
501 | 502 | |
|
502 | 503 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
503 | 504 | { |
|
504 | 505 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 ); |
|
505 | 506 | if (status!=RTEMS_SUCCESSFUL) { |
|
506 | 507 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") |
|
507 | 508 | } |
|
508 | 509 | } |
|
509 | 510 | |
|
510 |
if (status == RTEMS_SUCCESSFUL) // |
|
|
511 | if (status == RTEMS_SUCCESSFUL) // PRC0 | |
|
511 | 512 | { |
|
512 |
status = rtems_task_start( Task_id[TASKID_ |
|
|
513 | status = rtems_task_start( Task_id[TASKID_PRC0], prc0_task, 1 ); | |
|
513 | 514 | if (status!=RTEMS_SUCCESSFUL) { |
|
514 |
BOOT_PRINTF("in INIT *** Error starting TASK_ |
|
|
515 | BOOT_PRINTF("in INIT *** Error starting TASK_PRC0\n") | |
|
515 | 516 | } |
|
516 | 517 | } |
|
517 | 518 | |
|
518 | 519 | //**************** |
|
519 | 520 | // WAVEFORM PICKER |
|
520 | 521 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
521 | 522 | { |
|
522 | 523 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); |
|
523 | 524 | if (status!=RTEMS_SUCCESSFUL) { |
|
524 | 525 | BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") |
|
525 | 526 | } |
|
526 | 527 | } |
|
527 | 528 | |
|
528 | 529 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
529 | 530 | { |
|
530 | 531 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); |
|
531 | 532 | if (status!=RTEMS_SUCCESSFUL) { |
|
532 | 533 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") |
|
533 | 534 | } |
|
534 | 535 | } |
|
535 | 536 | |
|
536 | 537 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
537 | 538 | { |
|
538 | 539 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); |
|
539 | 540 | if (status!=RTEMS_SUCCESSFUL) { |
|
540 | 541 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") |
|
541 | 542 | } |
|
542 | 543 | } |
|
543 | 544 | |
|
544 | 545 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
545 | 546 | { |
|
546 | 547 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); |
|
547 | 548 | if (status!=RTEMS_SUCCESSFUL) { |
|
548 | 549 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") |
|
549 | 550 | } |
|
550 | 551 | } |
|
551 | 552 | |
|
552 | 553 | if (status == RTEMS_SUCCESSFUL) // SWBD |
|
553 | 554 | { |
|
554 | 555 | status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 ); |
|
555 | 556 | if (status!=RTEMS_SUCCESSFUL) { |
|
556 | 557 | BOOT_PRINTF("in INIT *** Error starting TASK_SWBD\n") |
|
557 | 558 | } |
|
558 | 559 | } |
|
559 | 560 | |
|
560 | 561 | //***** |
|
561 | 562 | // MISC |
|
562 | 563 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
563 | 564 | { |
|
564 | 565 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); |
|
565 | 566 | if (status!=RTEMS_SUCCESSFUL) { |
|
566 | 567 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") |
|
567 | 568 | } |
|
568 | 569 | } |
|
569 | 570 | |
|
570 | 571 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
571 | 572 | { |
|
572 | 573 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); |
|
573 | 574 | if (status!=RTEMS_SUCCESSFUL) { |
|
574 | 575 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") |
|
575 | 576 | } |
|
576 | 577 | } |
|
577 | 578 | |
|
578 | 579 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
579 | 580 | { |
|
580 | 581 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); |
|
581 | 582 | if (status!=RTEMS_SUCCESSFUL) { |
|
582 | 583 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") |
|
583 | 584 | } |
|
584 | 585 | } |
|
585 | 586 | |
|
586 | 587 | return status; |
|
587 | 588 | } |
|
588 | 589 | |
|
589 | 590 | rtems_status_code create_message_queues( void ) // create the two message queues used in the software |
|
590 | 591 | { |
|
591 | 592 | rtems_status_code status_recv; |
|
592 | 593 | rtems_status_code status_send; |
|
593 | 594 | rtems_status_code status_matr; |
|
594 | 595 | rtems_status_code ret; |
|
595 | 596 | rtems_id queue_id; |
|
596 | 597 | |
|
597 | 598 | //**************************************** |
|
598 | 599 | // create the queue for handling valid TCs |
|
599 | 600 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], |
|
600 | 601 | MSG_QUEUE_COUNT_RECV, CCSDS_TC_PKT_MAX_SIZE, |
|
601 | 602 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
602 | 603 | if ( status_recv != RTEMS_SUCCESSFUL ) { |
|
603 | 604 | PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) |
|
604 | 605 | } |
|
605 | 606 | |
|
606 | 607 | //************************************************ |
|
607 | 608 | // create the queue for handling TM packet sending |
|
608 | 609 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], |
|
609 | 610 | MSG_QUEUE_COUNT_SEND, MSG_QUEUE_SIZE_SEND, |
|
610 | 611 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
611 | 612 | if ( status_send != RTEMS_SUCCESSFUL ) { |
|
612 | 613 | PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) |
|
613 | 614 | } |
|
614 | 615 | |
|
615 | //************************************************************************ | |
|
616 | // create the queue for handling averaged spectral matrices for processing | |
|
617 |
status_matr = rtems_message_queue_create( misc_name[QUEUE_ |
|
|
618 |
MSG_QUEUE_COUNT_ |
|
|
616 | //***************************************************************************** | |
|
617 | // create the queue for handling averaged spectral matrices for processing @ f0 | |
|
618 | status_matr = rtems_message_queue_create( misc_name[QUEUE_PRC0], | |
|
619 | MSG_QUEUE_COUNT_PRC0, MSG_QUEUE_SIZE_PRC0, | |
|
619 | 620 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
620 | 621 | if ( status_send != RTEMS_SUCCESSFUL ) { |
|
621 |
PRINTF1("in create_message_queues *** ERR creating |
|
|
622 | PRINTF1("in create_message_queues *** ERR creating PR_0 queue, %d\n", status_matr) | |
|
622 | 623 | } |
|
623 | 624 | |
|
625 | //***************************************************************************** | |
|
626 | // create the queue for handling averaged spectral matrices for processing @ f1 | |
|
627 | // status_matr = rtems_message_queue_create( misc_name[QUEUE_PRC1], | |
|
628 | // MSG_QUEUE_COUNT_PRC1, MSG_QUEUE_SIZE_PRC1, | |
|
629 | // RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
|
630 | // if ( status_send != RTEMS_SUCCESSFUL ) { | |
|
631 | // PRINTF1("in create_message_queues *** ERR creating PR_1 queue, %d\n", status_matr) | |
|
632 | // } | |
|
633 | ||
|
624 | 634 | if ( status_recv != RTEMS_SUCCESSFUL ) |
|
625 | 635 | { |
|
626 | 636 | ret = status_recv; |
|
627 | 637 | } |
|
628 | 638 | else if( status_send != RTEMS_SUCCESSFUL ) |
|
629 | 639 | { |
|
630 | 640 | ret = status_send; |
|
631 | 641 | } |
|
632 | 642 | else |
|
633 | 643 | { |
|
634 | 644 | ret = status_matr; |
|
635 | 645 | } |
|
636 | 646 | |
|
637 | 647 | return ret; |
|
638 | 648 | } |
|
639 | 649 | |
|
640 | 650 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ) |
|
641 | 651 | { |
|
642 | 652 | rtems_status_code status; |
|
643 | 653 | rtems_name queue_name; |
|
644 | 654 | |
|
645 | 655 | queue_name = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
646 | 656 | |
|
647 | 657 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
648 | 658 | |
|
649 | 659 | return status; |
|
650 | 660 | } |
|
651 | 661 | |
|
652 | 662 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ) |
|
653 | 663 | { |
|
654 | 664 | rtems_status_code status; |
|
655 | 665 | rtems_name queue_name; |
|
656 | 666 | |
|
657 | 667 | queue_name = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
658 | 668 | |
|
659 | 669 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
660 | 670 | |
|
661 | 671 | return status; |
|
662 | 672 | } |
|
663 | 673 | |
|
664 |
rtems_status_code get_message_queue_id_ |
|
|
674 | rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id ) | |
|
665 | 675 | { |
|
666 | 676 | rtems_status_code status; |
|
667 | 677 | rtems_name queue_name; |
|
668 | 678 | |
|
669 |
queue_name = rtems_build_name( 'Q', '_', ' |
|
|
679 | queue_name = rtems_build_name( 'Q', '_', 'P', '0' ); | |
|
670 | 680 | |
|
671 | 681 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
672 | 682 | |
|
673 | 683 | return status; |
|
674 | 684 | } |
|
685 | ||
|
686 | rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id ) | |
|
687 | { | |
|
688 | rtems_status_code status; | |
|
689 | rtems_name queue_name; | |
|
690 | ||
|
691 | queue_name = rtems_build_name( 'Q', '_', 'P', '1' ); | |
|
692 | ||
|
693 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); | |
|
694 | ||
|
695 | return status; | |
|
696 | } |
This diff has been collapsed as it changes many lines, (513 lines changed) Show them Hide them | |||
@@ -1,892 +1,1079 | |||
|
1 | 1 | /** Functions related to data processing. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. |
|
7 | 7 | * |
|
8 | 8 | */ |
|
9 | 9 | |
|
10 | 10 | #include <fsw_processing.h> |
|
11 | 11 | |
|
12 | 12 | #include "fsw_processing_globals.c" |
|
13 | 13 | |
|
14 | 14 | //************************ |
|
15 | 15 | // spectral matrices rings |
|
16 | 16 | ring_node_sm sm_ring_f0[ NB_RING_NODES_SM_F0 ]; |
|
17 | 17 | ring_node_sm sm_ring_f1[ NB_RING_NODES_SM_F1 ]; |
|
18 | 18 | ring_node_sm sm_ring_f2[ NB_RING_NODES_SM_F2 ]; |
|
19 | 19 | ring_node_sm *current_ring_node_sm_f0; |
|
20 | ring_node_sm *ring_node_for_averaging_sm_f0; | |
|
21 | 20 | ring_node_sm *current_ring_node_sm_f1; |
|
22 | 21 | ring_node_sm *current_ring_node_sm_f2; |
|
22 | ring_node_sm *ring_node_for_averaging_sm_f0; | |
|
23 | ring_node_sm *ring_node_for_averaging_sm_f1; | |
|
23 | 24 | |
|
24 | 25 | ring_node_asm asm_ring_burst_sbm_f0[ NB_RING_NODES_ASM_BURST_SBM_F0 ]; |
|
25 | 26 | ring_node_asm asm_ring_norm_f0 [ NB_RING_NODES_ASM_BURST_SBM_F0 ]; |
|
26 | 27 | ring_node_asm *current_ring_node_asm_burst_sbm_f0; |
|
28 | ring_node_asm *current_ring_node_asm_burst_sbm_f1; | |
|
27 | 29 | ring_node_asm *current_ring_node_asm_norm_f0; |
|
30 | ring_node_asm *current_ring_node_asm_norm_f1; | |
|
28 | 31 | |
|
29 | 32 | float asm_norm_f0 [ TOTAL_SIZE_SM ]; |
|
30 | 33 | float asm_f0_reorganized [ TOTAL_SIZE_SM ]; |
|
31 | 34 | char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ]; |
|
32 | 35 | float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_F0 ]; |
|
33 | 36 | float compressed_sm_sbm [ TOTAL_SIZE_COMPRESSED_ASM_SBM1 ]; |
|
34 | 37 | |
|
35 | 38 | //*********************************************************** |
|
36 | 39 | // Interrupt Service Routine for spectral matrices processing |
|
37 | 40 | void reset_nb_sm_f0( unsigned char lfrMode ) |
|
38 | 41 | { |
|
39 | 42 | nb_sm.f0 = 0; |
|
40 | 43 | nb_sm.norm_bp1_f0 = 0; |
|
41 | 44 | nb_sm.norm_bp2_f0 = 0; |
|
42 | 45 | nb_sm.norm_asm_f0 = 0; |
|
43 | 46 | nb_sm.sbm_bp1_f0 = 0; |
|
44 | 47 | nb_sm.sbm_bp2_f0 = 0; |
|
45 | 48 | |
|
46 |
nb_sm_before_ |
|
|
47 |
nb_sm_before_ |
|
|
48 |
nb_sm_before_ |
|
|
49 |
nb_sm_before_ |
|
|
50 |
nb_sm_before_ |
|
|
51 |
nb_sm_before_ |
|
|
52 |
nb_sm_before_ |
|
|
53 |
nb_sm_before_ |
|
|
54 |
nb_sm_before_ |
|
|
49 | nb_sm_before_f0.norm_bp1_f0 = parameter_dump_packet.sy_lfr_n_bp_p0 * 96; | |
|
50 | nb_sm_before_f0.norm_bp2_f0 = parameter_dump_packet.sy_lfr_n_bp_p1 * 96; | |
|
51 | nb_sm_before_f0.norm_asm_f0 = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 96; | |
|
52 | nb_sm_before_f0.sbm1_bp1_f0 = parameter_dump_packet.sy_lfr_s1_bp_p0 * 24; | |
|
53 | nb_sm_before_f0.sbm1_bp2_f0 = parameter_dump_packet.sy_lfr_s1_bp_p1 * 96; | |
|
54 | nb_sm_before_f0.sbm2_bp1_f0 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 96; | |
|
55 | nb_sm_before_f0.sbm2_bp2_f0 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 96; | |
|
56 | nb_sm_before_f0.burst_bp1_f0 = parameter_dump_packet.sy_lfr_b_bp_p0 * 96; | |
|
57 | nb_sm_before_f0.burst_bp2_f0 = parameter_dump_packet.sy_lfr_b_bp_p1 * 96; | |
|
55 | 58 | |
|
56 | 59 | if (lfrMode == LFR_MODE_SBM1) |
|
57 | 60 | { |
|
58 |
nb_sm_before_ |
|
|
59 |
nb_sm_before_ |
|
|
61 | nb_sm_before_f0.burst_sbm_bp1_f0 = nb_sm_before_f0.sbm1_bp1_f0; | |
|
62 | nb_sm_before_f0.burst_sbm_bp2_f0 = nb_sm_before_f0.sbm1_bp2_f0; | |
|
60 | 63 | } |
|
61 | 64 | else if (lfrMode == LFR_MODE_SBM2) |
|
62 | 65 | { |
|
63 |
nb_sm_before_ |
|
|
64 |
nb_sm_before_ |
|
|
66 | nb_sm_before_f0.burst_sbm_bp1_f0 = nb_sm_before_f0.sbm2_bp1_f0; | |
|
67 | nb_sm_before_f0.burst_sbm_bp2_f0 = nb_sm_before_f0.sbm2_bp2_f0; | |
|
68 | } | |
|
69 | else if (lfrMode == LFR_MODE_BURST) | |
|
70 | { | |
|
71 | nb_sm_before_f0.burst_sbm_bp1_f0 = nb_sm_before_f0.burst_bp1_f0; | |
|
72 | nb_sm_before_f0.burst_sbm_bp2_f0 = nb_sm_before_f0.burst_bp2_f0; | |
|
73 | } | |
|
74 | else | |
|
75 | { | |
|
76 | nb_sm_before_f0.burst_sbm_bp1_f0 = nb_sm_before_f0.burst_bp1_f0; | |
|
77 | nb_sm_before_f0.burst_sbm_bp2_f0 = nb_sm_before_f0.burst_bp2_f0; | |
|
78 | } | |
|
79 | } | |
|
80 | ||
|
81 | void reset_nb_sm_f1( unsigned char lfrMode ) | |
|
82 | { | |
|
83 | nb_sm.f1 = 0; | |
|
84 | nb_sm.norm_bp1_f1 = 0; | |
|
85 | nb_sm.norm_bp2_f1 = 0; | |
|
86 | nb_sm.norm_asm_f1 = 0; | |
|
87 | nb_sm.sbm_bp1_f1 = 0; | |
|
88 | nb_sm.sbm_bp2_f1 = 0; | |
|
89 | ||
|
90 | nb_sm_before_f1.norm_bp1_f1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 16; | |
|
91 | nb_sm_before_f1.norm_bp2_f1 = parameter_dump_packet.sy_lfr_n_bp_p1 * 16; | |
|
92 | nb_sm_before_f1.norm_asm_f1 = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 16; | |
|
93 | nb_sm_before_f1.sbm2_bp1_f1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 16; | |
|
94 | nb_sm_before_f1.sbm2_bp2_f1 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 16; | |
|
95 | nb_sm_before_f1.burst_bp1_f1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 16; | |
|
96 | nb_sm_before_f1.burst_bp2_f1 = parameter_dump_packet.sy_lfr_b_bp_p1 * 16; | |
|
97 | ||
|
98 | if (lfrMode == LFR_MODE_SBM2) | |
|
99 | { | |
|
100 | nb_sm_before_f1.burst_sbm_bp1_f1 = nb_sm_before_f1.sbm2_bp1_f1; | |
|
101 | nb_sm_before_f1.burst_sbm_bp2_f1 = nb_sm_before_f1.sbm2_bp2_f1; | |
|
65 | 102 | } |
|
66 | 103 | else if (lfrMode == LFR_MODE_BURST) |
|
67 | 104 | { |
|
68 |
nb_sm_before_ |
|
|
69 |
nb_sm_before_ |
|
|
105 | nb_sm_before_f1.burst_sbm_bp1_f1 = nb_sm_before_f1.burst_bp1_f1; | |
|
106 | nb_sm_before_f1.burst_sbm_bp2_f1 = nb_sm_before_f1.burst_bp2_f1; | |
|
70 | 107 | } |
|
71 | 108 | else |
|
72 | 109 | { |
|
73 |
nb_sm_before_ |
|
|
74 |
nb_sm_before_ |
|
|
110 | nb_sm_before_f1.burst_sbm_bp1_f1 = nb_sm_before_f1.burst_bp1_f1; | |
|
111 | nb_sm_before_f1.burst_sbm_bp2_f1 = nb_sm_before_f1.burst_bp2_f1; | |
|
112 | } | |
|
113 | } | |
|
114 | ||
|
115 | void reset_nb_sm_f2( unsigned char lfrMode ) | |
|
116 | { | |
|
117 | nb_sm.f2 = 0; | |
|
118 | nb_sm.norm_bp1_f2 = 0; | |
|
119 | nb_sm.norm_bp2_f2 = 0; | |
|
120 | nb_sm.norm_asm_f2 = 0; | |
|
121 | nb_sm.sbm_bp1_f2 = 0; | |
|
122 | nb_sm.sbm_bp2_f2 = 0; | |
|
123 | ||
|
124 | nb_sm_before_f2.norm_bp1_f2 = parameter_dump_packet.sy_lfr_n_bp_p0; | |
|
125 | nb_sm_before_f2.norm_bp2_f2 = parameter_dump_packet.sy_lfr_n_bp_p1; | |
|
126 | 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]; | |
|
127 | nb_sm_before_f2.sbm2_bp1_f2 = parameter_dump_packet.sy_lfr_s2_bp_p0; | |
|
128 | nb_sm_before_f2.sbm2_bp2_f2 = parameter_dump_packet.sy_lfr_s2_bp_p1; | |
|
129 | nb_sm_before_f2.burst_bp1_f2 = parameter_dump_packet.sy_lfr_b_bp_p0; | |
|
130 | nb_sm_before_f2.burst_bp2_f2 = parameter_dump_packet.sy_lfr_b_bp_p1; | |
|
131 | ||
|
132 | if (lfrMode == LFR_MODE_SBM2) | |
|
133 | { | |
|
134 | nb_sm_before_f2.burst_sbm_bp1_f2 = nb_sm_before_f2.sbm2_bp1_f2; | |
|
135 | nb_sm_before_f2.burst_sbm_bp2_f2 = nb_sm_before_f2.sbm2_bp2_f2; | |
|
136 | } | |
|
137 | else if (lfrMode == LFR_MODE_BURST) | |
|
138 | { | |
|
139 | nb_sm_before_f2.burst_sbm_bp1_f2 = nb_sm_before_f2.burst_bp1_f2; | |
|
140 | nb_sm_before_f2.burst_sbm_bp2_f2 = nb_sm_before_f2.burst_bp2_f2; | |
|
141 | } | |
|
142 | else | |
|
143 | { | |
|
144 | nb_sm_before_f2.burst_sbm_bp1_f2 = nb_sm_before_f2.burst_bp1_f2; | |
|
145 | nb_sm_before_f2.burst_sbm_bp2_f2 = nb_sm_before_f2.burst_bp2_f2; | |
|
75 | 146 | } |
|
76 | 147 | } |
|
77 | 148 | |
|
78 | 149 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
79 | 150 | { |
|
80 | 151 | ring_node_sm *previous_ring_node_sm_f0; |
|
81 | 152 | |
|
82 | 153 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
83 | 154 | |
|
84 | 155 | previous_ring_node_sm_f0 = current_ring_node_sm_f0; |
|
85 | 156 | |
|
86 | 157 | if ( (spectral_matrix_regs->status & 0x2) == 0x02) // check ready matrix bit f0_1 |
|
87 | 158 | { |
|
88 | 159 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
89 | 160 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
90 | 161 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 |
|
91 | 162 | nb_sm.f0 = nb_sm.f0 + 1; |
|
92 | 163 | } |
|
93 | 164 | |
|
94 | 165 | //************************ |
|
95 | 166 | // reset status error bits |
|
96 | 167 | if ( (spectral_matrix_regs->status & 0x30) != 0x00) |
|
97 | 168 | { |
|
98 | 169 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
99 | 170 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111 |
|
100 | 171 | } |
|
101 | 172 | |
|
102 | 173 | //************************************** |
|
103 | 174 | // reset ready matrix bits for f0_0, f1 and f2 |
|
104 | 175 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff2; // 0010 |
|
105 | 176 | |
|
106 | 177 | if (nb_sm.f0 == NB_SM_BEFORE_AVF0) |
|
107 | 178 | { |
|
108 | 179 | ring_node_for_averaging_sm_f0 = previous_ring_node_sm_f0; |
|
109 | 180 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
110 | 181 | { |
|
111 | 182 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
112 | 183 | } |
|
113 | 184 | nb_sm.f0 = 0; |
|
114 | 185 | } |
|
115 | 186 | |
|
116 | 187 | } |
|
117 | 188 | |
|
118 | 189 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) |
|
119 | 190 | { |
|
120 | 191 | if (nb_sm.f0 == (NB_SM_BEFORE_AVF0-1) ) |
|
121 | 192 | { |
|
122 | 193 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; |
|
123 | 194 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
124 | 195 | { |
|
125 | 196 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
126 | 197 | } |
|
127 | 198 | nb_sm.f0 = 0; |
|
128 | 199 | } |
|
129 | 200 | else |
|
130 | 201 | { |
|
131 | 202 | nb_sm.f0 = nb_sm.f0 + 1; |
|
132 | 203 | } |
|
133 | 204 | } |
|
134 | 205 | |
|
135 | 206 | //************ |
|
136 | 207 | // RTEMS TASKS |
|
137 | 208 | |
|
138 | 209 | rtems_task smiq_task( rtems_task_argument argument ) // process the Spectral Matrices IRQ |
|
139 | 210 | { |
|
140 | 211 | rtems_event_set event_out; |
|
141 | 212 | |
|
142 | 213 | BOOT_PRINTF("in SMIQ *** \n") |
|
143 | 214 | |
|
144 | 215 | while(1){ |
|
145 | 216 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
146 | 217 | } |
|
147 | 218 | } |
|
148 | 219 | |
|
149 | 220 | rtems_task avf0_task( rtems_task_argument lfrRequestedMode ) |
|
150 | 221 | { |
|
151 | 222 | int i; |
|
152 | 223 | |
|
153 | 224 | rtems_event_set event_out; |
|
154 | 225 | rtems_status_code status; |
|
155 |
rtems_id queue_id_ |
|
|
226 | rtems_id queue_id_prc0; | |
|
156 | 227 | asm_msg msgForMATR; |
|
157 | 228 | ring_node_sm *ring_node_tab[8]; |
|
158 | 229 | |
|
159 | 230 | reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions |
|
160 | 231 | |
|
161 | 232 | BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", lfrRequestedMode) |
|
162 | 233 | |
|
163 |
status = get_message_queue_id_ |
|
|
234 | status = get_message_queue_id_prc0( &queue_id_prc0 ); | |
|
164 | 235 | if (status != RTEMS_SUCCESSFUL) |
|
165 | 236 | { |
|
166 |
PRINTF1("in MATR *** ERR get_message_queue_id_ |
|
|
237 | PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status) | |
|
167 | 238 | } |
|
168 | 239 | |
|
169 | 240 | while(1){ |
|
170 | 241 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
171 | 242 | ring_node_tab[NB_SM_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0; |
|
172 | 243 | for ( i = 2; i < (NB_SM_BEFORE_AVF0+1); i++ ) |
|
173 | 244 | { |
|
174 | 245 | ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous; |
|
175 | 246 | ring_node_tab[NB_SM_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0; |
|
176 | 247 | } |
|
177 | 248 | |
|
178 | 249 | // compute the average and store it in the averaged_sm_f1 buffer |
|
179 | 250 | SM_average( current_ring_node_asm_norm_f0->matrix, |
|
180 | 251 | current_ring_node_asm_burst_sbm_f0->matrix, |
|
181 | 252 | ring_node_tab, |
|
182 | 253 | nb_sm.norm_bp1_f0, nb_sm.sbm_bp1_f0 ); |
|
183 | 254 | |
|
184 | 255 | // update nb_average |
|
185 | 256 | nb_sm.norm_bp1_f0 = nb_sm.norm_bp1_f0 + NB_SM_BEFORE_AVF0; |
|
186 | 257 | nb_sm.norm_bp2_f0 = nb_sm.norm_bp2_f0 + NB_SM_BEFORE_AVF0; |
|
187 | 258 | nb_sm.norm_asm_f0 = nb_sm.norm_asm_f0 + NB_SM_BEFORE_AVF0; |
|
188 | 259 | nb_sm.sbm_bp1_f0 = nb_sm.sbm_bp1_f0 + NB_SM_BEFORE_AVF0; |
|
189 | 260 | nb_sm.sbm_bp2_f0 = nb_sm.sbm_bp2_f0 + NB_SM_BEFORE_AVF0; |
|
190 | 261 | |
|
191 | 262 | //**************************************** |
|
192 | 263 | // initialize the mesage for the MATR task |
|
193 | 264 |
msgForMATR.event |
|
194 |
msgForMATR.burst_sbm |
|
|
195 |
msgForMATR.norm |
|
|
265 | msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f0; | |
|
266 | msgForMATR.norm = current_ring_node_asm_norm_f0; | |
|
196 | 267 |
msgForMATR.coarseTime |
|
197 | 268 |
msgForMATR.fineTime |
|
198 | 269 | |
|
199 |
if (nb_sm.sbm_bp1_f0 == nb_sm_before_ |
|
|
270 | if (nb_sm.sbm_bp1_f0 == nb_sm_before_f0.burst_sbm_bp1_f0) | |
|
200 | 271 | { |
|
201 | 272 | nb_sm.sbm_bp1_f0 = 0; |
|
202 | 273 | // set another ring for the ASM storage |
|
203 | 274 | current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next; |
|
204 | 275 | if ( (lfrCurrentMode == LFR_MODE_BURST) |
|
205 | 276 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
206 | 277 | { |
|
207 | 278 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F0; |
|
208 | 279 | } |
|
209 | 280 | } |
|
210 | 281 | |
|
211 |
if (nb_sm.sbm_bp2_f0 == nb_sm_before_ |
|
|
282 | if (nb_sm.sbm_bp2_f0 == nb_sm_before_f0.burst_sbm_bp2_f0) | |
|
212 | 283 | { |
|
213 | 284 | nb_sm.sbm_bp2_f0 = 0; |
|
214 | 285 | if ( (lfrCurrentMode == LFR_MODE_BURST) |
|
215 | 286 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
216 | 287 | { |
|
217 | 288 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F0; |
|
218 | 289 | } |
|
219 | 290 | } |
|
220 | 291 | |
|
221 |
if (nb_sm.norm_bp1_f0 == nb_sm_before_ |
|
|
292 | if (nb_sm.norm_bp1_f0 == nb_sm_before_f0.norm_bp1_f0) | |
|
222 | 293 | { |
|
223 | 294 | nb_sm.norm_bp1_f0 = 0; |
|
224 | 295 | // set another ring for the ASM storage |
|
225 | 296 | current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next; |
|
226 | if (lfrCurrentMode == LFR_MODE_NORMAL) | |
|
297 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
|
298 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
|
227 | 299 | { |
|
228 | 300 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F0; |
|
229 | 301 | } |
|
230 | 302 | } |
|
231 | 303 | |
|
232 |
if (nb_sm.norm_bp2_f0 == nb_sm_before_ |
|
|
304 | if (nb_sm.norm_bp2_f0 == nb_sm_before_f0.norm_bp2_f0) | |
|
233 | 305 | { |
|
234 | 306 | nb_sm.norm_bp2_f0 = 0; |
|
235 | 307 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
236 | 308 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
237 | 309 | { |
|
238 | 310 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F0; |
|
239 | 311 | } |
|
240 | 312 | } |
|
241 | 313 | |
|
242 |
if (nb_sm.norm_asm_f0 == nb_sm_before_ |
|
|
314 | if (nb_sm.norm_asm_f0 == nb_sm_before_f0.norm_asm_f0) | |
|
243 | 315 | { |
|
244 | 316 | nb_sm.norm_asm_f0 = 0; |
|
245 | 317 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
246 | 318 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
247 | 319 | { |
|
248 | 320 | // PRINTF1("%lld\n", localTime) |
|
249 | 321 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F0; |
|
250 | 322 | } |
|
251 | 323 | } |
|
252 | 324 | |
|
253 | 325 | //************************* |
|
254 | 326 | // send the message to MATR |
|
255 | 327 | if (msgForMATR.event != 0x00) |
|
256 | 328 | { |
|
257 |
status = rtems_message_queue_send( queue_id_ |
|
|
329 | status = rtems_message_queue_send( queue_id_prc0, (char *) & msgForMATR, MSG_QUEUE_SIZE_PRC0); | |
|
258 | 330 | } |
|
259 | 331 | |
|
260 | 332 | if (status != RTEMS_SUCCESSFUL) { |
|
261 | 333 | printf("in AVF0 *** Error sending message to MATR, code %d\n", status); |
|
262 | 334 | } |
|
263 | 335 | } |
|
264 | 336 | } |
|
265 | 337 | |
|
266 |
rtems_task |
|
|
338 | rtems_task prc0_task( rtems_task_argument lfrRequestedMode ) | |
|
267 | 339 | { |
|
268 | char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer | |
|
269 | size_t size; // size of the incoming TC packet | |
|
270 | asm_msg *incomingMsg; | |
|
271 | // | |
|
272 | spw_ioctl_pkt_send spw_ioctl_send_ASM; | |
|
273 | rtems_status_code status; | |
|
274 | rtems_id queue_id; | |
|
275 | rtems_id queue_id_matr; | |
|
276 | Header_TM_LFR_SCIENCE_ASM_t headerASM; | |
|
277 | bp_packet_with_spare current_node_norm_bp1_f0; | |
|
278 | bp_packet current_node_norm_bp2_f0; | |
|
279 | bp_packet current_node_sbm_bp1_f0; | |
|
280 | bp_packet current_node_sbm_bp2_f0; | |
|
340 | // char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer | |
|
341 | // size_t size; // size of the incoming TC packet | |
|
342 | // asm_msg *incomingMsg; | |
|
343 | // // | |
|
344 | // spw_ioctl_pkt_send spw_ioctl_send_ASM; | |
|
345 | // rtems_status_code status; | |
|
346 | // rtems_id queue_id; | |
|
347 | // rtems_id queue_id_matr; | |
|
348 | // Header_TM_LFR_SCIENCE_ASM_t headerASM; | |
|
349 | // bp_packet_with_spare current_node_norm_bp1_f0; | |
|
350 | // bp_packet current_node_norm_bp2_f0; | |
|
351 | // bp_packet current_node_sbm_bp1_f0; | |
|
352 | // bp_packet current_node_sbm_bp2_f0; | |
|
353 | ||
|
354 | // unsigned long long int localTime; | |
|
355 | ||
|
356 | // ASM_init_header( &headerASM ); | |
|
357 | ||
|
358 | // //************* | |
|
359 | // // NORM headers | |
|
360 | // BP_init_header_with_spare( ¤t_node_norm_bp1_f0.header, | |
|
361 | // APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0, | |
|
362 | // PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 ); | |
|
363 | // BP_init_header( ¤t_node_norm_bp2_f0.header, | |
|
364 | // APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0, | |
|
365 | // PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0); | |
|
281 | 366 | |
|
282 | unsigned long long int localTime; | |
|
283 | ||
|
284 | ASM_init_header( &headerASM ); | |
|
367 | // //**************************** | |
|
368 | // // BURST SBM1 and SBM2 headers | |
|
369 | // if ( (lfrRequestedMode == LFR_MODE_BURST) | |
|
370 | // || (lfrRequestedMode == LFR_MODE_NORMAL) || (lfrRequestedMode == LFR_MODE_STANDBY) ) | |
|
371 | // { | |
|
372 | // BP_init_header( ¤t_node_sbm_bp1_f0.header, | |
|
373 | // APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0, | |
|
374 | // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
|
375 | // BP_init_header( ¤t_node_sbm_bp2_f0.header, | |
|
376 | // APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0, | |
|
377 | // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
|
378 | // } | |
|
379 | // else if ( lfrRequestedMode == LFR_MODE_SBM1 ) | |
|
380 | // { | |
|
381 | // BP_init_header( ¤t_node_sbm_bp1_f0.header, | |
|
382 | // APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0, | |
|
383 | // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
|
384 | // BP_init_header( ¤t_node_sbm_bp2_f0.header, | |
|
385 | // APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0, | |
|
386 | // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
|
387 | // } | |
|
388 | // else if ( lfrRequestedMode == LFR_MODE_SBM2 ) | |
|
389 | // { | |
|
390 | // BP_init_header( ¤t_node_sbm_bp1_f0.header, | |
|
391 | // APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0, | |
|
392 | // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
|
393 | // BP_init_header( ¤t_node_sbm_bp2_f0.header, | |
|
394 | // APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0, | |
|
395 | // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
|
396 | // } | |
|
397 | // else | |
|
398 | // { | |
|
399 | // PRINTF1("ERR *** in MATR *** unexpected lfrRequestedMode passed as argument = %d\n", (unsigned int) lfrRequestedMode) | |
|
400 | // } | |
|
285 | 401 | |
|
286 | //************* | |
|
287 | // NORM headers | |
|
288 | BP_init_header_with_spare( ¤t_node_norm_bp1_f0.header, | |
|
289 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0, | |
|
290 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 ); | |
|
291 | BP_init_header( ¤t_node_norm_bp2_f0.header, | |
|
292 | APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0, | |
|
293 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0); | |
|
402 | // status = get_message_queue_id_send( &queue_id ); | |
|
403 | // if (status != RTEMS_SUCCESSFUL) | |
|
404 | // { | |
|
405 | // PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status) | |
|
406 | // } | |
|
407 | // status = get_message_queue_id_prc0( &queue_id_matr); | |
|
408 | // if (status != RTEMS_SUCCESSFUL) | |
|
409 | // { | |
|
410 | // PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status) | |
|
411 | // } | |
|
412 | ||
|
413 | // BOOT_PRINTF1("in PRC0 *** lfrRequestedMode = %d\n", lfrRequestedMode) | |
|
294 | 414 | |
|
295 | //**************************** | |
|
296 | // BURST SBM1 and SBM2 headers | |
|
297 | if ( (lfrRequestedMode == LFR_MODE_BURST) | |
|
298 | || (lfrRequestedMode == LFR_MODE_NORMAL) || (lfrRequestedMode == LFR_MODE_STANDBY) ) | |
|
299 | { | |
|
300 | BP_init_header( ¤t_node_sbm_bp1_f0.header, | |
|
301 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0, | |
|
302 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
|
303 | BP_init_header( ¤t_node_sbm_bp2_f0.header, | |
|
304 | APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0, | |
|
305 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
|
306 | } | |
|
307 | else if ( lfrRequestedMode == LFR_MODE_SBM1 ) | |
|
308 | { | |
|
309 | BP_init_header( ¤t_node_sbm_bp1_f0.header, | |
|
310 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0, | |
|
311 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
|
312 | BP_init_header( ¤t_node_sbm_bp2_f0.header, | |
|
313 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0, | |
|
314 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
|
315 | } | |
|
316 | else if ( lfrRequestedMode == LFR_MODE_SBM2 ) | |
|
317 | { | |
|
318 | BP_init_header( ¤t_node_sbm_bp1_f0.header, | |
|
319 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0, | |
|
320 |
|
|
|
321 | BP_init_header( ¤t_node_sbm_bp2_f0.header, | |
|
322 | APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0, | |
|
323 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0); | |
|
324 | } | |
|
325 | else | |
|
326 | { | |
|
327 | PRINTF1("ERR *** in MATR *** unexpected lfrRequestedMode passed as argument = %d\n", (unsigned int) lfrRequestedMode) | |
|
415 | // while(1){ | |
|
416 | // status = rtems_message_queue_receive( queue_id_matr, incomingData, &size, //************************************ | |
|
417 | // RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0 | |
|
418 | ||
|
419 | // incomingMsg = (asm_msg*) incomingData; | |
|
420 | ||
|
421 | // localTime = getTimeAsUnsignedLongLongInt( ); | |
|
422 | // //**************** | |
|
423 | // //**************** | |
|
424 | // // BURST SBM1 SBM2 | |
|
425 | // //**************** | |
|
426 | // //**************** | |
|
427 | // if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F0 ) | |
|
428 | // { | |
|
429 | // // 1) compress the matrix for Basic Parameters calculation | |
|
430 | // ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm, | |
|
431 | // nb_sm_before_f0.burst_sbm_bp1_f0, | |
|
432 | // NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0, | |
|
433 | // ASM_F0_INDICE_START); | |
|
434 | // // 2) compute the BP1 set | |
|
435 | ||
|
436 | // // 3) send the BP1 set | |
|
437 | // set_time( current_node_sbm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
|
438 | // set_time( current_node_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); | |
|
439 | // BP_send( (char *) ¤t_node_sbm_bp1_f0.header, queue_id, | |
|
440 | // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA); | |
|
441 | // // 4) compute the BP2 set if needed | |
|
442 | // if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F0 ) | |
|
443 | // { | |
|
444 | // // 1) compute the BP2 set | |
|
445 | ||
|
446 | // // 2) send the BP2 set | |
|
447 | // set_time( current_node_sbm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
|
448 | // set_time( current_node_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); | |
|
449 | // BP_send( (char *) ¤t_node_sbm_bp2_f0.header, queue_id, | |
|
450 | // PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA); | |
|
451 | // } | |
|
452 | // } | |
|
453 | ||
|
454 | // //***** | |
|
455 | // //***** | |
|
456 | // // NORM | |
|
457 | // //***** | |
|
458 | // //***** | |
|
459 | // if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0) | |
|
460 | // { | |
|
461 | // // 1) compress the matrix for Basic Parameters calculation | |
|
462 | // ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0, | |
|
463 | // nb_sm_before_f0.norm_bp1_f0, | |
|
464 | // NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0, | |
|
465 | // ASM_F0_INDICE_START ); | |
|
466 | // // 2) compute the BP1 set | |
|
467 | ||
|
468 | // // 3) send the BP1 set | |
|
469 | // set_time( current_node_norm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
|
470 | // set_time( current_node_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); | |
|
471 | // BP_send( (char *) ¤t_node_norm_bp1_f0.header, queue_id, | |
|
472 | // PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA); | |
|
473 | // if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0) | |
|
474 | // { | |
|
475 | // // 1) compute the BP2 set | |
|
476 | ||
|
477 | // // 2) send the BP2 set | |
|
478 | // set_time( current_node_norm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
|
479 | // set_time( current_node_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); | |
|
480 | // BP_send( (char *) ¤t_node_norm_bp2_f0.header, queue_id, | |
|
481 | // PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA); | |
|
482 | // } | |
|
483 | // } | |
|
484 | ||
|
485 | // if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0) | |
|
486 | // { | |
|
487 | // // 1) reorganize the ASM and divide | |
|
488 | // ASM_reorganize_and_divide( incomingMsg->norm->matrix, asm_f0_reorganized, NB_SM_BEFORE_NORM_BP1_F0 ); | |
|
489 | // // 2) convert the float array in a char array | |
|
490 | // ASM_convert( asm_f0_reorganized, asm_f0_char); | |
|
491 | // // 3) send the spectral matrix packets | |
|
492 | // set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime ); | |
|
493 | // set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); | |
|
494 | // ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); | |
|
495 | // } | |
|
496 | ||
|
497 | // } | |
|
328 | 498 | } |
|
329 | 499 | |
|
330 | status = get_message_queue_id_send( &queue_id ); | |
|
500 | rtems_task avf1_task( rtems_task_argument lfrRequestedMode ) | |
|
501 | { | |
|
502 | int i; | |
|
503 | ||
|
504 | rtems_event_set event_out; | |
|
505 | rtems_status_code status; | |
|
506 | rtems_id queue_id_prc1; | |
|
507 | asm_msg msgForMATR; | |
|
508 | ring_node_sm *ring_node_tab[8]; | |
|
509 | ||
|
510 | reset_nb_sm_f1( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions | |
|
511 | ||
|
512 | BOOT_PRINTF1("in AVF1 *** lfrRequestedMode = %d\n", lfrRequestedMode) | |
|
513 | ||
|
514 | status = get_message_queue_id_prc1( &queue_id_prc1 ); | |
|
331 | 515 | if (status != RTEMS_SUCCESSFUL) |
|
332 | 516 | { |
|
333 |
PRINTF1("in MATR *** ERR get_message_queue_id_ |
|
|
517 | PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status) | |
|
334 | 518 | } |
|
335 | status = get_message_queue_id_matr( &queue_id_matr); | |
|
336 | if (status != RTEMS_SUCCESSFUL) | |
|
337 | { | |
|
338 | PRINTF1("in MATR *** ERR get_message_queue_id_matr %d\n", status) | |
|
339 | } | |
|
340 | ||
|
341 | BOOT_PRINTF1("in MATR *** lfrRequestedMode = %d\n", lfrRequestedMode) | |
|
342 | 519 | |
|
343 | 520 | while(1){ |
|
344 | status = rtems_message_queue_receive( queue_id_matr, incomingData, &size, //************************************ | |
|
345 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0 | |
|
346 | ||
|
347 | incomingMsg = (asm_msg*) incomingData; | |
|
348 | ||
|
349 | localTime = getTimeAsUnsignedLongLongInt( ); | |
|
350 | //**************** | |
|
351 | //**************** | |
|
352 | // BURST SBM1 SBM2 | |
|
353 | //**************** | |
|
354 | //**************** | |
|
355 | if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F0 ) | |
|
521 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
|
522 | ring_node_tab[NB_SM_BEFORE_AVF1-1] = ring_node_for_averaging_sm_f1; | |
|
523 | for ( i = 2; i < (NB_SM_BEFORE_AVF1+1); i++ ) | |
|
356 | 524 | { |
|
357 | // 1) compress the matrix for Basic Parameters calculation | |
|
358 | ASM_compress_reorganize_and_divide( incomingMsg->burst_sbmf0->matrix, compressed_sm_sbm, | |
|
359 | nb_sm_before_bp.burst_sbm_bp1_f0, | |
|
360 | NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0, | |
|
361 | ASM_F0_INDICE_START); | |
|
362 | // 2) compute the BP1 set | |
|
525 | ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous; | |
|
526 | ring_node_tab[NB_SM_BEFORE_AVF1-i] = ring_node_for_averaging_sm_f0; | |
|
527 | } | |
|
528 | ||
|
529 | // compute the average and store it in the averaged_sm_f1 buffer | |
|
530 | SM_average( current_ring_node_asm_norm_f1->matrix, | |
|
531 | current_ring_node_asm_burst_sbm_f1->matrix, | |
|
532 | ring_node_tab, | |
|
533 | nb_sm.norm_bp1_f1, nb_sm.sbm_bp1_f1 ); | |
|
534 | ||
|
535 | // update nb_average | |
|
536 | nb_sm.norm_bp1_f1 = nb_sm.norm_bp1_f1 + NB_SM_BEFORE_AVF1; | |
|
537 | nb_sm.norm_bp2_f1 = nb_sm.norm_bp2_f1 + NB_SM_BEFORE_AVF1; | |
|
538 | nb_sm.norm_asm_f1 = nb_sm.norm_asm_f1 + NB_SM_BEFORE_AVF1; | |
|
539 | nb_sm.sbm_bp1_f1 = nb_sm.sbm_bp1_f1 + NB_SM_BEFORE_AVF1; | |
|
540 | nb_sm.sbm_bp2_f1 = nb_sm.sbm_bp2_f1 + NB_SM_BEFORE_AVF1; | |
|
363 | 541 | |
|
364 | // 3) send the BP1 set | |
|
365 | set_time( current_node_sbm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
|
366 | set_time( current_node_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); | |
|
367 | BP_send( (char *) ¤t_node_sbm_bp1_f0.header, queue_id, | |
|
368 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA); | |
|
369 | // 4) compute the BP2 set if needed | |
|
370 | if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F0 ) | |
|
542 | //**************************************** | |
|
543 | // initialize the mesage for the MATR task | |
|
544 | msgForMATR.event = 0x00; // this composite event will be sent to the MATR task | |
|
545 | msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f1; | |
|
546 | msgForMATR.norm = current_ring_node_asm_norm_f1; | |
|
547 | msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0]; | |
|
548 | msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1]; | |
|
549 | ||
|
550 | if (nb_sm.sbm_bp1_f1 == nb_sm_before_f1.burst_sbm_bp1_f1) | |
|
371 | 551 |
|
|
372 | // 1) compute the BP2 set | |
|
373 | ||
|
374 | // 2) send the BP2 set | |
|
375 | set_time( current_node_sbm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
|
376 | set_time( current_node_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); | |
|
377 | BP_send( (char *) ¤t_node_sbm_bp2_f0.header, queue_id, | |
|
378 | PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA); | |
|
552 | nb_sm.sbm_bp1_f0 = 0; | |
|
553 | // set another ring for the ASM storage | |
|
554 | current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next; | |
|
555 | if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
|
556 | { | |
|
557 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F1; | |
|
379 | 558 | } |
|
380 | 559 | } |
|
381 | 560 | |
|
382 | //***** | |
|
383 | //***** | |
|
384 | // NORM | |
|
385 | //***** | |
|
386 | //***** | |
|
387 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0) | |
|
561 | if (nb_sm.sbm_bp2_f1 == nb_sm_before_f1.burst_sbm_bp2_f1) | |
|
388 | 562 | { |
|
389 | // 1) compress the matrix for Basic Parameters calculation | |
|
390 | ASM_compress_reorganize_and_divide( incomingMsg->norm_f0->matrix, compressed_sm_norm_f0, | |
|
391 | nb_sm_before_bp.norm_bp1_f0, | |
|
392 | NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0, | |
|
393 | ASM_F0_INDICE_START ); | |
|
394 | // 2) compute the BP1 set | |
|
563 | nb_sm.sbm_bp2_f0 = 0; | |
|
564 | if ( (lfrCurrentMode == LFR_MODE_BURST) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
|
565 | { | |
|
566 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F1; | |
|
567 | } | |
|
568 | } | |
|
395 | 569 | |
|
396 | // 3) send the BP1 set | |
|
397 | set_time( current_node_norm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
|
398 | set_time( current_node_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); | |
|
399 | BP_send( (char *) ¤t_node_norm_bp1_f0.header, queue_id, | |
|
400 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA); | |
|
401 | if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0) | |
|
570 | if (nb_sm.norm_bp1_f1 == nb_sm_before_f1.norm_bp1_f1) | |
|
402 | 571 |
|
|
403 | // 1) compute the BP2 set | |
|
404 | ||
|
405 | // 2) send the BP2 set | |
|
406 | set_time( current_node_norm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime ); | |
|
407 | set_time( current_node_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime ); | |
|
408 | BP_send( (char *) ¤t_node_norm_bp2_f0.header, queue_id, | |
|
409 | PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA); | |
|
572 | nb_sm.norm_bp1_f0 = 0; | |
|
573 | // set another ring for the ASM storage | |
|
574 | current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next; | |
|
575 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
|
576 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
|
577 | { | |
|
578 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F0; | |
|
410 | 579 | } |
|
411 | 580 | } |
|
412 | 581 | |
|
413 | if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0) | |
|
582 | if (nb_sm.norm_bp2_f1 == nb_sm_before_f1.norm_bp2_f1) | |
|
414 | 583 | { |
|
415 | // 1) reorganize the ASM and divide | |
|
416 | ASM_reorganize_and_divide( incomingMsg->norm_f0->matrix, asm_f0_reorganized, NB_SM_BEFORE_NORM_BP1_F0 ); | |
|
417 | // 2) convert the float array in a char array | |
|
418 | ASM_convert( asm_f0_reorganized, asm_f0_char); | |
|
419 | // 3) send the spectral matrix packets | |
|
420 | set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime ); | |
|
421 | set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime ); | |
|
422 | ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); | |
|
584 | nb_sm.norm_bp2_f0 = 0; | |
|
585 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
|
586 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
|
587 | { | |
|
588 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F1; | |
|
589 | } | |
|
423 | 590 | } |
|
424 | 591 | |
|
592 | if (nb_sm.norm_asm_f1 == nb_sm_before_f1.norm_asm_f1) | |
|
593 | { | |
|
594 | nb_sm.norm_asm_f0 = 0; | |
|
595 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) | |
|
596 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) | |
|
597 | { | |
|
598 | msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F1; | |
|
599 | } | |
|
600 | } | |
|
601 | ||
|
602 | //************************* | |
|
603 | // send the message to MATR | |
|
604 | if (msgForMATR.event != 0x00) | |
|
605 | { | |
|
606 | status = rtems_message_queue_send( queue_id_prc1, (char *) & msgForMATR, MSG_QUEUE_SIZE_PRC1); | |
|
607 | } | |
|
608 | ||
|
609 | if (status != RTEMS_SUCCESSFUL) { | |
|
610 | printf("in AVF1 *** Error sending message to PRC1, code %d\n", status); | |
|
611 | } | |
|
425 | 612 | } |
|
426 | 613 | } |
|
427 | 614 | |
|
428 | 615 | //****************** |
|
429 | 616 | // Spectral Matrices |
|
430 | 617 | |
|
431 | 618 | void SM_init_rings( void ) |
|
432 | 619 | { |
|
433 | 620 | unsigned char i; |
|
434 | 621 | |
|
435 | 622 | // F0 RING |
|
436 | 623 | sm_ring_f0[0].next = (ring_node_sm*) &sm_ring_f0[1]; |
|
437 | 624 | sm_ring_f0[0].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-1]; |
|
438 | 625 | sm_ring_f0[0].buffer_address = |
|
439 | 626 | (int) &sm_f0[ 0 ]; |
|
440 | 627 | |
|
441 | 628 | sm_ring_f0[NB_RING_NODES_SM_F0-1].next = (ring_node_sm*) &sm_ring_f0[0]; |
|
442 | 629 | sm_ring_f0[NB_RING_NODES_SM_F0-1].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-2]; |
|
443 | 630 | sm_ring_f0[NB_RING_NODES_SM_F0-1].buffer_address = |
|
444 | 631 | (int) &sm_f0[ (NB_RING_NODES_SM_F0-1) * TOTAL_SIZE_SM ]; |
|
445 | 632 | |
|
446 | 633 | for(i=1; i<NB_RING_NODES_SM_F0-1; i++) |
|
447 | 634 | { |
|
448 | 635 | sm_ring_f0[i].next = (ring_node_sm*) &sm_ring_f0[i+1]; |
|
449 | 636 | sm_ring_f0[i].previous = (ring_node_sm*) &sm_ring_f0[i-1]; |
|
450 | 637 | sm_ring_f0[i].buffer_address = |
|
451 | 638 | (int) &sm_f0[ i * TOTAL_SIZE_SM ]; |
|
452 | 639 | } |
|
453 | 640 | |
|
454 | 641 | // F1 RING |
|
455 | 642 | sm_ring_f1[0].next = (ring_node_sm*) &sm_ring_f1[1]; |
|
456 | 643 | sm_ring_f1[0].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-1]; |
|
457 | 644 | sm_ring_f1[0].buffer_address = |
|
458 | 645 | (int) &sm_f1[ 0 ]; |
|
459 | 646 | |
|
460 | 647 | sm_ring_f1[NB_RING_NODES_SM_F1-1].next = (ring_node_sm*) &sm_ring_f1[0]; |
|
461 | 648 | sm_ring_f1[NB_RING_NODES_SM_F1-1].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-2]; |
|
462 | 649 | sm_ring_f1[NB_RING_NODES_SM_F1-1].buffer_address = |
|
463 | 650 | (int) &sm_f1[ (NB_RING_NODES_SM_F1-1) * TOTAL_SIZE_SM ]; |
|
464 | 651 | |
|
465 | 652 | for(i=1; i<NB_RING_NODES_SM_F1-1; i++) |
|
466 | 653 | { |
|
467 | 654 | sm_ring_f1[i].next = (ring_node_sm*) &sm_ring_f1[i+1]; |
|
468 | 655 | sm_ring_f1[i].previous = (ring_node_sm*) &sm_ring_f1[i-1]; |
|
469 | 656 | sm_ring_f1[i].buffer_address = |
|
470 | 657 | (int) &sm_f1[ i * TOTAL_SIZE_SM ]; |
|
471 | 658 | } |
|
472 | 659 | |
|
473 | 660 | // F2 RING |
|
474 | 661 | sm_ring_f2[0].next = (ring_node_sm*) &sm_ring_f2[1]; |
|
475 | 662 | sm_ring_f2[0].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-1]; |
|
476 | 663 | sm_ring_f2[0].buffer_address = |
|
477 | 664 | (int) &sm_f2[ 0 ]; |
|
478 | 665 | |
|
479 | 666 | sm_ring_f2[NB_RING_NODES_SM_F2-1].next = (ring_node_sm*) &sm_ring_f2[0]; |
|
480 | 667 | sm_ring_f2[NB_RING_NODES_SM_F2-1].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-2]; |
|
481 | 668 | sm_ring_f2[NB_RING_NODES_SM_F2-1].buffer_address = |
|
482 | 669 | (int) &sm_f2[ (NB_RING_NODES_SM_F2-1) * TOTAL_SIZE_SM ]; |
|
483 | 670 | |
|
484 | 671 | for(i=1; i<NB_RING_NODES_SM_F2-1; i++) |
|
485 | 672 | { |
|
486 | 673 | sm_ring_f2[i].next = (ring_node_sm*) &sm_ring_f2[i+1]; |
|
487 | 674 | sm_ring_f2[i].previous = (ring_node_sm*) &sm_ring_f2[i-1]; |
|
488 | 675 | sm_ring_f2[i].buffer_address = |
|
489 | 676 | (int) &sm_f2[ i * TOTAL_SIZE_SM ]; |
|
490 | 677 | } |
|
491 | 678 | |
|
492 | 679 | DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) |
|
493 | 680 | DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1) |
|
494 | 681 | DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2) |
|
495 | 682 | |
|
496 | 683 | spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address; |
|
497 | 684 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0) |
|
498 | 685 | } |
|
499 | 686 | |
|
500 | 687 | void ASM_init_rings( void ) |
|
501 | 688 | { |
|
502 | 689 | unsigned char i; |
|
503 | 690 | |
|
504 | 691 | //************* |
|
505 | 692 | // BURST_SBM_F0 |
|
506 | 693 | asm_ring_burst_sbm_f0[0].next = (ring_node_asm*) &asm_ring_burst_sbm_f0[1]; |
|
507 | 694 | asm_ring_burst_sbm_f0[0].previous = (ring_node_asm*) &asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-1]; |
|
508 | 695 | |
|
509 | 696 | asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-1].next |
|
510 | 697 | = (ring_node_asm*) &asm_ring_burst_sbm_f0[0]; |
|
511 | 698 | asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-1].previous |
|
512 | 699 | = (ring_node_asm*) &asm_ring_burst_sbm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-2]; |
|
513 | 700 | |
|
514 | 701 | for(i=1; i<NB_RING_NODES_ASM_BURST_SBM_F0-1; i++) |
|
515 | 702 | { |
|
516 | 703 | asm_ring_burst_sbm_f0[i].next = (ring_node_asm*) &asm_ring_burst_sbm_f0[i+1]; |
|
517 | 704 | asm_ring_burst_sbm_f0[i].previous = (ring_node_asm*) &asm_ring_burst_sbm_f0[i-1]; |
|
518 | 705 | } |
|
519 | 706 | |
|
520 | 707 | //************* |
|
521 | 708 | // NORM_F0 |
|
522 | 709 | asm_ring_norm_f0[0].next = (ring_node_asm*) &asm_ring_norm_f0[1]; |
|
523 | 710 | asm_ring_norm_f0[0].previous = (ring_node_asm*) &asm_ring_norm_f0[NB_RING_NODES_ASM_BURST_SBM_F0-1]; |
|
524 | 711 | |
|
525 | 712 | asm_ring_norm_f0[NB_RING_NODES_ASM_NORM_F0-1].next |
|
526 | 713 | = (ring_node_asm*) &asm_ring_norm_f0[0]; |
|
527 | 714 | asm_ring_norm_f0[NB_RING_NODES_ASM_NORM_F0-1].previous |
|
528 | 715 | = (ring_node_asm*) &asm_ring_norm_f0[NB_RING_NODES_ASM_NORM_F0-2]; |
|
529 | 716 | |
|
530 | 717 | for(i=1; i<NB_RING_NODES_ASM_NORM_F0-1; i++) |
|
531 | 718 | { |
|
532 | 719 | asm_ring_norm_f0[i].next = (ring_node_asm*) &asm_ring_norm_f0[i+1]; |
|
533 | 720 | asm_ring_norm_f0[i].previous = (ring_node_asm*) &asm_ring_norm_f0[i-1]; |
|
534 | 721 | } |
|
535 | 722 | } |
|
536 | 723 | |
|
537 | 724 | void SM_reset_current_ring_nodes( void ) |
|
538 | 725 | { |
|
539 | 726 | current_ring_node_sm_f0 = sm_ring_f0; |
|
540 | 727 | current_ring_node_sm_f1 = sm_ring_f1; |
|
541 | 728 | current_ring_node_sm_f2 = sm_ring_f2; |
|
542 | 729 | |
|
543 | 730 | ring_node_for_averaging_sm_f0 = sm_ring_f0; |
|
544 | 731 | } |
|
545 | 732 | |
|
546 | 733 | void ASM_reset_current_ring_node( void ) |
|
547 | 734 | { |
|
548 | 735 | current_ring_node_asm_norm_f0 = asm_ring_norm_f0; |
|
549 | 736 | current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0; |
|
550 | 737 | } |
|
551 | 738 | |
|
552 | 739 | void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header) |
|
553 | 740 | { |
|
554 | 741 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
555 | 742 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
556 | 743 | header->reserved = 0x00; |
|
557 | 744 | header->userApplication = CCSDS_USER_APP; |
|
558 | 745 | header->packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8); |
|
559 | 746 | header->packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST); |
|
560 | 747 | header->packetSequenceControl[0] = 0xc0; |
|
561 | 748 | header->packetSequenceControl[1] = 0x00; |
|
562 | 749 | header->packetLength[0] = 0x00; |
|
563 | 750 | header->packetLength[1] = 0x00; |
|
564 | 751 | // DATA FIELD HEADER |
|
565 | 752 | header->spare1_pusVersion_spare2 = 0x10; |
|
566 | 753 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
567 | 754 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
568 | 755 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
569 | 756 | // AUXILIARY DATA HEADER |
|
570 | 757 | header->sid = 0x00; |
|
571 | 758 | header->biaStatusInfo = 0x00; |
|
572 | 759 | header->pa_lfr_pkt_cnt_asm = 0x00; |
|
573 | 760 | header->pa_lfr_pkt_nr_asm = 0x00; |
|
574 | 761 | header->time[0] = 0x00; |
|
575 | 762 | header->time[0] = 0x00; |
|
576 | 763 | header->time[0] = 0x00; |
|
577 | 764 | header->time[0] = 0x00; |
|
578 | 765 | header->time[0] = 0x00; |
|
579 | 766 | header->time[0] = 0x00; |
|
580 | 767 | header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB |
|
581 | 768 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB |
|
582 | 769 | } |
|
583 | 770 | |
|
584 | 771 | void SM_average( float *averaged_spec_mat_f0, float *averaged_spec_mat_f1, |
|
585 | 772 | ring_node_sm *ring_node_tab[], |
|
586 | 773 | unsigned int nbAverageNormF0, unsigned int nbAverageSBM1F0 ) |
|
587 | 774 | { |
|
588 | 775 | float sum; |
|
589 | 776 | unsigned int i; |
|
590 | 777 | |
|
591 | 778 | for(i=0; i<TOTAL_SIZE_SM; i++) |
|
592 | 779 | { |
|
593 | 780 | sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ] |
|
594 | 781 | + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ] |
|
595 | 782 | + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ] |
|
596 | 783 | + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ] |
|
597 | 784 | + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ] |
|
598 | 785 | + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ] |
|
599 | 786 | + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ] |
|
600 | 787 | + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ]; |
|
601 | 788 | |
|
602 | 789 | if ( (nbAverageNormF0 == 0) && (nbAverageSBM1F0 == 0) ) |
|
603 | 790 | { |
|
604 | 791 | averaged_spec_mat_f0[ i ] = sum; |
|
605 | 792 | averaged_spec_mat_f1[ i ] = sum; |
|
606 | 793 | } |
|
607 | 794 | else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 != 0) ) |
|
608 | 795 | { |
|
609 | 796 | averaged_spec_mat_f0[ i ] = ( averaged_spec_mat_f0[ i ] + sum ); |
|
610 | 797 | averaged_spec_mat_f1[ i ] = ( averaged_spec_mat_f1[ i ] + sum ); |
|
611 | 798 | } |
|
612 | 799 | else if ( (nbAverageNormF0 != 0) && (nbAverageSBM1F0 == 0) ) |
|
613 | 800 | { |
|
614 | 801 | averaged_spec_mat_f0[ i ] = ( averaged_spec_mat_f0[ i ] + sum ); |
|
615 | 802 | averaged_spec_mat_f1[ i ] = sum; |
|
616 | 803 | } |
|
617 | 804 | else |
|
618 | 805 | { |
|
619 | 806 | PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNormF0, nbAverageSBM1F0) |
|
620 | 807 | } |
|
621 | 808 | } |
|
622 | 809 | } |
|
623 | 810 | |
|
624 | 811 | void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider ) |
|
625 | 812 | { |
|
626 | 813 | int frequencyBin; |
|
627 | 814 | int asmComponent; |
|
628 | 815 | unsigned int offsetAveragedSpecMatReorganized; |
|
629 | 816 | unsigned int offsetAveragedSpecMat; |
|
630 | 817 | |
|
631 | 818 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) |
|
632 | 819 | { |
|
633 | 820 | for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ ) |
|
634 | 821 | { |
|
635 | 822 | offsetAveragedSpecMatReorganized = |
|
636 | 823 | frequencyBin * NB_VALUES_PER_SM |
|
637 | 824 | + asmComponent; |
|
638 | 825 | offsetAveragedSpecMat = |
|
639 | 826 | asmComponent * NB_BINS_PER_SM |
|
640 | 827 | + frequencyBin; |
|
641 | 828 | averaged_spec_mat_reorganized[offsetAveragedSpecMatReorganized ] = |
|
642 | 829 | averaged_spec_mat[ offsetAveragedSpecMat ] / divider; |
|
643 | 830 | } |
|
644 | 831 | } |
|
645 | 832 | } |
|
646 | 833 | |
|
647 | 834 | void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider, |
|
648 | 835 | unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart ) |
|
649 | 836 | { |
|
650 | 837 | int frequencyBin; |
|
651 | 838 | int asmComponent; |
|
652 | 839 | int offsetASM; |
|
653 | 840 | int offsetCompressed; |
|
654 | 841 | int k; |
|
655 | 842 | |
|
656 | 843 | // build data |
|
657 | 844 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) |
|
658 | 845 | { |
|
659 | 846 | for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ ) |
|
660 | 847 | { |
|
661 | 848 | offsetCompressed = // NO TIME OFFSET |
|
662 | 849 | frequencyBin * NB_VALUES_PER_SM |
|
663 | 850 | + asmComponent; |
|
664 | 851 | offsetASM = // NO TIME OFFSET |
|
665 | 852 | asmComponent * NB_BINS_PER_SM |
|
666 | 853 | + ASMIndexStart |
|
667 | 854 | + frequencyBin * nbBinsToAverage; |
|
668 | 855 | compressed_spec_mat[ offsetCompressed ] = 0; |
|
669 | 856 | for ( k = 0; k < nbBinsToAverage; k++ ) |
|
670 | 857 | { |
|
671 | 858 | compressed_spec_mat[offsetCompressed ] = |
|
672 | 859 | ( compressed_spec_mat[ offsetCompressed ] |
|
673 | 860 | + averaged_spec_mat[ offsetASM + k ] ) / (divider * nbBinsToAverage); |
|
674 | 861 | } |
|
675 | 862 | } |
|
676 | 863 | } |
|
677 | 864 | } |
|
678 | 865 | |
|
679 | 866 | void ASM_convert( volatile float *input_matrix, char *output_matrix) |
|
680 | 867 | { |
|
681 | 868 | unsigned int frequencyBin; |
|
682 | 869 | unsigned int asmComponent; |
|
683 | 870 | char * pt_char_input; |
|
684 | 871 | char * pt_char_output; |
|
685 | 872 | unsigned int offsetInput; |
|
686 | 873 | unsigned int offsetOutput; |
|
687 | 874 | |
|
688 | 875 | pt_char_input = (char*) &input_matrix; |
|
689 | 876 | pt_char_output = (char*) &output_matrix; |
|
690 | 877 | |
|
691 | 878 | // convert all other data |
|
692 | 879 | for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++) |
|
693 | 880 | { |
|
694 | 881 | for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++) |
|
695 | 882 | { |
|
696 | 883 | offsetInput = (frequencyBin*NB_VALUES_PER_SM) + asmComponent ; |
|
697 | 884 | offsetOutput = 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) ; |
|
698 | 885 | pt_char_input = (char*) &input_matrix [ offsetInput ]; |
|
699 | 886 | pt_char_output = (char*) &output_matrix[ offsetOutput ]; |
|
700 | 887 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float |
|
701 | 888 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float |
|
702 | 889 | } |
|
703 | 890 | } |
|
704 | 891 | } |
|
705 | 892 | |
|
706 | 893 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
707 | 894 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) |
|
708 | 895 | { |
|
709 | 896 | unsigned int i; |
|
710 | 897 | unsigned int length = 0; |
|
711 | 898 | rtems_status_code status; |
|
712 | 899 | |
|
713 | 900 | for (i=0; i<2; i++) |
|
714 | 901 | { |
|
715 | 902 | // (1) BUILD THE DATA |
|
716 | 903 | switch(sid) |
|
717 | 904 | { |
|
718 | 905 | case SID_NORM_ASM_F0: |
|
719 | 906 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; |
|
720 | 907 | spw_ioctl_send->data = &spectral_matrix[ |
|
721 | 908 | ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2 |
|
722 | 909 | ]; |
|
723 | 910 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; |
|
724 | 911 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB |
|
725 | 912 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB |
|
726 | 913 | break; |
|
727 | 914 | case SID_NORM_ASM_F1: |
|
728 | 915 | break; |
|
729 | 916 | case SID_NORM_ASM_F2: |
|
730 | 917 | break; |
|
731 | 918 | default: |
|
732 | 919 | PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid) |
|
733 | 920 | break; |
|
734 | 921 | } |
|
735 | 922 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
736 | 923 | spw_ioctl_send->hdr = (char *) header; |
|
737 | 924 | spw_ioctl_send->options = 0; |
|
738 | 925 | |
|
739 | 926 | // (2) BUILD THE HEADER |
|
740 | 927 | header->packetLength[0] = (unsigned char) (length>>8); |
|
741 | 928 | header->packetLength[1] = (unsigned char) (length); |
|
742 | 929 | header->sid = (unsigned char) sid; // SID |
|
743 | 930 | header->pa_lfr_pkt_cnt_asm = 2; |
|
744 | 931 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); |
|
745 | 932 | |
|
746 | 933 | // (3) SET PACKET TIME |
|
747 | 934 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
748 | 935 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
749 | 936 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
750 | 937 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
751 | 938 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
752 | 939 | header->time[5] = (unsigned char) (time_management_regs->fine_time); |
|
753 | 940 | // |
|
754 | 941 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
755 | 942 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
756 | 943 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
757 | 944 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); |
|
758 | 945 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
759 | 946 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); |
|
760 | 947 | |
|
761 | 948 | // (4) SEND PACKET |
|
762 | 949 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
763 | 950 | if (status != RTEMS_SUCCESSFUL) { |
|
764 | 951 | printf("in ASM_send *** ERR %d\n", (int) status); |
|
765 | 952 | } |
|
766 | 953 | } |
|
767 | 954 | } |
|
768 | 955 | |
|
769 | 956 | //***************** |
|
770 | 957 | // Basic Parameters |
|
771 | 958 | |
|
772 | 959 | void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header, |
|
773 | 960 | unsigned int apid, unsigned char sid, |
|
774 | 961 | unsigned int packetLength, unsigned char blkNr ) |
|
775 | 962 | { |
|
776 | 963 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
777 | 964 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
778 | 965 | header->reserved = 0x00; |
|
779 | 966 | header->userApplication = CCSDS_USER_APP; |
|
780 | 967 | header->packetID[0] = (unsigned char) (apid >> 8); |
|
781 | 968 | header->packetID[1] = (unsigned char) (apid); |
|
782 | 969 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
783 | 970 | header->packetSequenceControl[1] = 0x00; |
|
784 | 971 | header->packetLength[0] = (unsigned char) (packetLength >> 8); |
|
785 | 972 | header->packetLength[1] = (unsigned char) (packetLength); |
|
786 | 973 | // DATA FIELD HEADER |
|
787 | 974 | header->spare1_pusVersion_spare2 = 0x10; |
|
788 | 975 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
789 | 976 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
790 | 977 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
791 | 978 | // AUXILIARY DATA HEADER |
|
792 | 979 | header->sid = sid; |
|
793 | 980 | header->biaStatusInfo = 0x00; |
|
794 | 981 | header->time[0] = 0x00; |
|
795 | 982 | header->time[0] = 0x00; |
|
796 | 983 | header->time[0] = 0x00; |
|
797 | 984 | header->time[0] = 0x00; |
|
798 | 985 | header->time[0] = 0x00; |
|
799 | 986 | header->time[0] = 0x00; |
|
800 | 987 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB |
|
801 | 988 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB |
|
802 | 989 | } |
|
803 | 990 | |
|
804 | 991 | void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header, |
|
805 | 992 | unsigned int apid, unsigned char sid, |
|
806 | 993 | unsigned int packetLength , unsigned char blkNr) |
|
807 | 994 | { |
|
808 | 995 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
809 | 996 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
810 | 997 | header->reserved = 0x00; |
|
811 | 998 | header->userApplication = CCSDS_USER_APP; |
|
812 | 999 | header->packetID[0] = (unsigned char) (apid >> 8); |
|
813 | 1000 | header->packetID[1] = (unsigned char) (apid); |
|
814 | 1001 | header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
815 | 1002 | header->packetSequenceControl[1] = 0x00; |
|
816 | 1003 | header->packetLength[0] = (unsigned char) (packetLength >> 8); |
|
817 | 1004 | header->packetLength[1] = (unsigned char) (packetLength); |
|
818 | 1005 | // DATA FIELD HEADER |
|
819 | 1006 | header->spare1_pusVersion_spare2 = 0x10; |
|
820 | 1007 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
821 | 1008 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
822 | 1009 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
823 | 1010 | // AUXILIARY DATA HEADER |
|
824 | 1011 | header->sid = sid; |
|
825 | 1012 | header->biaStatusInfo = 0x00; |
|
826 | 1013 | header->time[0] = 0x00; |
|
827 | 1014 | header->time[0] = 0x00; |
|
828 | 1015 | header->time[0] = 0x00; |
|
829 | 1016 | header->time[0] = 0x00; |
|
830 | 1017 | header->time[0] = 0x00; |
|
831 | 1018 | header->time[0] = 0x00; |
|
832 | 1019 | header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB |
|
833 | 1020 | header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB |
|
834 | 1021 | } |
|
835 | 1022 | |
|
836 | 1023 | void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend ) |
|
837 | 1024 | { |
|
838 | 1025 | rtems_status_code status; |
|
839 | 1026 | |
|
840 | 1027 | // SEND PACKET |
|
841 | 1028 | status = rtems_message_queue_send( queue_id, data, nbBytesToSend); |
|
842 | 1029 | if (status != RTEMS_SUCCESSFUL) |
|
843 | 1030 | { |
|
844 | 1031 | printf("ERR *** in BP_send *** ERR %d\n", (int) status); |
|
845 | 1032 | } |
|
846 | 1033 | } |
|
847 | 1034 | |
|
848 | 1035 | //****************** |
|
849 | 1036 | // general functions |
|
850 | 1037 | |
|
851 | 1038 | void reset_spectral_matrix_regs( void ) |
|
852 | 1039 | { |
|
853 | 1040 | /** This function resets the spectral matrices module registers. |
|
854 | 1041 | * |
|
855 | 1042 | * The registers affected by this function are located at the following offset addresses: |
|
856 | 1043 | * |
|
857 | 1044 | * - 0x00 config |
|
858 | 1045 | * - 0x04 status |
|
859 | 1046 | * - 0x08 matrixF0_Address0 |
|
860 | 1047 | * - 0x10 matrixFO_Address1 |
|
861 | 1048 | * - 0x14 matrixF1_Address |
|
862 | 1049 | * - 0x18 matrixF2_Address |
|
863 | 1050 | * |
|
864 | 1051 | */ |
|
865 | 1052 | |
|
866 | 1053 | spectral_matrix_regs->config = 0x00; |
|
867 | 1054 | spectral_matrix_regs->status = 0x00; |
|
868 | 1055 | |
|
869 | 1056 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
870 | 1057 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; |
|
871 | 1058 | spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address; |
|
872 | 1059 | spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address; |
|
873 | 1060 | } |
|
874 | 1061 | |
|
875 | 1062 | void set_time( unsigned char *time, unsigned char * timeInBuffer ) |
|
876 | 1063 | { |
|
877 | 1064 | // time[0] = timeInBuffer[2]; |
|
878 | 1065 | // time[1] = timeInBuffer[3]; |
|
879 | 1066 | // time[2] = timeInBuffer[0]; |
|
880 | 1067 | // time[3] = timeInBuffer[1]; |
|
881 | 1068 | // time[4] = timeInBuffer[6]; |
|
882 | 1069 | // time[5] = timeInBuffer[7]; |
|
883 | 1070 | |
|
884 | 1071 | time[0] = timeInBuffer[0]; |
|
885 | 1072 | time[1] = timeInBuffer[1]; |
|
886 | 1073 | time[2] = timeInBuffer[2]; |
|
887 | 1074 | time[3] = timeInBuffer[3]; |
|
888 | 1075 | time[4] = timeInBuffer[6]; |
|
889 | 1076 | time[5] = timeInBuffer[7]; |
|
890 | 1077 | } |
|
891 | 1078 | |
|
892 | 1079 |
@@ -1,888 +1,888 | |||
|
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, BPF0, WFRM, CWF3, CW2, CWF1 |
|
575 | 575 | * |
|
576 | 576 | */ |
|
577 | 577 | |
|
578 | 578 | rtems_status_code status[7]; |
|
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 *** 0 ERR %d\n", status[0]) |
|
587 | 587 | } |
|
588 | 588 | |
|
589 | 589 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); |
|
590 | 590 | if (status[2] != RTEMS_SUCCESSFUL) |
|
591 | 591 | { |
|
592 | 592 | PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2]) |
|
593 | 593 | } |
|
594 | 594 | |
|
595 | 595 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); |
|
596 | 596 | if (status[3] != RTEMS_SUCCESSFUL) |
|
597 | 597 | { |
|
598 | 598 | PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3]) |
|
599 | 599 | } |
|
600 | 600 | |
|
601 | 601 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); |
|
602 | 602 | if (status[4] != RTEMS_SUCCESSFUL) |
|
603 | 603 | { |
|
604 | 604 | PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4]) |
|
605 | 605 | } |
|
606 | 606 | |
|
607 | 607 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); |
|
608 | 608 | if (status[5] != RTEMS_SUCCESSFUL) |
|
609 | 609 | { |
|
610 | 610 | PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5]) |
|
611 | 611 | } |
|
612 | 612 | |
|
613 |
status[6] = rtems_task_restart( Task_id[TASKID_ |
|
|
613 | status[6] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode ); | |
|
614 | 614 | if (status[6] != RTEMS_SUCCESSFUL) |
|
615 | 615 | { |
|
616 | 616 | PRINTF1("in restart_science_task *** 6 ERR %d\n", status[6]) |
|
617 | 617 | } |
|
618 | 618 | |
|
619 | 619 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || |
|
620 | 620 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || |
|
621 | 621 | (status[5] != RTEMS_SUCCESSFUL) || (status[6] != RTEMS_SUCCESSFUL) ) |
|
622 | 622 | { |
|
623 | 623 | ret = RTEMS_UNSATISFIED; |
|
624 | 624 | } |
|
625 | 625 | |
|
626 | 626 | return ret; |
|
627 | 627 | } |
|
628 | 628 | |
|
629 | 629 | int suspend_science_tasks() |
|
630 | 630 | { |
|
631 | 631 | /** This function suspends the science tasks. |
|
632 | 632 | * |
|
633 | 633 | * @return RTEMS directive status codes: |
|
634 | 634 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
635 | 635 | * - RTEMS_INVALID_ID - task id invalid |
|
636 | 636 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
637 | 637 | * |
|
638 | 638 | */ |
|
639 | 639 | |
|
640 | 640 | rtems_status_code status; |
|
641 | 641 | |
|
642 | 642 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); |
|
643 | 643 | if (status != RTEMS_SUCCESSFUL) |
|
644 | 644 | { |
|
645 | 645 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) |
|
646 | 646 | } |
|
647 | 647 | |
|
648 | 648 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM |
|
649 | 649 | { |
|
650 | 650 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
651 | 651 | if (status != RTEMS_SUCCESSFUL) |
|
652 | 652 | { |
|
653 | 653 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) |
|
654 | 654 | } |
|
655 | 655 | } |
|
656 | 656 | |
|
657 | 657 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 |
|
658 | 658 | { |
|
659 | 659 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); |
|
660 | 660 | if (status != RTEMS_SUCCESSFUL) |
|
661 | 661 | { |
|
662 | 662 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) |
|
663 | 663 | } |
|
664 | 664 | } |
|
665 | 665 | |
|
666 | 666 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 |
|
667 | 667 | { |
|
668 | 668 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); |
|
669 | 669 | if (status != RTEMS_SUCCESSFUL) |
|
670 | 670 | { |
|
671 | 671 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) |
|
672 | 672 | } |
|
673 | 673 | } |
|
674 | 674 | |
|
675 | 675 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 |
|
676 | 676 | { |
|
677 | 677 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
|
678 | 678 | if (status != RTEMS_SUCCESSFUL) |
|
679 | 679 | { |
|
680 | 680 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) |
|
681 | 681 | } |
|
682 | 682 | } |
|
683 | 683 | |
|
684 | 684 | return status; |
|
685 | 685 | } |
|
686 | 686 | |
|
687 | 687 | void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime ) |
|
688 | 688 | { |
|
689 | 689 | reset_current_ring_nodes(); |
|
690 | 690 | reset_waveform_picker_regs(); |
|
691 | 691 | set_wfp_burst_enable_register( mode ); |
|
692 | 692 | |
|
693 | 693 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
694 | 694 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
695 | 695 | |
|
696 | 696 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] |
|
697 | 697 | if (transitionCoarseTime == 0) |
|
698 | 698 | { |
|
699 | 699 | waveform_picker_regs->start_date = time_management_regs->coarse_time; |
|
700 | 700 | } |
|
701 | 701 | else |
|
702 | 702 | { |
|
703 | 703 | waveform_picker_regs->start_date = transitionCoarseTime; |
|
704 | 704 | } |
|
705 | 705 | } |
|
706 | 706 | |
|
707 | 707 | void launch_spectral_matrix( void ) |
|
708 | 708 | { |
|
709 | 709 | SM_reset_current_ring_nodes(); |
|
710 | 710 | ASM_reset_current_ring_node(); |
|
711 | 711 | reset_spectral_matrix_regs(); |
|
712 | 712 | |
|
713 | 713 | struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO; |
|
714 | 714 | grgpio_regs->io_port_direction_register = |
|
715 | 715 | grgpio_regs->io_port_direction_register | 0x01; // [0000 0001], 0 = output disabled, 1 = output enabled |
|
716 | 716 | grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfffffffe; // set the bit 0 to 0 |
|
717 | 717 | set_irq_on_new_ready_matrix( 1 ); |
|
718 | 718 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
719 | 719 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
720 | 720 | set_run_matrix_spectral( 1 ); |
|
721 | 721 | |
|
722 | 722 | } |
|
723 | 723 | |
|
724 | 724 | void launch_spectral_matrix_simu( void ) |
|
725 | 725 | { |
|
726 | 726 | SM_reset_current_ring_nodes(); |
|
727 | 727 | ASM_reset_current_ring_node(); |
|
728 | 728 | reset_spectral_matrix_regs(); |
|
729 | 729 | |
|
730 | 730 | // Spectral Matrices simulator |
|
731 | 731 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
732 | 732 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); |
|
733 | 733 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); |
|
734 | 734 | set_local_nb_interrupt_f0_MAX(); |
|
735 | 735 | } |
|
736 | 736 | |
|
737 | 737 | void set_irq_on_new_ready_matrix( unsigned char value ) |
|
738 | 738 | { |
|
739 | 739 | if (value == 1) |
|
740 | 740 | { |
|
741 | 741 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; |
|
742 | 742 | } |
|
743 | 743 | else |
|
744 | 744 | { |
|
745 | 745 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 |
|
746 | 746 | } |
|
747 | 747 | } |
|
748 | 748 | |
|
749 | 749 | void set_run_matrix_spectral( unsigned char value ) |
|
750 | 750 | { |
|
751 | 751 | if (value == 1) |
|
752 | 752 | { |
|
753 | 753 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1 |
|
754 | 754 | } |
|
755 | 755 | else |
|
756 | 756 | { |
|
757 | 757 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0 |
|
758 | 758 | } |
|
759 | 759 | } |
|
760 | 760 | |
|
761 | 761 | //**************** |
|
762 | 762 | // CLOSING ACTIONS |
|
763 | 763 | void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time ) |
|
764 | 764 | { |
|
765 | 765 | /** This function is used to update the HK packets statistics after a successful TC execution. |
|
766 | 766 | * |
|
767 | 767 | * @param TC points to the TC being processed |
|
768 | 768 | * @param time is the time used to date the TC execution |
|
769 | 769 | * |
|
770 | 770 | */ |
|
771 | 771 | |
|
772 | 772 | unsigned int val; |
|
773 | 773 | |
|
774 | 774 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; |
|
775 | 775 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; |
|
776 | 776 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; |
|
777 | 777 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; |
|
778 | 778 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; |
|
779 | 779 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; |
|
780 | 780 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0]; |
|
781 | 781 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1]; |
|
782 | 782 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2]; |
|
783 | 783 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3]; |
|
784 | 784 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4]; |
|
785 | 785 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5]; |
|
786 | 786 | |
|
787 | 787 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; |
|
788 | 788 | val++; |
|
789 | 789 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); |
|
790 | 790 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); |
|
791 | 791 | } |
|
792 | 792 | |
|
793 | 793 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time ) |
|
794 | 794 | { |
|
795 | 795 | /** This function is used to update the HK packets statistics after a TC rejection. |
|
796 | 796 | * |
|
797 | 797 | * @param TC points to the TC being processed |
|
798 | 798 | * @param time is the time used to date the TC rejection |
|
799 | 799 | * |
|
800 | 800 | */ |
|
801 | 801 | |
|
802 | 802 | unsigned int val; |
|
803 | 803 | |
|
804 | 804 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; |
|
805 | 805 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; |
|
806 | 806 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; |
|
807 | 807 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; |
|
808 | 808 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; |
|
809 | 809 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; |
|
810 | 810 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0]; |
|
811 | 811 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1]; |
|
812 | 812 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2]; |
|
813 | 813 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3]; |
|
814 | 814 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4]; |
|
815 | 815 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5]; |
|
816 | 816 | |
|
817 | 817 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; |
|
818 | 818 | val++; |
|
819 | 819 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); |
|
820 | 820 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); |
|
821 | 821 | } |
|
822 | 822 | |
|
823 | 823 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ) |
|
824 | 824 | { |
|
825 | 825 | /** This function is the last step of the TC execution workflow. |
|
826 | 826 | * |
|
827 | 827 | * @param TC points to the TC being processed |
|
828 | 828 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) |
|
829 | 829 | * @param queue_id is the id of the RTEMS message queue used to send TM packets |
|
830 | 830 | * @param time is the time used to date the TC execution |
|
831 | 831 | * |
|
832 | 832 | */ |
|
833 | 833 | |
|
834 | 834 | unsigned char requestedMode; |
|
835 | 835 | |
|
836 | 836 | if (result == LFR_SUCCESSFUL) |
|
837 | 837 | { |
|
838 | 838 | if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
839 | 839 | & |
|
840 | 840 | !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
841 | 841 | ) |
|
842 | 842 | { |
|
843 | 843 | send_tm_lfr_tc_exe_success( TC, queue_id ); |
|
844 | 844 | } |
|
845 | 845 | if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) ) |
|
846 | 846 | { |
|
847 | 847 | //********************************** |
|
848 | 848 | // UPDATE THE LFRMODE LOCAL VARIABLE |
|
849 | 849 | requestedMode = TC->dataAndCRC[1]; |
|
850 | 850 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d); |
|
851 | 851 | updateLFRCurrentMode(); |
|
852 | 852 | } |
|
853 | 853 | } |
|
854 | 854 | else if (result == LFR_EXE_ERROR) |
|
855 | 855 | { |
|
856 | 856 | send_tm_lfr_tc_exe_error( TC, queue_id ); |
|
857 | 857 | } |
|
858 | 858 | } |
|
859 | 859 | |
|
860 | 860 | //*************************** |
|
861 | 861 | // Interrupt Service Routines |
|
862 | 862 | rtems_isr commutation_isr1( rtems_vector_number vector ) |
|
863 | 863 | { |
|
864 | 864 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
865 | 865 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); |
|
866 | 866 | } |
|
867 | 867 | } |
|
868 | 868 | |
|
869 | 869 | rtems_isr commutation_isr2( rtems_vector_number vector ) |
|
870 | 870 | { |
|
871 | 871 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
872 | 872 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); |
|
873 | 873 | } |
|
874 | 874 | } |
|
875 | 875 | |
|
876 | 876 | //**************** |
|
877 | 877 | // OTHER FUNCTIONS |
|
878 | 878 | void updateLFRCurrentMode() |
|
879 | 879 | { |
|
880 | 880 | /** This function updates the value of the global variable lfrCurrentMode. |
|
881 | 881 | * |
|
882 | 882 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. |
|
883 | 883 | * |
|
884 | 884 | */ |
|
885 | 885 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure |
|
886 | 886 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
887 | 887 | } |
|
888 | 888 |
General Comments 0
You need to be logged in to leave comments.
Login now