@@ -1,253 +1,253 | |||
|
1 | 1 | ############################################################################# |
|
2 | 2 | # Makefile for building: bin/fsw |
|
3 |
# Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Mar |
|
|
3 | # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Mar 11 15:58:37 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=3 -DPRINT_MESSAGES_ON_CONSOLE | |
|
13 | DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=3 -DPRINT_MESSAGES_ON_CONSOLE -DDEBUG_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../../LFR_basic-parameters |
|
17 | 17 | LINK = sparc-rtems-g++ |
|
18 | 18 | LFLAGS = |
|
19 | 19 | LIBS = $(SUBLIBS) |
|
20 | 20 | AR = sparc-rtems-ar rcs |
|
21 | 21 | RANLIB = |
|
22 | 22 | QMAKE = /usr/bin/qmake-qt4 |
|
23 | 23 | TAR = tar -cf |
|
24 | 24 | COMPRESS = gzip -9f |
|
25 | 25 | COPY = cp -f |
|
26 | 26 | SED = sed |
|
27 | 27 | COPY_FILE = $(COPY) |
|
28 | 28 | COPY_DIR = $(COPY) -r |
|
29 | 29 | STRIP = sparc-rtems-strip |
|
30 | 30 | INSTALL_FILE = install -m 644 -p |
|
31 | 31 | INSTALL_DIR = $(COPY_DIR) |
|
32 | 32 | INSTALL_PROGRAM = install -m 755 -p |
|
33 | 33 | DEL_FILE = rm -f |
|
34 | 34 | SYMLINK = ln -f -s |
|
35 | 35 | DEL_DIR = rmdir |
|
36 | 36 | MOVE = mv -f |
|
37 | 37 | CHK_DIR_EXISTS= test -d |
|
38 | 38 | MKDIR = mkdir -p |
|
39 | 39 | |
|
40 | 40 | ####### Output directory |
|
41 | 41 | |
|
42 | 42 | OBJECTS_DIR = obj/ |
|
43 | 43 | |
|
44 | 44 | ####### Files |
|
45 | 45 | |
|
46 | 46 | SOURCES = ../src/wf_handler.c \ |
|
47 | 47 | ../src/tc_handler.c \ |
|
48 | 48 | ../src/fsw_processing.c \ |
|
49 | 49 | ../src/fsw_misc.c \ |
|
50 | 50 | ../src/fsw_init.c \ |
|
51 | 51 | ../src/fsw_globals.c \ |
|
52 | 52 | ../src/fsw_spacewire.c \ |
|
53 | 53 | ../src/tc_load_dump_parameters.c \ |
|
54 | 54 | ../src/tm_lfr_tc_exe.c \ |
|
55 | 55 | ../src/tc_acceptance.c \ |
|
56 | 56 | ../../LFR_basic-parameters/basic_parameters.c |
|
57 | 57 | OBJECTS = obj/wf_handler.o \ |
|
58 | 58 | obj/tc_handler.o \ |
|
59 | 59 | obj/fsw_processing.o \ |
|
60 | 60 | obj/fsw_misc.o \ |
|
61 | 61 | obj/fsw_init.o \ |
|
62 | 62 | obj/fsw_globals.o \ |
|
63 | 63 | obj/fsw_spacewire.o \ |
|
64 | 64 | obj/tc_load_dump_parameters.o \ |
|
65 | 65 | obj/tm_lfr_tc_exe.o \ |
|
66 | 66 | obj/tc_acceptance.o \ |
|
67 | 67 | obj/basic_parameters.o |
|
68 | 68 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
69 | 69 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
70 | 70 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
71 | 71 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
72 | 72 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
73 | 73 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
74 | 74 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
75 | 75 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
76 | 76 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
77 | 77 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
78 | 78 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
79 | 79 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
80 | 80 | sparc.pri \ |
|
81 | 81 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
82 | 82 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
83 | 83 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
84 | 84 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
85 | 85 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
86 | 86 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
87 | 87 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
88 | 88 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
89 | 89 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
90 | 90 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ |
|
91 | 91 | fsw-qt.pro |
|
92 | 92 | QMAKE_TARGET = fsw |
|
93 | 93 | DESTDIR = bin/ |
|
94 | 94 | TARGET = bin/fsw |
|
95 | 95 | |
|
96 | 96 | first: all |
|
97 | 97 | ####### Implicit rules |
|
98 | 98 | |
|
99 | 99 | .SUFFIXES: .o .c .cpp .cc .cxx .C |
|
100 | 100 | |
|
101 | 101 | .cpp.o: |
|
102 | 102 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
103 | 103 | |
|
104 | 104 | .cc.o: |
|
105 | 105 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
106 | 106 | |
|
107 | 107 | .cxx.o: |
|
108 | 108 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
109 | 109 | |
|
110 | 110 | .C.o: |
|
111 | 111 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
112 | 112 | |
|
113 | 113 | .c.o: |
|
114 | 114 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" |
|
115 | 115 | |
|
116 | 116 | ####### Build rules |
|
117 | 117 | |
|
118 | 118 | all: Makefile $(TARGET) |
|
119 | 119 | |
|
120 | 120 | $(TARGET): $(OBJECTS) |
|
121 | 121 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ |
|
122 | 122 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) |
|
123 | 123 | |
|
124 | 124 | Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
125 | 125 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
126 | 126 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
127 | 127 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
128 | 128 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
129 | 129 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
130 | 130 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
131 | 131 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
132 | 132 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
133 | 133 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
134 | 134 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
135 | 135 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
136 | 136 | sparc.pri \ |
|
137 | 137 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
138 | 138 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
139 | 139 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
140 | 140 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
141 | 141 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
142 | 142 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
143 | 143 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
144 | 144 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
145 | 145 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
146 | 146 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf |
|
147 | 147 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
148 | 148 | /usr/lib64/qt4/mkspecs/common/unix.conf: |
|
149 | 149 | /usr/lib64/qt4/mkspecs/common/linux.conf: |
|
150 | 150 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: |
|
151 | 151 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: |
|
152 | 152 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: |
|
153 | 153 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: |
|
154 | 154 | /usr/lib64/qt4/mkspecs/qconfig.pri: |
|
155 | 155 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: |
|
156 | 156 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: |
|
157 | 157 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: |
|
158 | 158 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: |
|
159 | 159 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: |
|
160 | 160 | sparc.pri: |
|
161 | 161 | /usr/lib64/qt4/mkspecs/features/release.prf: |
|
162 | 162 | /usr/lib64/qt4/mkspecs/features/default_post.prf: |
|
163 | 163 | /usr/lib64/qt4/mkspecs/features/shared.prf: |
|
164 | 164 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: |
|
165 | 165 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: |
|
166 | 166 | /usr/lib64/qt4/mkspecs/features/resources.prf: |
|
167 | 167 | /usr/lib64/qt4/mkspecs/features/uic.prf: |
|
168 | 168 | /usr/lib64/qt4/mkspecs/features/yacc.prf: |
|
169 | 169 | /usr/lib64/qt4/mkspecs/features/lex.prf: |
|
170 | 170 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: |
|
171 | 171 | qmake: FORCE |
|
172 | 172 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
173 | 173 | |
|
174 | 174 | dist: |
|
175 | 175 | @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0 |
|
176 | 176 | $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0 |
|
177 | 177 | |
|
178 | 178 | |
|
179 | 179 | clean:compiler_clean |
|
180 | 180 | -$(DEL_FILE) $(OBJECTS) |
|
181 | 181 | -$(DEL_FILE) *~ core *.core |
|
182 | 182 | |
|
183 | 183 | |
|
184 | 184 | ####### Sub-libraries |
|
185 | 185 | |
|
186 | 186 | distclean: clean |
|
187 | 187 | -$(DEL_FILE) $(TARGET) |
|
188 | 188 | -$(DEL_FILE) Makefile |
|
189 | 189 | |
|
190 | 190 | |
|
191 | 191 | grmon: |
|
192 | 192 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u |
|
193 | 193 | |
|
194 | 194 | check: first |
|
195 | 195 | |
|
196 | 196 | compiler_rcc_make_all: |
|
197 | 197 | compiler_rcc_clean: |
|
198 | 198 | compiler_uic_make_all: |
|
199 | 199 | compiler_uic_clean: |
|
200 | 200 | compiler_image_collection_make_all: qmake_image_collection.cpp |
|
201 | 201 | compiler_image_collection_clean: |
|
202 | 202 | -$(DEL_FILE) qmake_image_collection.cpp |
|
203 | 203 | compiler_yacc_decl_make_all: |
|
204 | 204 | compiler_yacc_decl_clean: |
|
205 | 205 | compiler_yacc_impl_make_all: |
|
206 | 206 | compiler_yacc_impl_clean: |
|
207 | 207 | compiler_lex_make_all: |
|
208 | 208 | compiler_lex_clean: |
|
209 | 209 | compiler_clean: |
|
210 | 210 | |
|
211 | 211 | ####### Compile |
|
212 | 212 | |
|
213 | 213 | obj/wf_handler.o: ../src/wf_handler.c |
|
214 | 214 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c |
|
215 | 215 | |
|
216 | 216 | obj/tc_handler.o: ../src/tc_handler.c |
|
217 | 217 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c |
|
218 | 218 | |
|
219 | 219 | obj/fsw_processing.o: ../src/fsw_processing.c ../src/fsw_processing_globals.c |
|
220 | 220 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c |
|
221 | 221 | |
|
222 | 222 | obj/fsw_misc.o: ../src/fsw_misc.c |
|
223 | 223 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c |
|
224 | 224 | |
|
225 | 225 | obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c |
|
226 | 226 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c |
|
227 | 227 | |
|
228 | 228 | obj/fsw_globals.o: ../src/fsw_globals.c |
|
229 | 229 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c |
|
230 | 230 | |
|
231 | 231 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c |
|
232 | 232 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c |
|
233 | 233 | |
|
234 | 234 | obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c |
|
235 | 235 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c |
|
236 | 236 | |
|
237 | 237 | obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c |
|
238 | 238 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c |
|
239 | 239 | |
|
240 | 240 | obj/tc_acceptance.o: ../src/tc_acceptance.c |
|
241 | 241 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c |
|
242 | 242 | |
|
243 | 243 | obj/basic_parameters.o: ../../LFR_basic-parameters/basic_parameters.c ../../LFR_basic-parameters/basic_parameters.h |
|
244 | 244 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../../LFR_basic-parameters/basic_parameters.c |
|
245 | 245 | |
|
246 | 246 | ####### Install |
|
247 | 247 | |
|
248 | 248 | install: FORCE |
|
249 | 249 | |
|
250 | 250 | uninstall: FORCE |
|
251 | 251 | |
|
252 | 252 | FORCE: |
|
253 | 253 |
@@ -1,77 +1,81 | |||
|
1 | 1 | TEMPLATE = app |
|
2 | 2 | # CONFIG += console v8 sim |
|
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report | |
|
4 | CONFIG += console verbose | |
|
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev | |
|
4 | CONFIG += console verbose debug_messages | |
|
5 | 5 | CONFIG -= qt |
|
6 | 6 | |
|
7 | 7 | include(./sparc.pri) |
|
8 | 8 | |
|
9 | 9 | # flight software version |
|
10 | 10 | SWVERSION=-1-0 |
|
11 | 11 | DEFINES += SW_VERSION_N1=1 # major |
|
12 | 12 | DEFINES += SW_VERSION_N2=0 # minor |
|
13 | 13 | DEFINES += SW_VERSION_N3=0 # patch |
|
14 | 14 | DEFINES += SW_VERSION_N4=3 # internal |
|
15 | 15 | |
|
16 | contains( CONFIG, vhdl_dev ) { | |
|
17 | DEFINES += VHDL_DEV | |
|
18 | } | |
|
19 | ||
|
16 | 20 | contains( CONFIG, verbose ) { |
|
17 | 21 | DEFINES += PRINT_MESSAGES_ON_CONSOLE |
|
18 | 22 | } |
|
19 | 23 | |
|
20 | 24 | contains( CONFIG, debug_messages ) { |
|
21 | 25 | DEFINES += DEBUG_MESSAGES |
|
22 | 26 | } |
|
23 | 27 | |
|
24 | 28 | contains( CONFIG, cpu_usage_report ) { |
|
25 | 29 | DEFINES += PRINT_TASK_STATISTICS |
|
26 | 30 | } |
|
27 | 31 | |
|
28 | 32 | contains( CONFIG, stack_report ) { |
|
29 | 33 | DEFINES += PRINT_STACK_REPORT |
|
30 | 34 | } |
|
31 | 35 | |
|
32 | 36 | contains( CONFIG, boot_messages ) { |
|
33 | 37 | DEFINES += BOOT_MESSAGES |
|
34 | 38 | } |
|
35 | 39 | |
|
36 | 40 | #doxygen.target = doxygen |
|
37 | 41 | #doxygen.commands = doxygen ../doc/Doxyfile |
|
38 | 42 | #QMAKE_EXTRA_TARGETS += doxygen |
|
39 | 43 | |
|
40 | 44 | TARGET = fsw |
|
41 | 45 | |
|
42 | 46 | INCLUDEPATH += \ |
|
43 | 47 | ../src \ |
|
44 | 48 | ../header \ |
|
45 | 49 | ../../LFR_basic-parameters |
|
46 | 50 | |
|
47 | 51 | SOURCES += \ |
|
48 | 52 | ../src/wf_handler.c \ |
|
49 | 53 | ../src/tc_handler.c \ |
|
50 | 54 | ../src/fsw_processing.c \ |
|
51 | 55 | ../src/fsw_misc.c \ |
|
52 | 56 | ../src/fsw_init.c \ |
|
53 | 57 | ../src/fsw_globals.c \ |
|
54 | 58 | ../src/fsw_spacewire.c \ |
|
55 | 59 | ../src/tc_load_dump_parameters.c \ |
|
56 | 60 | ../src/tm_lfr_tc_exe.c \ |
|
57 | 61 | ../src/tc_acceptance.c \ |
|
58 | 62 | ../../LFR_basic-parameters/basic_parameters.c |
|
59 | 63 | |
|
60 | 64 | |
|
61 | 65 | HEADERS += \ |
|
62 | 66 | ../header/wf_handler.h \ |
|
63 | 67 | ../header/tc_handler.h \ |
|
64 | 68 | ../header/grlib_regs.h \ |
|
65 | 69 | ../header/fsw_processing.h \ |
|
66 | 70 | ../header/fsw_params.h \ |
|
67 | 71 | ../header/fsw_misc.h \ |
|
68 | 72 | ../header/fsw_init.h \ |
|
69 | 73 | ../header/ccsds_types.h \ |
|
70 | 74 | ../header/fsw_params_processing.h \ |
|
71 | 75 | ../header/fsw_spacewire.h \ |
|
72 | 76 | ../header/tc_load_dump_parameters.h \ |
|
73 | 77 | ../header/tm_lfr_tc_exe.h \ |
|
74 | 78 | ../header/tc_acceptance.h \ |
|
75 | 79 | ../header/fsw_params_nb_bytes.h \ |
|
76 | 80 | ../../LFR_basic-parameters/basic_parameters.h |
|
77 | 81 |
@@ -1,339 +1,339 | |||
|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
|
2 | 2 | <!DOCTYPE QtCreatorProject> |
|
3 |
<!-- Written by QtCreator 3.0. |
|
|
3 | <!-- Written by QtCreator 3.0.1, 2014-03-13T15:53:26. --> | |
|
4 | 4 | <qtcreator> |
|
5 | 5 | <data> |
|
6 | 6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
7 | 7 | <value type="int">1</value> |
|
8 | 8 | </data> |
|
9 | 9 | <data> |
|
10 | 10 | <variable>ProjectExplorer.Project.EditorSettings</variable> |
|
11 | 11 | <valuemap type="QVariantMap"> |
|
12 | 12 | <value type="bool" key="EditorConfiguration.AutoIndent">true</value> |
|
13 | 13 | <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value> |
|
14 | 14 | <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value> |
|
15 | 15 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0"> |
|
16 | 16 | <value type="QString" key="language">Cpp</value> |
|
17 | 17 | <valuemap type="QVariantMap" key="value"> |
|
18 | 18 | <value type="QByteArray" key="CurrentPreferences">CppGlobal</value> |
|
19 | 19 | </valuemap> |
|
20 | 20 | </valuemap> |
|
21 | 21 | <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1"> |
|
22 | 22 | <value type="QString" key="language">QmlJS</value> |
|
23 | 23 | <valuemap type="QVariantMap" key="value"> |
|
24 | 24 | <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value> |
|
25 | 25 | </valuemap> |
|
26 | 26 | </valuemap> |
|
27 | 27 | <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value> |
|
28 | 28 | <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value> |
|
29 | 29 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> |
|
30 | 30 | <value type="int" key="EditorConfiguration.IndentSize">4</value> |
|
31 | 31 | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> |
|
32 | 32 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> |
|
33 | 33 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> |
|
34 | 34 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> |
|
35 | 35 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> |
|
36 | 36 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> |
|
37 | 37 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> |
|
38 | 38 | <value type="int" key="EditorConfiguration.TabSize">8</value> |
|
39 | 39 | <value type="bool" key="EditorConfiguration.UseGlobal">true</value> |
|
40 | 40 | <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value> |
|
41 | 41 | <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value> |
|
42 | 42 | <value type="bool" key="EditorConfiguration.cleanIndentation">true</value> |
|
43 | 43 | <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value> |
|
44 | 44 | <value type="bool" key="EditorConfiguration.inEntireDocument">false</value> |
|
45 | 45 | </valuemap> |
|
46 | 46 | </data> |
|
47 | 47 | <data> |
|
48 | 48 | <variable>ProjectExplorer.Project.PluginSettings</variable> |
|
49 | 49 | <valuemap type="QVariantMap"/> |
|
50 | 50 | </data> |
|
51 | 51 | <data> |
|
52 | 52 | <variable>ProjectExplorer.Project.Target.0</variable> |
|
53 | 53 | <valuemap type="QVariantMap"> |
|
54 | 54 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value> |
|
55 | 55 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value> |
|
56 | 56 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{e04e3924-0bd8-4708-be18-f1474e45608e}</value> |
|
57 | 57 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
|
58 | 58 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
|
59 | 59 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
|
60 | 60 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
|
61 | 61 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> |
|
62 | 62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
63 | 63 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
64 | 64 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
65 | 65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
66 | 66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
67 | 67 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
68 | 68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
69 | 69 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> |
|
70 | 70 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
71 | 71 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
72 | 72 | </valuemap> |
|
73 | 73 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
74 | 74 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
75 | 75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
76 | 76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
77 | 77 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
78 | 78 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
79 | 79 | <value type="QString">-w</value> |
|
80 | 80 | <value type="QString">-r</value> |
|
81 | 81 | </valuelist> |
|
82 | 82 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
83 | 83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|
84 | 84 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
85 | 85 | </valuemap> |
|
86 | 86 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
87 | 87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
88 | 88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
89 | 89 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
90 | 90 | </valuemap> |
|
91 | 91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
92 | 92 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
93 | 93 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
94 | 94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
95 | 95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
96 | 96 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
97 | 97 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
98 | 98 | <value type="QString">-w</value> |
|
99 | 99 | <value type="QString">-r</value> |
|
100 | 100 | </valuelist> |
|
101 | 101 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
102 | 102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|
103 | 103 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
104 | 104 | </valuemap> |
|
105 | 105 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
106 | 106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
107 | 107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
108 | 108 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
109 | 109 | </valuemap> |
|
110 | 110 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
111 | 111 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
112 | 112 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
113 | 113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> |
|
114 | 114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
115 | 115 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
116 | 116 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
117 | 117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
|
118 | 118 | </valuemap> |
|
119 | 119 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> |
|
120 | 120 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
121 | 121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
122 | 122 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
123 | 123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
124 | 124 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
125 | 125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|
126 | 126 | </valuemap> |
|
127 | 127 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
128 | 128 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> |
|
129 | 129 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
130 | 130 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
131 | 131 | </valuemap> |
|
132 | 132 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
133 | 133 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|
134 | 134 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
135 | 135 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
136 | 136 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
137 | 137 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
138 | 138 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
139 | 139 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
140 | 140 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
141 | 141 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
142 | 142 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
143 | 143 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
144 | 144 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
|
145 | 145 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
146 | 146 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
147 | 147 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
|
148 | 148 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
|
149 | 149 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
|
150 | 150 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
151 | 151 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
152 | 152 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
153 | 153 | <value type="int">0</value> |
|
154 | 154 | <value type="int">1</value> |
|
155 | 155 | <value type="int">2</value> |
|
156 | 156 | <value type="int">3</value> |
|
157 | 157 | <value type="int">4</value> |
|
158 | 158 | <value type="int">5</value> |
|
159 | 159 | <value type="int">6</value> |
|
160 | 160 | <value type="int">7</value> |
|
161 | 161 | <value type="int">8</value> |
|
162 | 162 | <value type="int">9</value> |
|
163 | 163 | <value type="int">10</value> |
|
164 | 164 | <value type="int">11</value> |
|
165 | 165 | <value type="int">12</value> |
|
166 | 166 | <value type="int">13</value> |
|
167 | 167 | <value type="int">14</value> |
|
168 | 168 | </valuelist> |
|
169 | 169 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
170 | 170 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
171 | 171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> |
|
172 | 172 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
173 | 173 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> |
|
174 | 174 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
|
175 | 175 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> |
|
176 | 176 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
|
177 | 177 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> |
|
178 | 178 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> |
|
179 | 179 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
180 | 180 | <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> |
|
181 | 181 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> |
|
182 | 182 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
183 | 183 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
184 | 184 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
|
185 | 185 | </valuemap> |
|
186 | 186 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> |
|
187 | 187 | </valuemap> |
|
188 | 188 | </data> |
|
189 | 189 | <data> |
|
190 | 190 | <variable>ProjectExplorer.Project.Target.1</variable> |
|
191 | 191 | <valuemap type="QVariantMap"> |
|
192 | 192 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
193 | 193 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
194 | 194 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value> |
|
195 | 195 | <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> |
|
196 | 196 | <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> |
|
197 | 197 | <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> |
|
198 | 198 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
|
199 | 199 | <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value> |
|
200 | 200 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
201 | 201 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
202 | 202 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
203 | 203 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
204 | 204 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
205 | 205 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
206 | 206 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
207 | 207 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value> |
|
208 | 208 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
209 | 209 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
210 | 210 | </valuemap> |
|
211 | 211 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
212 | 212 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
213 | 213 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
214 | 214 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
215 | 215 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
216 | 216 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
217 | 217 | <value type="QString">-w</value> |
|
218 | 218 | <value type="QString">-r</value> |
|
219 | 219 | </valuelist> |
|
220 | 220 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
221 | 221 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value> |
|
222 | 222 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
223 | 223 | </valuemap> |
|
224 | 224 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
225 | 225 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
226 | 226 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
227 | 227 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
228 | 228 | </valuemap> |
|
229 | 229 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
230 | 230 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
231 | 231 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
232 | 232 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
233 | 233 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
234 | 234 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
235 | 235 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
236 | 236 | <value type="QString">-w</value> |
|
237 | 237 | <value type="QString">-r</value> |
|
238 | 238 | </valuelist> |
|
239 | 239 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
240 | 240 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value> |
|
241 | 241 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
242 | 242 | </valuemap> |
|
243 | 243 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
244 | 244 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
245 | 245 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
246 | 246 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
247 | 247 | </valuemap> |
|
248 | 248 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
249 | 249 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
250 | 250 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
251 | 251 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value> |
|
252 | 252 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
253 | 253 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
254 | 254 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
255 | 255 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value> |
|
256 | 256 | </valuemap> |
|
257 | 257 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value> |
|
258 | 258 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
259 | 259 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
260 | 260 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
261 | 261 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
262 | 262 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
263 | 263 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|
264 | 264 | </valuemap> |
|
265 | 265 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
266 | 266 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value> |
|
267 | 267 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
268 | 268 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
269 | 269 | </valuemap> |
|
270 | 270 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
271 | 271 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|
272 | 272 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
273 | 273 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
274 | 274 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
275 | 275 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
276 | 276 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
277 | 277 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
278 | 278 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
279 | 279 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
280 | 280 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
281 | 281 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
282 | 282 | <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value> |
|
283 | 283 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
284 | 284 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
285 | 285 | <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value> |
|
286 | 286 | <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value> |
|
287 | 287 | <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value> |
|
288 | 288 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
289 | 289 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
290 | 290 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
291 | 291 | <value type="int">0</value> |
|
292 | 292 | <value type="int">1</value> |
|
293 | 293 | <value type="int">2</value> |
|
294 | 294 | <value type="int">3</value> |
|
295 | 295 | <value type="int">4</value> |
|
296 | 296 | <value type="int">5</value> |
|
297 | 297 | <value type="int">6</value> |
|
298 | 298 | <value type="int">7</value> |
|
299 | 299 | <value type="int">8</value> |
|
300 | 300 | <value type="int">9</value> |
|
301 | 301 | <value type="int">10</value> |
|
302 | 302 | <value type="int">11</value> |
|
303 | 303 | <value type="int">12</value> |
|
304 | 304 | <value type="int">13</value> |
|
305 | 305 | <value type="int">14</value> |
|
306 | 306 | </valuelist> |
|
307 | 307 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
308 | 308 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
309 | 309 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> |
|
310 | 310 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
311 | 311 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> |
|
312 | 312 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
|
313 | 313 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> |
|
314 | 314 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
|
315 | 315 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> |
|
316 | 316 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> |
|
317 | 317 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
318 | 318 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> |
|
319 | 319 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> |
|
320 | 320 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
321 | 321 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
322 | 322 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
|
323 | 323 | </valuemap> |
|
324 | 324 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> |
|
325 | 325 | </valuemap> |
|
326 | 326 | </data> |
|
327 | 327 | <data> |
|
328 | 328 | <variable>ProjectExplorer.Project.TargetCount</variable> |
|
329 | 329 | <value type="int">2</value> |
|
330 | 330 | </data> |
|
331 | 331 | <data> |
|
332 | 332 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> |
|
333 | 333 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> |
|
334 | 334 | </data> |
|
335 | 335 | <data> |
|
336 | 336 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
|
337 | 337 | <value type="int">15</value> |
|
338 | 338 | </data> |
|
339 | 339 | </qtcreator> |
@@ -1,226 +1,229 | |||
|
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 | //************************ |
|
22 | 22 | // flight software version |
|
23 | 23 | // this parameters is handled by the Qt project options |
|
24 | 24 | |
|
25 | 25 | #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk |
|
26 | 26 | #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk |
|
27 | 27 | #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688 |
|
28 | 28 | #define TIME_OFFSET 2 |
|
29 | 29 | #define TIME_OFFSET_IN_BYTES 8 |
|
30 | 30 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 |
|
31 | 31 | #define NB_BYTES_SWF_BLK (2 * 6) |
|
32 | 32 | #define NB_WORDS_SWF_BLK 3 |
|
33 | 33 | #define NB_BYTES_CWF3_LIGHT_BLK 6 |
|
34 | 34 | #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 |
|
35 | 35 | #define NB_RING_NODES_F0 3 // AT LEAST 3 |
|
36 | 36 | #define NB_RING_NODES_F1 5 // AT LEAST 3 |
|
37 | 37 | #define NB_RING_NODES_F2 5 // AT LEAST 3 |
|
38 | #define NB_RING_NODES_ASM_F0 12 // AT LEAST 3 | |
|
39 | #define NB_RING_NODES_ASM_F1 2 // AT LEAST 3 | |
|
40 | #define NB_RING_NODES_ASM_F2 2 // AT LEAST 3 | |
|
41 | 38 | |
|
42 | 39 | //********** |
|
43 | 40 | // LFR MODES |
|
44 | 41 | #define LFR_MODE_STANDBY 0 |
|
45 | 42 | #define LFR_MODE_NORMAL 1 |
|
46 | 43 | #define LFR_MODE_BURST 2 |
|
47 | 44 | #define LFR_MODE_SBM1 3 |
|
48 | 45 | #define LFR_MODE_SBM2 4 |
|
49 | 46 | |
|
50 | 47 | #define TDS_MODE_LFM 5 |
|
51 | 48 | #define TDS_MODE_STANDBY 0 |
|
52 | 49 | #define TDS_MODE_NORMAL 1 |
|
53 | 50 | #define TDS_MODE_BURST 2 |
|
54 | 51 | #define TDS_MODE_SBM1 3 |
|
55 | 52 | #define TDS_MODE_SBM2 4 |
|
56 | 53 | |
|
57 | 54 | #define THR_MODE_STANDBY 0 |
|
58 | 55 | #define THR_MODE_NORMAL 1 |
|
59 | 56 | #define THR_MODE_BURST 2 |
|
60 | 57 | |
|
61 | 58 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 |
|
62 | 59 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 |
|
63 | 60 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 |
|
64 | 61 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 |
|
65 | 62 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 |
|
66 | 63 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 |
|
67 | 64 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F0 RTEMS_EVENT_6 |
|
68 | 65 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F1 RTEMS_EVENT_7 |
|
69 | 66 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F2 RTEMS_EVENT_8 |
|
70 | 67 | |
|
71 | 68 | //**************************** |
|
72 | 69 | // LFR DEFAULT MODE PARAMETERS |
|
73 | 70 | // COMMON |
|
74 | 71 | #define DEFAULT_SY_LFR_COMMON0 0x00 |
|
75 | 72 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 |
|
76 | 73 | // NORM |
|
77 | 74 | #define SY_LFR_N_SWF_L 2048 // nb sample |
|
78 | 75 | #define SY_LFR_N_SWF_P 300 // sec |
|
79 | 76 | #define SY_LFR_N_ASM_P 3600 // sec |
|
80 | 77 | #define SY_LFR_N_BP_P0 4 // sec |
|
81 | 78 | #define SY_LFR_N_BP_P1 20 // sec |
|
82 | 79 | #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3 |
|
83 | 80 | #define MIN_DELTA_SNAPSHOT 16 // sec |
|
84 | 81 | // BURST |
|
85 | 82 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec |
|
86 | 83 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec |
|
87 | 84 | // SBM1 |
|
88 | 85 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec |
|
89 | 86 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec |
|
90 | 87 | // SBM2 |
|
91 | 88 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec |
|
92 | 89 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec |
|
93 | 90 | // ADDITIONAL PARAMETERS |
|
94 | 91 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms |
|
95 | 92 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s |
|
96 | 93 | // STATUS WORD |
|
97 | 94 | #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits |
|
98 | 95 | #define DEFAULT_STATUS_WORD_BYTE1 0x00 |
|
99 | 96 | // |
|
100 | 97 | #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s |
|
101 | 98 | #define SY_LFR_DPU_CONNECT_ATTEMPT 3 |
|
102 | 99 | //**************************** |
|
103 | 100 | |
|
104 | 101 | //***************************** |
|
105 | 102 | // APB REGISTERS BASE ADDRESSES |
|
106 | 103 | #define REGS_ADDR_APBUART 0x80000100 |
|
107 | 104 | #define REGS_ADDR_GPTIMER 0x80000300 |
|
108 | 105 | #define REGS_ADDR_GRSPW 0x80000500 |
|
109 | 106 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 |
|
107 | ||
|
108 | #ifdef VHDL_DEV | |
|
109 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 | |
|
110 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f40 | |
|
111 | #else | |
|
110 | 112 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 |
|
111 | 113 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20 |
|
114 | #endif | |
|
112 | 115 | |
|
113 | 116 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
|
114 | 117 | #define APBUART_CTRL_REG_MASK_TE 0x00000002 |
|
115 | 118 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) |
|
116 | 119 | |
|
117 | 120 | //********** |
|
118 | 121 | // IRQ LINES |
|
119 | 122 | #define IRQ_SM_SIMULATOR 9 |
|
120 | 123 | #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels |
|
121 | 124 | #define IRQ_WAVEFORM_PICKER 14 |
|
122 | 125 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels |
|
123 | 126 | #define IRQ_SPECTRAL_MATRIX 6 |
|
124 | 127 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels |
|
125 | 128 | |
|
126 | 129 | //***** |
|
127 | 130 | // TIME |
|
128 | 131 | #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms |
|
129 | 132 | #define TIMER_SM_SIMULATOR 1 |
|
130 | 133 | #define HK_PERIOD 100 // 100 * 10ms => 1s |
|
131 | 134 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000 |
|
132 | 135 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s |
|
133 | 136 | |
|
134 | 137 | //********** |
|
135 | 138 | // LPP CODES |
|
136 | 139 | #define LFR_SUCCESSFUL 0 |
|
137 | 140 | #define LFR_DEFAULT 1 |
|
138 | 141 | |
|
139 | 142 | //****** |
|
140 | 143 | // RTEMS |
|
141 | 144 | #define TASKID_RECV 1 |
|
142 | 145 | #define TASKID_ACTN 2 |
|
143 | 146 | #define TASKID_SPIQ 3 |
|
144 | 147 | #define TASKID_SMIQ 4 |
|
145 | 148 | #define TASKID_STAT 5 |
|
146 | 149 | #define TASKID_AVF0 6 |
|
147 | 150 | #define TASKID_SWBD 7 |
|
148 | 151 | #define TASKID_WFRM 8 |
|
149 | 152 | #define TASKID_DUMB 9 |
|
150 | 153 | #define TASKID_HOUS 10 |
|
151 | 154 | #define TASKID_MATR 11 |
|
152 | 155 | #define TASKID_CWF3 12 |
|
153 | 156 | #define TASKID_CWF2 13 |
|
154 | 157 | #define TASKID_CWF1 14 |
|
155 | 158 | #define TASKID_SEND 15 |
|
156 | 159 | #define TASKID_WTDG 16 |
|
157 | 160 | |
|
158 | 161 | #define TASK_PRIORITY_SPIQ 5 |
|
159 | 162 | #define TASK_PRIORITY_SMIQ 10 |
|
160 | 163 | #define TASK_PRIORITY_WTDG 20 |
|
161 | 164 | #define TASK_PRIORITY_HOUS 30 |
|
162 | 165 | #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together |
|
163 | 166 | #define TASK_PRIORITY_CWF2 35 // |
|
167 | #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it | |
|
164 | 168 | #define TASK_PRIORITY_WFRM 40 |
|
165 | 169 | #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1 |
|
166 | #define TASK_PRIORITY_SWBD 40 | |
|
167 | 170 | #define TASK_PRIORITY_SEND 45 |
|
168 | 171 | #define TASK_PRIORITY_RECV 50 |
|
169 | 172 | #define TASK_PRIORITY_ACTN 50 |
|
170 | 173 | #define TASK_PRIORITY_AVF0 60 |
|
171 | 174 | #define TASK_PRIORITY_BPF0 60 |
|
172 | 175 | #define TASK_PRIORITY_MATR 100 |
|
173 | 176 | #define TASK_PRIORITY_STAT 200 |
|
174 | 177 | #define TASK_PRIORITY_DUMB 200 |
|
175 | 178 | |
|
176 | 179 | #define ACTION_MSG_QUEUE_COUNT 10 |
|
177 | 180 | #define ACTION_MSG_PKTS_COUNT 50 |
|
178 | 181 | #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES) |
|
179 | 182 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options |
|
180 | 183 | |
|
181 | 184 | #define QUEUE_RECV 0 |
|
182 | 185 | #define QUEUE_SEND 1 |
|
183 | 186 | |
|
184 | 187 | //******* |
|
185 | 188 | // MACROS |
|
186 | 189 | #ifdef PRINT_MESSAGES_ON_CONSOLE |
|
187 | 190 | #define PRINTF(x) printf(x); |
|
188 | 191 | #define PRINTF1(x,y) printf(x,y); |
|
189 | 192 | #define PRINTF2(x,y,z) printf(x,y,z); |
|
190 | 193 | #else |
|
191 | 194 | #define PRINTF(x) ; |
|
192 | 195 | #define PRINTF1(x,y) ; |
|
193 | 196 | #define PRINTF2(x,y,z) ; |
|
194 | 197 | #endif |
|
195 | 198 | |
|
196 | 199 | #ifdef BOOT_MESSAGES |
|
197 | 200 | #define BOOT_PRINTF(x) printf(x); |
|
198 | 201 | #define BOOT_PRINTF1(x,y) printf(x,y); |
|
199 | 202 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); |
|
200 | 203 | #else |
|
201 | 204 | #define BOOT_PRINTF(x) ; |
|
202 | 205 | #define BOOT_PRINTF1(x,y) ; |
|
203 | 206 | #define BOOT_PRINTF2(x,y,z) ; |
|
204 | 207 | #endif |
|
205 | 208 | |
|
206 | 209 | #ifdef DEBUG_MESSAGES |
|
207 | 210 | #define DEBUG_PRINTF(x) printf(x); |
|
208 | 211 | #define DEBUG_PRINTF1(x,y) printf(x,y); |
|
209 | 212 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); |
|
210 | 213 | #else |
|
211 | 214 | #define DEBUG_PRINTF(x) ; |
|
212 | 215 | #define DEBUG_PRINTF1(x,y) ; |
|
213 | 216 | #define DEBUG_PRINTF2(x,y,z) ; |
|
214 | 217 | #endif |
|
215 | 218 | |
|
216 | 219 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period |
|
217 | 220 | |
|
218 | 221 | struct param_local_str{ |
|
219 | 222 | unsigned int local_sbm1_nb_cwf_sent; |
|
220 | 223 | unsigned int local_sbm1_nb_cwf_max; |
|
221 | 224 | unsigned int local_sbm2_nb_cwf_sent; |
|
222 | 225 | unsigned int local_sbm2_nb_cwf_max; |
|
223 | 226 | unsigned int local_nb_interrupt_f0_MAX; |
|
224 | 227 | }; |
|
225 | 228 | |
|
226 | 229 | #endif // FSW_PARAMS_H_INCLUDED |
@@ -1,51 +1,54 | |||
|
1 | 1 | #ifndef FSW_PARAMS_PROCESSING_H |
|
2 | 2 | #define FSW_PARAMS_PROCESSING_H |
|
3 | 3 | |
|
4 |
#define NB_BINS_PER_SM |
|
|
5 |
#define NB_VALUES_PER_SM |
|
|
6 | #define TOTAL_SIZE_SM 3200 // 25 * 128 | |
|
7 | #define SM_HEADER 0 // | |
|
4 | #define NB_BINS_PER_SM 128 | |
|
5 | #define NB_VALUES_PER_SM 25 | |
|
6 | #define TOTAL_SIZE_SM 3200 // 25 * 128 | |
|
7 | // | |
|
8 | #define NB_RING_NODES_ASM_F0 12 // AT LEAST 3 | |
|
9 | #define NB_RING_NODES_ASM_F1 2 // AT LEAST 3 | |
|
10 | #define NB_RING_NODES_ASM_F2 2 // AT LEAST 3 | |
|
8 | 11 | // |
|
9 | 12 | #define NB_BINS_PER_ASM_F0 88 |
|
10 | 13 | #define NB_BINS_PER_PKT_ASM_F0 44 |
|
11 | 14 | #define TOTAL_SIZE_ASM_F0_IN_BYTES 4400 // 25 * 88 * 2 |
|
12 | 15 | #define ASM_F0_INDICE_START 17 // 88 bins |
|
13 | 16 | #define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins |
|
14 | 17 | // |
|
15 | 18 | #define NB_BINS_PER_ASM_F1 104 |
|
16 | 19 | #define NB_BINS_PER_PKT_ASM_F1 52 |
|
17 | 20 | #define TOTAL_SIZE_ASM_F1 2600 // 25 * 104 |
|
18 | 21 | #define ASM_F1_INDICE_START 6 // 104 bins |
|
19 | 22 | #define ASM_F1_INDICE_STOP 109 // 2 packets of 52 bins |
|
20 | 23 | // |
|
21 | 24 | #define NB_BINS_PER_ASM_F2 96 |
|
22 | 25 | #define NB_BINS_PER_PKT_ASM_F2 48 |
|
23 | 26 | #define TOTAL_SIZE_ASM_F2 2400 // 25 * 96 |
|
24 | 27 | #define ASM_F2_INDICE_START 7 // 96 bins |
|
25 | 28 | #define ASM_F2_INDICE_STOP 102 // 2 packets of 48 bins |
|
26 | 29 | // |
|
27 | 30 | #define NB_BINS_COMPRESSED_SM_F0 11 |
|
28 | 31 | #define NB_BINS_COMPRESSED_SM_F1 13 |
|
29 | 32 | #define NB_BINS_COMPRESSED_SM_F2 12 |
|
30 | 33 | // |
|
31 | 34 | #define NB_BINS_TO_AVERAGE_ASM_F0 8 |
|
32 | 35 | #define NB_BINS_TO_AVERAGE_ASM_F1 8 |
|
33 | 36 | #define NB_BINS_TO_AVERAGE_ASM_F2 8 |
|
34 | 37 | // |
|
35 | 38 | #define TOTAL_SIZE_COMPRESSED_ASM_F0 275 // 11 * 25 |
|
36 | 39 | #define TOTAL_SIZE_COMPRESSED_ASM_F1 325 // 13 * 25 |
|
37 | 40 | #define TOTAL_SIZE_COMPRESSED_ASM_F2 300 // 12 * 25 |
|
38 | 41 | #define NB_AVERAGE_NORMAL_f0 96*4 |
|
39 | 42 | #define NB_SM_TO_RECEIVE_BEFORE_AVF0 8 |
|
40 | 43 | |
|
41 | 44 | typedef struct { |
|
42 | 45 | volatile unsigned char PE[2]; |
|
43 | 46 | volatile unsigned char PB[2]; |
|
44 | 47 | volatile unsigned char V0; |
|
45 | 48 | volatile unsigned char V1; |
|
46 | 49 | volatile unsigned char V2_ELLIP_DOP; |
|
47 | 50 | volatile unsigned char SZ; |
|
48 | 51 | volatile unsigned char VPHI; |
|
49 | 52 | } BP1_t; |
|
50 | 53 | |
|
51 | 54 | #endif // FSW_PARAMS_PROCESSING_H |
@@ -1,55 +1,55 | |||
|
1 | 1 | #ifndef FSW_PROCESSING_H_INCLUDED |
|
2 | 2 | #define FSW_PROCESSING_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include <rtems.h> |
|
5 | 5 | #include <grspw.h> |
|
6 | 6 | #include <math.h> |
|
7 | 7 | #include <stdlib.h> // abs() is in the stdlib |
|
8 | 8 | #include <stdio.h> // printf() |
|
9 | 9 | #include <math.h> |
|
10 | 10 | |
|
11 | 11 | #include "fsw_params.h" |
|
12 | 12 | #include "fsw_spacewire.h" |
|
13 | 13 | #include "basic_parameters.h" |
|
14 | 14 | |
|
15 |
extern volatile int sm_f0[ ] |
|
|
16 |
extern volatile int sm_f1[ ] |
|
|
17 |
extern volatile int sm_f2[ ] |
|
|
15 | extern volatile int sm_f0[ ]; | |
|
16 | extern volatile int sm_f1[ ]; | |
|
17 | extern volatile int sm_f2[ ]; | |
|
18 | 18 | |
|
19 | 19 | // parameters |
|
20 | 20 | extern struct param_local_str param_local; |
|
21 | 21 | |
|
22 | 22 | // registers |
|
23 | 23 | extern time_management_regs_t *time_management_regs; |
|
24 | 24 | extern spectral_matrix_regs_t *spectral_matrix_regs; |
|
25 | 25 | |
|
26 | 26 | extern rtems_name misc_name[5]; |
|
27 | 27 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
28 | 28 | |
|
29 | 29 | void init_sm_rings( void ); |
|
30 | 30 | void reset_current_sm_ring_nodes( void ); |
|
31 | 31 | |
|
32 | 32 | // ISR |
|
33 | 33 | void reset_nb_sm_f0( void ); |
|
34 | 34 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ); |
|
35 | 35 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ); |
|
36 | 36 | |
|
37 | 37 | // RTEMS TASKS |
|
38 | 38 | rtems_task avf0_task(rtems_task_argument argument); |
|
39 | 39 | rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator |
|
40 | 40 | rtems_task matr_task(rtems_task_argument argument); |
|
41 | 41 | |
|
42 | 42 | void matrix_reset(volatile float *averaged_spec_mat); |
|
43 | 43 | void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1); |
|
44 | 44 | void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat); |
|
45 | 45 | // |
|
46 | 46 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header); |
|
47 | 47 | void ASM_reorganize( float *averaged_spec_mat, float *averaged_spec_mat_reorganized ); |
|
48 | 48 | void ASM_compress( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat ); |
|
49 | 49 | void ASM_convert(volatile float *input_matrix, char *output_matrix); |
|
50 | 50 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
51 | 51 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id); |
|
52 | 52 | void fill_averaged_spectral_matrix( void ); |
|
53 | 53 | void reset_spectral_matrix_regs(); |
|
54 | 54 | |
|
55 | 55 | #endif // FSW_PROCESSING_H_INCLUDED |
@@ -1,86 +1,95 | |||
|
1 | 1 | #ifndef GRLIB_REGS_H_INCLUDED |
|
2 | 2 | #define GRLIB_REGS_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #define NB_GPTIMER 3 |
|
5 | 5 | |
|
6 | 6 | struct apbuart_regs_str{ |
|
7 | 7 | volatile unsigned int data; |
|
8 | 8 | volatile unsigned int status; |
|
9 | 9 | volatile unsigned int ctrl; |
|
10 | 10 | volatile unsigned int scaler; |
|
11 | 11 | volatile unsigned int fifoDebug; |
|
12 | 12 | }; |
|
13 | 13 | |
|
14 | 14 | struct ahbuart_regs_str{ |
|
15 | 15 | volatile unsigned int unused; |
|
16 | 16 | volatile unsigned int status; |
|
17 | 17 | volatile unsigned int ctrl; |
|
18 | 18 | volatile unsigned int scaler; |
|
19 | 19 | }; |
|
20 | 20 | |
|
21 | 21 | typedef struct { |
|
22 | 22 | volatile unsigned int counter; |
|
23 | 23 | volatile unsigned int reload; |
|
24 | 24 | volatile unsigned int ctrl; |
|
25 | 25 | volatile unsigned int unused; |
|
26 | 26 | } timer_regs_t; |
|
27 | 27 | |
|
28 | 28 | typedef struct { |
|
29 | 29 | volatile unsigned int scaler_value; |
|
30 | 30 | volatile unsigned int scaler_reload; |
|
31 | 31 | volatile unsigned int conf; |
|
32 | 32 | volatile unsigned int unused0; |
|
33 | 33 | timer_regs_t timer[NB_GPTIMER]; |
|
34 | 34 | } gptimer_regs_t; |
|
35 | 35 | |
|
36 | 36 | typedef struct { |
|
37 | 37 | volatile int ctrl; // bit 0 forces the load of the coarse_time_load value and resets the fine_time |
|
38 | 38 | volatile int coarse_time_load; |
|
39 | 39 | volatile int coarse_time; |
|
40 | 40 | volatile int fine_time; |
|
41 | 41 | } time_management_regs_t; |
|
42 | 42 | |
|
43 | 43 | typedef struct { |
|
44 | 44 | volatile int data_shaping; // 0x00 00 *** R1 R0 SP1 SP0 BW |
|
45 | 45 | volatile int burst_enable; // 0x04 01 *** burst f2, f1, f0 enable f3, f2, f1, f0 |
|
46 | 46 | volatile int addr_data_f0; // 0x08 10 *** |
|
47 | 47 | volatile int addr_data_f1; // 0x0c 11 *** |
|
48 | 48 | volatile int addr_data_f2; // 0x10 100 *** |
|
49 | 49 | volatile int addr_data_f3; // 0x14 101 *** |
|
50 | 50 | volatile int status; // 0x18 110 *** |
|
51 | 51 | volatile int delta_snapshot; // 0x1c 111 *** |
|
52 | 52 | volatile int delta_f2_f1; // 0x20 0000 *** |
|
53 | 53 | volatile int delta_f2_f0; // 0x24 0001 *** |
|
54 | 54 | volatile int nb_burst_available;// 0x28 0010 *** |
|
55 | 55 | volatile int nb_snapshot_param; // 0x2c 0011 *** |
|
56 | 56 | } waveform_picker_regs_t; |
|
57 | 57 | |
|
58 | 58 | typedef struct{ |
|
59 | 59 | int data_shaping; // 0x00 00 *** R1 R0 SP1 SP0 BW |
|
60 | 60 | int run_burst_enable; // 0x04 01 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] |
|
61 | 61 | int addr_data_f0; // 0x08 |
|
62 | 62 | int addr_data_f1; // 0x0c |
|
63 | 63 | int addr_data_f2; // 0x10 |
|
64 | 64 | int addr_data_f3; // 0x14 |
|
65 | 65 | volatile int status; // 0x18 |
|
66 | 66 | int delta_snapshot; // 0x1c |
|
67 | 67 | int delta_f0; // 0x20 |
|
68 | 68 | int delta_f0_2; // 0x24 |
|
69 | 69 | int delta_f1; // 0x28 |
|
70 | 70 | int delta_f2; // 0x2c |
|
71 | 71 | int nb_data_by_buffer; // 0x30 |
|
72 | 72 | int snapshot_param; // 0x34 |
|
73 | 73 | int start_date; // 0x38 |
|
74 | 74 | int nb_word_in_buffer; // 0x3c |
|
75 | 75 | } waveform_picker_regs_new_t; |
|
76 | 76 | |
|
77 | 77 | typedef struct { |
|
78 | 78 | volatile int config; |
|
79 | 79 | volatile int status; |
|
80 | 80 | volatile int matrixF0_Address0; |
|
81 | 81 | volatile int matrixFO_Address1; |
|
82 | 82 | volatile int matrixF1_Address; |
|
83 | 83 | volatile int matrixF2_Address; |
|
84 | volatile int coarse_time_F0_0; | |
|
85 | volatile int coarse_time_F0_1; | |
|
86 | volatile int coarse_time_F1; | |
|
87 | volatile int coarse_time_F2; | |
|
88 | volatile int fine_time_FO_0; | |
|
89 | volatile int fine_time_F0_1; | |
|
90 | volatile int fine_time_F1; | |
|
91 | volatile int fine_time_F2; | |
|
92 | volatile int debug; | |
|
84 | 93 | } spectral_matrix_regs_t; |
|
85 | 94 | |
|
86 | 95 | #endif // GRLIB_REGS_H_INCLUDED |
@@ -1,58 +1,58 | |||
|
1 | 1 | #ifndef TC_HANDLER_H_INCLUDED |
|
2 | 2 | #define TC_HANDLER_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include <rtems.h> |
|
5 | 5 | #include <leon.h> |
|
6 | 6 | |
|
7 | 7 | #include "tc_load_dump_parameters.h" |
|
8 | 8 | #include "tc_acceptance.h" |
|
9 | 9 | #include "tm_lfr_tc_exe.h" |
|
10 | 10 | #include "wf_handler.h" |
|
11 | 11 | #include "fsw_processing.h" |
|
12 | 12 | |
|
13 | 13 | // MODE PARAMETERS |
|
14 | 14 | extern unsigned int maxCount; |
|
15 | 15 | |
|
16 | 16 | //**** |
|
17 | 17 | // ISR |
|
18 | 18 | rtems_isr commutation_isr1( rtems_vector_number vector ); |
|
19 | 19 | rtems_isr commutation_isr2( rtems_vector_number vector ); |
|
20 | 20 | |
|
21 | 21 | //*********** |
|
22 | 22 | // RTEMS TASK |
|
23 | 23 | rtems_task actn_task( rtems_task_argument unused ); |
|
24 | 24 | |
|
25 | 25 | //*********** |
|
26 | 26 | // TC ACTIONS |
|
27 | 27 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
28 | 28 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
29 | 29 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
30 | 30 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
31 | 31 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
32 | 32 | int action_update_time(ccsdsTelecommandPacket_t *TC); |
|
33 | 33 | |
|
34 | 34 | // mode transition |
|
35 | 35 | int transition_validation(unsigned char requestedMode); |
|
36 | 36 | int stop_current_mode( void ); |
|
37 | 37 | int enter_mode(unsigned char mode); |
|
38 | 38 | int restart_science_tasks(); |
|
39 | 39 | int suspend_science_tasks(); |
|
40 | 40 | void launch_waveform_picker( unsigned char mode ); |
|
41 | 41 | void launch_spectral_matrix( unsigned char mode ); |
|
42 |
void |
|
|
43 | void disable_irq_on_new_ready_matrix( void ); | |
|
42 | void set_irq_on_new_ready_matrix(unsigned char value ); | |
|
43 | void set_run_matrix_spectral( unsigned char value ); | |
|
44 | 44 | void launch_spectral_matrix_simu( unsigned char mode ); |
|
45 | 45 | |
|
46 | 46 | // other functions |
|
47 | 47 | void updateLFRCurrentMode(); |
|
48 | 48 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC ); |
|
49 | 49 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC ); |
|
50 | 50 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ); |
|
51 | 51 | |
|
52 | 52 | extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); |
|
53 | 53 | extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); |
|
54 | 54 | |
|
55 | 55 | #endif // TC_HANDLER_H_INCLUDED |
|
56 | 56 | |
|
57 | 57 | |
|
58 | 58 |
@@ -1,96 +1,98 | |||
|
1 | 1 | #ifndef WF_HANDLER_H_INCLUDED |
|
2 | 2 | #define WF_HANDLER_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include <rtems.h> |
|
5 | 5 | #include <grspw.h> |
|
6 | 6 | #include <stdio.h> |
|
7 | 7 | #include <math.h> |
|
8 | 8 | |
|
9 | 9 | #include "fsw_params.h" |
|
10 | 10 | #include "fsw_spacewire.h" |
|
11 | 11 | #include "fsw_misc.h" |
|
12 | 12 | |
|
13 | 13 | #define pi 3.1415 |
|
14 | 14 | |
|
15 | 15 | extern int fdSPW; |
|
16 | 16 | |
|
17 | 17 | //***************** |
|
18 | 18 | // waveform buffers |
|
19 | 19 | // F0 |
|
20 | 20 | //extern volatile int wf_snap_f0[ ]; |
|
21 | 21 | // F1 F2 |
|
22 | 22 | extern volatile int wf_snap_f0[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ]; |
|
23 | 23 | extern volatile int wf_snap_f1[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ]; |
|
24 | 24 | extern volatile int wf_snap_f2[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 62 ]; |
|
25 | 25 | // F3 |
|
26 | 26 | extern volatile int wf_cont_f3_a[ ]; |
|
27 | 27 | extern volatile int wf_cont_f3_b[ ]; |
|
28 | 28 | extern char wf_cont_f3_light[ ]; |
|
29 | 29 | |
|
30 | 30 | extern waveform_picker_regs_new_t *waveform_picker_regs; |
|
31 | 31 | extern time_management_regs_t *time_management_regs; |
|
32 | 32 | extern Packet_TM_LFR_HK_t housekeeping_packet; |
|
33 | 33 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
34 | 34 | extern struct param_local_str param_local; |
|
35 | 35 | |
|
36 | 36 | extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST; |
|
37 | 37 | extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2; |
|
38 | 38 | |
|
39 | 39 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
40 | 40 | |
|
41 | 41 | extern unsigned char lfrCurrentMode; |
|
42 | 42 | |
|
43 | 43 | //********** |
|
44 | 44 | // RTEMS_ISR |
|
45 | void reset_extractSWF( void ); | |
|
45 | 46 | rtems_isr waveforms_isr( rtems_vector_number vector ); |
|
46 | 47 | |
|
47 | 48 | //*********** |
|
48 | 49 | // RTEMS_TASK |
|
49 | 50 | rtems_task wfrm_task( rtems_task_argument argument ); |
|
50 | 51 | rtems_task cwf3_task( rtems_task_argument argument ); |
|
51 | 52 | rtems_task cwf2_task( rtems_task_argument argument ); |
|
52 | 53 | rtems_task cwf1_task( rtems_task_argument argument ); |
|
53 | 54 | rtems_task swbd_task( rtems_task_argument argument ); |
|
54 | 55 | |
|
55 | 56 | //****************** |
|
56 | 57 | // general functions |
|
57 | 58 | void init_waveforms( void ); |
|
58 | 59 | void init_waveform_rings( void ); |
|
59 | 60 | void reset_current_ring_nodes( void ); |
|
60 | 61 | // |
|
61 | 62 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF ); |
|
62 | 63 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ); |
|
63 | 64 | int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ); |
|
64 | 65 | // |
|
65 | 66 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ); |
|
66 | 67 | int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
67 | 68 | int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
68 | 69 | int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
69 | 70 | // |
|
70 | 71 | void compute_acquisition_time(unsigned int coarseTime, unsigned int fineTime, |
|
71 | 72 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char *acquisitionTime ); |
|
72 | void build_snapshot_from_ring( void ); | |
|
73 | void build_snapshot_from_ring(ring_node *ring_node_to_send , unsigned char frequencyChannel ); | |
|
74 | void build_acquisition_time( unsigned long long int * acquisitionTimeAslong, ring_node *current_ring_node ); | |
|
73 | 75 | // |
|
74 | 76 | rtems_id get_pkts_queue_id( void ); |
|
75 | 77 | |
|
76 | 78 | //************** |
|
77 | 79 | // wfp registers |
|
78 | 80 | // RESET |
|
79 | 81 | void reset_wfp_burst_enable( void ); |
|
80 | 82 | void reset_wfp_status(void); |
|
81 | 83 | void reset_waveform_picker_regs( void ); |
|
82 | 84 | // SET |
|
83 | 85 | void set_wfp_data_shaping(void); |
|
84 | 86 | void set_wfp_burst_enable_register( unsigned char mode ); |
|
85 | 87 | void set_wfp_delta_snapshot( void ); |
|
86 | 88 | void set_wfp_delta_f0_f0_2( void ); |
|
87 | 89 | void set_wfp_delta_f1( void ); |
|
88 | 90 | void set_wfp_delta_f2( void ); |
|
89 | 91 | |
|
90 | 92 | //***************** |
|
91 | 93 | // local parameters |
|
92 | 94 | void set_local_nb_interrupt_f0_MAX( void ); |
|
93 | 95 | |
|
94 | 96 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ); |
|
95 | 97 | |
|
96 | 98 | #endif // WF_HANDLER_H_INCLUDED |
@@ -1,72 +1,73 | |||
|
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 | // SPECTRAL MATRICES GLOBAL VARIABLES |
|
49 | volatile int sm_f0[ NB_RING_NODES_ASM_F0 ][ TIME_OFFSET + TOTAL_SIZE_SM + 62 ] __attribute__((aligned(0x100))); | |
|
50 |
volatile int sm_f |
|
|
51 |
volatile int sm_f |
|
|
49 | // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00 | |
|
50 | volatile int sm_f0[ NB_RING_NODES_ASM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); | |
|
51 | volatile int sm_f1[ NB_RING_NODES_ASM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); | |
|
52 | volatile int sm_f2[ NB_RING_NODES_ASM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))); | |
|
52 | 53 | |
|
53 | 54 | // APB CONFIGURATION REGISTERS |
|
54 | 55 | time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT; |
|
55 | 56 | gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER; |
|
56 | 57 | waveform_picker_regs_new_t *waveform_picker_regs = (waveform_picker_regs_new_t*) REGS_ADDR_WAVEFORM_PICKER; |
|
57 | 58 | spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX; |
|
58 | 59 | |
|
59 | 60 | // MODE PARAMETERS |
|
60 | 61 | Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
61 | 62 | struct param_local_str param_local; |
|
62 | 63 | |
|
63 | 64 | // HK PACKETS |
|
64 | 65 | Packet_TM_LFR_HK_t housekeeping_packet; |
|
65 | 66 | // sequence counters are incremented by APID (PID + CAT) and destination ID |
|
66 | 67 | unsigned short sequenceCounters_SCIENCE_NORMAL_BURST; |
|
67 | 68 | unsigned short sequenceCounters_SCIENCE_SBM1_SBM2; |
|
68 | 69 | unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID]; |
|
69 | 70 | spw_stats spacewire_stats; |
|
70 | 71 | spw_stats spacewire_stats_backup; |
|
71 | 72 | |
|
72 | 73 |
@@ -1,739 +1,760 | |||
|
1 | 1 | /** Functions related to data processing. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. |
|
7 | 7 | * |
|
8 | 8 | */ |
|
9 | 9 | |
|
10 | 10 | #include <fsw_processing.h> |
|
11 | 11 | |
|
12 | 12 | #include "fsw_processing_globals.c" |
|
13 | 13 | |
|
14 | 14 | //************************ |
|
15 | 15 | // spectral matrices rings |
|
16 | 16 | ring_node sm_ring_f0[NB_RING_NODES_ASM_F0]; |
|
17 | 17 | ring_node sm_ring_f1[NB_RING_NODES_ASM_F1]; |
|
18 | 18 | ring_node sm_ring_f2[NB_RING_NODES_ASM_F2]; |
|
19 | 19 | ring_node *current_ring_node_sm_f0; |
|
20 | 20 | ring_node *ring_node_for_averaging_sm_f0; |
|
21 | 21 | ring_node *current_ring_node_sm_f1; |
|
22 | 22 | ring_node *current_ring_node_sm_f2; |
|
23 | 23 | |
|
24 | 24 | BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ]; |
|
25 | 25 | float averaged_sm_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ]; |
|
26 | 26 | float averaged_sm_f0_reorganized[ TIME_OFFSET + TOTAL_SIZE_SM ]; |
|
27 | 27 | char averaged_sm_f0_char [ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_SM * 2 ]; |
|
28 | 28 | float compressed_sm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_F0 ]; |
|
29 | 29 | |
|
30 | 30 | unsigned int nb_sm_f0; |
|
31 | 31 | |
|
32 | 32 | void init_sm_rings( void ) |
|
33 | 33 | { |
|
34 | 34 | unsigned char i; |
|
35 | 35 | |
|
36 | 36 | // F0 RING |
|
37 | 37 | sm_ring_f0[0].next = (ring_node*) &sm_ring_f0[1]; |
|
38 | 38 | sm_ring_f0[0].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-1]; |
|
39 |
sm_ring_f0[0].buffer_address = |
|
|
39 | sm_ring_f0[0].buffer_address = | |
|
40 | (int) &sm_f0[ 0 ]; | |
|
40 | 41 | |
|
41 | 42 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].next = (ring_node*) &sm_ring_f0[0]; |
|
42 | 43 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-2]; |
|
43 |
sm_ring_f0[NB_RING_NODES_ASM_F0-1].buffer_address = |
|
|
44 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].buffer_address = | |
|
45 | (int) &sm_f0[ (NB_RING_NODES_ASM_F0-1) * TOTAL_SIZE_SM ]; | |
|
44 | 46 | |
|
45 | 47 | for(i=1; i<NB_RING_NODES_ASM_F0-1; i++) |
|
46 | 48 | { |
|
47 | 49 | sm_ring_f0[i].next = (ring_node*) &sm_ring_f0[i+1]; |
|
48 | 50 | sm_ring_f0[i].previous = (ring_node*) &sm_ring_f0[i-1]; |
|
49 |
sm_ring_f0[i].buffer_address = |
|
|
51 | sm_ring_f0[i].buffer_address = | |
|
52 | (int) &sm_f0[ i * TOTAL_SIZE_SM ]; | |
|
53 | } | |
|
54 | ||
|
55 | // F1 RING | |
|
56 | sm_ring_f1[0].next = (ring_node*) &sm_ring_f1[1]; | |
|
57 | sm_ring_f1[0].previous = (ring_node*) &sm_ring_f1[NB_RING_NODES_ASM_F1-1]; | |
|
58 | sm_ring_f1[0].buffer_address = | |
|
59 | (int) &sm_f1[ 0 ]; | |
|
60 | ||
|
61 | sm_ring_f1[NB_RING_NODES_ASM_F1-1].next = (ring_node*) &sm_ring_f1[0]; | |
|
62 | sm_ring_f1[NB_RING_NODES_ASM_F1-1].previous = (ring_node*) &sm_ring_f1[NB_RING_NODES_ASM_F1-2]; | |
|
63 | sm_ring_f1[NB_RING_NODES_ASM_F1-1].buffer_address = | |
|
64 | (int) &sm_f1[ (NB_RING_NODES_ASM_F1-1) * TOTAL_SIZE_SM ]; | |
|
65 | ||
|
66 | for(i=1; i<NB_RING_NODES_ASM_F1-1; i++) | |
|
67 | { | |
|
68 | sm_ring_f1[i].next = (ring_node*) &sm_ring_f1[i+1]; | |
|
69 | sm_ring_f1[i].previous = (ring_node*) &sm_ring_f1[i-1]; | |
|
70 | sm_ring_f1[i].buffer_address = | |
|
71 | (int) &sm_f1[ i * TOTAL_SIZE_SM ]; | |
|
72 | } | |
|
73 | ||
|
74 | // F2 RING | |
|
75 | sm_ring_f2[0].next = (ring_node*) &sm_ring_f2[1]; | |
|
76 | sm_ring_f2[0].previous = (ring_node*) &sm_ring_f2[NB_RING_NODES_ASM_F2-1]; | |
|
77 | sm_ring_f2[0].buffer_address = | |
|
78 | (int) &sm_f2[ 0 ]; | |
|
79 | ||
|
80 | sm_ring_f2[NB_RING_NODES_ASM_F2-1].next = (ring_node*) &sm_ring_f2[0]; | |
|
81 | sm_ring_f2[NB_RING_NODES_ASM_F2-1].previous = (ring_node*) &sm_ring_f2[NB_RING_NODES_ASM_F2-2]; | |
|
82 | sm_ring_f2[NB_RING_NODES_ASM_F2-1].buffer_address = | |
|
83 | (int) &sm_f2[ (NB_RING_NODES_ASM_F2-1) * TOTAL_SIZE_SM ]; | |
|
84 | ||
|
85 | for(i=1; i<NB_RING_NODES_ASM_F2-1; i++) | |
|
86 | { | |
|
87 | sm_ring_f2[i].next = (ring_node*) &sm_ring_f2[i+1]; | |
|
88 | sm_ring_f2[i].previous = (ring_node*) &sm_ring_f2[i-1]; | |
|
89 | sm_ring_f2[i].buffer_address = | |
|
90 | (int) &sm_f2[ i * TOTAL_SIZE_SM ]; | |
|
50 | 91 | } |
|
51 | 92 | |
|
52 | 93 | DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) |
|
94 | DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1) | |
|
95 | DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2) | |
|
53 | 96 | |
|
54 | 97 | spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address; |
|
55 | 98 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0) |
|
56 | 99 | } |
|
57 | 100 | |
|
58 | 101 | void reset_current_sm_ring_nodes( void ) |
|
59 | 102 | { |
|
60 |
current_ring_node_sm_f0 |
|
|
103 | current_ring_node_sm_f0 = sm_ring_f0; | |
|
104 | current_ring_node_sm_f1 = sm_ring_f1; | |
|
105 | current_ring_node_sm_f2 = sm_ring_f2; | |
|
106 | ||
|
61 | 107 | ring_node_for_averaging_sm_f0 = sm_ring_f0; |
|
62 | 108 | } |
|
63 | 109 | |
|
64 | 110 | //*********************************************************** |
|
65 | 111 | // Interrupt Service Routine for spectral matrices processing |
|
66 | 112 | void reset_nb_sm_f0( void ) |
|
67 | 113 | { |
|
68 | 114 | nb_sm_f0 = 0; |
|
69 | 115 | } |
|
70 | 116 | |
|
71 | 117 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
72 | 118 | { |
|
73 | 119 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
74 | 120 | |
|
75 | 121 | if ( (spectral_matrix_regs->status & 0x1) == 0x01) |
|
76 | 122 | { |
|
77 | 123 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
78 | 124 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
79 | 125 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110 |
|
80 | 126 | nb_sm_f0 = nb_sm_f0 + 1; |
|
81 | 127 | } |
|
82 | 128 | else if ( (spectral_matrix_regs->status & 0x2) == 0x02) |
|
83 | 129 | { |
|
84 | 130 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
85 | 131 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; |
|
86 | 132 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 |
|
87 | 133 | nb_sm_f0 = nb_sm_f0 + 1; |
|
88 | 134 | } |
|
89 | 135 | |
|
90 | 136 | if ( (spectral_matrix_regs->status & 0x30) != 0x00) |
|
91 | 137 | { |
|
92 | 138 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
93 | 139 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111 |
|
94 | 140 | } |
|
95 | 141 | |
|
96 | 142 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011 |
|
97 | 143 | |
|
98 | 144 | if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) ) |
|
99 | 145 | { |
|
100 | 146 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; |
|
101 | 147 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
102 | 148 | { |
|
103 | 149 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
104 | 150 | } |
|
105 | 151 | nb_sm_f0 = 0; |
|
106 | 152 | } |
|
107 | 153 | else |
|
108 | 154 | { |
|
109 | 155 | nb_sm_f0 = nb_sm_f0 + 1; |
|
110 | 156 | } |
|
111 | 157 | } |
|
112 | 158 | |
|
113 | 159 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) |
|
114 | 160 | { |
|
115 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
|
116 | ||
|
117 | if ( (spectral_matrix_regs->status & 0x1) == 0x01) | |
|
118 | { | |
|
119 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
|
120 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; | |
|
121 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110 | |
|
122 | nb_sm_f0 = nb_sm_f0 + 1; | |
|
123 | } | |
|
124 | else if ( (spectral_matrix_regs->status & 0x2) == 0x02) | |
|
125 | { | |
|
126 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
|
127 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; | |
|
128 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 | |
|
129 | nb_sm_f0 = nb_sm_f0 + 1; | |
|
130 | } | |
|
131 | ||
|
132 | if ( (spectral_matrix_regs->status & 0x30) != 0x00) | |
|
133 | { | |
|
134 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); | |
|
135 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111 | |
|
136 | } | |
|
137 | ||
|
138 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011 | |
|
139 | ||
|
140 | 161 | if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) ) |
|
141 | 162 | { |
|
142 | 163 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; |
|
143 | 164 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
144 | 165 | { |
|
145 | 166 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
146 | 167 | } |
|
147 | 168 | nb_sm_f0 = 0; |
|
148 | 169 | } |
|
149 | 170 | else |
|
150 | 171 | { |
|
151 | 172 | nb_sm_f0 = nb_sm_f0 + 1; |
|
152 | 173 | } |
|
153 | 174 | } |
|
154 | 175 | |
|
155 | 176 | //************ |
|
156 | 177 | // RTEMS TASKS |
|
157 | 178 | |
|
158 | 179 | rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ |
|
159 | 180 | { |
|
160 | 181 | rtems_event_set event_out; |
|
161 | 182 | |
|
162 | 183 | BOOT_PRINTF("in SMIQ *** \n") |
|
163 | 184 | |
|
164 | 185 | while(1){ |
|
165 | 186 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
166 | 187 | } |
|
167 | 188 | } |
|
168 | 189 | |
|
169 | 190 | rtems_task avf0_task(rtems_task_argument argument) |
|
170 | 191 | { |
|
171 | 192 | int i; |
|
172 | 193 | static int nb_average; |
|
173 | 194 | rtems_event_set event_out; |
|
174 | 195 | rtems_status_code status; |
|
175 | 196 | ring_node *ring_node_tab[8]; |
|
176 | 197 | |
|
177 | 198 | nb_average = 0; |
|
178 | 199 | |
|
179 | 200 | BOOT_PRINTF("in AVFO *** \n") |
|
180 | 201 | |
|
181 | 202 | while(1){ |
|
182 | 203 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
183 | 204 | ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0; |
|
184 | 205 | for (i=2; i<NB_SM_TO_RECEIVE_BEFORE_AVF0+1; i++) |
|
185 | 206 | { |
|
186 | 207 | ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous; |
|
187 | 208 | ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0; |
|
188 | 209 | } |
|
189 | 210 | |
|
190 | 211 | averaged_sm_f0[0] = ( (int *) (ring_node_tab[7]->buffer_address) ) [0]; |
|
191 | 212 | averaged_sm_f0[1] = ( (int *) (ring_node_tab[7]->buffer_address) ) [1]; |
|
192 | 213 | for(i=0; i<TOTAL_SIZE_SM; i++) |
|
193 | 214 | { |
|
194 | 215 | averaged_sm_f0[i] = ( (int *) (ring_node_tab[0]->buffer_address) ) [i + TIME_OFFSET] |
|
195 | 216 | + ( (int *) (ring_node_tab[1]->buffer_address) ) [i + TIME_OFFSET] |
|
196 | 217 | + ( (int *) (ring_node_tab[2]->buffer_address) ) [i + TIME_OFFSET] |
|
197 | 218 | + ( (int *) (ring_node_tab[3]->buffer_address) ) [i + TIME_OFFSET] |
|
198 | 219 | + ( (int *) (ring_node_tab[4]->buffer_address) ) [i + TIME_OFFSET] |
|
199 | 220 | + ( (int *) (ring_node_tab[5]->buffer_address) ) [i + TIME_OFFSET] |
|
200 | 221 | + ( (int *) (ring_node_tab[6]->buffer_address) ) [i + TIME_OFFSET] |
|
201 | 222 | + ( (int *) (ring_node_tab[7]->buffer_address) ) [i + TIME_OFFSET]; |
|
202 | 223 | } |
|
203 | 224 | |
|
204 | 225 | nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0; |
|
205 | 226 | if (nb_average == NB_AVERAGE_NORMAL_f0) { |
|
206 | 227 | nb_average = 0; |
|
207 | 228 | status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0 |
|
208 | 229 | if (status != RTEMS_SUCCESSFUL) { |
|
209 | 230 | printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status); |
|
210 | 231 | } |
|
211 | 232 | } |
|
212 | 233 | } |
|
213 | 234 | } |
|
214 | 235 | |
|
215 | 236 | rtems_task matr_task(rtems_task_argument argument) |
|
216 | 237 | { |
|
217 | 238 | spw_ioctl_pkt_send spw_ioctl_send_ASM; |
|
218 | 239 | rtems_event_set event_out; |
|
219 | 240 | rtems_status_code status; |
|
220 | 241 | rtems_id queue_id; |
|
221 | 242 | Header_TM_LFR_SCIENCE_ASM_t headerASM; |
|
222 | 243 | |
|
223 | 244 | init_header_asm( &headerASM ); |
|
224 | 245 | |
|
225 | 246 | status = get_message_queue_id_send( &queue_id ); |
|
226 | 247 | if (status != RTEMS_SUCCESSFUL) |
|
227 | 248 | { |
|
228 | 249 | PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status) |
|
229 | 250 | } |
|
230 | 251 | |
|
231 | 252 | BOOT_PRINTF("in MATR *** \n") |
|
232 | 253 | |
|
233 | 254 | fill_averaged_spectral_matrix( ); |
|
234 | 255 | |
|
235 | 256 | while(1){ |
|
236 | 257 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
237 | 258 | // 1) compress the matrix for Basic Parameters calculation |
|
238 | 259 | ASM_compress( averaged_sm_f0, 0, compressed_sm_f0 ); |
|
239 | 260 | // 2) |
|
240 | 261 | //BP1_set(compressed_sm_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0); |
|
241 | 262 | // 3) convert the float array in a char array |
|
242 | 263 | ASM_reorganize( averaged_sm_f0, averaged_sm_f0_reorganized ); |
|
243 | 264 | ASM_convert( averaged_sm_f0_reorganized, averaged_sm_f0_char); |
|
244 | 265 | // 4) send the spectral matrix packets |
|
245 | 266 | ASM_send( &headerASM, averaged_sm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); |
|
246 | 267 | } |
|
247 | 268 | } |
|
248 | 269 | |
|
249 | 270 | //***************************** |
|
250 | 271 | // Spectral matrices processing |
|
251 | 272 | |
|
252 | 273 | void matrix_reset(volatile float *averaged_spec_mat) |
|
253 | 274 | { |
|
254 | 275 | int i; |
|
255 | 276 | for(i=0; i<TOTAL_SIZE_SM; i++){ |
|
256 | 277 | averaged_spec_mat[i] = 0; |
|
257 | 278 | } |
|
258 | 279 | } |
|
259 | 280 | |
|
260 | 281 | void ASM_reorganize( float *averaged_spec_mat, float *averaged_spec_mat_reorganized ) |
|
261 | 282 | { |
|
262 | 283 | int frequencyBin; |
|
263 | 284 | int asmComponent; |
|
264 | 285 | |
|
265 | 286 | // copy the time information |
|
266 | 287 | averaged_spec_mat_reorganized[ 0 ] = averaged_spec_mat[ 0 ]; |
|
267 | 288 | averaged_spec_mat_reorganized[ 1 ] = averaged_spec_mat[ 1 ]; |
|
268 | 289 | |
|
269 | 290 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) |
|
270 | 291 | { |
|
271 | 292 | for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ ) |
|
272 | 293 | { |
|
273 | 294 | averaged_spec_mat_reorganized[ frequencyBin * NB_VALUES_PER_SM + asmComponent + TIME_OFFSET ] = |
|
274 | 295 | averaged_spec_mat[ asmComponent * NB_BINS_PER_SM + frequencyBin + TIME_OFFSET]; |
|
275 | 296 | } |
|
276 | 297 | } |
|
277 | 298 | } |
|
278 | 299 | |
|
279 | 300 | void ASM_compress( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat ) |
|
280 | 301 | { |
|
281 | 302 | int frequencyBin; |
|
282 | 303 | int asmComponent; |
|
283 | 304 | int offsetASM; |
|
284 | 305 | int offsetCompressed; |
|
285 | 306 | int k; |
|
286 | 307 | |
|
287 | 308 | switch (fChannel){ |
|
288 | 309 | case 0: |
|
289 | 310 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) |
|
290 | 311 | { |
|
291 | 312 | for( frequencyBin = 0; frequencyBin < NB_BINS_COMPRESSED_SM_F0; frequencyBin++ ) |
|
292 | 313 | { |
|
293 | 314 | offsetASM = asmComponent * NB_BINS_PER_SM |
|
294 | 315 | + ASM_F0_INDICE_START |
|
295 | 316 | + frequencyBin * NB_BINS_TO_AVERAGE_ASM_F0; |
|
296 | 317 | offsetCompressed = frequencyBin * NB_VALUES_PER_SM |
|
297 | 318 | + asmComponent; |
|
298 | 319 | compressed_spec_mat[ offsetCompressed ] = 0; |
|
299 | 320 | for ( k = 0; k < NB_BINS_TO_AVERAGE_ASM_F0; k++ ) |
|
300 | 321 | { |
|
301 | 322 | compressed_spec_mat[offsetCompressed ] = |
|
302 | 323 | compressed_spec_mat[ offsetCompressed ] |
|
303 | 324 | + averaged_spec_mat[ offsetASM + k ]; |
|
304 | 325 | } |
|
305 | 326 | } |
|
306 | 327 | } |
|
307 | 328 | break; |
|
308 | 329 | |
|
309 | 330 | case 1: |
|
310 | 331 | // case fChannel = f1 to be completed later |
|
311 | 332 | break; |
|
312 | 333 | |
|
313 | 334 | case 2: |
|
314 | 335 | // case fChannel = f1 to be completed later |
|
315 | 336 | break; |
|
316 | 337 | |
|
317 | 338 | default: |
|
318 | 339 | break; |
|
319 | 340 | } |
|
320 | 341 | } |
|
321 | 342 | |
|
322 | 343 | void ASM_convert( volatile float *input_matrix, char *output_matrix) |
|
323 | 344 | { |
|
324 | 345 | unsigned int i; |
|
325 | 346 | unsigned int frequencyBin; |
|
326 | 347 | unsigned int asmComponent; |
|
327 | 348 | char * pt_char_input; |
|
328 | 349 | char * pt_char_output; |
|
329 | 350 | |
|
330 | 351 | pt_char_input = (char*) &input_matrix; |
|
331 | 352 | pt_char_output = (char*) &output_matrix; |
|
332 | 353 | |
|
333 | 354 | // copy the time information |
|
334 | 355 | for (i=0; i<TIME_OFFSET_IN_BYTES; i++) |
|
335 | 356 | { |
|
336 | 357 | pt_char_output[ i ] = pt_char_output[ i ]; |
|
337 | 358 | } |
|
338 | 359 | |
|
339 | 360 | // convert all other data |
|
340 | 361 | for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++) |
|
341 | 362 | { |
|
342 | 363 | for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++) |
|
343 | 364 | { |
|
344 | 365 | pt_char_input = (char*) &input_matrix [ (frequencyBin*NB_VALUES_PER_SM) + asmComponent + TIME_OFFSET ]; |
|
345 | 366 | pt_char_output = (char*) &output_matrix[ 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) + TIME_OFFSET_IN_BYTES ]; |
|
346 | 367 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float |
|
347 | 368 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float |
|
348 | 369 | } |
|
349 | 370 | } |
|
350 | 371 | } |
|
351 | 372 | |
|
352 | 373 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
353 | 374 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) |
|
354 | 375 | { |
|
355 | 376 | unsigned int i; |
|
356 | 377 | unsigned int length = 0; |
|
357 | 378 | rtems_status_code status; |
|
358 | 379 | |
|
359 | 380 | for (i=0; i<2; i++) |
|
360 | 381 | { |
|
361 | 382 | // (1) BUILD THE DATA |
|
362 | 383 | switch(sid) |
|
363 | 384 | { |
|
364 | 385 | case SID_NORM_ASM_F0: |
|
365 | 386 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; |
|
366 | 387 | spw_ioctl_send->data = &spectral_matrix[ |
|
367 | 388 | ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2 |
|
368 | 389 | + TIME_OFFSET_IN_BYTES |
|
369 | 390 | ]; |
|
370 | 391 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; |
|
371 | 392 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB |
|
372 | 393 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB |
|
373 | 394 | break; |
|
374 | 395 | case SID_NORM_ASM_F1: |
|
375 | 396 | break; |
|
376 | 397 | case SID_NORM_ASM_F2: |
|
377 | 398 | break; |
|
378 | 399 | default: |
|
379 | 400 | PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid) |
|
380 | 401 | break; |
|
381 | 402 | } |
|
382 | 403 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
383 | 404 | spw_ioctl_send->hdr = (char *) header; |
|
384 | 405 | spw_ioctl_send->options = 0; |
|
385 | 406 | |
|
386 | 407 | // (2) BUILD THE HEADER |
|
387 | 408 | header->packetLength[0] = (unsigned char) (length>>8); |
|
388 | 409 | header->packetLength[1] = (unsigned char) (length); |
|
389 | 410 | header->sid = (unsigned char) sid; // SID |
|
390 | 411 | header->pa_lfr_pkt_cnt_asm = 2; |
|
391 | 412 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); |
|
392 | 413 | |
|
393 | 414 | // (3) SET PACKET TIME |
|
394 | 415 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
395 | 416 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
396 | 417 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
397 | 418 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
398 | 419 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
399 | 420 | header->time[5] = (unsigned char) (time_management_regs->fine_time); |
|
400 | 421 | // |
|
401 | 422 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
402 | 423 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
403 | 424 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
404 | 425 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); |
|
405 | 426 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
406 | 427 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); |
|
407 | 428 | |
|
408 | 429 | // (4) SEND PACKET |
|
409 | 430 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
410 | 431 | if (status != RTEMS_SUCCESSFUL) { |
|
411 | 432 | printf("in ASM_send *** ERR %d\n", (int) status); |
|
412 | 433 | } |
|
413 | 434 | } |
|
414 | 435 | } |
|
415 | 436 | |
|
416 | 437 | void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){ |
|
417 | 438 | int i; |
|
418 | 439 | int j; |
|
419 | 440 | unsigned char tmp_u_char; |
|
420 | 441 | unsigned char * pt_char = NULL; |
|
421 | 442 | float PSDB, PSDE; |
|
422 | 443 | float NVEC_V0; |
|
423 | 444 | float NVEC_V1; |
|
424 | 445 | float NVEC_V2; |
|
425 | 446 | //float significand; |
|
426 | 447 | //int exponent; |
|
427 | 448 | float aux; |
|
428 | 449 | float tr_SB_SB; |
|
429 | 450 | float tmp; |
|
430 | 451 | float sx_re; |
|
431 | 452 | float sx_im; |
|
432 | 453 | float nebx_re = 0; |
|
433 | 454 | float nebx_im = 0; |
|
434 | 455 | float ny = 0; |
|
435 | 456 | float nz = 0; |
|
436 | 457 | float bx_bx_star = 0; |
|
437 | 458 | for(i=0; i<nb_bins_compressed_spec_mat; i++){ |
|
438 | 459 | //============================================== |
|
439 | 460 | // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits |
|
440 | 461 | PSDB = compressed_spec_mat[i*30] // S11 |
|
441 | 462 | + compressed_spec_mat[(i*30) + 10] // S22 |
|
442 | 463 | + compressed_spec_mat[(i*30) + 18]; // S33 |
|
443 | 464 | //significand = frexp(PSDB, &exponent); |
|
444 | 465 | pt_char = (unsigned char*) &PSDB; |
|
445 | 466 | LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float |
|
446 | 467 | LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float |
|
447 | 468 | //============================================== |
|
448 | 469 | // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits |
|
449 | 470 | PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44 |
|
450 | 471 | + compressed_spec_mat[(i*30) + 28] * K55_pe // S55 |
|
451 | 472 | + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45 |
|
452 | 473 | - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45 |
|
453 | 474 | pt_char = (unsigned char*) &PSDE; |
|
454 | 475 | LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float |
|
455 | 476 | LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float |
|
456 | 477 | //============================================================================== |
|
457 | 478 | // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits |
|
458 | 479 | // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits |
|
459 | 480 | // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits |
|
460 | 481 | tmp = sqrt( |
|
461 | 482 | compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12 |
|
462 | 483 | +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13 |
|
463 | 484 | +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23 |
|
464 | 485 | ); |
|
465 | 486 | NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23 |
|
466 | 487 | NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13 |
|
467 | 488 | NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12 |
|
468 | 489 | LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127); |
|
469 | 490 | LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127); |
|
470 | 491 | pt_char = (unsigned char*) &NVEC_V2; |
|
471 | 492 | LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2 |
|
472 | 493 | //======================================================= |
|
473 | 494 | // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits |
|
474 | 495 | aux = 2*tmp / PSDB; // compute the ellipticity |
|
475 | 496 | tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity |
|
476 | 497 | LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char |
|
477 | 498 | //============================================================== |
|
478 | 499 | // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits |
|
479 | 500 | for(j = 0; j<NB_VALUES_PER_SM;j++){ |
|
480 | 501 | tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30] |
|
481 | 502 | + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10] |
|
482 | 503 | + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18] |
|
483 | 504 | + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2] |
|
484 | 505 | + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3] |
|
485 | 506 | + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4] |
|
486 | 507 | + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5] |
|
487 | 508 | + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12] |
|
488 | 509 | + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13]; |
|
489 | 510 | } |
|
490 | 511 | aux = PSDB*PSDB; |
|
491 | 512 | tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) ); |
|
492 | 513 | tmp_u_char = (unsigned char) (NVEC_V0*(8-1)); |
|
493 | 514 | LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char |
|
494 | 515 | //======================================================================================= |
|
495 | 516 | // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1) |
|
496 | 517 | sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re |
|
497 | 518 | + compressed_spec_mat[(i*30) + 6] * K14_sx_re |
|
498 | 519 | + compressed_spec_mat[(i*30) + 8] * K15_sx_re |
|
499 | 520 | + compressed_spec_mat[(i*30) + 14] * K24_sx_re |
|
500 | 521 | + compressed_spec_mat[(i*30) + 16] * K25_sx_re |
|
501 | 522 | + compressed_spec_mat[(i*30) + 22] * K35_sx_re; |
|
502 | 523 | sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im |
|
503 | 524 | + compressed_spec_mat[(i*30) + 7] * K14_sx_im |
|
504 | 525 | + compressed_spec_mat[(i*30) + 9] * K15_sx_im |
|
505 | 526 | + compressed_spec_mat[(i*30) + 15] * K24_sx_im |
|
506 | 527 | + compressed_spec_mat[(i*30) + 17] * K25_sx_im |
|
507 | 528 | + compressed_spec_mat[(i*30) + 23] * K35_sx_im; |
|
508 | 529 | LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression |
|
509 | 530 | if ( abs(sx_re) > abs(sx_im) ) { |
|
510 | 531 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx |
|
511 | 532 | } |
|
512 | 533 | else { |
|
513 | 534 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx |
|
514 | 535 | } |
|
515 | 536 | //====================================================================== |
|
516 | 537 | // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1) |
|
517 | 538 | ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2; |
|
518 | 539 | nz = NVEC_V0; |
|
519 | 540 | bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22 |
|
520 | 541 | + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33 |
|
521 | 542 | - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23 |
|
522 | 543 | nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re |
|
523 | 544 | +compressed_spec_mat[(i*30) + 16] * K25_ny_re |
|
524 | 545 | +compressed_spec_mat[(i*30) + 20] * K34_ny_re |
|
525 | 546 | +compressed_spec_mat[(i*30) + 22] * K35_ny_re) |
|
526 | 547 | + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re |
|
527 | 548 | +compressed_spec_mat[(i*30) + 16] * K25_nz_re |
|
528 | 549 | +compressed_spec_mat[(i*30) + 20] * K34_nz_re |
|
529 | 550 | +compressed_spec_mat[(i*30) + 22] * K35_nz_re); |
|
530 | 551 | nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re |
|
531 | 552 | +compressed_spec_mat[(i*30) + 17] * K25_ny_re |
|
532 | 553 | +compressed_spec_mat[(i*30) + 21] * K34_ny_re |
|
533 | 554 | +compressed_spec_mat[(i*30) + 23] * K35_ny_re) |
|
534 | 555 | + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im |
|
535 | 556 | +compressed_spec_mat[(i*30) + 17] * K25_nz_im |
|
536 | 557 | +compressed_spec_mat[(i*30) + 21] * K34_nz_im |
|
537 | 558 | +compressed_spec_mat[(i*30) + 23] * K35_nz_im); |
|
538 | 559 | tmp = nebx_re / bx_bx_star; |
|
539 | 560 | LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression |
|
540 | 561 | if ( abs(nebx_re) > abs(nebx_im) ) { |
|
541 | 562 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx |
|
542 | 563 | } |
|
543 | 564 | else { |
|
544 | 565 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx |
|
545 | 566 | } |
|
546 | 567 | } |
|
547 | 568 | |
|
548 | 569 | } |
|
549 | 570 | |
|
550 | 571 | void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){ |
|
551 | 572 | // BP2 autocorrelation |
|
552 | 573 | int i; |
|
553 | 574 | int aux = 0; |
|
554 | 575 | |
|
555 | 576 | for(i = 0; i<nb_bins_compressed_spec_mat; i++){ |
|
556 | 577 | // S12 |
|
557 | 578 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]); |
|
558 | 579 | compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux; |
|
559 | 580 | compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux; |
|
560 | 581 | // S13 |
|
561 | 582 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]); |
|
562 | 583 | compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux; |
|
563 | 584 | compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux; |
|
564 | 585 | // S23 |
|
565 | 586 | aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]); |
|
566 | 587 | compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux; |
|
567 | 588 | compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux; |
|
568 | 589 | // S45 |
|
569 | 590 | aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]); |
|
570 | 591 | compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux; |
|
571 | 592 | compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux; |
|
572 | 593 | // S14 |
|
573 | 594 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]); |
|
574 | 595 | compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux; |
|
575 | 596 | compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux; |
|
576 | 597 | // S15 |
|
577 | 598 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]); |
|
578 | 599 | compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux; |
|
579 | 600 | compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux; |
|
580 | 601 | // S24 |
|
581 | 602 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]); |
|
582 | 603 | compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux; |
|
583 | 604 | compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux; |
|
584 | 605 | // S25 |
|
585 | 606 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]); |
|
586 | 607 | compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux; |
|
587 | 608 | compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux; |
|
588 | 609 | // S34 |
|
589 | 610 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]); |
|
590 | 611 | compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux; |
|
591 | 612 | compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux; |
|
592 | 613 | // S35 |
|
593 | 614 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]); |
|
594 | 615 | compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux; |
|
595 | 616 | compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux; |
|
596 | 617 | } |
|
597 | 618 | } |
|
598 | 619 | |
|
599 | 620 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header) |
|
600 | 621 | { |
|
601 | 622 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
602 | 623 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
603 | 624 | header->reserved = 0x00; |
|
604 | 625 | header->userApplication = CCSDS_USER_APP; |
|
605 | 626 | header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
606 | 627 | header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
607 | 628 | header->packetSequenceControl[0] = 0xc0; |
|
608 | 629 | header->packetSequenceControl[1] = 0x00; |
|
609 | 630 | header->packetLength[0] = 0x00; |
|
610 | 631 | header->packetLength[1] = 0x00; |
|
611 | 632 | // DATA FIELD HEADER |
|
612 | 633 | header->spare1_pusVersion_spare2 = 0x10; |
|
613 | 634 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
614 | 635 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
615 | 636 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
616 | 637 | // AUXILIARY DATA HEADER |
|
617 | 638 | header->sid = 0x00; |
|
618 | 639 | header->biaStatusInfo = 0x00; |
|
619 | 640 | header->pa_lfr_pkt_cnt_asm = 0x00; |
|
620 | 641 | header->pa_lfr_pkt_nr_asm = 0x00; |
|
621 | 642 | header->time[0] = 0x00; |
|
622 | 643 | header->time[0] = 0x00; |
|
623 | 644 | header->time[0] = 0x00; |
|
624 | 645 | header->time[0] = 0x00; |
|
625 | 646 | header->time[0] = 0x00; |
|
626 | 647 | header->time[0] = 0x00; |
|
627 | 648 | header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB |
|
628 | 649 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB |
|
629 | 650 | } |
|
630 | 651 | |
|
631 | 652 | void fill_averaged_spectral_matrix(void) |
|
632 | 653 | { |
|
633 | 654 | /** This function fills spectral matrices related buffers with arbitrary data. |
|
634 | 655 | * |
|
635 | 656 | * This function is for testing purpose only. |
|
636 | 657 | * |
|
637 | 658 | */ |
|
638 | 659 | |
|
639 | 660 | float offset; |
|
640 | 661 | float coeff; |
|
641 | 662 | |
|
642 | 663 | offset = 10.; |
|
643 | 664 | coeff = 100000.; |
|
644 | 665 | averaged_sm_f0[ 0 + 25 * 0 ] = 0. + offset; |
|
645 | 666 | averaged_sm_f0[ 0 + 25 * 1 ] = 1. + offset; |
|
646 | 667 | averaged_sm_f0[ 0 + 25 * 2 ] = 2. + offset; |
|
647 | 668 | averaged_sm_f0[ 0 + 25 * 3 ] = 3. + offset; |
|
648 | 669 | averaged_sm_f0[ 0 + 25 * 4 ] = 4. + offset; |
|
649 | 670 | averaged_sm_f0[ 0 + 25 * 5 ] = 5. + offset; |
|
650 | 671 | averaged_sm_f0[ 0 + 25 * 6 ] = 6. + offset; |
|
651 | 672 | averaged_sm_f0[ 0 + 25 * 7 ] = 7. + offset; |
|
652 | 673 | averaged_sm_f0[ 0 + 25 * 8 ] = 8. + offset; |
|
653 | 674 | averaged_sm_f0[ 0 + 25 * 9 ] = 9. + offset; |
|
654 | 675 | averaged_sm_f0[ 0 + 25 * 10 ] = 10. + offset; |
|
655 | 676 | averaged_sm_f0[ 0 + 25 * 11 ] = 11. + offset; |
|
656 | 677 | averaged_sm_f0[ 0 + 25 * 12 ] = 12. + offset; |
|
657 | 678 | averaged_sm_f0[ 0 + 25 * 13 ] = 13. + offset; |
|
658 | 679 | averaged_sm_f0[ 0 + 25 * 14 ] = 14. + offset; |
|
659 | 680 | averaged_sm_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff; |
|
660 | 681 | averaged_sm_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff; |
|
661 | 682 | averaged_sm_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff; |
|
662 | 683 | averaged_sm_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff; |
|
663 | 684 | averaged_sm_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff; |
|
664 | 685 | averaged_sm_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff; |
|
665 | 686 | averaged_sm_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff; |
|
666 | 687 | averaged_sm_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff; |
|
667 | 688 | averaged_sm_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff; |
|
668 | 689 | averaged_sm_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff; |
|
669 | 690 | averaged_sm_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff; |
|
670 | 691 | averaged_sm_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff; |
|
671 | 692 | averaged_sm_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff; |
|
672 | 693 | averaged_sm_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff; |
|
673 | 694 | averaged_sm_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff; |
|
674 | 695 | |
|
675 | 696 | offset = 10000000; |
|
676 | 697 | averaged_sm_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff; |
|
677 | 698 | averaged_sm_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff; |
|
678 | 699 | averaged_sm_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff; |
|
679 | 700 | averaged_sm_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff; |
|
680 | 701 | averaged_sm_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff; |
|
681 | 702 | averaged_sm_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff; |
|
682 | 703 | averaged_sm_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff; |
|
683 | 704 | averaged_sm_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff; |
|
684 | 705 | averaged_sm_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff; |
|
685 | 706 | averaged_sm_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff; |
|
686 | 707 | averaged_sm_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff; |
|
687 | 708 | averaged_sm_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff; |
|
688 | 709 | averaged_sm_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff; |
|
689 | 710 | averaged_sm_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff; |
|
690 | 711 | averaged_sm_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff; |
|
691 | 712 | |
|
692 | 713 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_sm_f0[ 0 ]; |
|
693 | 714 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_sm_f0[ 1 ]; |
|
694 | 715 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_sm_f0[ 2 ]; |
|
695 | 716 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_sm_f0[ 3 ]; |
|
696 | 717 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_sm_f0[ 4 ]; |
|
697 | 718 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_sm_f0[ 5 ]; |
|
698 | 719 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_sm_f0[ 6 ]; |
|
699 | 720 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_sm_f0[ 7 ]; |
|
700 | 721 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_sm_f0[ 8 ]; |
|
701 | 722 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_sm_f0[ 9 ]; |
|
702 | 723 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_sm_f0[ 10 ]; |
|
703 | 724 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_sm_f0[ 11 ]; |
|
704 | 725 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_sm_f0[ 12 ]; |
|
705 | 726 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_sm_f0[ 13 ]; |
|
706 | 727 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_sm_f0[ 14 ]; |
|
707 | 728 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_sm_f0[ 15 ]; |
|
708 | 729 | } |
|
709 | 730 | |
|
710 | 731 | void reset_spectral_matrix_regs() |
|
711 | 732 | { |
|
712 | 733 | /** This function resets the spectral matrices module registers. |
|
713 | 734 | * |
|
714 | 735 | * The registers affected by this function are located at the following offset addresses: |
|
715 | 736 | * |
|
716 | 737 | * - 0x00 config |
|
717 | 738 | * - 0x04 status |
|
718 | 739 | * - 0x08 matrixF0_Address0 |
|
719 | 740 | * - 0x10 matrixFO_Address1 |
|
720 | 741 | * - 0x14 matrixF1_Address |
|
721 | 742 | * - 0x18 matrixF2_Address |
|
722 | 743 | * |
|
723 | 744 | */ |
|
724 | 745 | |
|
725 | 746 | spectral_matrix_regs->config = 0x00; |
|
726 | 747 | spectral_matrix_regs->status = 0x00; |
|
727 | 748 | |
|
728 | 749 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
729 | 750 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; |
|
730 | 751 | spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address; |
|
731 | 752 | spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address; |
|
732 | 753 | } |
|
733 | 754 | |
|
734 | 755 | //****************** |
|
735 | 756 | // general functions |
|
736 | 757 | |
|
737 | 758 | |
|
738 | 759 | |
|
739 | 760 |
@@ -1,765 +1,791 | |||
|
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, time ); |
|
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, unsigned char *time) |
|
153 | 153 | { |
|
154 | 154 | /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received. |
|
155 | 155 | * |
|
156 | 156 | * @param TC points to the TeleCommand packet that is being processed |
|
157 | 157 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
158 | 158 | * |
|
159 | 159 | */ |
|
160 | 160 | |
|
161 | 161 | rtems_status_code status; |
|
162 | 162 | unsigned char requestedMode; |
|
163 | 163 | |
|
164 | 164 | requestedMode = TC->dataAndCRC[1]; |
|
165 | 165 | |
|
166 | 166 | if ( (requestedMode != LFR_MODE_STANDBY) |
|
167 | 167 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) |
|
168 | 168 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) |
|
169 | 169 | { |
|
170 | 170 | status = RTEMS_UNSATISFIED; |
|
171 | 171 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode ); |
|
172 | 172 | } |
|
173 | 173 | else |
|
174 | 174 | { |
|
175 | 175 | printf("in action_enter_mode *** enter mode %d\n", requestedMode); |
|
176 | 176 | |
|
177 | 177 | status = transition_validation(requestedMode); |
|
178 | 178 | |
|
179 | 179 | if ( status == LFR_SUCCESSFUL ) { |
|
180 | 180 | if ( lfrCurrentMode != LFR_MODE_STANDBY) |
|
181 | 181 | { |
|
182 | 182 | status = stop_current_mode(); |
|
183 | 183 | } |
|
184 | 184 | if (status != RTEMS_SUCCESSFUL) |
|
185 | 185 | { |
|
186 | 186 | PRINTF("ERR *** in action_enter *** stop_current_mode\n") |
|
187 | 187 | } |
|
188 | 188 | status = enter_mode( requestedMode ); |
|
189 | 189 | } |
|
190 | 190 | else |
|
191 | 191 | { |
|
192 | 192 | PRINTF("ERR *** in action_enter *** transition rejected\n") |
|
193 | 193 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
194 | 194 | } |
|
195 | 195 | } |
|
196 | 196 | |
|
197 | 197 | return status; |
|
198 | 198 | } |
|
199 | 199 | |
|
200 | 200 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
201 | 201 | { |
|
202 | 202 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. |
|
203 | 203 | * |
|
204 | 204 | * @param TC points to the TeleCommand packet that is being processed |
|
205 | 205 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
206 | 206 | * |
|
207 | 207 | * @return LFR directive status code: |
|
208 | 208 | * - LFR_DEFAULT |
|
209 | 209 | * - LFR_SUCCESSFUL |
|
210 | 210 | * |
|
211 | 211 | */ |
|
212 | 212 | |
|
213 | 213 | unsigned int val; |
|
214 | 214 | int result; |
|
215 | 215 | unsigned int status; |
|
216 | 216 | unsigned char mode; |
|
217 | 217 | |
|
218 | 218 | // check LFR MODE |
|
219 | 219 | mode = (TC->dataAndCRC[ BYTE_POS_HK_UPDATE_INFO_PAR_SET5 ] & 0x1e) >> 1; |
|
220 | 220 | status = check_update_info_hk_lfr_mode( mode ); |
|
221 | 221 | if (status != LFR_DEFAULT) // check TDS mode |
|
222 | 222 | { |
|
223 | 223 | mode = (TC->dataAndCRC[ BYTE_POS_HK_UPDATE_INFO_PAR_SET6 ] & 0xf0) >> 4; |
|
224 | 224 | status = check_update_info_hk_tds_mode( mode ); |
|
225 | 225 | } |
|
226 | 226 | if (status != LFR_DEFAULT) // check THR mode |
|
227 | 227 | { |
|
228 | 228 | mode = (TC->dataAndCRC[ BYTE_POS_HK_UPDATE_INFO_PAR_SET6 ] & 0x0f); |
|
229 | 229 | status = check_update_info_hk_thr_mode( mode ); |
|
230 | 230 | } |
|
231 | 231 | if (status != LFR_DEFAULT) // if the parameter check is successful |
|
232 | 232 | { |
|
233 | 233 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 |
|
234 | 234 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; |
|
235 | 235 | val++; |
|
236 | 236 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); |
|
237 | 237 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); |
|
238 | 238 | } |
|
239 | 239 | |
|
240 | 240 | result = status; |
|
241 | 241 | |
|
242 | 242 | return result; |
|
243 | 243 | } |
|
244 | 244 | |
|
245 | 245 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
246 | 246 | { |
|
247 | 247 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. |
|
248 | 248 | * |
|
249 | 249 | * @param TC points to the TeleCommand packet that is being processed |
|
250 | 250 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
251 | 251 | * |
|
252 | 252 | */ |
|
253 | 253 | |
|
254 | 254 | int result; |
|
255 | 255 | unsigned char lfrMode; |
|
256 | 256 | |
|
257 | 257 | result = LFR_DEFAULT; |
|
258 | 258 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
259 | 259 | |
|
260 | 260 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
261 | 261 | result = LFR_DEFAULT; |
|
262 | 262 | |
|
263 | 263 | return result; |
|
264 | 264 | } |
|
265 | 265 | |
|
266 | 266 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
267 | 267 | { |
|
268 | 268 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. |
|
269 | 269 | * |
|
270 | 270 | * @param TC points to the TeleCommand packet that is being processed |
|
271 | 271 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
272 | 272 | * |
|
273 | 273 | */ |
|
274 | 274 | |
|
275 | 275 | int result; |
|
276 | 276 | unsigned char lfrMode; |
|
277 | 277 | |
|
278 | 278 | result = LFR_DEFAULT; |
|
279 | 279 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
280 | 280 | |
|
281 | 281 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
282 | 282 | result = LFR_DEFAULT; |
|
283 | 283 | |
|
284 | 284 | return result; |
|
285 | 285 | } |
|
286 | 286 | |
|
287 | 287 | int action_update_time(ccsdsTelecommandPacket_t *TC) |
|
288 | 288 | { |
|
289 | 289 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. |
|
290 | 290 | * |
|
291 | 291 | * @param TC points to the TeleCommand packet that is being processed |
|
292 | 292 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
293 | 293 | * |
|
294 | 294 | * @return LFR_SUCCESSFUL |
|
295 | 295 | * |
|
296 | 296 | */ |
|
297 | 297 | |
|
298 | 298 | unsigned int val; |
|
299 | 299 | |
|
300 | 300 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) |
|
301 | 301 | + (TC->dataAndCRC[1] << 16) |
|
302 | 302 | + (TC->dataAndCRC[2] << 8) |
|
303 | 303 | + TC->dataAndCRC[3]; |
|
304 | 304 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 |
|
305 | 305 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; |
|
306 | 306 | val++; |
|
307 | 307 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); |
|
308 | 308 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); |
|
309 | 309 | time_management_regs->ctrl = time_management_regs->ctrl | 1; |
|
310 | 310 | |
|
311 | 311 | return LFR_SUCCESSFUL; |
|
312 | 312 | } |
|
313 | 313 | |
|
314 | 314 | //******************* |
|
315 | 315 | // ENTERING THE MODES |
|
316 | 316 | |
|
317 | 317 | int transition_validation(unsigned char requestedMode) |
|
318 | 318 | { |
|
319 | 319 | /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE. |
|
320 | 320 | * |
|
321 | 321 | * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE |
|
322 | 322 | * |
|
323 | 323 | * @return LFR directive status codes: |
|
324 | 324 | * - LFR_SUCCESSFUL - the transition is authorized |
|
325 | 325 | * - LFR_DEFAULT - the transition is not authorized |
|
326 | 326 | * |
|
327 | 327 | */ |
|
328 | 328 | |
|
329 | 329 | int status; |
|
330 | 330 | |
|
331 | 331 | switch (requestedMode) |
|
332 | 332 | { |
|
333 | 333 | case LFR_MODE_STANDBY: |
|
334 | 334 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { |
|
335 | 335 | status = LFR_DEFAULT; |
|
336 | 336 | } |
|
337 | 337 | else |
|
338 | 338 | { |
|
339 | 339 | status = LFR_SUCCESSFUL; |
|
340 | 340 | } |
|
341 | 341 | break; |
|
342 | 342 | case LFR_MODE_NORMAL: |
|
343 | 343 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { |
|
344 | 344 | status = LFR_DEFAULT; |
|
345 | 345 | } |
|
346 | 346 | else { |
|
347 | 347 | status = LFR_SUCCESSFUL; |
|
348 | 348 | } |
|
349 | 349 | break; |
|
350 | 350 | case LFR_MODE_BURST: |
|
351 | 351 | if ( lfrCurrentMode == LFR_MODE_BURST ) { |
|
352 | 352 | status = LFR_DEFAULT; |
|
353 | 353 | } |
|
354 | 354 | else { |
|
355 | 355 | status = LFR_SUCCESSFUL; |
|
356 | 356 | } |
|
357 | 357 | break; |
|
358 | 358 | case LFR_MODE_SBM1: |
|
359 | 359 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { |
|
360 | 360 | status = LFR_DEFAULT; |
|
361 | 361 | } |
|
362 | 362 | else { |
|
363 | 363 | status = LFR_SUCCESSFUL; |
|
364 | 364 | } |
|
365 | 365 | break; |
|
366 | 366 | case LFR_MODE_SBM2: |
|
367 | 367 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { |
|
368 | 368 | status = LFR_DEFAULT; |
|
369 | 369 | } |
|
370 | 370 | else { |
|
371 | 371 | status = LFR_SUCCESSFUL; |
|
372 | 372 | } |
|
373 | 373 | break; |
|
374 | 374 | default: |
|
375 | 375 | status = LFR_DEFAULT; |
|
376 | 376 | break; |
|
377 | 377 | } |
|
378 | 378 | |
|
379 | 379 | return status; |
|
380 | 380 | } |
|
381 | 381 | |
|
382 | 382 | int stop_current_mode(void) |
|
383 | 383 | { |
|
384 | 384 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. |
|
385 | 385 | * |
|
386 | 386 | * @return RTEMS directive status codes: |
|
387 | 387 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
388 | 388 | * - RTEMS_INVALID_ID - task id invalid |
|
389 | 389 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
390 | 390 | * |
|
391 | 391 | */ |
|
392 | 392 | |
|
393 | 393 | rtems_status_code status; |
|
394 | 394 | |
|
395 | 395 | status = RTEMS_SUCCESSFUL; |
|
396 | 396 | |
|
397 | 397 | // (1) mask interruptions |
|
398 | 398 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt |
|
399 | 399 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
400 | 400 | |
|
401 | 401 | // (2) clear interruptions |
|
402 | 402 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt |
|
403 | 403 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
404 | 404 | |
|
405 | 405 | // (3) reset registers |
|
406 | // waveform picker | |
|
406 | 407 | reset_wfp_burst_enable(); // reset burst and enable bits |
|
407 | 408 | reset_wfp_status(); // reset all the status bits |
|
408 | disable_irq_on_new_ready_matrix(); // stop the spectral matrices | |
|
409 | // spectral matrices | |
|
410 | set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices | |
|
411 | set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0 | |
|
412 | reset_extractSWF(); // reset the extractSWF flag to false | |
|
409 | 413 | |
|
410 | 414 | // <Spectral Matrices simulator> |
|
411 | 415 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator |
|
412 | 416 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
413 | 417 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator |
|
414 | 418 | // </Spectral Matrices simulator> |
|
415 | 419 | |
|
416 | 420 | // suspend several tasks |
|
417 | 421 | if (lfrCurrentMode != LFR_MODE_STANDBY) { |
|
418 | 422 | status = suspend_science_tasks(); |
|
419 | 423 | } |
|
420 | 424 | |
|
421 | 425 | if (status != RTEMS_SUCCESSFUL) |
|
422 | 426 | { |
|
423 | 427 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
424 | 428 | } |
|
425 | 429 | |
|
426 | 430 | return status; |
|
427 | 431 | } |
|
428 | 432 | |
|
429 | 433 | int enter_mode(unsigned char mode ) |
|
430 | 434 | { |
|
431 | 435 | /** This function is launched after a mode transition validation. |
|
432 | 436 | * |
|
433 | 437 | * @param mode is the mode in which LFR will be put. |
|
434 | 438 | * |
|
435 | 439 | * @return RTEMS directive status codes: |
|
436 | 440 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully |
|
437 | 441 | * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully |
|
438 | 442 | * |
|
439 | 443 | */ |
|
440 | 444 | |
|
441 | 445 | rtems_status_code status; |
|
442 | 446 | |
|
443 | 447 | status = RTEMS_UNSATISFIED; |
|
444 | 448 | |
|
445 | 449 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d); |
|
446 | 450 | updateLFRCurrentMode(); |
|
447 | 451 | |
|
448 | 452 | if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST) |
|
449 | 453 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) ) |
|
450 | 454 | { |
|
451 | 455 | #ifdef PRINT_TASK_STATISTICS |
|
452 | 456 | rtems_cpu_usage_reset(); |
|
453 | 457 | maxCount = 0; |
|
454 | 458 | #endif |
|
455 | 459 | status = restart_science_tasks(); |
|
456 | 460 | launch_waveform_picker( mode ); |
|
457 | 461 | launch_spectral_matrix( mode ); |
|
458 | 462 | } |
|
459 | 463 | else if ( mode == LFR_MODE_STANDBY ) |
|
460 | 464 | { |
|
461 | 465 | #ifdef PRINT_TASK_STATISTICS |
|
462 | 466 | rtems_cpu_usage_report(); |
|
463 | 467 | #endif |
|
464 | 468 | |
|
465 | 469 | #ifdef PRINT_STACK_REPORT |
|
466 | 470 | rtems_stack_checker_report_usage(); |
|
467 | 471 | #endif |
|
468 | 472 | status = stop_current_mode(); |
|
469 | 473 | PRINTF1("maxCount = %d\n", maxCount) |
|
470 | 474 | } |
|
471 | 475 | else |
|
472 | 476 | { |
|
473 | 477 | status = RTEMS_UNSATISFIED; |
|
474 | 478 | } |
|
475 | 479 | |
|
476 | 480 | if (status != RTEMS_SUCCESSFUL) |
|
477 | 481 | { |
|
478 | 482 | PRINTF1("in enter_mode *** ERR = %d\n", status) |
|
479 | 483 | status = RTEMS_UNSATISFIED; |
|
480 | 484 | } |
|
481 | 485 | |
|
482 | 486 | return status; |
|
483 | 487 | } |
|
484 | 488 | |
|
485 | 489 | int restart_science_tasks() |
|
486 | 490 | { |
|
487 | 491 | /** This function is used to restart all science tasks. |
|
488 | 492 | * |
|
489 | 493 | * @return RTEMS directive status codes: |
|
490 | 494 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
491 | 495 | * - RTEMS_INVALID_ID - task id invalid |
|
492 | 496 | * - RTEMS_INCORRECT_STATE - task never started |
|
493 | 497 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task |
|
494 | 498 | * |
|
495 | 499 | * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1 |
|
496 | 500 | * |
|
497 | 501 | */ |
|
498 | 502 | |
|
499 | 503 | rtems_status_code status[6]; |
|
500 | 504 | rtems_status_code ret; |
|
501 | 505 | |
|
502 | 506 | ret = RTEMS_SUCCESSFUL; |
|
503 | 507 | |
|
504 | 508 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 ); |
|
505 | 509 | if (status[0] != RTEMS_SUCCESSFUL) |
|
506 | 510 | { |
|
507 | 511 | PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0]) |
|
508 | 512 | } |
|
509 | 513 | |
|
510 | 514 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); |
|
511 | 515 | if (status[2] != RTEMS_SUCCESSFUL) |
|
512 | 516 | { |
|
513 | 517 | PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2]) |
|
514 | 518 | } |
|
515 | 519 | |
|
516 | 520 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); |
|
517 | 521 | if (status[3] != RTEMS_SUCCESSFUL) |
|
518 | 522 | { |
|
519 | 523 | PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3]) |
|
520 | 524 | } |
|
521 | 525 | |
|
522 | 526 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); |
|
523 | 527 | if (status[4] != RTEMS_SUCCESSFUL) |
|
524 | 528 | { |
|
525 | 529 | PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4]) |
|
526 | 530 | } |
|
527 | 531 | |
|
528 | 532 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); |
|
529 | 533 | if (status[5] != RTEMS_SUCCESSFUL) |
|
530 | 534 | { |
|
531 | 535 | PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5]) |
|
532 | 536 | } |
|
533 | 537 | |
|
534 | 538 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || |
|
535 | 539 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) |
|
536 | 540 | { |
|
537 | 541 | ret = RTEMS_UNSATISFIED; |
|
538 | 542 | } |
|
539 | 543 | |
|
540 | 544 | return ret; |
|
541 | 545 | } |
|
542 | 546 | |
|
543 | 547 | int suspend_science_tasks() |
|
544 | 548 | { |
|
545 | 549 | /** This function suspends the science tasks. |
|
546 | 550 | * |
|
547 | 551 | * @return RTEMS directive status codes: |
|
548 | 552 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
549 | 553 | * - RTEMS_INVALID_ID - task id invalid |
|
550 | 554 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
551 | 555 | * |
|
552 | 556 | */ |
|
553 | 557 | |
|
554 | 558 | rtems_status_code status; |
|
555 | 559 | |
|
556 | 560 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); |
|
557 | 561 | if (status != RTEMS_SUCCESSFUL) |
|
558 | 562 | { |
|
559 | 563 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) |
|
560 | 564 | } |
|
561 | 565 | |
|
562 | 566 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM |
|
563 | 567 | { |
|
564 | 568 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
565 | 569 | if (status != RTEMS_SUCCESSFUL) |
|
566 | 570 | { |
|
567 | 571 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) |
|
568 | 572 | } |
|
569 | 573 | } |
|
570 | 574 | |
|
571 | 575 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 |
|
572 | 576 | { |
|
573 | 577 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); |
|
574 | 578 | if (status != RTEMS_SUCCESSFUL) |
|
575 | 579 | { |
|
576 | 580 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) |
|
577 | 581 | } |
|
578 | 582 | } |
|
579 | 583 | |
|
580 | 584 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 |
|
581 | 585 | { |
|
582 | 586 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); |
|
583 | 587 | if (status != RTEMS_SUCCESSFUL) |
|
584 | 588 | { |
|
585 | 589 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) |
|
586 | 590 | } |
|
587 | 591 | } |
|
588 | 592 | |
|
589 | 593 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 |
|
590 | 594 | { |
|
591 | 595 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
|
592 | 596 | if (status != RTEMS_SUCCESSFUL) |
|
593 | 597 | { |
|
594 | 598 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) |
|
595 | 599 | } |
|
596 | 600 | } |
|
597 | 601 | |
|
598 | 602 | return status; |
|
599 | 603 | } |
|
600 | 604 | |
|
601 | 605 | void launch_waveform_picker( unsigned char mode ) |
|
602 | 606 | { |
|
603 | 607 | int startDate; |
|
604 | 608 | |
|
605 | 609 | reset_current_ring_nodes(); |
|
606 | 610 | reset_waveform_picker_regs(); |
|
607 | 611 | set_wfp_burst_enable_register( mode ); |
|
612 | ||
|
608 | 613 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
609 | 614 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
615 | ||
|
610 | 616 | startDate = time_management_regs->coarse_time + 2; |
|
611 | 617 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] |
|
612 | 618 | waveform_picker_regs->start_date = startDate; |
|
613 | 619 | } |
|
614 | 620 | |
|
615 | 621 | void launch_spectral_matrix( unsigned char mode ) |
|
616 | 622 | { |
|
617 | 623 | reset_nb_sm_f0(); |
|
618 | 624 | reset_current_sm_ring_nodes(); |
|
619 | 625 | reset_spectral_matrix_regs(); |
|
620 | 626 | |
|
621 | enable_irq_on_new_ready_matrix(); | |
|
622 | ||
|
627 | #ifdef VHDL_DEV | |
|
628 | set_irq_on_new_ready_matrix( 1 ); | |
|
623 | 629 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
624 | 630 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
631 | set_run_matrix_spectral( 1 ); | |
|
632 | #else | |
|
633 | // Spectral Matrices simulator | |
|
634 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |
|
635 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); | |
|
636 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); | |
|
637 | #endif | |
|
625 | 638 | } |
|
626 | 639 | |
|
627 |
void |
|
|
640 | void set_irq_on_new_ready_matrix( unsigned char value ) | |
|
628 | 641 | { |
|
629 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; | |
|
642 | if (value == 1) | |
|
643 | { | |
|
644 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; | |
|
645 | } | |
|
646 | else | |
|
647 | { | |
|
648 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 | |
|
649 | } | |
|
630 | 650 | } |
|
631 | 651 | |
|
632 | void disable_irq_on_new_ready_matrix( void ) | |
|
652 | void set_run_matrix_spectral( unsigned char value ) | |
|
633 | 653 | { |
|
634 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 | |
|
654 | if (value == 1) | |
|
655 | { | |
|
656 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // 0100 set run_matrix spectral to 1 | |
|
657 | } | |
|
658 | else | |
|
659 | { | |
|
660 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // 1011 set run_matrix spectral to 0 | |
|
661 | } | |
|
635 | 662 | } |
|
636 | 663 | |
|
637 | ||
|
638 | 664 | void launch_spectral_matrix_simu( unsigned char mode ) |
|
639 | 665 | { |
|
640 | 666 | reset_nb_sm_f0(); |
|
641 | 667 | reset_current_sm_ring_nodes(); |
|
642 | 668 | reset_spectral_matrix_regs(); |
|
643 | 669 | |
|
644 | 670 | // Spectral Matrices simulator |
|
645 | 671 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
646 | 672 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); |
|
647 | 673 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); |
|
648 | 674 | set_local_nb_interrupt_f0_MAX(); |
|
649 | 675 | } |
|
650 | 676 | |
|
651 | 677 | //**************** |
|
652 | 678 | // CLOSING ACTIONS |
|
653 | 679 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC) |
|
654 | 680 | { |
|
655 | 681 | /** This function is used to update the HK packets statistics after a successful TC execution. |
|
656 | 682 | * |
|
657 | 683 | * @param TC points to the TC being processed |
|
658 | 684 | * @param time is the time used to date the TC execution |
|
659 | 685 | * |
|
660 | 686 | */ |
|
661 | 687 | |
|
662 | 688 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; |
|
663 | 689 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; |
|
664 | 690 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; |
|
665 | 691 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; |
|
666 | 692 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; |
|
667 | 693 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; |
|
668 | 694 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
669 | 695 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
670 | 696 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
671 | 697 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
672 | 698 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
673 | 699 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = (unsigned char) (time_management_regs->fine_time); |
|
674 | 700 | } |
|
675 | 701 | |
|
676 | 702 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC ) |
|
677 | 703 | { |
|
678 | 704 | /** This function is used to update the HK packets statistics after a TC rejection. |
|
679 | 705 | * |
|
680 | 706 | * @param TC points to the TC being processed |
|
681 | 707 | * @param time is the time used to date the TC rejection |
|
682 | 708 | * |
|
683 | 709 | */ |
|
684 | 710 | |
|
685 | 711 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; |
|
686 | 712 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; |
|
687 | 713 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; |
|
688 | 714 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; |
|
689 | 715 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; |
|
690 | 716 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; |
|
691 | 717 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
692 | 718 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
693 | 719 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
694 | 720 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
695 | 721 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
696 | 722 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = (unsigned char) (time_management_regs->fine_time); |
|
697 | 723 | } |
|
698 | 724 | |
|
699 | 725 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ) |
|
700 | 726 | { |
|
701 | 727 | /** This function is the last step of the TC execution workflow. |
|
702 | 728 | * |
|
703 | 729 | * @param TC points to the TC being processed |
|
704 | 730 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) |
|
705 | 731 | * @param queue_id is the id of the RTEMS message queue used to send TM packets |
|
706 | 732 | * @param time is the time used to date the TC execution |
|
707 | 733 | * |
|
708 | 734 | */ |
|
709 | 735 | |
|
710 | 736 | unsigned int val = 0; |
|
711 | 737 | |
|
712 | 738 | if (result == LFR_SUCCESSFUL) |
|
713 | 739 | { |
|
714 | 740 | if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
715 | 741 | && |
|
716 | 742 | !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
717 | 743 | ) |
|
718 | 744 | { |
|
719 | 745 | send_tm_lfr_tc_exe_success( TC, queue_id ); |
|
720 | 746 | } |
|
721 | 747 | update_last_TC_exe( TC ); |
|
722 | 748 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; |
|
723 | 749 | val++; |
|
724 | 750 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); |
|
725 | 751 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); |
|
726 | 752 | } |
|
727 | 753 | else |
|
728 | 754 | { |
|
729 | 755 | update_last_TC_rej( TC ); |
|
730 | 756 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; |
|
731 | 757 | val++; |
|
732 | 758 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); |
|
733 | 759 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); |
|
734 | 760 | } |
|
735 | 761 | } |
|
736 | 762 | |
|
737 | 763 | //*************************** |
|
738 | 764 | // Interrupt Service Routines |
|
739 | 765 | rtems_isr commutation_isr1( rtems_vector_number vector ) |
|
740 | 766 | { |
|
741 | 767 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
742 | 768 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); |
|
743 | 769 | } |
|
744 | 770 | } |
|
745 | 771 | |
|
746 | 772 | rtems_isr commutation_isr2( rtems_vector_number vector ) |
|
747 | 773 | { |
|
748 | 774 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
749 | 775 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); |
|
750 | 776 | } |
|
751 | 777 | } |
|
752 | 778 | |
|
753 | 779 | //**************** |
|
754 | 780 | // OTHER FUNCTIONS |
|
755 | 781 | void updateLFRCurrentMode() |
|
756 | 782 | { |
|
757 | 783 | /** This function updates the value of the global variable lfrCurrentMode. |
|
758 | 784 | * |
|
759 | 785 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. |
|
760 | 786 | * |
|
761 | 787 | */ |
|
762 | 788 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure |
|
763 | 789 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
764 | 790 | } |
|
765 | 791 |
@@ -1,1236 +1,1363 | |||
|
1 | 1 | /** Functions and tasks related to waveform packet generation. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * A group of functions to handle waveforms, in snapshot or continuous format.\n |
|
7 | 7 | * |
|
8 | 8 | */ |
|
9 | 9 | |
|
10 | 10 | #include "wf_handler.h" |
|
11 | 11 | |
|
12 | 12 | //***************** |
|
13 | 13 | // waveform headers |
|
14 | 14 | // SWF |
|
15 | 15 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7]; |
|
16 | 16 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7]; |
|
17 | 17 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7]; |
|
18 | 18 | // CWF |
|
19 | 19 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[ NB_PACKETS_PER_GROUP_OF_CWF ]; |
|
20 | 20 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[ NB_PACKETS_PER_GROUP_OF_CWF ]; |
|
21 | 21 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[ NB_PACKETS_PER_GROUP_OF_CWF ]; |
|
22 | 22 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[ NB_PACKETS_PER_GROUP_OF_CWF ]; |
|
23 | 23 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[ NB_PACKETS_PER_GROUP_OF_CWF_LIGHT ]; |
|
24 | 24 | |
|
25 | 25 | //************** |
|
26 | 26 | // waveform ring |
|
27 | 27 | ring_node waveform_ring_f0[NB_RING_NODES_F0]; |
|
28 | 28 | ring_node waveform_ring_f1[NB_RING_NODES_F1]; |
|
29 | 29 | ring_node waveform_ring_f2[NB_RING_NODES_F2]; |
|
30 | 30 | ring_node *current_ring_node_f0; |
|
31 | 31 | ring_node *ring_node_to_send_swf_f0; |
|
32 | 32 | ring_node *current_ring_node_f1; |
|
33 | 33 | ring_node *ring_node_to_send_swf_f1; |
|
34 | 34 | ring_node *ring_node_to_send_cwf_f1; |
|
35 | 35 | ring_node *current_ring_node_f2; |
|
36 | 36 | ring_node *ring_node_to_send_swf_f2; |
|
37 | 37 | ring_node *ring_node_to_send_cwf_f2; |
|
38 | 38 | |
|
39 | 39 | bool extractSWF = false; |
|
40 | bool swf_f0_ready = false; | |
|
41 | bool swf_f1_ready = false; | |
|
42 | bool swf_f2_ready = false; | |
|
40 | 43 | |
|
41 |
int wf_snap_ |
|
|
44 | int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; | |
|
45 | ||
|
46 | //********************* | |
|
47 | // Interrupt SubRoutine | |
|
48 | ||
|
49 | void reset_extractSWF( void ) | |
|
50 | { | |
|
51 | extractSWF = false; | |
|
52 | swf_f0_ready = false; | |
|
53 | swf_f1_ready = false; | |
|
54 | swf_f2_ready = false; | |
|
55 | } | |
|
42 | 56 | |
|
43 | 57 | rtems_isr waveforms_isr( rtems_vector_number vector ) |
|
44 | 58 | { |
|
45 | 59 | /** This is the interrupt sub routine called by the waveform picker core. |
|
46 | 60 | * |
|
47 | 61 | * This ISR launch different actions depending mainly on two pieces of information: |
|
48 | 62 | * 1. the values read in the registers of the waveform picker. |
|
49 | 63 | * 2. the current LFR mode. |
|
50 | 64 | * |
|
51 | 65 | */ |
|
52 | 66 | |
|
67 | rtems_status_code status; | |
|
53 | 68 | static unsigned char nb_swf = 0; |
|
54 | 69 | |
|
55 | 70 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
56 | 71 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
57 | 72 | { // in modes other than STANDBY and BURST, send the CWF_F3 data |
|
58 | 73 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full |
|
59 | 74 | // (1) change the receiving buffer for the waveform picker |
|
60 | 75 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) { |
|
61 | 76 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b); |
|
62 | 77 | } |
|
63 | 78 | else { |
|
64 | 79 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); |
|
65 | 80 | } |
|
66 | 81 | // (2) send an event for the waveforms transmission |
|
67 | 82 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
68 | 83 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
69 | 84 | } |
|
70 | 85 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] |
|
71 | 86 | } |
|
72 | 87 | } |
|
73 | 88 | |
|
74 | 89 | switch(lfrCurrentMode) |
|
75 | 90 | { |
|
76 | 91 | //******** |
|
77 | 92 | // STANDBY |
|
78 | 93 | case(LFR_MODE_STANDBY): |
|
79 | 94 | break; |
|
80 | 95 | |
|
81 | 96 | //****** |
|
82 | 97 | // NORMAL |
|
83 | 98 | case(LFR_MODE_NORMAL): |
|
84 | 99 | if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits |
|
85 | 100 | { |
|
86 | 101 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
87 | 102 | } |
|
88 | 103 | if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits |
|
89 | 104 | { |
|
90 | 105 | // change F0 ring node |
|
91 | 106 | ring_node_to_send_swf_f0 = current_ring_node_f0; |
|
92 | 107 | current_ring_node_f0 = current_ring_node_f0->next; |
|
93 | 108 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; |
|
94 | 109 | // change F1 ring node |
|
95 | 110 | ring_node_to_send_swf_f1 = current_ring_node_f1; |
|
96 | 111 | current_ring_node_f1 = current_ring_node_f1->next; |
|
97 | 112 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
98 | 113 | // change F2 ring node |
|
99 | 114 | ring_node_to_send_swf_f2 = current_ring_node_f2; |
|
100 | 115 | current_ring_node_f2 = current_ring_node_f2->next; |
|
101 | 116 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
102 | 117 | // |
|
103 | 118 | // if (nb_swf < 2) |
|
104 | 119 | if (true) |
|
105 | 120 | { |
|
106 | 121 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
107 | 122 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
108 | 123 | } |
|
109 | 124 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000] |
|
110 | 125 | nb_swf = nb_swf + 1; |
|
111 | 126 | } |
|
112 | 127 | else |
|
113 | 128 | { |
|
114 | 129 | reset_wfp_burst_enable(); |
|
115 | 130 | nb_swf = 0; |
|
116 | 131 | } |
|
117 | 132 | |
|
118 | 133 | } |
|
119 | 134 | |
|
120 | 135 | break; |
|
121 | 136 | |
|
122 | 137 | //****** |
|
123 | 138 | // BURST |
|
124 | 139 | case(LFR_MODE_BURST): |
|
125 | 140 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
126 | 141 | // (1) change the receiving buffer for the waveform picker |
|
127 | 142 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
128 | 143 | current_ring_node_f2 = current_ring_node_f2->next; |
|
129 | 144 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
130 | 145 | // (2) send an event for the waveforms transmission |
|
131 | 146 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { |
|
132 | 147 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
133 | 148 | } |
|
134 | 149 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
135 | 150 | } |
|
136 | 151 | break; |
|
137 | 152 | |
|
138 | 153 | //***** |
|
139 | 154 | // SBM1 |
|
140 | 155 | case(LFR_MODE_SBM1): |
|
141 | 156 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
142 | 157 | // (0) launch snapshot extraction if needed |
|
143 | 158 | if (extractSWF == true) |
|
144 | 159 | { |
|
145 | 160 | ring_node_to_send_swf_f1 = current_ring_node_f1; |
|
146 | if (rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { | |
|
147 |
|
|
|
148 | } | |
|
161 | // extract the snapshot | |
|
162 | status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 ); | |
|
149 | 163 | extractSWF = false; |
|
164 | swf_f1_ready = true; | |
|
150 | 165 | } |
|
151 | 166 | // (1) change the receiving buffer for the waveform picker |
|
152 | 167 | ring_node_to_send_cwf_f1 = current_ring_node_f1; |
|
153 | 168 | current_ring_node_f1 = current_ring_node_f1->next; |
|
154 | 169 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
155 | 170 | // (2) send an event for the the CWF1 task for transmission |
|
156 |
|
|
|
157 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
|
171 | status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ); | |
|
172 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0 | |
|
173 | if (swf_f0_ready == true) | |
|
174 | { | |
|
175 | extractSWF = true; | |
|
176 | swf_f0_ready = false; | |
|
158 | 177 | } |
|
159 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0 | |
|
178 | if ((swf_f1_ready == true) && (swf_f2_ready == true)) | |
|
179 | { | |
|
180 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ); | |
|
181 | swf_f1_ready = false; | |
|
182 | swf_f2_ready = false; | |
|
183 | } | |
|
160 | 184 | } |
|
161 | 185 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
162 |
|
|
|
186 | swf_f0_ready = true; | |
|
163 | 187 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 |
|
164 | 188 | } |
|
165 | 189 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit |
|
166 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) { | |
|
167 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
|
168 | } | |
|
190 | swf_f2_ready = true; | |
|
169 | 191 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0 |
|
170 | 192 | } |
|
171 | 193 | break; |
|
172 | 194 | |
|
173 | 195 | //***** |
|
174 | 196 | // SBM2 |
|
175 | 197 | case(LFR_MODE_SBM2): |
|
176 | 198 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
199 | // (0) launch snapshot extraction if needed | |
|
200 | if (extractSWF == true) | |
|
201 | { | |
|
202 | ring_node_to_send_swf_f2 = current_ring_node_f2; | |
|
203 | // extract the snapshot | |
|
204 | status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM2 ); | |
|
205 | // send the snapshot when build, SWBD priority < WFRM priority | |
|
206 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ); | |
|
207 | extractSWF = false; | |
|
208 | } | |
|
177 | 209 | // (1) change the receiving buffer for the waveform picker |
|
178 | 210 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
179 | 211 | current_ring_node_f2 = current_ring_node_f2->next; |
|
180 | 212 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
181 | 213 | // (2) send an event for the waveforms transmission |
|
182 |
|
|
|
183 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
|
214 | status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ); | |
|
215 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 | |
|
216 | // (3) check whether swf_fo and swf_f& are ready or not | |
|
217 | if (swf_f0_ready && swf_f1_ready) | |
|
218 | { | |
|
219 | extractSWF = true; | |
|
220 | swf_f0_ready = false; | |
|
221 | swf_f1_ready = false; | |
|
184 | 222 | } |
|
185 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 | |
|
186 | 223 | } |
|
187 | 224 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
188 | ring_node_to_send_swf_f2 = current_ring_node_f2->previous; | |
|
225 | swf_f0_ready = true; | |
|
226 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0 | |
|
189 | 227 | } |
|
190 | 228 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
191 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { | |
|
192 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
|
193 | } | |
|
194 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 | |
|
229 | swf_f1_ready = true; | |
|
230 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0 | |
|
195 | 231 | } |
|
196 | 232 | break; |
|
197 | 233 | |
|
198 | 234 | //******** |
|
199 | 235 | // DEFAULT |
|
200 | 236 | default: |
|
201 | 237 | break; |
|
202 | 238 | } |
|
203 | 239 | } |
|
204 | 240 | |
|
241 | //************ | |
|
242 | // RTEMS TASKS | |
|
243 | ||
|
205 | 244 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
206 | 245 | { |
|
207 | 246 | /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode. |
|
208 | 247 | * |
|
209 | 248 | * @param unused is the starting argument of the RTEMS task |
|
210 | 249 | * |
|
211 | 250 | * The following data packets are sent by this task: |
|
212 | 251 | * - TM_LFR_SCIENCE_NORMAL_SWF_F0 |
|
213 | 252 | * - TM_LFR_SCIENCE_NORMAL_SWF_F1 |
|
214 | 253 | * - TM_LFR_SCIENCE_NORMAL_SWF_F2 |
|
215 | 254 | * |
|
216 | 255 | */ |
|
217 | 256 | |
|
218 | 257 | rtems_event_set event_out; |
|
219 | 258 | rtems_id queue_id; |
|
220 | 259 | rtems_status_code status; |
|
221 | 260 | |
|
222 | 261 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); |
|
223 | 262 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); |
|
224 | 263 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); |
|
225 | 264 | |
|
226 | 265 | init_waveforms(); |
|
227 | 266 | |
|
228 | 267 | status = get_message_queue_id_send( &queue_id ); |
|
229 | 268 | if (status != RTEMS_SUCCESSFUL) |
|
230 | 269 | { |
|
231 | 270 | PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status) |
|
232 | 271 | } |
|
233 | 272 | |
|
234 | 273 | BOOT_PRINTF("in WFRM ***\n") |
|
235 | 274 | |
|
236 | 275 | while(1){ |
|
237 | 276 | // wait for an RTEMS_EVENT |
|
238 | 277 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 |
|
239 | 278 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, |
|
240 | 279 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
241 | 280 | if (event_out == RTEMS_EVENT_MODE_NORMAL) |
|
242 | 281 | { |
|
243 | PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n") | |
|
282 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n") | |
|
244 | 283 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
245 | 284 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
246 | 285 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
247 | 286 | } |
|
248 | 287 | if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
249 | 288 | { |
|
250 | PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n") | |
|
289 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n") | |
|
251 | 290 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
252 |
send_waveform_SWF((volatile int*) wf_snap_ |
|
|
291 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
|
253 | 292 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
254 | 293 | } |
|
294 | if (event_out == RTEMS_EVENT_MODE_SBM2) | |
|
295 | { | |
|
296 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n") | |
|
297 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); | |
|
298 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); | |
|
299 | send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F2, headerSWF_F2, queue_id); | |
|
300 | } | |
|
255 | 301 | } |
|
256 | 302 | } |
|
257 | 303 | |
|
258 | 304 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
259 | 305 | { |
|
260 | 306 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3. |
|
261 | 307 | * |
|
262 | 308 | * @param unused is the starting argument of the RTEMS task |
|
263 | 309 | * |
|
264 | 310 | * The following data packet is sent by this task: |
|
265 | 311 | * - TM_LFR_SCIENCE_NORMAL_CWF_F3 |
|
266 | 312 | * |
|
267 | 313 | */ |
|
268 | 314 | |
|
269 | 315 | rtems_event_set event_out; |
|
270 | 316 | rtems_id queue_id; |
|
271 | 317 | rtems_status_code status; |
|
272 | 318 | |
|
273 | 319 | init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 ); |
|
274 | 320 | init_header_continuous_cwf3_light_table( headerCWF_F3_light ); |
|
275 | 321 | |
|
276 | 322 | status = get_message_queue_id_send( &queue_id ); |
|
277 | 323 | if (status != RTEMS_SUCCESSFUL) |
|
278 | 324 | { |
|
279 | 325 | PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status) |
|
280 | 326 | } |
|
281 | 327 | |
|
282 | 328 | BOOT_PRINTF("in CWF3 ***\n") |
|
283 | 329 | |
|
284 | 330 | while(1){ |
|
285 | 331 | // wait for an RTEMS_EVENT |
|
286 | 332 | rtems_event_receive( RTEMS_EVENT_0, |
|
287 | 333 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
288 | 334 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) |
|
289 | 335 | { |
|
290 | 336 | PRINTF("send CWF_LONG_F3\n") |
|
291 | 337 | } |
|
292 | 338 | else |
|
293 | 339 | { |
|
294 | 340 | PRINTF("send CWF_F3 (light)\n") |
|
295 | 341 | } |
|
296 | 342 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) { |
|
297 | 343 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) |
|
298 | 344 | { |
|
299 | 345 | send_waveform_CWF( wf_cont_f3_b, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); |
|
300 | 346 | } |
|
301 | 347 | else |
|
302 | 348 | { |
|
303 | 349 | send_waveform_CWF3_light( wf_cont_f3_b, headerCWF_F3_light, queue_id ); |
|
304 | 350 | } |
|
305 | 351 | } |
|
306 | 352 | else |
|
307 | 353 | { |
|
308 | 354 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) |
|
309 | 355 | { |
|
310 | 356 | send_waveform_CWF( wf_cont_f3_a, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); |
|
311 | 357 | } |
|
312 | 358 | else |
|
313 | 359 | { |
|
314 | 360 | send_waveform_CWF3_light( wf_cont_f3_a, headerCWF_F3_light, queue_id ); |
|
315 | 361 | } |
|
316 | 362 | |
|
317 | 363 | } |
|
318 | 364 | } |
|
319 | 365 | } |
|
320 | 366 | |
|
321 | 367 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 |
|
322 | 368 | { |
|
323 | 369 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2. |
|
324 | 370 | * |
|
325 | 371 | * @param unused is the starting argument of the RTEMS task |
|
326 | 372 | * |
|
327 | 373 | * The following data packet is sent by this function: |
|
328 | 374 | * - TM_LFR_SCIENCE_BURST_CWF_F2 |
|
329 | 375 | * - TM_LFR_SCIENCE_SBM2_CWF_F2 |
|
330 | 376 | * |
|
331 | 377 | */ |
|
332 | 378 | |
|
333 | 379 | rtems_event_set event_out; |
|
334 | 380 | rtems_id queue_id; |
|
335 | 381 | rtems_status_code status; |
|
336 | 382 | |
|
337 | 383 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); |
|
338 | 384 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); |
|
339 | 385 | |
|
340 | 386 | status = get_message_queue_id_send( &queue_id ); |
|
341 | 387 | if (status != RTEMS_SUCCESSFUL) |
|
342 | 388 | { |
|
343 | 389 | PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status) |
|
344 | 390 | } |
|
345 | 391 | |
|
346 | 392 | BOOT_PRINTF("in CWF2 ***\n") |
|
347 | 393 | |
|
348 | 394 | while(1){ |
|
349 | 395 | // wait for an RTEMS_EVENT |
|
350 | 396 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, |
|
351 | 397 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
352 | 398 | if (event_out == RTEMS_EVENT_MODE_BURST) |
|
353 | 399 | { |
|
354 | 400 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); |
|
355 | 401 | } |
|
356 | 402 | if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
357 | 403 | { |
|
358 | 404 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
359 | 405 | } |
|
360 | 406 | } |
|
361 | 407 | } |
|
362 | 408 | |
|
363 | 409 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 |
|
364 | 410 | { |
|
365 | 411 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1. |
|
366 | 412 | * |
|
367 | 413 | * @param unused is the starting argument of the RTEMS task |
|
368 | 414 | * |
|
369 | 415 | * The following data packet is sent by this function: |
|
370 | 416 | * - TM_LFR_SCIENCE_SBM1_CWF_F1 |
|
371 | 417 | * |
|
372 | 418 | */ |
|
373 | 419 | |
|
374 | 420 | rtems_event_set event_out; |
|
375 | 421 | rtems_id queue_id; |
|
376 | 422 | rtems_status_code status; |
|
377 | 423 | |
|
378 | 424 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); |
|
379 | 425 | |
|
380 | 426 | status = get_message_queue_id_send( &queue_id ); |
|
381 | 427 | if (status != RTEMS_SUCCESSFUL) |
|
382 | 428 | { |
|
383 | 429 | PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status) |
|
384 | 430 | } |
|
385 | 431 | |
|
386 | 432 | BOOT_PRINTF("in CWF1 ***\n") |
|
387 | 433 | |
|
388 | 434 | while(1){ |
|
389 | 435 | // wait for an RTEMS_EVENT |
|
390 | 436 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, |
|
391 | 437 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
392 | 438 | send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
393 | 439 | } |
|
394 | 440 | } |
|
395 | 441 | |
|
396 | 442 | rtems_task swbd_task(rtems_task_argument argument) |
|
397 | 443 | { |
|
398 | 444 | /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers. |
|
399 | 445 | * |
|
400 | 446 | * @param unused is the starting argument of the RTEMS task |
|
401 | 447 | * |
|
402 | 448 | */ |
|
403 | 449 | |
|
404 | 450 | rtems_event_set event_out; |
|
405 | 451 | |
|
406 | 452 | BOOT_PRINTF("in SWBD ***\n") |
|
407 | 453 | |
|
408 | 454 | while(1){ |
|
409 | 455 | // wait for an RTEMS_EVENT |
|
410 |
rtems_event_receive( RTEMS_EVENT_ |
|
|
456 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2, | |
|
411 | 457 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
412 | build_snapshot_from_ring(); | |
|
458 | if (event_out == RTEMS_EVENT_MODE_SBM1) | |
|
459 | { | |
|
460 | build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 ); | |
|
461 | } | |
|
462 | else if (event_out == RTEMS_EVENT_MODE_SBM2) | |
|
463 | { | |
|
464 | build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 ); | |
|
465 | } | |
|
466 | else | |
|
467 | { | |
|
468 | PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out) | |
|
469 | } | |
|
413 | 470 | } |
|
414 | 471 | } |
|
415 | 472 | |
|
416 | 473 | //****************** |
|
417 | 474 | // general functions |
|
418 | 475 | void init_waveforms( void ) |
|
419 | 476 | { |
|
420 | 477 | int i = 0; |
|
421 | 478 | |
|
422 | 479 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
423 | 480 | { |
|
424 | 481 | //*** |
|
425 | 482 | // F0 |
|
426 | 483 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; // |
|
427 | 484 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; // |
|
428 | 485 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; // |
|
429 | 486 | |
|
430 | 487 | //*** |
|
431 | 488 | // F1 |
|
432 | 489 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111; |
|
433 | 490 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333; |
|
434 | 491 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; |
|
435 | 492 | |
|
436 | 493 | //*** |
|
437 | 494 | // F2 |
|
438 | 495 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333; |
|
439 | 496 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; |
|
440 | 497 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; |
|
441 | 498 | |
|
442 | 499 | //*** |
|
443 | 500 | // F3 |
|
444 | 501 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1; |
|
445 | 502 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2; |
|
446 | 503 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000; |
|
447 | 504 | } |
|
448 | 505 | } |
|
449 | 506 | |
|
450 | 507 | void init_waveform_rings( void ) |
|
451 | 508 | { |
|
452 | 509 | unsigned char i; |
|
453 | 510 | |
|
454 | 511 | // F0 RING |
|
455 | 512 | waveform_ring_f0[0].next = (ring_node*) &waveform_ring_f0[1]; |
|
456 | 513 | waveform_ring_f0[0].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-1]; |
|
457 | 514 | waveform_ring_f0[0].buffer_address = (int) &wf_snap_f0[0][0]; |
|
458 | 515 | |
|
459 | 516 | waveform_ring_f0[NB_RING_NODES_F0-1].next = (ring_node*) &waveform_ring_f0[0]; |
|
460 | 517 | waveform_ring_f0[NB_RING_NODES_F0-1].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-2]; |
|
461 | 518 | waveform_ring_f0[NB_RING_NODES_F0-1].buffer_address = (int) &wf_snap_f0[NB_RING_NODES_F0-1][0]; |
|
462 | 519 | |
|
463 | 520 | for(i=1; i<NB_RING_NODES_F0-1; i++) |
|
464 | 521 | { |
|
465 | 522 | waveform_ring_f0[i].next = (ring_node*) &waveform_ring_f0[i+1]; |
|
466 | 523 | waveform_ring_f0[i].previous = (ring_node*) &waveform_ring_f0[i-1]; |
|
467 | 524 | waveform_ring_f0[i].buffer_address = (int) &wf_snap_f0[i][0]; |
|
468 | 525 | } |
|
469 | 526 | |
|
470 | 527 | // F1 RING |
|
471 | 528 | waveform_ring_f1[0].next = (ring_node*) &waveform_ring_f1[1]; |
|
472 | 529 | waveform_ring_f1[0].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-1]; |
|
473 | 530 | waveform_ring_f1[0].buffer_address = (int) &wf_snap_f1[0][0]; |
|
474 | 531 | |
|
475 | 532 | waveform_ring_f1[NB_RING_NODES_F1-1].next = (ring_node*) &waveform_ring_f1[0]; |
|
476 | 533 | waveform_ring_f1[NB_RING_NODES_F1-1].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-2]; |
|
477 | 534 | waveform_ring_f1[NB_RING_NODES_F1-1].buffer_address = (int) &wf_snap_f1[NB_RING_NODES_F1-1][0]; |
|
478 | 535 | |
|
479 | 536 | for(i=1; i<NB_RING_NODES_F1-1; i++) |
|
480 | 537 | { |
|
481 | 538 | waveform_ring_f1[i].next = (ring_node*) &waveform_ring_f1[i+1]; |
|
482 | 539 | waveform_ring_f1[i].previous = (ring_node*) &waveform_ring_f1[i-1]; |
|
483 | 540 | waveform_ring_f1[i].buffer_address = (int) &wf_snap_f1[i][0]; |
|
484 | 541 | } |
|
485 | 542 | |
|
486 | 543 | // F2 RING |
|
487 | 544 | waveform_ring_f2[0].next = (ring_node*) &waveform_ring_f2[1]; |
|
488 | 545 | waveform_ring_f2[0].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-1]; |
|
489 | 546 | waveform_ring_f2[0].buffer_address = (int) &wf_snap_f2[0][0]; |
|
490 | 547 | |
|
491 | 548 | waveform_ring_f2[NB_RING_NODES_F2-1].next = (ring_node*) &waveform_ring_f2[0]; |
|
492 | 549 | waveform_ring_f2[NB_RING_NODES_F2-1].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-2]; |
|
493 | 550 | waveform_ring_f2[NB_RING_NODES_F2-1].buffer_address = (int) &wf_snap_f2[NB_RING_NODES_F2-1][0]; |
|
494 | 551 | |
|
495 | 552 | for(i=1; i<NB_RING_NODES_F2-1; i++) |
|
496 | 553 | { |
|
497 | 554 | waveform_ring_f2[i].next = (ring_node*) &waveform_ring_f2[i+1]; |
|
498 | 555 | waveform_ring_f2[i].previous = (ring_node*) &waveform_ring_f2[i-1]; |
|
499 | 556 | waveform_ring_f2[i].buffer_address = (int) &wf_snap_f2[i][0]; |
|
500 | 557 | } |
|
501 | 558 | |
|
502 | 559 | DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0) |
|
503 | 560 | DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1) |
|
504 | 561 | DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2) |
|
505 | 562 | |
|
506 | 563 | } |
|
507 | 564 | |
|
508 | 565 | void reset_current_ring_nodes( void ) |
|
509 | 566 | { |
|
510 | 567 | current_ring_node_f0 = waveform_ring_f0; |
|
511 | 568 | ring_node_to_send_swf_f0 = waveform_ring_f0; |
|
512 | 569 | |
|
513 | 570 | current_ring_node_f1 = waveform_ring_f1; |
|
514 | 571 | ring_node_to_send_cwf_f1 = waveform_ring_f1; |
|
515 | 572 | ring_node_to_send_swf_f1 = waveform_ring_f1; |
|
516 | 573 | |
|
517 | 574 | current_ring_node_f2 = waveform_ring_f2; |
|
518 | 575 | ring_node_to_send_cwf_f2 = waveform_ring_f2; |
|
519 | 576 | ring_node_to_send_swf_f2 = waveform_ring_f2; |
|
520 | 577 | } |
|
521 | 578 | |
|
522 | 579 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) |
|
523 | 580 | { |
|
524 | 581 | unsigned char i; |
|
525 | 582 | |
|
526 | 583 | for (i=0; i<7; i++) |
|
527 | 584 | { |
|
528 | 585 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
529 | 586 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
530 | 587 | headerSWF[ i ].reserved = DEFAULT_RESERVED; |
|
531 | 588 | headerSWF[ i ].userApplication = CCSDS_USER_APP; |
|
532 | 589 | headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
533 | 590 | headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
534 | 591 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
535 | 592 | if (i == 6) |
|
536 | 593 | { |
|
537 | 594 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8); |
|
538 | 595 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 ); |
|
539 | 596 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8); |
|
540 | 597 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 ); |
|
541 | 598 | } |
|
542 | 599 | else |
|
543 | 600 | { |
|
544 | 601 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8); |
|
545 | 602 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 ); |
|
546 | 603 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8); |
|
547 | 604 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 ); |
|
548 | 605 | } |
|
549 | 606 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
550 | 607 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT |
|
551 | 608 | headerSWF[ i ].pktNr = i+1; // PKT_NR |
|
552 | 609 | // DATA FIELD HEADER |
|
553 | 610 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
554 | 611 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
555 | 612 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
556 | 613 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
557 | 614 | // AUXILIARY DATA HEADER |
|
558 | 615 | headerSWF[ i ].time[0] = 0x00; |
|
559 | 616 | headerSWF[ i ].time[0] = 0x00; |
|
560 | 617 | headerSWF[ i ].time[0] = 0x00; |
|
561 | 618 | headerSWF[ i ].time[0] = 0x00; |
|
562 | 619 | headerSWF[ i ].time[0] = 0x00; |
|
563 | 620 | headerSWF[ i ].time[0] = 0x00; |
|
564 | 621 | headerSWF[ i ].sid = sid; |
|
565 | 622 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
566 | 623 | } |
|
567 | 624 | return LFR_SUCCESSFUL; |
|
568 | 625 | } |
|
569 | 626 | |
|
570 | 627 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
571 | 628 | { |
|
572 | 629 | unsigned int i; |
|
573 | 630 | |
|
574 | 631 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) |
|
575 | 632 | { |
|
576 | 633 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
577 | 634 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
578 | 635 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
579 | 636 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
580 | 637 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) |
|
581 | 638 | { |
|
582 | 639 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8); |
|
583 | 640 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2); |
|
584 | 641 | } |
|
585 | 642 | else |
|
586 | 643 | { |
|
587 | 644 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
588 | 645 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
589 | 646 | } |
|
590 | 647 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
591 | 648 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8); |
|
592 | 649 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 ); |
|
593 | 650 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8); |
|
594 | 651 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF ); |
|
595 | 652 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
596 | 653 | // DATA FIELD HEADER |
|
597 | 654 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
598 | 655 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
599 | 656 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
600 | 657 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
601 | 658 | // AUXILIARY DATA HEADER |
|
602 | 659 | headerCWF[ i ].sid = sid; |
|
603 | 660 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
604 | 661 | headerCWF[ i ].time[0] = 0x00; |
|
605 | 662 | headerCWF[ i ].time[0] = 0x00; |
|
606 | 663 | headerCWF[ i ].time[0] = 0x00; |
|
607 | 664 | headerCWF[ i ].time[0] = 0x00; |
|
608 | 665 | headerCWF[ i ].time[0] = 0x00; |
|
609 | 666 | headerCWF[ i ].time[0] = 0x00; |
|
610 | 667 | } |
|
611 | 668 | return LFR_SUCCESSFUL; |
|
612 | 669 | } |
|
613 | 670 | |
|
614 | 671 | int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
615 | 672 | { |
|
616 | 673 | unsigned int i; |
|
617 | 674 | |
|
618 | 675 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) |
|
619 | 676 | { |
|
620 | 677 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
621 | 678 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
622 | 679 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
623 | 680 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
624 | 681 | |
|
625 | 682 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
626 | 683 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
627 | 684 | |
|
628 | 685 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
629 | 686 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8); |
|
630 | 687 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 ); |
|
631 | 688 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8); |
|
632 | 689 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 ); |
|
633 | 690 | |
|
634 | 691 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
635 | 692 | // DATA FIELD HEADER |
|
636 | 693 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
637 | 694 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
638 | 695 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
639 | 696 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
640 | 697 | // AUXILIARY DATA HEADER |
|
641 | 698 | headerCWF[ i ].sid = SID_NORM_CWF_F3; |
|
642 | 699 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
643 | 700 | headerCWF[ i ].time[0] = 0x00; |
|
644 | 701 | headerCWF[ i ].time[0] = 0x00; |
|
645 | 702 | headerCWF[ i ].time[0] = 0x00; |
|
646 | 703 | headerCWF[ i ].time[0] = 0x00; |
|
647 | 704 | headerCWF[ i ].time[0] = 0x00; |
|
648 | 705 | headerCWF[ i ].time[0] = 0x00; |
|
649 | 706 | } |
|
650 | 707 | return LFR_SUCCESSFUL; |
|
651 | 708 | } |
|
652 | 709 | |
|
653 | 710 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, |
|
654 | 711 | Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ) |
|
655 | 712 | { |
|
656 | 713 | /** This function sends SWF CCSDS packets (F2, F1 or F0). |
|
657 | 714 | * |
|
658 | 715 | * @param waveform points to the buffer containing the data that will be send. |
|
659 | 716 | * @param sid is the source identifier of the data that will be sent. |
|
660 | 717 | * @param headerSWF points to a table of headers that have been prepared for the data transmission. |
|
661 | 718 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
662 | 719 | * contain information to setup the transmission of the data packets. |
|
663 | 720 | * |
|
664 | 721 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
665 | 722 | * |
|
666 | 723 | */ |
|
667 | 724 | |
|
668 | 725 | unsigned int i; |
|
669 | 726 | int ret; |
|
670 | 727 | unsigned int coarseTime; |
|
671 | 728 | unsigned int fineTime; |
|
672 | 729 | rtems_status_code status; |
|
673 | 730 | spw_ioctl_pkt_send spw_ioctl_send_SWF; |
|
674 | 731 | |
|
675 | 732 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header |
|
676 | 733 | spw_ioctl_send_SWF.options = 0; |
|
677 | 734 | |
|
678 | 735 | ret = LFR_DEFAULT; |
|
679 | 736 | |
|
680 | DEBUG_PRINTF1("sid = %d, ", sid) | |
|
681 | DEBUG_PRINTF2("coarse = %x, fine = %x\n", waveform[0], waveform[1]) | |
|
682 | ||
|
683 | 737 | coarseTime = waveform[0]; |
|
684 | 738 | fineTime = waveform[1]; |
|
685 | 739 | |
|
686 | 740 | for (i=0; i<7; i++) // send waveform |
|
687 | 741 | { |
|
688 | 742 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
689 | 743 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; |
|
690 | 744 | // BUILD THE DATA |
|
691 | 745 | if (i==6) { |
|
692 | 746 | spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK; |
|
693 | 747 | } |
|
694 | 748 | else { |
|
695 | 749 | spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK; |
|
696 | 750 | } |
|
697 | 751 | // SET PACKET SEQUENCE COUNTER |
|
698 | 752 | increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid ); |
|
699 | 753 | // SET PACKET TIME |
|
700 | 754 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime ); |
|
701 | 755 | // |
|
702 | 756 | headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
703 | 757 | headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
704 | 758 | headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
705 | 759 | headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
706 | 760 | headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
707 | 761 | headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); |
|
708 | 762 | // SEND PACKET |
|
709 | 763 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
710 | 764 | if (status != RTEMS_SUCCESSFUL) { |
|
711 | 765 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
712 | 766 | ret = LFR_DEFAULT; |
|
713 | 767 | } |
|
714 | 768 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds |
|
715 | 769 | } |
|
716 | 770 | |
|
717 | 771 | return ret; |
|
718 | 772 | } |
|
719 | 773 | |
|
720 | 774 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, |
|
721 | 775 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
722 | 776 | { |
|
723 | 777 | /** This function sends CWF CCSDS packets (F2, F1 or F0). |
|
724 | 778 | * |
|
725 | 779 | * @param waveform points to the buffer containing the data that will be send. |
|
726 | 780 | * @param sid is the source identifier of the data that will be sent. |
|
727 | 781 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
728 | 782 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
729 | 783 | * contain information to setup the transmission of the data packets. |
|
730 | 784 | * |
|
731 | 785 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
732 | 786 | * |
|
733 | 787 | */ |
|
734 | 788 | |
|
735 | 789 | unsigned int i; |
|
736 | 790 | int ret; |
|
737 | 791 | unsigned int coarseTime; |
|
738 | 792 | unsigned int fineTime; |
|
739 | 793 | rtems_status_code status; |
|
740 | 794 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
741 | 795 | |
|
742 | 796 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
743 | 797 | spw_ioctl_send_CWF.options = 0; |
|
744 | 798 | |
|
745 | 799 | ret = LFR_DEFAULT; |
|
746 | 800 | |
|
747 | 801 | coarseTime = waveform[0]; |
|
748 | 802 | fineTime = waveform[1]; |
|
749 | 803 | |
|
750 | 804 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform |
|
751 | 805 | { |
|
752 | 806 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
753 | 807 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
754 | 808 | // BUILD THE DATA |
|
755 | 809 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK; |
|
756 | 810 | // SET PACKET SEQUENCE COUNTER |
|
757 | 811 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid ); |
|
758 | 812 | // SET PACKET TIME |
|
759 | 813 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime); |
|
760 | 814 | // |
|
761 | 815 | headerCWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
762 | 816 | headerCWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
763 | 817 | headerCWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
764 | 818 | headerCWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
765 | 819 | headerCWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
766 | 820 | headerCWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); |
|
767 | 821 | // SEND PACKET |
|
768 | 822 | if (sid == SID_NORM_CWF_LONG_F3) |
|
769 | 823 | { |
|
770 | 824 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
771 | 825 | if (status != RTEMS_SUCCESSFUL) { |
|
772 | 826 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
773 | 827 | ret = LFR_DEFAULT; |
|
774 | 828 | } |
|
775 | 829 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
776 | 830 | } |
|
777 | 831 | else |
|
778 | 832 | { |
|
779 | 833 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
780 | 834 | if (status != RTEMS_SUCCESSFUL) { |
|
781 | 835 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
782 | 836 | ret = LFR_DEFAULT; |
|
783 | 837 | } |
|
784 | 838 | } |
|
785 | 839 | } |
|
786 | 840 | |
|
787 | 841 | return ret; |
|
788 | 842 | } |
|
789 | 843 | |
|
790 | 844 | int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
791 | 845 | { |
|
792 | 846 | /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data. |
|
793 | 847 | * |
|
794 | 848 | * @param waveform points to the buffer containing the data that will be send. |
|
795 | 849 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
796 | 850 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
797 | 851 | * contain information to setup the transmission of the data packets. |
|
798 | 852 | * |
|
799 | 853 | * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer |
|
800 | 854 | * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks. |
|
801 | 855 | * |
|
802 | 856 | */ |
|
803 | 857 | |
|
804 | 858 | unsigned int i; |
|
805 | 859 | int ret; |
|
806 | 860 | unsigned int coarseTime; |
|
807 | 861 | unsigned int fineTime; |
|
808 | 862 | rtems_status_code status; |
|
809 | 863 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
810 | 864 | char *sample; |
|
811 | 865 | |
|
812 | 866 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
813 | 867 | spw_ioctl_send_CWF.options = 0; |
|
814 | 868 | |
|
815 | 869 | ret = LFR_DEFAULT; |
|
816 | 870 | |
|
817 | 871 | //********************** |
|
818 | 872 | // BUILD CWF3_light DATA |
|
819 | 873 | for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
820 | 874 | { |
|
821 | 875 | sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; |
|
822 | 876 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ]; |
|
823 | 877 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ]; |
|
824 | 878 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ]; |
|
825 | 879 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ]; |
|
826 | 880 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ]; |
|
827 | 881 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ]; |
|
828 | 882 | } |
|
829 | 883 | |
|
830 | 884 | coarseTime = waveform[0]; |
|
831 | 885 | fineTime = waveform[1]; |
|
832 | 886 | |
|
833 | 887 | //********************* |
|
834 | 888 | // SEND CWF3_light DATA |
|
835 | 889 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform |
|
836 | 890 | { |
|
837 | 891 | spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES]; |
|
838 | 892 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
839 | 893 | // BUILD THE DATA |
|
840 | 894 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK; |
|
841 | 895 | // SET PACKET SEQUENCE COUNTER |
|
842 | 896 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 ); |
|
843 | 897 | // SET PACKET TIME |
|
844 | 898 | compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime ); |
|
845 | 899 | // |
|
846 | 900 | headerCWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
847 | 901 | headerCWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
848 | 902 | headerCWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
849 | 903 | headerCWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
850 | 904 | headerCWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
851 | 905 | headerCWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); |
|
852 | 906 | // SEND PACKET |
|
853 | 907 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
854 | 908 | if (status != RTEMS_SUCCESSFUL) { |
|
855 | 909 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); |
|
856 | 910 | ret = LFR_DEFAULT; |
|
857 | 911 | } |
|
858 | 912 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
859 | 913 | } |
|
860 | 914 | |
|
861 | 915 | return ret; |
|
862 | 916 | } |
|
863 | 917 | |
|
864 | 918 | void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime, |
|
865 | 919 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime ) |
|
866 | 920 | { |
|
867 | 921 | unsigned long long int acquisitionTimeAsLong; |
|
868 | 922 | unsigned char localAcquisitionTime[6]; |
|
869 | 923 | double deltaT; |
|
870 | 924 | |
|
871 | 925 | deltaT = 0.; |
|
872 | 926 | |
|
873 | 927 | localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 8 ); |
|
874 | 928 | localAcquisitionTime[1] = (unsigned char) ( coarseTime ); |
|
875 | 929 | localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 24 ); |
|
876 | 930 | localAcquisitionTime[3] = (unsigned char) ( coarseTime >> 16 ); |
|
877 | 931 | localAcquisitionTime[4] = (unsigned char) ( fineTime >> 24 ); |
|
878 | 932 | localAcquisitionTime[5] = (unsigned char) ( fineTime >> 16 ); |
|
879 | 933 | |
|
880 | 934 | acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 ) |
|
881 | 935 | + ( (unsigned long long int) localAcquisitionTime[1] << 32 ) |
|
882 | 936 | + ( localAcquisitionTime[2] << 24 ) |
|
883 | 937 | + ( localAcquisitionTime[3] << 16 ) |
|
884 | 938 | + ( localAcquisitionTime[4] << 8 ) |
|
885 | 939 | + ( localAcquisitionTime[5] ); |
|
886 | 940 | |
|
887 | 941 | switch( sid ) |
|
888 | 942 | { |
|
889 | 943 | case SID_NORM_SWF_F0: |
|
890 | 944 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ; |
|
891 | 945 | break; |
|
892 | 946 | |
|
893 | 947 | case SID_NORM_SWF_F1: |
|
894 | 948 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ; |
|
895 | 949 | break; |
|
896 | 950 | |
|
897 | 951 | case SID_NORM_SWF_F2: |
|
898 | 952 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ; |
|
899 | 953 | break; |
|
900 | 954 | |
|
901 | 955 | case SID_SBM1_CWF_F1: |
|
902 | 956 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ; |
|
903 | 957 | break; |
|
904 | 958 | |
|
905 | 959 | case SID_SBM2_CWF_F2: |
|
906 | 960 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; |
|
907 | 961 | break; |
|
908 | 962 | |
|
909 | 963 | case SID_BURST_CWF_F2: |
|
910 | 964 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; |
|
911 | 965 | break; |
|
912 | 966 | |
|
913 | 967 | case SID_NORM_CWF_F3: |
|
914 | 968 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ; |
|
915 | 969 | break; |
|
916 | 970 | |
|
917 | 971 | case SID_NORM_CWF_LONG_F3: |
|
918 | 972 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ; |
|
919 | 973 | break; |
|
920 | 974 | |
|
921 | 975 | default: |
|
922 | 976 | PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid) |
|
923 | 977 | deltaT = 0.; |
|
924 | 978 | break; |
|
925 | 979 | } |
|
926 | 980 | |
|
927 | 981 | acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT; |
|
928 | 982 | // |
|
929 | 983 | acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40); |
|
930 | 984 | acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32); |
|
931 | 985 | acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24); |
|
932 | 986 | acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16); |
|
933 | 987 | acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 ); |
|
934 | 988 | acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong ); |
|
935 | 989 | |
|
936 | 990 | } |
|
937 | 991 | |
|
938 | void build_snapshot_from_ring( void ) | |
|
992 | void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel ) | |
|
939 | 993 | { |
|
940 | 994 | unsigned int i; |
|
941 | 995 | unsigned long long int centerTime_asLong; |
|
942 | 996 | unsigned long long int acquisitionTimeF0_asLong; |
|
943 |
unsigned long long int acquisitionTime |
|
|
944 |
unsigned |
|
|
945 | unsigned char *acquisitionTimeF1; | |
|
997 | unsigned long long int acquisitionTime_asLong; | |
|
998 | unsigned long long int bufferAcquisitionTime_asLong; | |
|
946 | 999 | unsigned char *ptr1; |
|
947 | 1000 | unsigned char *ptr2; |
|
1001 | unsigned char nb_ring_nodes; | |
|
1002 | unsigned long long int frequency_asLong; | |
|
1003 | unsigned long long int nbTicksPerSample_asLong; | |
|
1004 | unsigned long long int nbSamplesPart1_asLong; | |
|
1005 | unsigned long long int sampleOffset_asLong; | |
|
948 | 1006 | |
|
949 | unsigned int deltaT; | |
|
1007 | unsigned int deltaT_F0; | |
|
1008 | unsigned int deltaT_F1; | |
|
1009 | unsigned long long int deltaT_F2; | |
|
950 | 1010 | |
|
951 | deltaT = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; | |
|
1011 | deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; | |
|
1012 | deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384; | |
|
1013 | deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144; | |
|
1014 | sampleOffset_asLong = 0x00; | |
|
952 | 1015 | |
|
953 | acquisitionTimeF0 = (unsigned char*) current_ring_node_f0->buffer_address; | |
|
954 | acquisitionTimeF1 = (unsigned char*) ring_node_to_send_cwf_f1->buffer_address; | |
|
1016 | // get the f0 acquisition time | |
|
1017 | build_acquisition_time( &acquisitionTimeF0_asLong, current_ring_node_f0 ); | |
|
1018 | PRINTF1("acquisitionTimeF0_asLong %llx \n", acquisitionTimeF0_asLong) | |
|
1019 | ||
|
1020 | // compute the central reference time | |
|
1021 | centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0; | |
|
1022 | PRINTF1("centerTime_asLong %llx \n", centerTime_asLong) | |
|
955 | 1023 | |
|
956 | acquisitionTimeF0_asLong = 0x00; | |
|
957 | acquisitionTimeF1_asLong = 0x00; | |
|
958 | acquisitionTimeF0_asLong = ( acquisitionTimeF0[0] << 24 ) | |
|
959 | + ( acquisitionTimeF0[1] << 16 ) | |
|
960 | + ( (unsigned long long int) acquisitionTimeF0[2] << 40 ) | |
|
961 | + ( (unsigned long long int) acquisitionTimeF0[3] << 32 ) | |
|
962 | + ( acquisitionTimeF0[4] << 8 ) | |
|
963 | + ( acquisitionTimeF0[5] ); | |
|
1024 | // compute the acquisition time of the current snapshot | |
|
1025 | switch(frequencyChannel) | |
|
1026 | { | |
|
1027 | case 1: // 1 is for F1 = 4096 Hz | |
|
1028 | acquisitionTime_asLong = centerTime_asLong - deltaT_F1; | |
|
1029 | nb_ring_nodes = NB_RING_NODES_F1; | |
|
1030 | frequency_asLong = 4096; | |
|
1031 | nbTicksPerSample_asLong = 16; // 65536 / 4096; | |
|
1032 | break; | |
|
1033 | case 2: // 2 is for F2 = 256 Hz | |
|
1034 | acquisitionTime_asLong = centerTime_asLong - deltaT_F2; | |
|
1035 | nb_ring_nodes = NB_RING_NODES_F2; | |
|
1036 | frequency_asLong = 256; | |
|
1037 | nbTicksPerSample_asLong = 256; // 65536 / 256; | |
|
1038 | break; | |
|
1039 | default: | |
|
1040 | acquisitionTime_asLong = centerTime_asLong; | |
|
1041 | frequency_asLong = 256; | |
|
1042 | nbTicksPerSample_asLong = 256; | |
|
1043 | break; | |
|
1044 | } | |
|
1045 | PRINTF1("acquisitionTime_asLong %llx\n", acquisitionTime_asLong) | |
|
964 | 1046 | |
|
965 | acquisitionTimeF1_asLong = ( acquisitionTimeF1[0] << 24 ) | |
|
966 | + ( acquisitionTimeF1[1] << 16 ) | |
|
967 | + ( (unsigned long long int) acquisitionTimeF1[2] << 40 ) | |
|
968 | + ( (unsigned long long int) acquisitionTimeF1[3] << 32 ) | |
|
969 | + ( acquisitionTimeF1[4] << 8 ) | |
|
970 | + ( acquisitionTimeF1[5] ); | |
|
1047 | //**************************************************************************** | |
|
1048 | // 1) search the ring_node with the acquisition time <= acquisitionTime_asLong | |
|
1049 | for (i=0; i<nb_ring_nodes; i++) | |
|
1050 | { | |
|
1051 | PRINTF1("%d ... ", i) | |
|
1052 | build_acquisition_time( &bufferAcquisitionTime_asLong, ring_node_to_send ); | |
|
1053 | if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong) | |
|
1054 | { | |
|
1055 | PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong) | |
|
1056 | break; | |
|
1057 | } | |
|
1058 | ring_node_to_send = ring_node_to_send->previous; | |
|
1059 | } | |
|
971 | 1060 | |
|
972 | centerTime_asLong = acquisitionTimeF0_asLong + deltaT; | |
|
1061 | //************************************************* | |
|
1062 | // (2) once the buffer is found, build the snapshot | |
|
1063 | ||
|
1064 | // compute the number of samples to take in the current buffer | |
|
1065 | sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16; | |
|
1066 | nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong; | |
|
1067 | PRINTF2("sampleOffset_asLong = %lld, nbSamplesPart1 = %lld\n", sampleOffset_asLong, nbSamplesPart1_asLong) | |
|
973 | 1068 | |
|
974 | ptr1 = (unsigned char*) &acquisitionTimeF1_asLong; | |
|
975 | ptr2 = (unsigned char*) wf_snap_f1_extracted; | |
|
1069 | // compute the final acquisition time | |
|
1070 | acquisitionTime_asLong = bufferAcquisitionTime_asLong + | |
|
1071 | sampleOffset_asLong * nbTicksPerSample_asLong; | |
|
1072 | PRINTF1("FINAL acquisitionTime_asLong %llx\n\n", acquisitionTime_asLong) | |
|
976 | 1073 | |
|
1074 | // copy the acquisition time at the beginning of the extrated snapshot | |
|
1075 | ptr1 = (unsigned char*) &acquisitionTime_asLong; | |
|
1076 | ptr2 = (unsigned char*) wf_snap_extracted; | |
|
977 | 1077 | ptr2[0] = ptr1[ 2 + 2 ]; |
|
978 | 1078 | ptr2[1] = ptr1[ 3 + 2 ]; |
|
979 | 1079 | ptr2[2] = ptr1[ 0 + 2 ]; |
|
980 | 1080 | ptr2[3] = ptr1[ 1 + 2 ]; |
|
981 | 1081 | ptr2[4] = ptr1[ 4 + 2 ]; |
|
982 | 1082 | ptr2[5] = ptr1[ 5 + 2 ]; |
|
983 | 1083 | |
|
984 | for (i=0; i<(NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ ) | |
|
1084 | // re set the synchronization bit | |
|
1085 | ||
|
1086 | ||
|
1087 | // copy the part 1 of the snapshot in the extracted buffer | |
|
1088 | for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ ) | |
|
1089 | { | |
|
1090 | wf_snap_extracted[i + TIME_OFFSET] = | |
|
1091 | ((int*) ring_node_to_send->buffer_address)[i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) + TIME_OFFSET]; | |
|
1092 | } | |
|
1093 | // copy the part 2 of the snapshot in the extracted buffer | |
|
1094 | ring_node_to_send = ring_node_to_send->next; | |
|
1095 | for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ ) | |
|
985 | 1096 | { |
|
986 | wf_snap_f1_extracted[i + TIME_OFFSET] = ((int*)(ring_node_to_send_cwf_f1->buffer_address))[i + TIME_OFFSET]; | |
|
1097 | wf_snap_extracted[i + TIME_OFFSET] = | |
|
1098 | ((int*) ring_node_to_send->buffer_address)[(i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) + TIME_OFFSET]; | |
|
987 | 1099 | } |
|
988 | 1100 | } |
|
989 | 1101 | |
|
1102 | void build_acquisition_time( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node ) | |
|
1103 | { | |
|
1104 | unsigned char *acquisitionTimeCharPtr; | |
|
1105 | ||
|
1106 | acquisitionTimeCharPtr = (unsigned char*) current_ring_node->buffer_address; | |
|
1107 | ||
|
1108 | *acquisitionTimeAslong = 0x00; | |
|
1109 | *acquisitionTimeAslong = ( acquisitionTimeCharPtr[0] << 24 ) | |
|
1110 | + ( acquisitionTimeCharPtr[1] << 16 ) | |
|
1111 | + ( (unsigned long long int) (acquisitionTimeCharPtr[2] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit | |
|
1112 | + ( (unsigned long long int) acquisitionTimeCharPtr[3] << 32 ) | |
|
1113 | + ( acquisitionTimeCharPtr[4] << 8 ) | |
|
1114 | + ( acquisitionTimeCharPtr[5] ); | |
|
1115 | } | |
|
1116 | ||
|
990 | 1117 | //************** |
|
991 | 1118 | // wfp registers |
|
992 | 1119 | void reset_wfp_burst_enable(void) |
|
993 | 1120 | { |
|
994 | 1121 | /** This function resets the waveform picker burst_enable register. |
|
995 | 1122 | * |
|
996 | 1123 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. |
|
997 | 1124 | * |
|
998 | 1125 | */ |
|
999 | 1126 | |
|
1000 | 1127 | waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1001 | 1128 | } |
|
1002 | 1129 | |
|
1003 | 1130 | void reset_wfp_status( void ) |
|
1004 | 1131 | { |
|
1005 | 1132 | /** This function resets the waveform picker status register. |
|
1006 | 1133 | * |
|
1007 | 1134 | * All status bits are set to 0 [new_err full_err full]. |
|
1008 | 1135 | * |
|
1009 | 1136 | */ |
|
1010 | 1137 | |
|
1011 | 1138 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1012 | 1139 | } |
|
1013 | 1140 | |
|
1014 | 1141 | void reset_waveform_picker_regs(void) |
|
1015 | 1142 | { |
|
1016 | 1143 | /** This function resets the waveform picker module registers. |
|
1017 | 1144 | * |
|
1018 | 1145 | * The registers affected by this function are located at the following offset addresses: |
|
1019 | 1146 | * - 0x00 data_shaping |
|
1020 | 1147 | * - 0x04 run_burst_enable |
|
1021 | 1148 | * - 0x08 addr_data_f0 |
|
1022 | 1149 | * - 0x0C addr_data_f1 |
|
1023 | 1150 | * - 0x10 addr_data_f2 |
|
1024 | 1151 | * - 0x14 addr_data_f3 |
|
1025 | 1152 | * - 0x18 status |
|
1026 | 1153 | * - 0x1C delta_snapshot |
|
1027 | 1154 | * - 0x20 delta_f0 |
|
1028 | 1155 | * - 0x24 delta_f0_2 |
|
1029 | 1156 | * - 0x28 delta_f1 |
|
1030 | 1157 | * - 0x2c delta_f2 |
|
1031 | 1158 | * - 0x30 nb_data_by_buffer |
|
1032 | 1159 | * - 0x34 nb_snapshot_param |
|
1033 | 1160 | * - 0x38 start_date |
|
1034 | 1161 | * - 0x3c nb_word_in_buffer |
|
1035 | 1162 | * |
|
1036 | 1163 | */ |
|
1037 | 1164 | |
|
1038 | 1165 | waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW |
|
1039 | 1166 | waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] |
|
1040 | 1167 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08 |
|
1041 | 1168 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c |
|
1042 | 1169 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10 |
|
1043 | 1170 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14 |
|
1044 | 1171 | waveform_picker_regs->status = 0x00; // 0x18 |
|
1045 | 1172 | // |
|
1046 | 1173 | set_wfp_delta_snapshot(); // 0x1c |
|
1047 | 1174 | set_wfp_delta_f0_f0_2(); // 0x20, 0x24 |
|
1048 | 1175 | set_wfp_delta_f1(); // 0x28 |
|
1049 | 1176 | set_wfp_delta_f2(); // 0x2c |
|
1050 | 1177 | DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot) |
|
1051 | 1178 | DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0) |
|
1052 | 1179 | DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2) |
|
1053 | 1180 | DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1) |
|
1054 | 1181 | DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2) |
|
1055 | 1182 | // 2688 = 8 * 336 |
|
1056 | 1183 | waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1 |
|
1057 | 1184 | waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples |
|
1058 | 1185 | waveform_picker_regs->start_date = 0x00; // 0x38 |
|
1059 | 1186 | waveform_picker_regs->nb_word_in_buffer = 0x1f82; // 0x3c *** 2688 * 3 + 2 = 8066 |
|
1060 | 1187 | } |
|
1061 | 1188 | |
|
1062 | 1189 | void set_wfp_data_shaping( void ) |
|
1063 | 1190 | { |
|
1064 | 1191 | /** This function sets the data_shaping register of the waveform picker module. |
|
1065 | 1192 | * |
|
1066 | 1193 | * The value is read from one field of the parameter_dump_packet structure:\n |
|
1067 | 1194 | * bw_sp0_sp1_r0_r1 |
|
1068 | 1195 | * |
|
1069 | 1196 | */ |
|
1070 | 1197 | |
|
1071 | 1198 | unsigned char data_shaping; |
|
1072 | 1199 | |
|
1073 | 1200 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register |
|
1074 | 1201 | // waveform picker : [R1 R0 SP1 SP0 BW] |
|
1075 | 1202 | |
|
1076 | 1203 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; |
|
1077 | 1204 | |
|
1078 | 1205 | waveform_picker_regs->data_shaping = |
|
1079 | 1206 | ( (data_shaping & 0x10) >> 4 ) // BW |
|
1080 | 1207 | + ( (data_shaping & 0x08) >> 2 ) // SP0 |
|
1081 | 1208 | + ( (data_shaping & 0x04) ) // SP1 |
|
1082 | 1209 | + ( (data_shaping & 0x02) << 2 ) // R0 |
|
1083 | 1210 | + ( (data_shaping & 0x01) << 4 ); // R1 |
|
1084 | 1211 | } |
|
1085 | 1212 | |
|
1086 | 1213 | void set_wfp_burst_enable_register( unsigned char mode ) |
|
1087 | 1214 | { |
|
1088 | 1215 | /** This function sets the waveform picker burst_enable register depending on the mode. |
|
1089 | 1216 | * |
|
1090 | 1217 | * @param mode is the LFR mode to launch. |
|
1091 | 1218 | * |
|
1092 | 1219 | * The burst bits shall be before the enable bits. |
|
1093 | 1220 | * |
|
1094 | 1221 | */ |
|
1095 | 1222 | |
|
1096 | 1223 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 |
|
1097 | 1224 | // the burst bits shall be set first, before the enable bits |
|
1098 | 1225 | switch(mode) { |
|
1099 | 1226 | case(LFR_MODE_NORMAL): |
|
1100 | 1227 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable |
|
1101 | 1228 | waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 |
|
1102 | 1229 | break; |
|
1103 | 1230 | case(LFR_MODE_BURST): |
|
1104 | 1231 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1105 | 1232 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2 |
|
1106 | 1233 | break; |
|
1107 | 1234 | case(LFR_MODE_SBM1): |
|
1108 | 1235 | waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled |
|
1109 | 1236 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1110 | 1237 | break; |
|
1111 | 1238 | case(LFR_MODE_SBM2): |
|
1112 | 1239 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1113 | 1240 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1114 | 1241 | break; |
|
1115 | 1242 | default: |
|
1116 | 1243 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled |
|
1117 | 1244 | break; |
|
1118 | 1245 | } |
|
1119 | 1246 | } |
|
1120 | 1247 | |
|
1121 | 1248 | void set_wfp_delta_snapshot( void ) |
|
1122 | 1249 | { |
|
1123 | 1250 | /** This function sets the delta_snapshot register of the waveform picker module. |
|
1124 | 1251 | * |
|
1125 | 1252 | * The value is read from two (unsigned char) of the parameter_dump_packet structure: |
|
1126 | 1253 | * - sy_lfr_n_swf_p[0] |
|
1127 | 1254 | * - sy_lfr_n_swf_p[1] |
|
1128 | 1255 | * |
|
1129 | 1256 | */ |
|
1130 | 1257 | |
|
1131 | 1258 | unsigned int delta_snapshot; |
|
1132 | 1259 | unsigned int delta_snapshot_in_T2; |
|
1133 | 1260 | |
|
1134 | 1261 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 |
|
1135 | 1262 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; |
|
1136 | 1263 | |
|
1137 | 1264 | delta_snapshot_in_T2 = delta_snapshot * 256; |
|
1138 | 1265 | waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2; // max 4 bytes |
|
1139 | 1266 | } |
|
1140 | 1267 | |
|
1141 | 1268 | void set_wfp_delta_f0_f0_2( void ) |
|
1142 | 1269 | { |
|
1143 | 1270 | unsigned int delta_snapshot; |
|
1144 | 1271 | unsigned int nb_samples_per_snapshot; |
|
1145 | 1272 | float delta_f0_in_float; |
|
1146 | 1273 | |
|
1147 | 1274 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1148 | 1275 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1149 | 1276 | delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.; |
|
1150 | 1277 | |
|
1151 | 1278 | waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float ); |
|
1152 | 1279 | waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits |
|
1153 | 1280 | } |
|
1154 | 1281 | |
|
1155 | 1282 | void set_wfp_delta_f1( void ) |
|
1156 | 1283 | { |
|
1157 | 1284 | unsigned int delta_snapshot; |
|
1158 | 1285 | unsigned int nb_samples_per_snapshot; |
|
1159 | 1286 | float delta_f1_in_float; |
|
1160 | 1287 | |
|
1161 | 1288 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1162 | 1289 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1163 | 1290 | delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.; |
|
1164 | 1291 | |
|
1165 | 1292 | waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float ); |
|
1166 | 1293 | } |
|
1167 | 1294 | |
|
1168 | 1295 | void set_wfp_delta_f2() |
|
1169 | 1296 | { |
|
1170 | 1297 | unsigned int delta_snapshot; |
|
1171 | 1298 | unsigned int nb_samples_per_snapshot; |
|
1172 | 1299 | |
|
1173 | 1300 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1174 | 1301 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1175 | 1302 | |
|
1176 | 1303 | waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2; |
|
1177 | 1304 | } |
|
1178 | 1305 | |
|
1179 | 1306 | //***************** |
|
1180 | 1307 | // local parameters |
|
1181 | 1308 | void set_local_nb_interrupt_f0_MAX( void ) |
|
1182 | 1309 | { |
|
1183 | 1310 | /** This function sets the value of the nb_interrupt_f0_MAX local parameter. |
|
1184 | 1311 | * |
|
1185 | 1312 | * This parameter is used for the SM validation only.\n |
|
1186 | 1313 | * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices |
|
1187 | 1314 | * module before launching a basic processing. |
|
1188 | 1315 | * |
|
1189 | 1316 | */ |
|
1190 | 1317 | |
|
1191 | 1318 | param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256 |
|
1192 | 1319 | + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100; |
|
1193 | 1320 | } |
|
1194 | 1321 | |
|
1195 | 1322 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ) |
|
1196 | 1323 | { |
|
1197 | 1324 | unsigned short *sequence_cnt; |
|
1198 | 1325 | unsigned short segmentation_grouping_flag; |
|
1199 | 1326 | unsigned short new_packet_sequence_control; |
|
1200 | 1327 | |
|
1201 | 1328 | if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2) |
|
1202 | 1329 | || (sid ==SID_NORM_CWF_F3) || (sid==SID_NORM_CWF_LONG_F3) || (sid ==SID_BURST_CWF_F2) ) |
|
1203 | 1330 | { |
|
1204 | 1331 | sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST; |
|
1205 | 1332 | } |
|
1206 | 1333 | else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) ) |
|
1207 | 1334 | { |
|
1208 | 1335 | sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2; |
|
1209 | 1336 | } |
|
1210 | 1337 | else |
|
1211 | 1338 | { |
|
1212 | 1339 | sequence_cnt = NULL; |
|
1213 | 1340 | PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid) |
|
1214 | 1341 | } |
|
1215 | 1342 | |
|
1216 | 1343 | if (sequence_cnt != NULL) |
|
1217 | 1344 | { |
|
1218 | 1345 | segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8; |
|
1219 | 1346 | *sequence_cnt = (*sequence_cnt) & 0x3fff; |
|
1220 | 1347 | |
|
1221 | 1348 | new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ; |
|
1222 | 1349 | |
|
1223 | 1350 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); |
|
1224 | 1351 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); |
|
1225 | 1352 | |
|
1226 | 1353 | // increment the sequence counter for the next packet |
|
1227 | 1354 | if ( *sequence_cnt < SEQ_CNT_MAX) |
|
1228 | 1355 | { |
|
1229 | 1356 | *sequence_cnt = *sequence_cnt + 1; |
|
1230 | 1357 | } |
|
1231 | 1358 | else |
|
1232 | 1359 | { |
|
1233 | 1360 | *sequence_cnt = 0; |
|
1234 | 1361 | } |
|
1235 | 1362 | } |
|
1236 | 1363 | } |
General Comments 0
You need to be logged in to leave comments.
Login now