@@ -1,253 +1,253 | |||
|
1 | 1 | ############################################################################# |
|
2 | 2 | # Makefile for building: bin/fsw |
|
3 |
# Generated by qmake (2.01a) (Qt 4.8.5) on: |
|
|
3 | # Generated by qmake (2.01a) (Qt 4.8.5) on: Fri Feb 21 15:32:25 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=2 -DPRINT_MESSAGES_ON_CONSOLE |
|
|
13 | DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=2 -DPRINT_MESSAGES_ON_CONSOLE | |
|
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,16 +1,20 | |||
|
1 | 1 | #!/usr/bin/lppmon -e |
|
2 | 2 | |
|
3 | 3 | address_to_read = 0x80000f08 |
|
4 | 4 | val = RMAPPlugin0.Read( address_to_read, 1) |
|
5 | 5 | matrixF0_Address0 = val[0] |
|
6 | 6 | print hex(matrixF0_Address0) |
|
7 | 7 | |
|
8 | 8 | # BUILD THE DATA |
|
9 | 9 | dataToWrite = [] |
|
10 | 10 | for frequencyBin in range(128): |
|
11 | 11 | for component in range (25): |
|
12 | 12 | dataToWrite.append( component ) |
|
13 | 13 | |
|
14 | #for frequencyBin in range(64): | |
|
15 | # for component in range (25): | |
|
16 | # dataToWrite.append( 2 * component ) | |
|
17 | ||
|
14 | 18 | # WRITE THE DATA |
|
15 | 19 | print len(dataToWrite) |
|
16 | 20 | RMAPPlugin0.Write( matrixF0_Address0, dataToWrite ) |
@@ -1,78 +1,78 | |||
|
1 | 1 | TEMPLATE = app |
|
2 | 2 | # CONFIG += console v8 sim |
|
3 | 3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report |
|
4 |
CONFIG += console verbose |
|
|
4 | CONFIG += console verbose | |
|
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=2 # internal |
|
15 | 15 | |
|
16 | 16 | contains( CONFIG, verbose ) { |
|
17 | 17 | DEFINES += PRINT_MESSAGES_ON_CONSOLE |
|
18 | 18 | } |
|
19 | 19 | |
|
20 | 20 | contains( CONFIG, debug_messages ) { |
|
21 | 21 | DEFINES += DEBUG_MESSAGES |
|
22 | 22 | } |
|
23 | 23 | |
|
24 | 24 | contains( CONFIG, cpu_usage_report ) { |
|
25 | 25 | DEFINES += PRINT_TASK_STATISTICS |
|
26 | 26 | } |
|
27 | 27 | |
|
28 | 28 | contains( CONFIG, stack_report ) { |
|
29 | 29 | DEFINES += PRINT_STACK_REPORT |
|
30 | 30 | } |
|
31 | 31 | |
|
32 | 32 | contains( CONFIG, boot_messages ) { |
|
33 | 33 | DEFINES += BOOT_MESSAGES |
|
34 | 34 | } |
|
35 | 35 | |
|
36 | 36 | #doxygen.target = doxygen |
|
37 | 37 | #doxygen.commands = doxygen ../doc/Doxyfile |
|
38 | 38 | #QMAKE_EXTRA_TARGETS += doxygen |
|
39 | 39 | |
|
40 | 40 | TARGET = fsw |
|
41 | 41 | |
|
42 | 42 | INCLUDEPATH += \ |
|
43 | 43 | ../src \ |
|
44 | 44 | ../header \ |
|
45 | 45 | ../../LFR_basic-parameters |
|
46 | 46 | |
|
47 | 47 | SOURCES += \ |
|
48 | 48 | ../src/wf_handler.c \ |
|
49 | 49 | ../src/tc_handler.c \ |
|
50 | 50 | ../src/fsw_processing.c \ |
|
51 | 51 | ../src/fsw_misc.c \ |
|
52 | 52 | ../src/fsw_init.c \ |
|
53 | 53 | ../src/fsw_globals.c \ |
|
54 | 54 | ../src/fsw_spacewire.c \ |
|
55 | 55 | ../src/tc_load_dump_parameters.c \ |
|
56 | 56 | ../src/tm_lfr_tc_exe.c \ |
|
57 | 57 | ../src/tc_acceptance.c \ |
|
58 | 58 | ../../LFR_basic-parameters/basic_parameters.c |
|
59 | 59 | |
|
60 | 60 | |
|
61 | 61 | HEADERS += \ |
|
62 | 62 | ../header/wf_handler.h \ |
|
63 | 63 | ../header/tc_handler.h \ |
|
64 | 64 | ../header/grlib_regs.h \ |
|
65 | 65 | ../header/fsw_processing.h \ |
|
66 | 66 | ../header/fsw_params.h \ |
|
67 | 67 | ../header/fsw_misc.h \ |
|
68 | 68 | ../header/fsw_init.h \ |
|
69 | 69 | ../header/ccsds_types.h \ |
|
70 | 70 | ../header/fsw_params_processing.h \ |
|
71 | 71 | ../header/fsw_spacewire.h \ |
|
72 | 72 | ../header/tm_byte_positions.h \ |
|
73 | 73 | ../header/tc_load_dump_parameters.h \ |
|
74 | 74 | ../header/tm_lfr_tc_exe.h \ |
|
75 | 75 | ../header/tc_acceptance.h \ |
|
76 | 76 | ../header/fsw_params_nb_bytes.h \ |
|
77 | 77 | ../../LFR_basic-parameters/basic_parameters.h |
|
78 | 78 |
@@ -1,339 +1,339 | |||
|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
|
2 | 2 | <!DOCTYPE QtCreatorProject> |
|
3 |
<!-- Written by QtCreator 3.0.0, 2014-02-2 |
|
|
3 | <!-- Written by QtCreator 3.0.0, 2014-02-21T15:56:03. --> | |
|
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,212 +1,212 | |||
|
1 | 1 | #ifndef FSW_PARAMS_H_INCLUDED |
|
2 | 2 | #define FSW_PARAMS_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include "grlib_regs.h" |
|
5 | 5 | #include "fsw_params_processing.h" |
|
6 | 6 | #include "tm_byte_positions.h" |
|
7 | 7 | #include "ccsds_types.h" |
|
8 | 8 | |
|
9 | 9 | #define GRSPW_DEVICE_NAME "/dev/grspw0" |
|
10 | 10 | #define UART_DEVICE_NAME "/dev/console" |
|
11 | 11 | |
|
12 | 12 | typedef struct ring_node |
|
13 | 13 | { |
|
14 | 14 | struct ring_node *previous; |
|
15 | 15 | int buffer_address; |
|
16 | 16 | struct ring_node *next; |
|
17 | 17 | unsigned int status; |
|
18 | 18 | } ring_node; |
|
19 | 19 | |
|
20 | 20 | //************************ |
|
21 | 21 | // flight software version |
|
22 | 22 | // this parameters is handled by the Qt project options |
|
23 | 23 | |
|
24 | 24 | #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk |
|
25 | 25 | #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk |
|
26 | 26 | #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688 |
|
27 | 27 | #define TIME_OFFSET 2 |
|
28 | 28 | #define TIME_OFFSET_IN_BYTES 8 |
|
29 | 29 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 |
|
30 | 30 | #define NB_BYTES_SWF_BLK (2 * 6) |
|
31 | 31 | #define NB_WORDS_SWF_BLK 3 |
|
32 | 32 | #define NB_BYTES_CWF3_LIGHT_BLK 6 |
|
33 | 33 | #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 |
|
34 | 34 | #define NB_RING_NODES_F0 3 // AT LEAST 3 |
|
35 | 35 | #define NB_RING_NODES_F1 5 // AT LEAST 3 |
|
36 | 36 | #define NB_RING_NODES_F2 5 // AT LEAST 3 |
|
37 | 37 | #define NB_RING_NODES_ASM_F0 12 // AT LEAST 3 |
|
38 | 38 | #define NB_RING_NODES_ASM_F1 2 // AT LEAST 3 |
|
39 | 39 | #define NB_RING_NODES_ASM_F2 2 // AT LEAST 3 |
|
40 | 40 | |
|
41 | 41 | //********** |
|
42 | 42 | // LFR MODES |
|
43 | 43 | #define LFR_MODE_STANDBY 0 |
|
44 | 44 | #define LFR_MODE_NORMAL 1 |
|
45 | 45 | #define LFR_MODE_BURST 2 |
|
46 | 46 | #define LFR_MODE_SBM1 3 |
|
47 | 47 | #define LFR_MODE_SBM2 4 |
|
48 | 48 | #define LFR_MODE_NORMAL_CWF_F3 5 |
|
49 | 49 | |
|
50 | 50 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 |
|
51 | 51 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 |
|
52 | 52 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 |
|
53 | 53 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 |
|
54 | 54 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 |
|
55 | 55 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 |
|
56 | 56 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F0 RTEMS_EVENT_6 |
|
57 | 57 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F1 RTEMS_EVENT_7 |
|
58 | 58 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F2 RTEMS_EVENT_8 |
|
59 | 59 | |
|
60 | 60 | //**************************** |
|
61 | 61 | // LFR DEFAULT MODE PARAMETERS |
|
62 | 62 | // COMMON |
|
63 | 63 | #define DEFAULT_SY_LFR_COMMON0 0x00 |
|
64 | 64 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 |
|
65 | 65 | // NORM |
|
66 | 66 | #define SY_LFR_N_SWF_L 2048 // nb sample |
|
67 | 67 | #define SY_LFR_N_SWF_P 300 // sec |
|
68 | 68 | #define SY_LFR_N_ASM_P 3600 // sec |
|
69 | 69 | #define SY_LFR_N_BP_P0 4 // sec |
|
70 | 70 | #define SY_LFR_N_BP_P1 20 // sec |
|
71 | 71 | #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3 |
|
72 | 72 | #define MIN_DELTA_SNAPSHOT 16 // sec |
|
73 | 73 | // BURST |
|
74 | 74 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec |
|
75 | 75 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec |
|
76 | 76 | // SBM1 |
|
77 | 77 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec |
|
78 | 78 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec |
|
79 | 79 | // SBM2 |
|
80 | 80 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec |
|
81 | 81 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec |
|
82 | 82 | // ADDITIONAL PARAMETERS |
|
83 | 83 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms |
|
84 | 84 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s |
|
85 | 85 | // STATUS WORD |
|
86 | 86 | #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits |
|
87 | 87 | #define DEFAULT_STATUS_WORD_BYTE1 0x00 |
|
88 | 88 | // |
|
89 | 89 | #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s |
|
90 | 90 | #define SY_LFR_DPU_CONNECT_ATTEMPT 3 |
|
91 | 91 | //**************************** |
|
92 | 92 | |
|
93 | 93 | //***************************** |
|
94 | 94 | // APB REGISTERS BASE ADDRESSES |
|
95 | 95 | #define REGS_ADDR_APBUART 0x80000100 |
|
96 | 96 | #define REGS_ADDR_GPTIMER 0x80000300 |
|
97 | 97 | #define REGS_ADDR_GRSPW 0x80000500 |
|
98 | 98 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 |
|
99 | 99 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 |
|
100 | 100 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20 |
|
101 | 101 | |
|
102 | 102 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
|
103 | 103 | #define APBUART_CTRL_REG_MASK_TE 0x00000002 |
|
104 | 104 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) |
|
105 | 105 | |
|
106 | 106 | //********** |
|
107 | 107 | // IRQ LINES |
|
108 | 108 | #define IRQ_SM_SIMULATOR 9 |
|
109 | 109 | #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels |
|
110 | 110 | #define IRQ_WAVEFORM_PICKER 14 |
|
111 | 111 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels |
|
112 | 112 | #define IRQ_SPECTRAL_MATRIX 6 |
|
113 | 113 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels |
|
114 | 114 | |
|
115 | 115 | //***** |
|
116 | 116 | // TIME |
|
117 | 117 | #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms |
|
118 | 118 | #define TIMER_SM_SIMULATOR 1 |
|
119 | 119 | #define HK_PERIOD 100 // 100 * 10ms => 1sec |
|
120 | 120 | |
|
121 | 121 | //********** |
|
122 | 122 | // LPP CODES |
|
123 | 123 | #define LFR_SUCCESSFUL 0 |
|
124 | 124 | #define LFR_DEFAULT 1 |
|
125 | 125 | |
|
126 | 126 | //****** |
|
127 | 127 | // RTEMS |
|
128 | 128 | #define TASKID_RECV 1 |
|
129 | 129 | #define TASKID_ACTN 2 |
|
130 | 130 | #define TASKID_SPIQ 3 |
|
131 | 131 | #define TASKID_SMIQ 4 |
|
132 | 132 | #define TASKID_STAT 5 |
|
133 | 133 | #define TASKID_AVF0 6 |
|
134 | #define TASKID_BPF0 7 | |
|
134 | //#define TASKID_BPF0 7 | |
|
135 | 135 | #define TASKID_WFRM 8 |
|
136 | 136 | #define TASKID_DUMB 9 |
|
137 | 137 | #define TASKID_HOUS 10 |
|
138 | 138 | #define TASKID_MATR 11 |
|
139 | 139 | #define TASKID_CWF3 12 |
|
140 | 140 | #define TASKID_CWF2 13 |
|
141 | 141 | #define TASKID_CWF1 14 |
|
142 | 142 | #define TASKID_SEND 15 |
|
143 | 143 | #define TASKID_WTDG 16 |
|
144 | 144 | |
|
145 | 145 | #define TASK_PRIORITY_SPIQ 5 |
|
146 | 146 | #define TASK_PRIORITY_SMIQ 10 |
|
147 | 147 | #define TASK_PRIORITY_WTDG 20 |
|
148 | 148 | #define TASK_PRIORITY_HOUS 30 |
|
149 | 149 | #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together |
|
150 | 150 | #define TASK_PRIORITY_CWF2 35 // |
|
151 | 151 | #define TASK_PRIORITY_WFRM 40 |
|
152 | 152 | #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1 |
|
153 | 153 | #define TASK_PRIORITY_SEND 45 |
|
154 | 154 | #define TASK_PRIORITY_RECV 50 |
|
155 | 155 | #define TASK_PRIORITY_ACTN 50 |
|
156 | 156 | #define TASK_PRIORITY_AVF0 60 |
|
157 | 157 | #define TASK_PRIORITY_BPF0 60 |
|
158 | 158 | #define TASK_PRIORITY_MATR 100 |
|
159 | 159 | #define TASK_PRIORITY_STAT 200 |
|
160 | 160 | #define TASK_PRIORITY_DUMB 200 |
|
161 | 161 | |
|
162 | 162 | #define ACTION_MSG_QUEUE_COUNT 10 |
|
163 | 163 | #define ACTION_MSG_PKTS_COUNT 50 |
|
164 | 164 | #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES) |
|
165 | 165 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options |
|
166 | 166 | |
|
167 | 167 | #define QUEUE_RECV 0 |
|
168 | 168 | #define QUEUE_SEND 1 |
|
169 | 169 | |
|
170 | 170 | //******* |
|
171 | 171 | // MACROS |
|
172 | 172 | #ifdef PRINT_MESSAGES_ON_CONSOLE |
|
173 | 173 | #define PRINTF(x) printf(x); |
|
174 | 174 | #define PRINTF1(x,y) printf(x,y); |
|
175 | 175 | #define PRINTF2(x,y,z) printf(x,y,z); |
|
176 | 176 | #else |
|
177 | 177 | #define PRINTF(x) ; |
|
178 | 178 | #define PRINTF1(x,y) ; |
|
179 | 179 | #define PRINTF2(x,y,z) ; |
|
180 | 180 | #endif |
|
181 | 181 | |
|
182 | 182 | #ifdef BOOT_MESSAGES |
|
183 | 183 | #define BOOT_PRINTF(x) printf(x); |
|
184 | 184 | #define BOOT_PRINTF1(x,y) printf(x,y); |
|
185 | 185 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); |
|
186 | 186 | #else |
|
187 | 187 | #define BOOT_PRINTF(x) ; |
|
188 | 188 | #define BOOT_PRINTF1(x,y) ; |
|
189 | 189 | #define BOOT_PRINTF2(x,y,z) ; |
|
190 | 190 | #endif |
|
191 | 191 | |
|
192 | 192 | #ifdef DEBUG_MESSAGES |
|
193 | 193 | #define DEBUG_PRINTF(x) printf(x); |
|
194 | 194 | #define DEBUG_PRINTF1(x,y) printf(x,y); |
|
195 | 195 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); |
|
196 | 196 | #else |
|
197 | 197 | #define DEBUG_PRINTF(x) ; |
|
198 | 198 | #define DEBUG_PRINTF1(x,y) ; |
|
199 | 199 | #define DEBUG_PRINTF2(x,y,z) ; |
|
200 | 200 | #endif |
|
201 | 201 | |
|
202 | 202 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period |
|
203 | 203 | |
|
204 | 204 | struct param_local_str{ |
|
205 | 205 | unsigned int local_sbm1_nb_cwf_sent; |
|
206 | 206 | unsigned int local_sbm1_nb_cwf_max; |
|
207 | 207 | unsigned int local_sbm2_nb_cwf_sent; |
|
208 | 208 | unsigned int local_sbm2_nb_cwf_max; |
|
209 | 209 | unsigned int local_nb_interrupt_f0_MAX; |
|
210 | 210 | }; |
|
211 | 211 | |
|
212 | 212 | #endif // FSW_PARAMS_H_INCLUDED |
@@ -1,45 +1,51 | |||
|
1 | 1 | #ifndef FSW_PARAMS_PROCESSING_H |
|
2 | 2 | #define FSW_PARAMS_PROCESSING_H |
|
3 | 3 | |
|
4 | 4 | #define NB_BINS_PER_SM 128 // |
|
5 | 5 | #define NB_VALUES_PER_SM 25 // |
|
6 | 6 | #define TOTAL_SIZE_SM 3200 // 25 * 128 |
|
7 | 7 | #define SM_HEADER 0 // |
|
8 | 8 | // |
|
9 | 9 | #define NB_BINS_PER_ASM_F0 88 |
|
10 | 10 | #define NB_BINS_PER_PKT_ASM_F0 44 |
|
11 | 11 | #define TOTAL_SIZE_ASM_F0_IN_BYTES 4400 // 25 * 88 * 2 |
|
12 | 12 | #define ASM_F0_INDICE_START 17 // 88 bins |
|
13 | 13 | #define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins |
|
14 | 14 | // |
|
15 | 15 | #define NB_BINS_PER_ASM_F1 104 |
|
16 | 16 | #define NB_BINS_PER_PKT_ASM_F1 52 |
|
17 | 17 | #define TOTAL_SIZE_ASM_F1 2600 // 25 * 104 |
|
18 | 18 | #define ASM_F1_INDICE_START 6 // 104 bins |
|
19 | 19 | #define ASM_F1_INDICE_STOP 109 // 2 packets of 52 bins |
|
20 | 20 | // |
|
21 | 21 | #define NB_BINS_PER_ASM_F2 96 |
|
22 | 22 | #define NB_BINS_PER_PKT_ASM_F2 48 |
|
23 | 23 | #define TOTAL_SIZE_ASM_F2 2400 // 25 * 96 |
|
24 | 24 | #define ASM_F2_INDICE_START 7 // 96 bins |
|
25 | 25 | #define ASM_F2_INDICE_STOP 102 // 2 packets of 48 bins |
|
26 | 26 | // |
|
27 | 27 | #define NB_BINS_COMPRESSED_SM_F0 11 |
|
28 | 28 | #define NB_BINS_COMPRESSED_SM_F1 13 |
|
29 | 29 | #define NB_BINS_COMPRESSED_SM_F2 12 |
|
30 | 30 | // |
|
31 | #define TOTAL_SIZE_COMPRESSED_MATRIX_f0 (NB_BINS_COMPRESSED_SM_F0 * NB_VALUES_PER_SM) | |
|
31 | #define NB_BINS_TO_AVERAGE_ASM_F0 8 | |
|
32 | #define NB_BINS_TO_AVERAGE_ASM_F1 8 | |
|
33 | #define NB_BINS_TO_AVERAGE_ASM_F2 8 | |
|
34 | // | |
|
35 | #define TOTAL_SIZE_COMPRESSED_ASM_F0 275 // 11 * 25 | |
|
36 | #define TOTAL_SIZE_COMPRESSED_ASM_F1 325 // 13 * 25 | |
|
37 | #define TOTAL_SIZE_COMPRESSED_ASM_F2 300 // 12 * 25 | |
|
32 | 38 | #define NB_AVERAGE_NORMAL_f0 96*4 |
|
33 | 39 | #define NB_SM_TO_RECEIVE_BEFORE_AVF0 8 |
|
34 | 40 | |
|
35 | 41 | typedef struct { |
|
36 | 42 | volatile unsigned char PE[2]; |
|
37 | 43 | volatile unsigned char PB[2]; |
|
38 | 44 | volatile unsigned char V0; |
|
39 | 45 | volatile unsigned char V1; |
|
40 | 46 | volatile unsigned char V2_ELLIP_DOP; |
|
41 | 47 | volatile unsigned char SZ; |
|
42 | 48 | volatile unsigned char VPHI; |
|
43 | 49 | } BP1_t; |
|
44 | 50 | |
|
45 | 51 | #endif // FSW_PARAMS_PROCESSING_H |
@@ -1,56 +1,54 | |||
|
1 | 1 | #ifndef FSW_PROCESSING_H_INCLUDED |
|
2 | 2 | #define FSW_PROCESSING_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include <rtems.h> |
|
5 | 5 | #include <grspw.h> |
|
6 | 6 | #include <math.h> |
|
7 | 7 | #include <stdlib.h> // abs() is in the stdlib |
|
8 | 8 | #include <stdio.h> // printf() |
|
9 | 9 | #include <math.h> |
|
10 | 10 | |
|
11 | 11 | #include "fsw_params.h" |
|
12 | 12 | #include "fsw_spacewire.h" |
|
13 | 13 | #include "basic_parameters.h" |
|
14 | 14 | |
|
15 | 15 | extern volatile int sm_f0[ ][ SM_HEADER + TOTAL_SIZE_SM ]; |
|
16 | 16 | extern volatile int sm_f1[ ][ SM_HEADER + TOTAL_SIZE_SM ]; |
|
17 | 17 | extern volatile int sm_f2[ ][ SM_HEADER + TOTAL_SIZE_SM ]; |
|
18 | 18 | |
|
19 | 19 | // parameters |
|
20 | 20 | extern struct param_local_str param_local; |
|
21 | 21 | |
|
22 | 22 | // registers |
|
23 | 23 | extern time_management_regs_t *time_management_regs; |
|
24 | 24 | extern spectral_matrix_regs_t *spectral_matrix_regs; |
|
25 | 25 | |
|
26 | 26 | extern rtems_name misc_name[5]; |
|
27 | 27 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
28 | 28 | |
|
29 | 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 | rtems_task spw_bppr_task(rtems_task_argument argument); | |
|
39 | 38 | rtems_task avf0_task(rtems_task_argument argument); |
|
40 | rtems_task bpf0_task(rtems_task_argument argument); | |
|
41 | 39 | rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator |
|
42 | 40 | rtems_task matr_task(rtems_task_argument argument); |
|
43 | 41 | |
|
44 | void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat); | |
|
45 | 42 | void matrix_reset(volatile float *averaged_spec_mat); |
|
46 | 43 | void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1); |
|
47 | 44 | void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat); |
|
48 | 45 | // |
|
49 | 46 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header); |
|
50 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
|
47 | void compress_averaged_spectral_matrix( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat ); | |
|
48 | void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix); | |
|
49 | void send_averaged_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
|
51 | 50 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id); |
|
52 | void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix); | |
|
53 | 51 | void fill_averaged_spectral_matrix( void ); |
|
54 | 52 | void reset_spectral_matrix_regs(); |
|
55 | 53 | |
|
56 | 54 | #endif // FSW_PROCESSING_H_INCLUDED |
@@ -1,610 +1,594 | |||
|
1 | 1 | /** This is the RTEMS initialization module. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * This module contains two very different information: |
|
7 | 7 | * - specific instructions to configure the compilation of the RTEMS executive |
|
8 | 8 | * - functions related to the fligth softwre initialization, especially the INIT RTEMS task |
|
9 | 9 | * |
|
10 | 10 | */ |
|
11 | 11 | |
|
12 | 12 | //************************* |
|
13 | 13 | // GPL reminder to be added |
|
14 | 14 | //************************* |
|
15 | 15 | |
|
16 | 16 | #include <rtems.h> |
|
17 | 17 | |
|
18 | 18 | /* configuration information */ |
|
19 | 19 | |
|
20 | 20 | #define CONFIGURE_INIT |
|
21 | 21 | |
|
22 | 22 | #include <bsp.h> /* for device driver prototypes */ |
|
23 | 23 | |
|
24 | 24 | /* configuration information */ |
|
25 | 25 | |
|
26 | 26 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
27 | 27 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
28 | 28 | |
|
29 | 29 | #define CONFIGURE_MAXIMUM_TASKS 20 |
|
30 | 30 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
|
31 | 31 | #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) |
|
32 | 32 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 |
|
33 | 33 | #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100 |
|
34 | 34 | #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT) |
|
35 | 35 | #define CONFIGURE_MAXIMUM_DRIVERS 16 |
|
36 | 36 | #define CONFIGURE_MAXIMUM_PERIODS 5 |
|
37 | 37 | #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s) |
|
38 | 38 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2 |
|
39 | 39 | #ifdef PRINT_STACK_REPORT |
|
40 | 40 | #define CONFIGURE_STACK_CHECKER_ENABLED |
|
41 | 41 | #endif |
|
42 | 42 | |
|
43 | 43 | #include <rtems/confdefs.h> |
|
44 | 44 | |
|
45 | 45 | /* If --drvmgr was enabled during the configuration of the RTEMS kernel */ |
|
46 | 46 | #ifdef RTEMS_DRVMGR_STARTUP |
|
47 | 47 | #ifdef LEON3 |
|
48 | 48 | /* Add Timer and UART Driver */ |
|
49 | 49 | #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
50 | 50 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER |
|
51 | 51 | #endif |
|
52 | 52 | #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
53 | 53 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART |
|
54 | 54 | #endif |
|
55 | 55 | #endif |
|
56 | 56 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */ |
|
57 | 57 | #include <drvmgr/drvmgr_confdefs.h> |
|
58 | 58 | #endif |
|
59 | 59 | |
|
60 | 60 | #include "fsw_init.h" |
|
61 | 61 | #include "fsw_config.c" |
|
62 | 62 | |
|
63 | 63 | rtems_task Init( rtems_task_argument ignored ) |
|
64 | 64 | { |
|
65 | 65 | /** This is the RTEMS INIT taks, it the first task launched by the system. |
|
66 | 66 | * |
|
67 | 67 | * @param unused is the starting argument of the RTEMS task |
|
68 | 68 | * |
|
69 | 69 | * The INIT task create and run all other RTEMS tasks. |
|
70 | 70 | * |
|
71 | 71 | */ |
|
72 | 72 | |
|
73 | 73 | |
|
74 | 74 | rtems_status_code status; |
|
75 | 75 | rtems_status_code status_spw; |
|
76 | 76 | rtems_isr_entry old_isr_handler; |
|
77 | 77 | |
|
78 | 78 | // UART settings |
|
79 | 79 | send_console_outputs_on_apbuart_port(); |
|
80 | 80 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); |
|
81 | 81 | enable_apbuart_transmitter(); |
|
82 | 82 | DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") |
|
83 | 83 | |
|
84 | 84 | PRINTF("\n\n\n\n\n") |
|
85 | 85 | PRINTF("*************************\n") |
|
86 | 86 | PRINTF("** LFR Flight Software **\n") |
|
87 | 87 | PRINTF1("** %d.", SW_VERSION_N1) |
|
88 | 88 | PRINTF1("%d.", SW_VERSION_N2) |
|
89 | 89 | PRINTF1("%d.", SW_VERSION_N3) |
|
90 | 90 | PRINTF1("%d **\n", SW_VERSION_N4) |
|
91 | 91 | PRINTF("*************************\n") |
|
92 | 92 | PRINTF("\n\n") |
|
93 | 93 | |
|
94 | 94 | reset_wfp_burst_enable(); // stop the waveform picker if it was running |
|
95 | 95 | init_waveform_rings(); // initialize the waveform rings |
|
96 | 96 | init_sm_rings(); |
|
97 | 97 | |
|
98 | 98 | init_parameter_dump(); |
|
99 | 99 | init_local_mode_parameters(); |
|
100 | 100 | init_housekeeping_parameters(); |
|
101 | 101 | |
|
102 | 102 | updateLFRCurrentMode(); |
|
103 | 103 | |
|
104 | 104 | BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) |
|
105 | 105 | |
|
106 | 106 | create_names(); // create all names |
|
107 | 107 | |
|
108 | 108 | status = create_message_queues(); // create message queues |
|
109 | 109 | if (status != RTEMS_SUCCESSFUL) |
|
110 | 110 | { |
|
111 | 111 | PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) |
|
112 | 112 | } |
|
113 | 113 | |
|
114 | 114 | status = create_all_tasks(); // create all tasks |
|
115 | 115 | if (status != RTEMS_SUCCESSFUL) |
|
116 | 116 | { |
|
117 | 117 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status) |
|
118 | 118 | } |
|
119 | 119 | |
|
120 | 120 | // ************************** |
|
121 | 121 | // <SPACEWIRE INITIALIZATION> |
|
122 | 122 | grspw_timecode_callback = &timecode_irq_handler; |
|
123 | 123 | |
|
124 | 124 | status_spw = spacewire_open_link(); // (1) open the link |
|
125 | 125 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
126 | 126 | { |
|
127 | 127 | PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) |
|
128 | 128 | } |
|
129 | 129 | |
|
130 | 130 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link |
|
131 | 131 | { |
|
132 | 132 | status_spw = spacewire_configure_link( fdSPW ); |
|
133 | 133 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
134 | 134 | { |
|
135 | 135 | PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) |
|
136 | 136 | } |
|
137 | 137 | } |
|
138 | 138 | |
|
139 | 139 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link |
|
140 | 140 | { |
|
141 | 141 | status_spw = spacewire_start_link( fdSPW ); |
|
142 | 142 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
143 | 143 | { |
|
144 | 144 | PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) |
|
145 | 145 | } |
|
146 | 146 | } |
|
147 | 147 | // </SPACEWIRE INITIALIZATION> |
|
148 | 148 | // *************************** |
|
149 | 149 | |
|
150 | 150 | status = start_all_tasks(); // start all tasks |
|
151 | 151 | if (status != RTEMS_SUCCESSFUL) |
|
152 | 152 | { |
|
153 | 153 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) |
|
154 | 154 | } |
|
155 | 155 | |
|
156 | 156 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization |
|
157 | 157 | status = start_recv_send_tasks(); |
|
158 | 158 | if ( status != RTEMS_SUCCESSFUL ) |
|
159 | 159 | { |
|
160 | 160 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) |
|
161 | 161 | } |
|
162 | 162 | |
|
163 | 163 | // suspend science tasks. they will be restarted later depending on the mode |
|
164 | 164 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) |
|
165 | 165 | if (status != RTEMS_SUCCESSFUL) |
|
166 | 166 | { |
|
167 | 167 | PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
168 | 168 | } |
|
169 | 169 | |
|
170 | 170 | //****************************** |
|
171 | 171 | // <SPECTRAL MATRICES SIMULATOR> |
|
172 | 172 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); |
|
173 | 173 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, |
|
174 | 174 | IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu ); |
|
175 | 175 | // </SPECTRAL MATRICES SIMULATOR> |
|
176 | 176 | //******************************* |
|
177 | 177 | |
|
178 | 178 | // configure IRQ handling for the waveform picker unit |
|
179 | 179 | status = rtems_interrupt_catch( waveforms_isr, |
|
180 | 180 | IRQ_SPARC_WAVEFORM_PICKER, |
|
181 | 181 | &old_isr_handler) ; |
|
182 | 182 | |
|
183 | 183 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery |
|
184 | 184 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
185 | 185 | { |
|
186 | 186 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); |
|
187 | 187 | if ( status != RTEMS_SUCCESSFUL ) { |
|
188 | 188 | PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) |
|
189 | 189 | } |
|
190 | 190 | } |
|
191 | 191 | |
|
192 | 192 | BOOT_PRINTF("delete INIT\n") |
|
193 | 193 | |
|
194 | 194 | status = rtems_task_delete(RTEMS_SELF); |
|
195 | 195 | |
|
196 | 196 | } |
|
197 | 197 | |
|
198 | 198 | void init_local_mode_parameters( void ) |
|
199 | 199 | { |
|
200 | 200 | /** This function initialize the param_local global variable with default values. |
|
201 | 201 | * |
|
202 | 202 | */ |
|
203 | 203 | |
|
204 | 204 | unsigned int i; |
|
205 | 205 | |
|
206 | 206 | // LOCAL PARAMETERS |
|
207 | 207 | set_local_nb_interrupt_f0_MAX(); |
|
208 | 208 | |
|
209 | 209 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
210 | 210 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
211 | 211 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
212 | 212 | |
|
213 | 213 | // init sequence counters |
|
214 | 214 | |
|
215 | 215 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) |
|
216 | 216 | { |
|
217 | 217 | sequenceCounters_TC_EXE[i] = 0x00; |
|
218 | 218 | } |
|
219 | 219 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; |
|
220 | 220 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; |
|
221 | 221 | } |
|
222 | 222 | |
|
223 | 223 | void create_names( void ) // create all names for tasks and queues |
|
224 | 224 | { |
|
225 | 225 | /** This function creates all RTEMS names used in the software for tasks and queues. |
|
226 | 226 | * |
|
227 | 227 | * @return RTEMS directive status codes: |
|
228 | 228 | * - RTEMS_SUCCESSFUL - successful completion |
|
229 | 229 | * |
|
230 | 230 | */ |
|
231 | 231 | |
|
232 | 232 | // task names |
|
233 | 233 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); |
|
234 | 234 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); |
|
235 | 235 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
|
236 | 236 | Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' ); |
|
237 | 237 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); |
|
238 | 238 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); |
|
239 | Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' ); | |
|
239 | // Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' ); | |
|
240 | 240 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
241 | 241 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); |
|
242 | 242 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
243 | 243 | Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' ); |
|
244 | 244 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); |
|
245 | 245 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); |
|
246 | 246 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); |
|
247 | 247 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); |
|
248 | 248 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); |
|
249 | 249 | |
|
250 | 250 | // rate monotonic period names |
|
251 | 251 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
252 | 252 | |
|
253 | 253 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
254 | 254 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
255 | 255 | } |
|
256 | 256 | |
|
257 | 257 | int create_all_tasks( void ) // create all tasks which run in the software |
|
258 | 258 | { |
|
259 | 259 | /** This function creates all RTEMS tasks used in the software. |
|
260 | 260 | * |
|
261 | 261 | * @return RTEMS directive status codes: |
|
262 | 262 | * - RTEMS_SUCCESSFUL - task created successfully |
|
263 | 263 | * - RTEMS_INVALID_ADDRESS - id is NULL |
|
264 | 264 | * - RTEMS_INVALID_NAME - invalid task name |
|
265 | 265 | * - RTEMS_INVALID_PRIORITY - invalid task priority |
|
266 | 266 | * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured |
|
267 | 267 | * - RTEMS_TOO_MANY - too many tasks created |
|
268 | 268 | * - RTEMS_UNSATISFIED - not enough memory for stack/FP context |
|
269 | 269 | * - RTEMS_TOO_MANY - too many global objects |
|
270 | 270 | * |
|
271 | 271 | */ |
|
272 | 272 | |
|
273 | 273 | rtems_status_code status; |
|
274 | 274 | |
|
275 | 275 | // RECV |
|
276 | 276 | status = rtems_task_create( |
|
277 | 277 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, |
|
278 | 278 | RTEMS_DEFAULT_MODES, |
|
279 | 279 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] |
|
280 | 280 | ); |
|
281 | 281 | |
|
282 | 282 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
283 | 283 | { |
|
284 | 284 | status = rtems_task_create( |
|
285 | 285 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, |
|
286 | 286 | RTEMS_DEFAULT_MODES, |
|
287 | 287 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] |
|
288 | 288 | ); |
|
289 | 289 | } |
|
290 | 290 | if (status == RTEMS_SUCCESSFUL) // SPIQ |
|
291 | 291 | { |
|
292 | 292 | status = rtems_task_create( |
|
293 | 293 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
294 | 294 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
295 | 295 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] |
|
296 | 296 | ); |
|
297 | 297 | } |
|
298 | 298 | if (status == RTEMS_SUCCESSFUL) // SMIQ |
|
299 | 299 | { |
|
300 | 300 | status = rtems_task_create( |
|
301 | 301 | Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
302 | 302 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
303 | 303 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ] |
|
304 | 304 | ); |
|
305 | 305 | } |
|
306 | 306 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
307 | 307 | { |
|
308 | 308 | status = rtems_task_create( |
|
309 | 309 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, |
|
310 | 310 | RTEMS_DEFAULT_MODES, |
|
311 | 311 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] |
|
312 | 312 | ); |
|
313 | 313 | } |
|
314 | 314 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
315 | 315 | { |
|
316 | 316 | status = rtems_task_create( |
|
317 | 317 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, |
|
318 | 318 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
319 | 319 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] |
|
320 | 320 | ); |
|
321 | 321 | } |
|
322 | if (status == RTEMS_SUCCESSFUL) // BPF0 | |
|
323 | { | |
|
324 | status = rtems_task_create( | |
|
325 | Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE, | |
|
326 | RTEMS_DEFAULT_MODES, | |
|
327 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0] | |
|
328 | ); | |
|
329 | } | |
|
330 | 322 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
331 | 323 | { |
|
332 | 324 | status = rtems_task_create( |
|
333 | 325 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, |
|
334 | 326 | RTEMS_DEFAULT_MODES, |
|
335 | 327 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] |
|
336 | 328 | ); |
|
337 | 329 | } |
|
338 | 330 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
339 | 331 | { |
|
340 | 332 | status = rtems_task_create( |
|
341 | 333 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, |
|
342 | 334 | RTEMS_DEFAULT_MODES, |
|
343 | 335 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] |
|
344 | 336 | ); |
|
345 | 337 | } |
|
346 | 338 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
347 | 339 | { |
|
348 | 340 | status = rtems_task_create( |
|
349 | 341 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, |
|
350 | 342 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
351 | 343 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] |
|
352 | 344 | ); |
|
353 | 345 | } |
|
354 | 346 | if (status == RTEMS_SUCCESSFUL) // MATR |
|
355 | 347 | { |
|
356 | 348 | status = rtems_task_create( |
|
357 | 349 | Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE, |
|
358 | 350 | RTEMS_DEFAULT_MODES, |
|
359 | 351 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR] |
|
360 | 352 | ); |
|
361 | 353 | } |
|
362 | 354 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
363 | 355 | { |
|
364 | 356 | status = rtems_task_create( |
|
365 | 357 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, |
|
366 | 358 | RTEMS_DEFAULT_MODES, |
|
367 | 359 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3] |
|
368 | 360 | ); |
|
369 | 361 | } |
|
370 | 362 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
371 | 363 | { |
|
372 | 364 | status = rtems_task_create( |
|
373 | 365 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, |
|
374 | 366 | RTEMS_DEFAULT_MODES, |
|
375 | 367 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2] |
|
376 | 368 | ); |
|
377 | 369 | } |
|
378 | 370 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
379 | 371 | { |
|
380 | 372 | status = rtems_task_create( |
|
381 | 373 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, |
|
382 | 374 | RTEMS_DEFAULT_MODES, |
|
383 | 375 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1] |
|
384 | 376 | ); |
|
385 | 377 | } |
|
386 | 378 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
387 | 379 | { |
|
388 | 380 | status = rtems_task_create( |
|
389 | 381 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, |
|
390 | 382 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
391 | 383 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] |
|
392 | 384 | ); |
|
393 | 385 | } |
|
394 | 386 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
395 | 387 | { |
|
396 | 388 | status = rtems_task_create( |
|
397 | 389 | Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE, |
|
398 | 390 | RTEMS_DEFAULT_MODES, |
|
399 | 391 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG] |
|
400 | 392 | ); |
|
401 | 393 | } |
|
402 | 394 | |
|
403 | 395 | return status; |
|
404 | 396 | } |
|
405 | 397 | |
|
406 | 398 | int start_recv_send_tasks( void ) |
|
407 | 399 | { |
|
408 | 400 | rtems_status_code status; |
|
409 | 401 | |
|
410 | 402 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); |
|
411 | 403 | if (status!=RTEMS_SUCCESSFUL) { |
|
412 | 404 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") |
|
413 | 405 | } |
|
414 | 406 | |
|
415 | 407 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
416 | 408 | { |
|
417 | 409 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); |
|
418 | 410 | if (status!=RTEMS_SUCCESSFUL) { |
|
419 | 411 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") |
|
420 | 412 | } |
|
421 | 413 | } |
|
422 | 414 | |
|
423 | 415 | return status; |
|
424 | 416 | } |
|
425 | 417 | |
|
426 | 418 | int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS |
|
427 | 419 | { |
|
428 | 420 | /** This function starts all RTEMS tasks used in the software. |
|
429 | 421 | * |
|
430 | 422 | * @return RTEMS directive status codes: |
|
431 | 423 | * - RTEMS_SUCCESSFUL - ask started successfully |
|
432 | 424 | * - RTEMS_INVALID_ADDRESS - invalid task entry point |
|
433 | 425 | * - RTEMS_INVALID_ID - invalid task id |
|
434 | 426 | * - RTEMS_INCORRECT_STATE - task not in the dormant state |
|
435 | 427 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task |
|
436 | 428 | * |
|
437 | 429 | */ |
|
438 | 430 | // starts all the tasks fot eh flight software |
|
439 | 431 | |
|
440 | 432 | rtems_status_code status; |
|
441 | 433 | |
|
442 | 434 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); |
|
443 | 435 | if (status!=RTEMS_SUCCESSFUL) { |
|
444 | 436 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") |
|
445 | 437 | } |
|
446 | 438 | |
|
447 | 439 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
448 | 440 | { |
|
449 | 441 | status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 ); |
|
450 | 442 | if (status!=RTEMS_SUCCESSFUL) { |
|
451 | 443 | BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n") |
|
452 | 444 | } |
|
453 | 445 | } |
|
454 | 446 | |
|
455 | 447 | if (status == RTEMS_SUCCESSFUL) // SMIQ |
|
456 | 448 | { |
|
457 | 449 | status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 ); |
|
458 | 450 | if (status!=RTEMS_SUCCESSFUL) { |
|
459 | 451 | BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n") |
|
460 | 452 | } |
|
461 | 453 | } |
|
462 | 454 | |
|
463 | 455 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
464 | 456 | { |
|
465 | 457 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); |
|
466 | 458 | if (status!=RTEMS_SUCCESSFUL) { |
|
467 | 459 | BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") |
|
468 | 460 | } |
|
469 | 461 | } |
|
470 | 462 | |
|
471 | 463 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
472 | 464 | { |
|
473 | 465 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); |
|
474 | 466 | if (status!=RTEMS_SUCCESSFUL) { |
|
475 | 467 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") |
|
476 | 468 | } |
|
477 | 469 | } |
|
478 | 470 | |
|
479 | 471 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
480 | 472 | { |
|
481 | 473 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 ); |
|
482 | 474 | if (status!=RTEMS_SUCCESSFUL) { |
|
483 | 475 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") |
|
484 | 476 | } |
|
485 | 477 | } |
|
486 | 478 | |
|
487 | if (status == RTEMS_SUCCESSFUL) // BPF0 | |
|
488 | { | |
|
489 | status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 ); | |
|
490 | if (status!=RTEMS_SUCCESSFUL) { | |
|
491 | BOOT_PRINTF("in INIT *** Error starting TASK_BPF0\n") | |
|
492 | } | |
|
493 | } | |
|
494 | ||
|
495 | 479 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
496 | 480 | { |
|
497 | 481 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); |
|
498 | 482 | if (status!=RTEMS_SUCCESSFUL) { |
|
499 | 483 | BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") |
|
500 | 484 | } |
|
501 | 485 | } |
|
502 | 486 | |
|
503 | 487 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
504 | 488 | { |
|
505 | 489 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); |
|
506 | 490 | if (status!=RTEMS_SUCCESSFUL) { |
|
507 | 491 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") |
|
508 | 492 | } |
|
509 | 493 | } |
|
510 | 494 | |
|
511 | 495 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
512 | 496 | { |
|
513 | 497 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); |
|
514 | 498 | if (status!=RTEMS_SUCCESSFUL) { |
|
515 | 499 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") |
|
516 | 500 | } |
|
517 | 501 | } |
|
518 | 502 | |
|
519 | 503 | if (status == RTEMS_SUCCESSFUL) // MATR |
|
520 | 504 | { |
|
521 | 505 | status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 ); |
|
522 | 506 | if (status!=RTEMS_SUCCESSFUL) { |
|
523 | 507 | BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n") |
|
524 | 508 | } |
|
525 | 509 | } |
|
526 | 510 | |
|
527 | 511 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
528 | 512 | { |
|
529 | 513 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); |
|
530 | 514 | if (status!=RTEMS_SUCCESSFUL) { |
|
531 | 515 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") |
|
532 | 516 | } |
|
533 | 517 | } |
|
534 | 518 | |
|
535 | 519 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
536 | 520 | { |
|
537 | 521 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); |
|
538 | 522 | if (status!=RTEMS_SUCCESSFUL) { |
|
539 | 523 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") |
|
540 | 524 | } |
|
541 | 525 | } |
|
542 | 526 | |
|
543 | 527 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
544 | 528 | { |
|
545 | 529 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); |
|
546 | 530 | if (status!=RTEMS_SUCCESSFUL) { |
|
547 | 531 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") |
|
548 | 532 | } |
|
549 | 533 | } |
|
550 | 534 | return status; |
|
551 | 535 | } |
|
552 | 536 | |
|
553 | 537 | rtems_status_code create_message_queues( void ) // create the two message queues used in the software |
|
554 | 538 | { |
|
555 | 539 | rtems_status_code status_recv; |
|
556 | 540 | rtems_status_code status_send; |
|
557 | 541 | rtems_status_code ret; |
|
558 | 542 | rtems_id queue_id; |
|
559 | 543 | |
|
560 | 544 | // create the queue for handling valid TCs |
|
561 | 545 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], |
|
562 | 546 | ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE, |
|
563 | 547 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
564 | 548 | if ( status_recv != RTEMS_SUCCESSFUL ) { |
|
565 | 549 | PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) |
|
566 | 550 | } |
|
567 | 551 | |
|
568 | 552 | // create the queue for handling TM packet sending |
|
569 | 553 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], |
|
570 | 554 | ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE, |
|
571 | 555 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
572 | 556 | if ( status_send != RTEMS_SUCCESSFUL ) { |
|
573 | 557 | PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) |
|
574 | 558 | } |
|
575 | 559 | |
|
576 | 560 | if ( status_recv != RTEMS_SUCCESSFUL ) |
|
577 | 561 | { |
|
578 | 562 | ret = status_recv; |
|
579 | 563 | } |
|
580 | 564 | else |
|
581 | 565 | { |
|
582 | 566 | ret = status_send; |
|
583 | 567 | } |
|
584 | 568 | |
|
585 | 569 | return ret; |
|
586 | 570 | } |
|
587 | 571 | |
|
588 | 572 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ) |
|
589 | 573 | { |
|
590 | 574 | rtems_status_code status; |
|
591 | 575 | rtems_name queue_name; |
|
592 | 576 | |
|
593 | 577 | queue_name = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
594 | 578 | |
|
595 | 579 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
596 | 580 | |
|
597 | 581 | return status; |
|
598 | 582 | } |
|
599 | 583 | |
|
600 | 584 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ) |
|
601 | 585 | { |
|
602 | 586 | rtems_status_code status; |
|
603 | 587 | rtems_name queue_name; |
|
604 | 588 | |
|
605 | 589 | queue_name = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
606 | 590 | |
|
607 | 591 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
608 | 592 | |
|
609 | 593 | return status; |
|
610 | 594 | } |
@@ -1,686 +1,679 | |||
|
1 | 1 | /** Functions related to data processing. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. |
|
7 | 7 | * |
|
8 | 8 | */ |
|
9 | 9 | |
|
10 | 10 | #include <fsw_processing.h> |
|
11 | 11 | |
|
12 | 12 | #include "fsw_processing_globals.c" |
|
13 | 13 | |
|
14 | 14 | //************************ |
|
15 | 15 | // spectral matrices rings |
|
16 | 16 | ring_node sm_ring_f0[NB_RING_NODES_ASM_F0]; |
|
17 | 17 | ring_node sm_ring_f1[NB_RING_NODES_ASM_F1]; |
|
18 | 18 | ring_node sm_ring_f2[NB_RING_NODES_ASM_F2]; |
|
19 | 19 | ring_node *current_ring_node_sm_f0; |
|
20 | 20 | ring_node *ring_node_for_averaging_sm_f0; |
|
21 | 21 | ring_node *current_ring_node_sm_f1; |
|
22 | 22 | ring_node *current_ring_node_sm_f2; |
|
23 | 23 | |
|
24 | 24 | BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ]; |
|
25 | 25 | float averaged_sm_f0[ TOTAL_SIZE_SM ]; |
|
26 | 26 | char averaged_sm_f0_char[ TOTAL_SIZE_SM * 2 ]; |
|
27 |
float compressed_sm_f0[ TOTAL_SIZE_COMPRESSED_ |
|
|
27 | float compressed_sm_f0[ TOTAL_SIZE_COMPRESSED_ASM_F0 ]; | |
|
28 | 28 | |
|
29 | 29 | unsigned int nb_sm_f0; |
|
30 | 30 | |
|
31 | 31 | void init_sm_rings( void ) |
|
32 | 32 | { |
|
33 | 33 | unsigned char i; |
|
34 | 34 | |
|
35 | 35 | // F0 RING |
|
36 | 36 | sm_ring_f0[0].next = (ring_node*) &sm_ring_f0[1]; |
|
37 | 37 | sm_ring_f0[0].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-1]; |
|
38 | 38 | sm_ring_f0[0].buffer_address = (int) &sm_f0[0][0]; |
|
39 | 39 | |
|
40 | 40 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].next = (ring_node*) &sm_ring_f0[0]; |
|
41 | 41 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-2]; |
|
42 | 42 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].buffer_address = (int) &sm_f0[NB_RING_NODES_ASM_F0-1][0]; |
|
43 | 43 | |
|
44 | 44 | for(i=1; i<NB_RING_NODES_ASM_F0-1; i++) |
|
45 | 45 | { |
|
46 | 46 | sm_ring_f0[i].next = (ring_node*) &sm_ring_f0[i+1]; |
|
47 | 47 | sm_ring_f0[i].previous = (ring_node*) &sm_ring_f0[i-1]; |
|
48 | 48 | sm_ring_f0[i].buffer_address = (int) &sm_f0[i][0]; |
|
49 | 49 | } |
|
50 | 50 | |
|
51 | 51 | DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) |
|
52 | 52 | |
|
53 | 53 | spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address; |
|
54 | 54 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0) |
|
55 | 55 | } |
|
56 | 56 | |
|
57 | 57 | void reset_current_sm_ring_nodes( void ) |
|
58 | 58 | { |
|
59 | 59 | current_ring_node_sm_f0 = sm_ring_f0; |
|
60 | 60 | ring_node_for_averaging_sm_f0 = sm_ring_f0; |
|
61 | 61 | } |
|
62 | 62 | |
|
63 | 63 | //*********************************************************** |
|
64 | 64 | // Interrupt Service Routine for spectral matrices processing |
|
65 | 65 | void reset_nb_sm_f0( void ) |
|
66 | 66 | { |
|
67 | 67 | nb_sm_f0 = 0; |
|
68 | 68 | } |
|
69 | 69 | |
|
70 | 70 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
71 | 71 | { |
|
72 | 72 | // unsigned char status; |
|
73 | 73 | // unsigned char i; |
|
74 | 74 | |
|
75 | 75 | // status = spectral_matrix_regs->status; //[f2 f1 f0_1 f0_0] |
|
76 | 76 | // for (i=0; i<4; i++) |
|
77 | 77 | // { |
|
78 | 78 | // if ( ( (status >> i) & 0x01) == 1) // (1) buffer rotation |
|
79 | 79 | // { |
|
80 | 80 | // switch(i) |
|
81 | 81 | // { |
|
82 | 82 | // case 0: |
|
83 | 83 | // current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
84 | 84 | // spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
85 | 85 | // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; |
|
86 | 86 | // nb_interrupt_f0 = nb_interrupt_f0 + 1; |
|
87 | 87 | // if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){ |
|
88 | 88 | // ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; |
|
89 | 89 | // if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
90 | 90 | // { |
|
91 | 91 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
92 | 92 | // } |
|
93 | 93 | // nb_interrupt_f0 = 0; |
|
94 | 94 | // } |
|
95 | 95 | // break; |
|
96 | 96 | // case 1: |
|
97 | 97 | // break; |
|
98 | 98 | // case 2: |
|
99 | 99 | // break; |
|
100 | 100 | // default: |
|
101 | 101 | // break; |
|
102 | 102 | // } |
|
103 | 103 | // } |
|
104 | 104 | // } |
|
105 | 105 | |
|
106 | 106 | // // reset error codes to 0 |
|
107 | 107 | // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // [1100 1111] |
|
108 | 108 | } |
|
109 | 109 | |
|
110 | 110 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) |
|
111 | 111 | { |
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
|
112 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; | |
|
113 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; | |
|
114 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; | |
|
115 | 115 | |
|
116 | 116 | if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) ) |
|
117 | 117 | { |
|
118 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; | |
|
118 | // ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; | |
|
119 | ring_node_for_averaging_sm_f0 = &sm_ring_f0[NB_SM_TO_RECEIVE_BEFORE_AVF0-1]; | |
|
119 | 120 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
120 | 121 | { |
|
121 | 122 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
122 | 123 | } |
|
123 | 124 | nb_sm_f0 = 0; |
|
124 | 125 | } |
|
125 | 126 | else |
|
126 | 127 | { |
|
127 | 128 | nb_sm_f0 = nb_sm_f0 + 1; |
|
128 | 129 | } |
|
129 | 130 | } |
|
130 | 131 | |
|
131 | 132 | //************ |
|
132 | 133 | // RTEMS TASKS |
|
133 | 134 | |
|
134 | 135 | rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ |
|
135 | 136 | { |
|
136 | 137 | rtems_event_set event_out; |
|
137 | 138 | |
|
138 | 139 | BOOT_PRINTF("in SMIQ *** \n") |
|
139 | 140 | |
|
140 | 141 | while(1){ |
|
141 | 142 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
142 | 143 | } |
|
143 | 144 | } |
|
144 | 145 | |
|
145 | rtems_task spw_bppr_task(rtems_task_argument argument) | |
|
146 | { | |
|
147 | rtems_status_code status; | |
|
148 | rtems_event_set event_out; | |
|
149 | ||
|
150 | BOOT_PRINTF("in BPPR ***\n"); | |
|
151 | ||
|
152 | while( true ){ // wait for an event to begin with the processing | |
|
153 | status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); | |
|
154 | } | |
|
155 | } | |
|
156 | ||
|
157 | 146 | rtems_task avf0_task(rtems_task_argument argument) |
|
158 | 147 | { |
|
159 | 148 | int i; |
|
160 | 149 | static int nb_average; |
|
161 | 150 | rtems_event_set event_out; |
|
162 | 151 | rtems_status_code status; |
|
163 | 152 | ring_node *ring_node_tab[8]; |
|
164 | 153 | |
|
165 | 154 | nb_average = 0; |
|
166 | 155 | |
|
167 | 156 | BOOT_PRINTF("in AVFO *** \n") |
|
168 | 157 | |
|
169 | 158 | while(1){ |
|
170 | 159 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
171 | ring_node_for_averaging_sm_f0 = &sm_ring_f0[NB_SM_TO_RECEIVE_BEFORE_AVF0-1]; | |
|
172 | 160 | ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0; |
|
173 | 161 | for (i=2; i<NB_SM_TO_RECEIVE_BEFORE_AVF0+1; i++) |
|
174 | 162 | { |
|
175 | 163 | ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous; |
|
176 | 164 | ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0; |
|
177 | 165 | } |
|
178 | 166 | for(i=0; i<TOTAL_SIZE_SM; i++) |
|
179 | 167 | { |
|
180 | 168 | averaged_sm_f0[i] = ( (int *) (ring_node_tab[0]->buffer_address) ) [i] |
|
181 | 169 | + ( (int *) (ring_node_tab[1]->buffer_address) ) [i] |
|
182 | 170 | + ( (int *) (ring_node_tab[2]->buffer_address) ) [i] |
|
183 | 171 | + ( (int *) (ring_node_tab[3]->buffer_address) ) [i] |
|
184 | 172 | + ( (int *) (ring_node_tab[4]->buffer_address) ) [i] |
|
185 | 173 | + ( (int *) (ring_node_tab[5]->buffer_address) ) [i] |
|
186 | 174 | + ( (int *) (ring_node_tab[6]->buffer_address) ) [i] |
|
187 | 175 | + ( (int *) (ring_node_tab[7]->buffer_address) ) [i]; |
|
188 | 176 | } |
|
189 | 177 | nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0; |
|
190 | 178 | if (nb_average == NB_AVERAGE_NORMAL_f0) { |
|
191 | 179 | nb_average = 0; |
|
192 | 180 | status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0 |
|
193 | 181 | if (status != RTEMS_SUCCESSFUL) { |
|
194 | 182 | printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status); |
|
195 | 183 | } |
|
196 | 184 | } |
|
197 | 185 | } |
|
198 | 186 | } |
|
199 | 187 | |
|
200 | rtems_task bpf0_task(rtems_task_argument argument) | |
|
201 | { | |
|
202 | rtems_event_set event_out; | |
|
203 | static unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_SM_F0 * 9 ]; | |
|
204 | ||
|
205 | BOOT_PRINTF("in BPFO *** \n") | |
|
206 | ||
|
207 | while(1){ | |
|
208 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
|
209 | matrix_compression(averaged_sm_f0, 0, compressed_sm_f0); | |
|
210 | BP1_set(compressed_sm_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0); | |
|
211 | } | |
|
212 | } | |
|
213 | ||
|
214 | 188 | rtems_task matr_task(rtems_task_argument argument) |
|
215 | 189 | { |
|
216 | 190 | spw_ioctl_pkt_send spw_ioctl_send_ASM; |
|
217 | 191 | rtems_event_set event_out; |
|
218 | 192 | rtems_status_code status; |
|
219 | 193 | rtems_id queue_id; |
|
220 | 194 | Header_TM_LFR_SCIENCE_ASM_t headerASM; |
|
221 | 195 | |
|
222 | 196 | init_header_asm( &headerASM ); |
|
223 | 197 | |
|
224 | 198 | status = get_message_queue_id_send( &queue_id ); |
|
225 | 199 | if (status != RTEMS_SUCCESSFUL) |
|
226 | 200 | { |
|
227 | 201 | PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status) |
|
228 | 202 | } |
|
229 | 203 | |
|
230 | 204 | BOOT_PRINTF("in MATR *** \n") |
|
231 | 205 | |
|
232 | 206 | fill_averaged_spectral_matrix( ); |
|
233 | 207 | |
|
234 | 208 | while(1){ |
|
235 | 209 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
236 | // 1) convert the float array in a char array | |
|
210 | // 1) compress the matrix for Basic Parameters calculation | |
|
211 | compress_averaged_spectral_matrix( averaged_sm_f0, 0, compressed_sm_f0 ); | |
|
212 | // 2) | |
|
213 | //BP1_set(compressed_sm_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0); | |
|
214 | // 3) convert the float array in a char array | |
|
237 | 215 | convert_averaged_spectral_matrix( averaged_sm_f0, averaged_sm_f0_char); |
|
238 |
// |
|
|
239 | send_spectral_matrix( &headerASM, averaged_sm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); | |
|
216 | // 4) send the spectral matrix packets | |
|
217 | send_averaged_spectral_matrix( &headerASM, averaged_sm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); | |
|
240 | 218 | } |
|
241 | 219 | } |
|
242 | 220 | |
|
243 | 221 | //***************************** |
|
244 | 222 | // Spectral matrices processing |
|
245 | 223 | |
|
246 | 224 | void matrix_reset(volatile float *averaged_spec_mat) |
|
247 | 225 | { |
|
248 | 226 | int i; |
|
249 | 227 | for(i=0; i<TOTAL_SIZE_SM; i++){ |
|
250 | 228 | averaged_spec_mat[i] = 0; |
|
251 | 229 | } |
|
252 | 230 | } |
|
253 | 231 | |
|
254 |
void |
|
|
232 | void compress_averaged_spectral_matrix( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat ) | |
|
255 | 233 | { |
|
256 | int i; | |
|
257 | int j; | |
|
234 | int frequencyBin; | |
|
235 | int asmComponent; | |
|
236 | int offsetASM; | |
|
237 | int generalOffsetASM; | |
|
238 | int offsetCompressed; | |
|
239 | int k; | |
|
240 | ||
|
258 | 241 | switch (fChannel){ |
|
259 |
|
|
|
260 | for(i=0;i<NB_BINS_COMPRESSED_SM_F0;i++){ | |
|
261 | j = 17 + (i * 8); | |
|
262 | compressed_spec_mat[i] = (averaged_spec_mat[j] | |
|
263 | + averaged_spec_mat[j+1] | |
|
264 | + averaged_spec_mat[j+2] | |
|
265 | + averaged_spec_mat[j+3] | |
|
266 | + averaged_spec_mat[j+4] | |
|
267 | + averaged_spec_mat[j+5] | |
|
268 | + averaged_spec_mat[j+6] | |
|
269 | + averaged_spec_mat[j+7])/(8*NB_AVERAGE_NORMAL_f0); | |
|
242 | case 0: | |
|
243 | generalOffsetASM = ASM_F0_INDICE_START * NB_VALUES_PER_SM; | |
|
244 | for( frequencyBin = 0; frequencyBin < NB_BINS_COMPRESSED_SM_F0; frequencyBin++ ) | |
|
245 | { | |
|
246 | offsetCompressed = frequencyBin * NB_VALUES_PER_SM; | |
|
247 | offsetASM = generalOffsetASM + frequencyBin * NB_BINS_TO_AVERAGE_ASM_F0 * NB_VALUES_PER_SM; | |
|
248 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) | |
|
249 | { | |
|
250 | compressed_spec_mat[ offsetCompressed + asmComponent ] = 0; | |
|
251 | for ( k = 0; k < NB_BINS_TO_AVERAGE_ASM_F0; k++ ) | |
|
252 | { | |
|
253 | compressed_spec_mat[ offsetCompressed + asmComponent ] = | |
|
254 | compressed_spec_mat[ offsetCompressed + asmComponent ] | |
|
255 | + averaged_spec_mat[ offsetASM + (k*NB_VALUES_PER_SM) + asmComponent ]; | |
|
270 | 256 | } |
|
271 | break; | |
|
272 | case 1: | |
|
257 | compressed_spec_mat[ offsetCompressed + asmComponent ] = | |
|
258 | compressed_spec_mat[ offsetCompressed + asmComponent ] / NB_BINS_TO_AVERAGE_ASM_F0; | |
|
259 | } | |
|
260 | } | |
|
261 | break; | |
|
262 | ||
|
263 | case 1: | |
|
264 | // case fChannel = f1 to be completed later | |
|
265 | break; | |
|
266 | ||
|
267 | case 2: | |
|
273 | 268 | // case fChannel = f1 to be completed later |
|
269 | break; | |
|
270 | ||
|
271 | default: | |
|
272 | break; | |
|
273 | } | |
|
274 | } | |
|
275 | ||
|
276 | void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix) | |
|
277 | { | |
|
278 | unsigned int i; | |
|
279 | unsigned int j; | |
|
280 | char * pt_char_input; | |
|
281 | char * pt_char_output; | |
|
282 | ||
|
283 | pt_char_input = NULL; | |
|
284 | pt_char_output = NULL; | |
|
285 | ||
|
286 | for( i=0; i<NB_BINS_PER_SM; i++) | |
|
287 | { | |
|
288 | for ( j=0; j<NB_VALUES_PER_SM; j++) | |
|
289 | { | |
|
290 | pt_char_input = (char*) &input_matrix [ (i*NB_VALUES_PER_SM) + j ]; | |
|
291 | pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ]; | |
|
292 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float | |
|
293 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float | |
|
294 | } | |
|
295 | } | |
|
296 | } | |
|
297 | ||
|
298 | void send_averaged_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
|
299 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) | |
|
300 | { | |
|
301 | unsigned int i; | |
|
302 | unsigned int length = 0; | |
|
303 | rtems_status_code status; | |
|
304 | ||
|
305 | for (i=0; i<2; i++) | |
|
306 | { | |
|
307 | // (1) BUILD THE DATA | |
|
308 | switch(sid) | |
|
309 | { | |
|
310 | case SID_NORM_ASM_F0: | |
|
311 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; | |
|
312 | spw_ioctl_send->data = &spectral_matrix[ ( (ASM_F0_INDICE_START+ (i*NB_BINS_PER_PKT_ASM_F0)) * NB_VALUES_PER_SM) * 2 ]; | |
|
313 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; | |
|
314 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB | |
|
315 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB | |
|
274 | 316 | break; |
|
275 |
case |
|
|
276 | // case fChannel = f1 to be completed later | |
|
317 | case SID_NORM_ASM_F1: | |
|
318 | break; | |
|
319 | case SID_NORM_ASM_F2: | |
|
277 | 320 | break; |
|
278 | 321 | default: |
|
322 | PRINTF1("ERR *** in send_averaged_spectral_matrix *** unexpected sid %d\n", sid) | |
|
279 | 323 | break; |
|
324 | } | |
|
325 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
|
326 | spw_ioctl_send->hdr = (char *) header; | |
|
327 | spw_ioctl_send->options = 0; | |
|
328 | ||
|
329 | // (2) BUILD THE HEADER | |
|
330 | header->packetLength[0] = (unsigned char) (length>>8); | |
|
331 | header->packetLength[1] = (unsigned char) (length); | |
|
332 | header->sid = (unsigned char) sid; // SID | |
|
333 | header->pa_lfr_pkt_cnt_asm = 2; | |
|
334 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); | |
|
335 | ||
|
336 | // (3) SET PACKET TIME | |
|
337 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
|
338 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
|
339 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
|
340 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); | |
|
341 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
|
342 | header->time[5] = (unsigned char) (time_management_regs->fine_time); | |
|
343 | // | |
|
344 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
|
345 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
|
346 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
|
347 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); | |
|
348 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
|
349 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); | |
|
350 | ||
|
351 | // (4) SEND PACKET | |
|
352 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
|
353 | if (status != RTEMS_SUCCESSFUL) { | |
|
354 | printf("in send_averaged_spectral_matrix *** ERR %d\n", (int) status); | |
|
355 | } | |
|
280 | 356 | } |
|
281 | 357 | } |
|
282 | 358 | |
|
283 | 359 | void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){ |
|
284 | 360 | int i; |
|
285 | 361 | int j; |
|
286 | 362 | unsigned char tmp_u_char; |
|
287 | 363 | unsigned char * pt_char = NULL; |
|
288 | 364 | float PSDB, PSDE; |
|
289 | 365 | float NVEC_V0; |
|
290 | 366 | float NVEC_V1; |
|
291 | 367 | float NVEC_V2; |
|
292 | 368 | //float significand; |
|
293 | 369 | //int exponent; |
|
294 | 370 | float aux; |
|
295 | 371 | float tr_SB_SB; |
|
296 | 372 | float tmp; |
|
297 | 373 | float sx_re; |
|
298 | 374 | float sx_im; |
|
299 | 375 | float nebx_re = 0; |
|
300 | 376 | float nebx_im = 0; |
|
301 | 377 | float ny = 0; |
|
302 | 378 | float nz = 0; |
|
303 | 379 | float bx_bx_star = 0; |
|
304 | 380 | for(i=0; i<nb_bins_compressed_spec_mat; i++){ |
|
305 | 381 | //============================================== |
|
306 | 382 | // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits |
|
307 | 383 | PSDB = compressed_spec_mat[i*30] // S11 |
|
308 | 384 | + compressed_spec_mat[(i*30) + 10] // S22 |
|
309 | 385 | + compressed_spec_mat[(i*30) + 18]; // S33 |
|
310 | 386 | //significand = frexp(PSDB, &exponent); |
|
311 | 387 | pt_char = (unsigned char*) &PSDB; |
|
312 | 388 | LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float |
|
313 | 389 | LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float |
|
314 | 390 | //============================================== |
|
315 | 391 | // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits |
|
316 | 392 | PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44 |
|
317 | 393 | + compressed_spec_mat[(i*30) + 28] * K55_pe // S55 |
|
318 | 394 | + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45 |
|
319 | 395 | - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45 |
|
320 | 396 | pt_char = (unsigned char*) &PSDE; |
|
321 | 397 | LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float |
|
322 | 398 | LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float |
|
323 | 399 | //============================================================================== |
|
324 | 400 | // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits |
|
325 | 401 | // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits |
|
326 | 402 | // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits |
|
327 | 403 | tmp = sqrt( |
|
328 | 404 | compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12 |
|
329 | 405 | +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13 |
|
330 | 406 | +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23 |
|
331 | 407 | ); |
|
332 | 408 | NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23 |
|
333 | 409 | NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13 |
|
334 | 410 | NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12 |
|
335 | 411 | LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127); |
|
336 | 412 | LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127); |
|
337 | 413 | pt_char = (unsigned char*) &NVEC_V2; |
|
338 | 414 | LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2 |
|
339 | 415 | //======================================================= |
|
340 | 416 | // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits |
|
341 | 417 | aux = 2*tmp / PSDB; // compute the ellipticity |
|
342 | 418 | tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity |
|
343 | 419 | LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char |
|
344 | 420 | //============================================================== |
|
345 | 421 | // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits |
|
346 | 422 | for(j = 0; j<NB_VALUES_PER_SM;j++){ |
|
347 | 423 | tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30] |
|
348 | 424 | + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10] |
|
349 | 425 | + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18] |
|
350 | 426 | + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2] |
|
351 | 427 | + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3] |
|
352 | 428 | + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4] |
|
353 | 429 | + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5] |
|
354 | 430 | + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12] |
|
355 | 431 | + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13]; |
|
356 | 432 | } |
|
357 | 433 | aux = PSDB*PSDB; |
|
358 | 434 | tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) ); |
|
359 | 435 | tmp_u_char = (unsigned char) (NVEC_V0*(8-1)); |
|
360 | 436 | LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char |
|
361 | 437 | //======================================================================================= |
|
362 | 438 | // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1) |
|
363 | 439 | sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re |
|
364 | 440 | + compressed_spec_mat[(i*30) + 6] * K14_sx_re |
|
365 | 441 | + compressed_spec_mat[(i*30) + 8] * K15_sx_re |
|
366 | 442 | + compressed_spec_mat[(i*30) + 14] * K24_sx_re |
|
367 | 443 | + compressed_spec_mat[(i*30) + 16] * K25_sx_re |
|
368 | 444 | + compressed_spec_mat[(i*30) + 22] * K35_sx_re; |
|
369 | 445 | sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im |
|
370 | 446 | + compressed_spec_mat[(i*30) + 7] * K14_sx_im |
|
371 | 447 | + compressed_spec_mat[(i*30) + 9] * K15_sx_im |
|
372 | 448 | + compressed_spec_mat[(i*30) + 15] * K24_sx_im |
|
373 | 449 | + compressed_spec_mat[(i*30) + 17] * K25_sx_im |
|
374 | 450 | + compressed_spec_mat[(i*30) + 23] * K35_sx_im; |
|
375 | 451 | LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression |
|
376 | 452 | if ( abs(sx_re) > abs(sx_im) ) { |
|
377 | 453 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx |
|
378 | 454 | } |
|
379 | 455 | else { |
|
380 | 456 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx |
|
381 | 457 | } |
|
382 | 458 | //====================================================================== |
|
383 | 459 | // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1) |
|
384 | 460 | ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2; |
|
385 | 461 | nz = NVEC_V0; |
|
386 | 462 | bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22 |
|
387 | 463 | + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33 |
|
388 | 464 | - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23 |
|
389 | 465 | nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re |
|
390 | 466 | +compressed_spec_mat[(i*30) + 16] * K25_ny_re |
|
391 | 467 | +compressed_spec_mat[(i*30) + 20] * K34_ny_re |
|
392 | 468 | +compressed_spec_mat[(i*30) + 22] * K35_ny_re) |
|
393 | 469 | + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re |
|
394 | 470 | +compressed_spec_mat[(i*30) + 16] * K25_nz_re |
|
395 | 471 | +compressed_spec_mat[(i*30) + 20] * K34_nz_re |
|
396 | 472 | +compressed_spec_mat[(i*30) + 22] * K35_nz_re); |
|
397 | 473 | nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re |
|
398 | 474 | +compressed_spec_mat[(i*30) + 17] * K25_ny_re |
|
399 | 475 | +compressed_spec_mat[(i*30) + 21] * K34_ny_re |
|
400 | 476 | +compressed_spec_mat[(i*30) + 23] * K35_ny_re) |
|
401 | 477 | + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im |
|
402 | 478 | +compressed_spec_mat[(i*30) + 17] * K25_nz_im |
|
403 | 479 | +compressed_spec_mat[(i*30) + 21] * K34_nz_im |
|
404 | 480 | +compressed_spec_mat[(i*30) + 23] * K35_nz_im); |
|
405 | 481 | tmp = nebx_re / bx_bx_star; |
|
406 | 482 | LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression |
|
407 | 483 | if ( abs(nebx_re) > abs(nebx_im) ) { |
|
408 | 484 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx |
|
409 | 485 | } |
|
410 | 486 | else { |
|
411 | 487 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx |
|
412 | 488 | } |
|
413 | 489 | } |
|
414 | 490 | |
|
415 | 491 | } |
|
416 | 492 | |
|
417 | 493 | void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){ |
|
418 | 494 | // BP2 autocorrelation |
|
419 | 495 | int i; |
|
420 | 496 | int aux = 0; |
|
421 | 497 | |
|
422 | 498 | for(i = 0; i<nb_bins_compressed_spec_mat; i++){ |
|
423 | 499 | // S12 |
|
424 | 500 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]); |
|
425 | 501 | compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux; |
|
426 | 502 | compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux; |
|
427 | 503 | // S13 |
|
428 | 504 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]); |
|
429 | 505 | compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux; |
|
430 | 506 | compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux; |
|
431 | 507 | // S23 |
|
432 | 508 | aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]); |
|
433 | 509 | compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux; |
|
434 | 510 | compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux; |
|
435 | 511 | // S45 |
|
436 | 512 | aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]); |
|
437 | 513 | compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux; |
|
438 | 514 | compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux; |
|
439 | 515 | // S14 |
|
440 | 516 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]); |
|
441 | 517 | compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux; |
|
442 | 518 | compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux; |
|
443 | 519 | // S15 |
|
444 | 520 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]); |
|
445 | 521 | compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux; |
|
446 | 522 | compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux; |
|
447 | 523 | // S24 |
|
448 | 524 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]); |
|
449 | 525 | compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux; |
|
450 | 526 | compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux; |
|
451 | 527 | // S25 |
|
452 | 528 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]); |
|
453 | 529 | compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux; |
|
454 | 530 | compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux; |
|
455 | 531 | // S34 |
|
456 | 532 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]); |
|
457 | 533 | compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux; |
|
458 | 534 | compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux; |
|
459 | 535 | // S35 |
|
460 | 536 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]); |
|
461 | 537 | compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux; |
|
462 | 538 | compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux; |
|
463 | 539 | } |
|
464 | 540 | } |
|
465 | 541 | |
|
466 | 542 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header) |
|
467 | 543 | { |
|
468 | 544 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
469 | 545 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
470 | 546 | header->reserved = 0x00; |
|
471 | 547 | header->userApplication = CCSDS_USER_APP; |
|
472 | 548 | header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
473 | 549 | header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
474 | 550 | header->packetSequenceControl[0] = 0xc0; |
|
475 | 551 | header->packetSequenceControl[1] = 0x00; |
|
476 | 552 | header->packetLength[0] = 0x00; |
|
477 | 553 | header->packetLength[1] = 0x00; |
|
478 | 554 | // DATA FIELD HEADER |
|
479 | 555 | header->spare1_pusVersion_spare2 = 0x10; |
|
480 | 556 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
481 | 557 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
482 | 558 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
483 | 559 | // AUXILIARY DATA HEADER |
|
484 | 560 | header->sid = 0x00; |
|
485 | 561 | header->biaStatusInfo = 0x00; |
|
486 | 562 | header->pa_lfr_pkt_cnt_asm = 0x00; |
|
487 | 563 | header->pa_lfr_pkt_nr_asm = 0x00; |
|
488 | 564 | header->time[0] = 0x00; |
|
489 | 565 | header->time[0] = 0x00; |
|
490 | 566 | header->time[0] = 0x00; |
|
491 | 567 | header->time[0] = 0x00; |
|
492 | 568 | header->time[0] = 0x00; |
|
493 | 569 | header->time[0] = 0x00; |
|
494 | 570 | header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB |
|
495 | 571 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB |
|
496 | 572 | } |
|
497 | 573 | |
|
498 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |
|
499 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) | |
|
500 | { | |
|
501 | unsigned int i; | |
|
502 | unsigned int length = 0; | |
|
503 | rtems_status_code status; | |
|
504 | ||
|
505 | for (i=0; i<2; i++) | |
|
506 | { | |
|
507 | // (1) BUILD THE DATA | |
|
508 | switch(sid) | |
|
509 | { | |
|
510 | case SID_NORM_ASM_F0: | |
|
511 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; | |
|
512 | spw_ioctl_send->data = &spectral_matrix[ ( (ASM_F0_INDICE_START+ (i*NB_BINS_PER_PKT_ASM_F0)) * NB_VALUES_PER_SM) * 2 ]; | |
|
513 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; | |
|
514 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB | |
|
515 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB | |
|
516 | break; | |
|
517 | case SID_NORM_ASM_F1: | |
|
518 | break; | |
|
519 | case SID_NORM_ASM_F2: | |
|
520 | break; | |
|
521 | default: | |
|
522 | PRINTF1("ERR *** in send_spectral_matrix *** unexpected sid %d\n", sid) | |
|
523 | break; | |
|
524 | } | |
|
525 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
|
526 | spw_ioctl_send->hdr = (char *) header; | |
|
527 | spw_ioctl_send->options = 0; | |
|
528 | ||
|
529 | // (2) BUILD THE HEADER | |
|
530 | header->packetLength[0] = (unsigned char) (length>>8); | |
|
531 | header->packetLength[1] = (unsigned char) (length); | |
|
532 | header->sid = (unsigned char) sid; // SID | |
|
533 | header->pa_lfr_pkt_cnt_asm = 2; | |
|
534 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); | |
|
535 | ||
|
536 | // (3) SET PACKET TIME | |
|
537 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
|
538 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
|
539 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
|
540 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); | |
|
541 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
|
542 | header->time[5] = (unsigned char) (time_management_regs->fine_time); | |
|
543 | // | |
|
544 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
|
545 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
|
546 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
|
547 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); | |
|
548 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
|
549 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); | |
|
550 | ||
|
551 | // (4) SEND PACKET | |
|
552 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
|
553 | if (status != RTEMS_SUCCESSFUL) { | |
|
554 | printf("in send_spectral_matrix *** ERR %d\n", (int) status); | |
|
555 | } | |
|
556 | } | |
|
557 | } | |
|
558 | ||
|
559 | void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix) | |
|
560 | { | |
|
561 | unsigned int i; | |
|
562 | unsigned int j; | |
|
563 | char * pt_char_input; | |
|
564 | char * pt_char_output; | |
|
565 | ||
|
566 | pt_char_input = NULL; | |
|
567 | pt_char_output = NULL; | |
|
568 | ||
|
569 | for( i=0; i<NB_BINS_PER_SM; i++) | |
|
570 | { | |
|
571 | for ( j=0; j<NB_VALUES_PER_SM; j++) | |
|
572 | { | |
|
573 | pt_char_input = (char*) &input_matrix [ (i*NB_VALUES_PER_SM) + j ]; | |
|
574 | pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ]; | |
|
575 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float | |
|
576 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float | |
|
577 | } | |
|
578 | } | |
|
579 | } | |
|
580 | ||
|
581 | 574 | void fill_averaged_spectral_matrix(void) |
|
582 | 575 | { |
|
583 | 576 | /** This function fills spectral matrices related buffers with arbitrary data. |
|
584 | 577 | * |
|
585 | 578 | * This function is for testing purpose only. |
|
586 | 579 | * |
|
587 | 580 | */ |
|
588 | 581 | |
|
589 | 582 | float offset; |
|
590 | 583 | float coeff; |
|
591 | 584 | |
|
592 | 585 | offset = 10.; |
|
593 | 586 | coeff = 100000.; |
|
594 | 587 | averaged_sm_f0[ 0 + 25 * 0 ] = 0. + offset; |
|
595 | 588 | averaged_sm_f0[ 0 + 25 * 1 ] = 1. + offset; |
|
596 | 589 | averaged_sm_f0[ 0 + 25 * 2 ] = 2. + offset; |
|
597 | 590 | averaged_sm_f0[ 0 + 25 * 3 ] = 3. + offset; |
|
598 | 591 | averaged_sm_f0[ 0 + 25 * 4 ] = 4. + offset; |
|
599 | 592 | averaged_sm_f0[ 0 + 25 * 5 ] = 5. + offset; |
|
600 | 593 | averaged_sm_f0[ 0 + 25 * 6 ] = 6. + offset; |
|
601 | 594 | averaged_sm_f0[ 0 + 25 * 7 ] = 7. + offset; |
|
602 | 595 | averaged_sm_f0[ 0 + 25 * 8 ] = 8. + offset; |
|
603 | 596 | averaged_sm_f0[ 0 + 25 * 9 ] = 9. + offset; |
|
604 | 597 | averaged_sm_f0[ 0 + 25 * 10 ] = 10. + offset; |
|
605 | 598 | averaged_sm_f0[ 0 + 25 * 11 ] = 11. + offset; |
|
606 | 599 | averaged_sm_f0[ 0 + 25 * 12 ] = 12. + offset; |
|
607 | 600 | averaged_sm_f0[ 0 + 25 * 13 ] = 13. + offset; |
|
608 | 601 | averaged_sm_f0[ 0 + 25 * 14 ] = 14. + offset; |
|
609 | 602 | averaged_sm_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff; |
|
610 | 603 | averaged_sm_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff; |
|
611 | 604 | averaged_sm_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff; |
|
612 | 605 | averaged_sm_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff; |
|
613 | 606 | averaged_sm_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff; |
|
614 | 607 | averaged_sm_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff; |
|
615 | 608 | averaged_sm_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff; |
|
616 | 609 | averaged_sm_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff; |
|
617 | 610 | averaged_sm_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff; |
|
618 | 611 | averaged_sm_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff; |
|
619 | 612 | averaged_sm_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff; |
|
620 | 613 | averaged_sm_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff; |
|
621 | 614 | averaged_sm_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff; |
|
622 | 615 | averaged_sm_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff; |
|
623 | 616 | averaged_sm_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff; |
|
624 | 617 | |
|
625 | 618 | offset = 10000000; |
|
626 | 619 | averaged_sm_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff; |
|
627 | 620 | averaged_sm_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff; |
|
628 | 621 | averaged_sm_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff; |
|
629 | 622 | averaged_sm_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff; |
|
630 | 623 | averaged_sm_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff; |
|
631 | 624 | averaged_sm_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff; |
|
632 | 625 | averaged_sm_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff; |
|
633 | 626 | averaged_sm_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff; |
|
634 | 627 | averaged_sm_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff; |
|
635 | 628 | averaged_sm_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff; |
|
636 | 629 | averaged_sm_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff; |
|
637 | 630 | averaged_sm_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff; |
|
638 | 631 | averaged_sm_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff; |
|
639 | 632 | averaged_sm_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff; |
|
640 | 633 | averaged_sm_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff; |
|
641 | 634 | |
|
642 | 635 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_sm_f0[ 0 ]; |
|
643 | 636 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_sm_f0[ 1 ]; |
|
644 | 637 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_sm_f0[ 2 ]; |
|
645 | 638 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_sm_f0[ 3 ]; |
|
646 | 639 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_sm_f0[ 4 ]; |
|
647 | 640 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_sm_f0[ 5 ]; |
|
648 | 641 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_sm_f0[ 6 ]; |
|
649 | 642 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_sm_f0[ 7 ]; |
|
650 | 643 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_sm_f0[ 8 ]; |
|
651 | 644 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_sm_f0[ 9 ]; |
|
652 | 645 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_sm_f0[ 10 ]; |
|
653 | 646 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_sm_f0[ 11 ]; |
|
654 | 647 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_sm_f0[ 12 ]; |
|
655 | 648 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_sm_f0[ 13 ]; |
|
656 | 649 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_sm_f0[ 14 ]; |
|
657 | 650 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_sm_f0[ 15 ]; |
|
658 | 651 | } |
|
659 | 652 | |
|
660 | 653 | void reset_spectral_matrix_regs() |
|
661 | 654 | { |
|
662 | 655 | /** This function resets the spectral matrices module registers. |
|
663 | 656 | * |
|
664 | 657 | * The registers affected by this function are located at the following offset addresses: |
|
665 | 658 | * |
|
666 | 659 | * - 0x00 config |
|
667 | 660 | * - 0x04 status |
|
668 | 661 | * - 0x08 matrixF0_Address0 |
|
669 | 662 | * - 0x10 matrixFO_Address1 |
|
670 | 663 | * - 0x14 matrixF1_Address |
|
671 | 664 | * - 0x18 matrixF2_Address |
|
672 | 665 | * |
|
673 | 666 | */ |
|
674 | 667 | |
|
675 | 668 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
676 | 669 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; |
|
677 | 670 | spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address; |
|
678 | 671 | spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address; |
|
679 | 672 | } |
|
680 | 673 | |
|
681 | 674 | //****************** |
|
682 | 675 | // general functions |
|
683 | 676 | |
|
684 | 677 | |
|
685 | 678 | |
|
686 | 679 |
@@ -1,748 +1,733 | |||
|
1 | 1 | /** Functions and tasks related to TeleCommand handling. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * A group of functions to handle TeleCommands:\n |
|
7 | 7 | * action launching\n |
|
8 | 8 | * TC parsing\n |
|
9 | 9 | * ... |
|
10 | 10 | * |
|
11 | 11 | */ |
|
12 | 12 | |
|
13 | 13 | #include "tc_handler.h" |
|
14 | 14 | |
|
15 | 15 | //*********** |
|
16 | 16 | // RTEMS TASK |
|
17 | 17 | |
|
18 | 18 | rtems_task actn_task( rtems_task_argument unused ) |
|
19 | 19 | { |
|
20 | 20 | /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands. |
|
21 | 21 | * |
|
22 | 22 | * @param unused is the starting argument of the RTEMS task |
|
23 | 23 | * |
|
24 | 24 | * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending |
|
25 | 25 | * on the incoming TeleCommand. |
|
26 | 26 | * |
|
27 | 27 | */ |
|
28 | 28 | |
|
29 | 29 | int result; |
|
30 | 30 | rtems_status_code status; // RTEMS status code |
|
31 | 31 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task |
|
32 | 32 | size_t size; // size of the incoming TC packet |
|
33 | 33 | unsigned char subtype; // subtype of the current TC packet |
|
34 | 34 | unsigned char time[6]; |
|
35 | 35 | rtems_id queue_rcv_id; |
|
36 | 36 | rtems_id queue_snd_id; |
|
37 | 37 | |
|
38 | 38 | status = get_message_queue_id_recv( &queue_rcv_id ); |
|
39 | 39 | if (status != RTEMS_SUCCESSFUL) |
|
40 | 40 | { |
|
41 | 41 | PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status) |
|
42 | 42 | } |
|
43 | 43 | |
|
44 | 44 | status = get_message_queue_id_send( &queue_snd_id ); |
|
45 | 45 | if (status != RTEMS_SUCCESSFUL) |
|
46 | 46 | { |
|
47 | 47 | PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status) |
|
48 | 48 | } |
|
49 | 49 | |
|
50 | 50 | result = LFR_SUCCESSFUL; |
|
51 | 51 | subtype = 0; // subtype of the current TC packet |
|
52 | 52 | |
|
53 | 53 | BOOT_PRINTF("in ACTN *** \n") |
|
54 | 54 | |
|
55 | 55 | while(1) |
|
56 | 56 | { |
|
57 | 57 | status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size, |
|
58 | 58 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); |
|
59 | 59 | getTime( time ); // set time to the current time |
|
60 | 60 | if (status!=RTEMS_SUCCESSFUL) |
|
61 | 61 | { |
|
62 | 62 | PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) |
|
63 | 63 | } |
|
64 | 64 | else |
|
65 | 65 | { |
|
66 | 66 | subtype = TC.serviceSubType; |
|
67 | 67 | switch(subtype) |
|
68 | 68 | { |
|
69 | 69 | case TC_SUBTYPE_RESET: |
|
70 | 70 | result = action_reset( &TC, queue_snd_id, time ); |
|
71 | 71 | close_action( &TC, result, queue_snd_id, time ); |
|
72 | 72 | break; |
|
73 | 73 | // |
|
74 | 74 | case TC_SUBTYPE_LOAD_COMM: |
|
75 | 75 | result = action_load_common_par( &TC ); |
|
76 | 76 | close_action( &TC, result, queue_snd_id, time ); |
|
77 | 77 | break; |
|
78 | 78 | // |
|
79 | 79 | case TC_SUBTYPE_LOAD_NORM: |
|
80 | 80 | result = action_load_normal_par( &TC, queue_snd_id, time ); |
|
81 | 81 | close_action( &TC, result, queue_snd_id, time ); |
|
82 | 82 | break; |
|
83 | 83 | // |
|
84 | 84 | case TC_SUBTYPE_LOAD_BURST: |
|
85 | 85 | result = action_load_burst_par( &TC, queue_snd_id, time ); |
|
86 | 86 | close_action( &TC, result, queue_snd_id, time ); |
|
87 | 87 | break; |
|
88 | 88 | // |
|
89 | 89 | case TC_SUBTYPE_LOAD_SBM1: |
|
90 | 90 | result = action_load_sbm1_par( &TC, queue_snd_id, time ); |
|
91 | 91 | close_action( &TC, result, queue_snd_id, time ); |
|
92 | 92 | break; |
|
93 | 93 | // |
|
94 | 94 | case TC_SUBTYPE_LOAD_SBM2: |
|
95 | 95 | result = action_load_sbm2_par( &TC, queue_snd_id, time ); |
|
96 | 96 | close_action( &TC, result, queue_snd_id, time ); |
|
97 | 97 | break; |
|
98 | 98 | // |
|
99 | 99 | case TC_SUBTYPE_DUMP: |
|
100 | 100 | result = action_dump_par( queue_snd_id ); |
|
101 | 101 | close_action( &TC, result, queue_snd_id, time ); |
|
102 | 102 | break; |
|
103 | 103 | // |
|
104 | 104 | case TC_SUBTYPE_ENTER: |
|
105 | 105 | result = action_enter_mode( &TC, queue_snd_id, time ); |
|
106 | 106 | close_action( &TC, result, queue_snd_id, time ); |
|
107 | 107 | break; |
|
108 | 108 | // |
|
109 | 109 | case TC_SUBTYPE_UPDT_INFO: |
|
110 | 110 | result = action_update_info( &TC, queue_snd_id ); |
|
111 | 111 | close_action( &TC, result, queue_snd_id, time ); |
|
112 | 112 | break; |
|
113 | 113 | // |
|
114 | 114 | case TC_SUBTYPE_EN_CAL: |
|
115 | 115 | result = action_enable_calibration( &TC, queue_snd_id, time ); |
|
116 | 116 | close_action( &TC, result, queue_snd_id, time ); |
|
117 | 117 | break; |
|
118 | 118 | // |
|
119 | 119 | case TC_SUBTYPE_DIS_CAL: |
|
120 | 120 | result = action_disable_calibration( &TC, queue_snd_id, time ); |
|
121 | 121 | close_action( &TC, result, queue_snd_id, time ); |
|
122 | 122 | break; |
|
123 | 123 | // |
|
124 | 124 | case TC_SUBTYPE_UPDT_TIME: |
|
125 | 125 | result = action_update_time( &TC ); |
|
126 | 126 | close_action( &TC, result, queue_snd_id, time ); |
|
127 | 127 | break; |
|
128 | 128 | // |
|
129 | 129 | default: |
|
130 | 130 | break; |
|
131 | 131 | } |
|
132 | 132 | } |
|
133 | 133 | } |
|
134 | 134 | } |
|
135 | 135 | |
|
136 | 136 | //*********** |
|
137 | 137 | // TC ACTIONS |
|
138 | 138 | |
|
139 | 139 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
140 | 140 | { |
|
141 | 141 | /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received. |
|
142 | 142 | * |
|
143 | 143 | * @param TC points to the TeleCommand packet that is being processed |
|
144 | 144 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
145 | 145 | * |
|
146 | 146 | */ |
|
147 | 147 | |
|
148 | 148 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
149 | 149 | return LFR_DEFAULT; |
|
150 | 150 | } |
|
151 | 151 | |
|
152 | 152 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
153 | 153 | { |
|
154 | 154 | /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received. |
|
155 | 155 | * |
|
156 | 156 | * @param TC points to the TeleCommand packet that is being processed |
|
157 | 157 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
158 | 158 | * |
|
159 | 159 | */ |
|
160 | 160 | |
|
161 | 161 | rtems_status_code status; |
|
162 | 162 | unsigned char requestedMode; |
|
163 | 163 | |
|
164 | 164 | requestedMode = TC->dataAndCRC[1]; |
|
165 | 165 | |
|
166 | 166 | if ( (requestedMode != LFR_MODE_STANDBY) |
|
167 | 167 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) |
|
168 | 168 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) |
|
169 | 169 | { |
|
170 | 170 | status = RTEMS_UNSATISFIED; |
|
171 | 171 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode, time ); |
|
172 | 172 | } |
|
173 | 173 | else |
|
174 | 174 | { |
|
175 | 175 | printf("in action_enter_mode *** enter mode %d\n", requestedMode); |
|
176 | 176 | |
|
177 | 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, time ); |
|
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 | |
|
216 | 216 | result = LFR_SUCCESSFUL; |
|
217 | 217 | |
|
218 | 218 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 |
|
219 | 219 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; |
|
220 | 220 | val++; |
|
221 | 221 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); |
|
222 | 222 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); |
|
223 | 223 | |
|
224 | 224 | return result; |
|
225 | 225 | } |
|
226 | 226 | |
|
227 | 227 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
228 | 228 | { |
|
229 | 229 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. |
|
230 | 230 | * |
|
231 | 231 | * @param TC points to the TeleCommand packet that is being processed |
|
232 | 232 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
233 | 233 | * |
|
234 | 234 | */ |
|
235 | 235 | |
|
236 | 236 | int result; |
|
237 | 237 | unsigned char lfrMode; |
|
238 | 238 | |
|
239 | 239 | result = LFR_DEFAULT; |
|
240 | 240 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
241 | 241 | |
|
242 | 242 | if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) { |
|
243 | 243 | send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); |
|
244 | 244 | result = LFR_DEFAULT; |
|
245 | 245 | } |
|
246 | 246 | else { |
|
247 | 247 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
248 | 248 | result = LFR_DEFAULT; |
|
249 | 249 | } |
|
250 | 250 | return result; |
|
251 | 251 | } |
|
252 | 252 | |
|
253 | 253 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
254 | 254 | { |
|
255 | 255 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. |
|
256 | 256 | * |
|
257 | 257 | * @param TC points to the TeleCommand packet that is being processed |
|
258 | 258 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
259 | 259 | * |
|
260 | 260 | */ |
|
261 | 261 | |
|
262 | 262 | int result; |
|
263 | 263 | unsigned char lfrMode; |
|
264 | 264 | |
|
265 | 265 | result = LFR_DEFAULT; |
|
266 | 266 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
267 | 267 | |
|
268 | 268 | if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) { |
|
269 | 269 | send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); |
|
270 | 270 | result = LFR_DEFAULT; |
|
271 | 271 | } |
|
272 | 272 | else { |
|
273 | 273 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
274 | 274 | result = LFR_DEFAULT; |
|
275 | 275 | } |
|
276 | 276 | return result; |
|
277 | 277 | } |
|
278 | 278 | |
|
279 | 279 | int action_update_time(ccsdsTelecommandPacket_t *TC) |
|
280 | 280 | { |
|
281 | 281 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. |
|
282 | 282 | * |
|
283 | 283 | * @param TC points to the TeleCommand packet that is being processed |
|
284 | 284 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
285 | 285 | * |
|
286 | 286 | * @return LFR_SUCCESSFUL |
|
287 | 287 | * |
|
288 | 288 | */ |
|
289 | 289 | |
|
290 | 290 | unsigned int val; |
|
291 | 291 | |
|
292 | 292 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) |
|
293 | 293 | + (TC->dataAndCRC[1] << 16) |
|
294 | 294 | + (TC->dataAndCRC[2] << 8) |
|
295 | 295 | + TC->dataAndCRC[3]; |
|
296 | 296 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 |
|
297 | 297 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; |
|
298 | 298 | val++; |
|
299 | 299 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); |
|
300 | 300 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); |
|
301 | 301 | time_management_regs->ctrl = time_management_regs->ctrl | 1; |
|
302 | 302 | |
|
303 | 303 | return LFR_SUCCESSFUL; |
|
304 | 304 | } |
|
305 | 305 | |
|
306 | 306 | //******************* |
|
307 | 307 | // ENTERING THE MODES |
|
308 | 308 | |
|
309 | 309 | int transition_validation(unsigned char requestedMode) |
|
310 | 310 | { |
|
311 | 311 | /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE. |
|
312 | 312 | * |
|
313 | 313 | * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE |
|
314 | 314 | * |
|
315 | 315 | * @return LFR directive status codes: |
|
316 | 316 | * - LFR_SUCCESSFUL - the transition is authorized |
|
317 | 317 | * - LFR_DEFAULT - the transition is not authorized |
|
318 | 318 | * |
|
319 | 319 | */ |
|
320 | 320 | |
|
321 | 321 | int status; |
|
322 | 322 | |
|
323 | 323 | switch (requestedMode) |
|
324 | 324 | { |
|
325 | 325 | case LFR_MODE_STANDBY: |
|
326 | 326 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { |
|
327 | 327 | status = LFR_DEFAULT; |
|
328 | 328 | } |
|
329 | 329 | else |
|
330 | 330 | { |
|
331 | 331 | status = LFR_SUCCESSFUL; |
|
332 | 332 | } |
|
333 | 333 | break; |
|
334 | 334 | case LFR_MODE_NORMAL: |
|
335 | 335 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { |
|
336 | 336 | status = LFR_DEFAULT; |
|
337 | 337 | } |
|
338 | 338 | else { |
|
339 | 339 | status = LFR_SUCCESSFUL; |
|
340 | 340 | } |
|
341 | 341 | break; |
|
342 | 342 | case LFR_MODE_BURST: |
|
343 | 343 | if ( lfrCurrentMode == LFR_MODE_BURST ) { |
|
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_SBM1: |
|
351 | 351 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { |
|
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_SBM2: |
|
359 | 359 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { |
|
360 | 360 | status = LFR_DEFAULT; |
|
361 | 361 | } |
|
362 | 362 | else { |
|
363 | 363 | status = LFR_SUCCESSFUL; |
|
364 | 364 | } |
|
365 | 365 | break; |
|
366 | 366 | default: |
|
367 | 367 | status = LFR_DEFAULT; |
|
368 | 368 | break; |
|
369 | 369 | } |
|
370 | 370 | |
|
371 | 371 | return status; |
|
372 | 372 | } |
|
373 | 373 | |
|
374 | 374 | int stop_current_mode(void) |
|
375 | 375 | { |
|
376 | 376 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. |
|
377 | 377 | * |
|
378 | 378 | * @return RTEMS directive status codes: |
|
379 | 379 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
380 | 380 | * - RTEMS_INVALID_ID - task id invalid |
|
381 | 381 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
382 | 382 | * |
|
383 | 383 | */ |
|
384 | 384 | |
|
385 | 385 | rtems_status_code status; |
|
386 | 386 | |
|
387 | 387 | status = RTEMS_SUCCESSFUL; |
|
388 | 388 | |
|
389 | 389 | // (1) mask interruptions |
|
390 | 390 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt |
|
391 | 391 | //LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
392 | 392 | |
|
393 | 393 | // (2) clear interruptions |
|
394 | 394 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt |
|
395 | 395 | //LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
396 | 396 | |
|
397 | 397 | // (3) reset registers |
|
398 | 398 | reset_wfp_burst_enable(); // reset burst and enable bits |
|
399 | 399 | reset_wfp_status(); // reset all the status bits |
|
400 | 400 | |
|
401 | 401 | // <Spectral Matrices simulator> |
|
402 | 402 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator |
|
403 | 403 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
404 | 404 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator |
|
405 | 405 | // </Spectral Matrices simulator> |
|
406 | 406 | |
|
407 | 407 | // suspend several tasks |
|
408 | 408 | if (lfrCurrentMode != LFR_MODE_STANDBY) { |
|
409 | 409 | status = suspend_science_tasks(); |
|
410 | 410 | } |
|
411 | 411 | |
|
412 | 412 | if (status != RTEMS_SUCCESSFUL) |
|
413 | 413 | { |
|
414 | 414 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
415 | 415 | } |
|
416 | 416 | |
|
417 | 417 | return status; |
|
418 | 418 | } |
|
419 | 419 | |
|
420 | 420 | int enter_mode(unsigned char mode ) |
|
421 | 421 | { |
|
422 | 422 | /** This function is launched after a mode transition validation. |
|
423 | 423 | * |
|
424 | 424 | * @param mode is the mode in which LFR will be put. |
|
425 | 425 | * |
|
426 | 426 | * @return RTEMS directive status codes: |
|
427 | 427 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully |
|
428 | 428 | * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully |
|
429 | 429 | * |
|
430 | 430 | */ |
|
431 | 431 | |
|
432 | 432 | rtems_status_code status; |
|
433 | 433 | |
|
434 | 434 | status = RTEMS_UNSATISFIED; |
|
435 | 435 | |
|
436 | 436 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d); |
|
437 | 437 | updateLFRCurrentMode(); |
|
438 | 438 | |
|
439 | 439 | if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST) |
|
440 | 440 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) ) |
|
441 | 441 | { |
|
442 | 442 | #ifdef PRINT_TASK_STATISTICS |
|
443 | 443 | rtems_cpu_usage_reset(); |
|
444 | 444 | maxCount = 0; |
|
445 | 445 | #endif |
|
446 | 446 | status = restart_science_tasks(); |
|
447 | 447 | launch_waveform_picker( mode ); |
|
448 | launch_spectral_matrix( mode ); | |
|
448 | //launch_spectral_matrix( mode ); | |
|
449 | 449 | } |
|
450 | 450 | else if ( mode == LFR_MODE_STANDBY ) |
|
451 | 451 | { |
|
452 | 452 | #ifdef PRINT_TASK_STATISTICS |
|
453 | 453 | rtems_cpu_usage_report(); |
|
454 | 454 | #endif |
|
455 | 455 | |
|
456 | 456 | #ifdef PRINT_STACK_REPORT |
|
457 | 457 | rtems_stack_checker_report_usage(); |
|
458 | 458 | #endif |
|
459 | 459 | status = stop_current_mode(); |
|
460 | 460 | PRINTF1("maxCount = %d\n", maxCount) |
|
461 | 461 | } |
|
462 | 462 | else |
|
463 | 463 | { |
|
464 | 464 | status = RTEMS_UNSATISFIED; |
|
465 | 465 | } |
|
466 | 466 | |
|
467 | 467 | if (status != RTEMS_SUCCESSFUL) |
|
468 | 468 | { |
|
469 | 469 | PRINTF1("in enter_mode *** ERR = %d\n", status) |
|
470 | 470 | status = RTEMS_UNSATISFIED; |
|
471 | 471 | } |
|
472 | 472 | |
|
473 | 473 | return status; |
|
474 | 474 | } |
|
475 | 475 | |
|
476 | 476 | int restart_science_tasks() |
|
477 | 477 | { |
|
478 | 478 | /** This function is used to restart all science tasks. |
|
479 | 479 | * |
|
480 | 480 | * @return RTEMS directive status codes: |
|
481 | 481 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
482 | 482 | * - RTEMS_INVALID_ID - task id invalid |
|
483 | 483 | * - RTEMS_INCORRECT_STATE - task never started |
|
484 | 484 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task |
|
485 | 485 | * |
|
486 | 486 | * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1 |
|
487 | 487 | * |
|
488 | 488 | */ |
|
489 | 489 | |
|
490 | 490 | rtems_status_code status[6]; |
|
491 | 491 | rtems_status_code ret; |
|
492 | 492 | |
|
493 | 493 | ret = RTEMS_SUCCESSFUL; |
|
494 | 494 | |
|
495 | 495 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 ); |
|
496 | 496 | if (status[0] != RTEMS_SUCCESSFUL) |
|
497 | 497 | { |
|
498 | 498 | PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0]) |
|
499 | 499 | } |
|
500 | 500 | |
|
501 | status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 ); | |
|
502 | if (status[1] != RTEMS_SUCCESSFUL) | |
|
503 | { | |
|
504 | PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1]) | |
|
505 | } | |
|
506 | ||
|
507 | 501 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); |
|
508 | 502 | if (status[2] != RTEMS_SUCCESSFUL) |
|
509 | 503 | { |
|
510 | 504 | PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2]) |
|
511 | 505 | } |
|
512 | 506 | |
|
513 | 507 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); |
|
514 | 508 | if (status[3] != RTEMS_SUCCESSFUL) |
|
515 | 509 | { |
|
516 | 510 | PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3]) |
|
517 | 511 | } |
|
518 | 512 | |
|
519 | 513 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); |
|
520 | 514 | if (status[4] != RTEMS_SUCCESSFUL) |
|
521 | 515 | { |
|
522 | 516 | PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4]) |
|
523 | 517 | } |
|
524 | 518 | |
|
525 | 519 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); |
|
526 | 520 | if (status[5] != RTEMS_SUCCESSFUL) |
|
527 | 521 | { |
|
528 | 522 | PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5]) |
|
529 | 523 | } |
|
530 | 524 | |
|
531 |
if ( (status[0 |
|
|
525 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || | |
|
532 | 526 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) |
|
533 | 527 | { |
|
534 | 528 | ret = RTEMS_UNSATISFIED; |
|
535 | 529 | } |
|
536 | 530 | |
|
537 | 531 | return ret; |
|
538 | 532 | } |
|
539 | 533 | |
|
540 | 534 | int suspend_science_tasks() |
|
541 | 535 | { |
|
542 | 536 | /** This function suspends the science tasks. |
|
543 | 537 | * |
|
544 | 538 | * @return RTEMS directive status codes: |
|
545 | 539 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
546 | 540 | * - RTEMS_INVALID_ID - task id invalid |
|
547 | 541 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
548 | 542 | * |
|
549 | 543 | */ |
|
550 | 544 | |
|
551 | 545 | rtems_status_code status; |
|
552 | 546 | |
|
553 | 547 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); |
|
554 | 548 | if (status != RTEMS_SUCCESSFUL) |
|
555 | 549 | { |
|
556 | 550 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) |
|
557 | 551 | } |
|
558 | 552 | |
|
559 | if (status == RTEMS_SUCCESSFUL) // suspend BPF0 | |
|
560 | { | |
|
561 | status = rtems_task_suspend( Task_id[TASKID_BPF0] ); | |
|
562 | if (status != RTEMS_SUCCESSFUL) | |
|
563 | { | |
|
564 | PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status) | |
|
565 | } | |
|
566 | } | |
|
567 | ||
|
568 | 553 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM |
|
569 | 554 | { |
|
570 | 555 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
571 | 556 | if (status != RTEMS_SUCCESSFUL) |
|
572 | 557 | { |
|
573 | 558 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) |
|
574 | 559 | } |
|
575 | 560 | } |
|
576 | 561 | |
|
577 | 562 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 |
|
578 | 563 | { |
|
579 | 564 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); |
|
580 | 565 | if (status != RTEMS_SUCCESSFUL) |
|
581 | 566 | { |
|
582 | 567 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) |
|
583 | 568 | } |
|
584 | 569 | } |
|
585 | 570 | |
|
586 | 571 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 |
|
587 | 572 | { |
|
588 | 573 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); |
|
589 | 574 | if (status != RTEMS_SUCCESSFUL) |
|
590 | 575 | { |
|
591 | 576 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) |
|
592 | 577 | } |
|
593 | 578 | } |
|
594 | 579 | |
|
595 | 580 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 |
|
596 | 581 | { |
|
597 | 582 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
|
598 | 583 | if (status != RTEMS_SUCCESSFUL) |
|
599 | 584 | { |
|
600 | 585 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) |
|
601 | 586 | } |
|
602 | 587 | } |
|
603 | 588 | |
|
604 | 589 | return status; |
|
605 | 590 | } |
|
606 | 591 | |
|
607 | 592 | void launch_waveform_picker( unsigned char mode ) |
|
608 | 593 | { |
|
609 | 594 | int startDate; |
|
610 | 595 | |
|
611 | 596 | reset_current_ring_nodes(); |
|
612 | 597 | reset_waveform_picker_regs(); |
|
613 | 598 | set_wfp_burst_enable_register( mode ); |
|
614 | 599 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
615 | 600 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
616 | 601 | startDate = time_management_regs->coarse_time + 2; |
|
617 | 602 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] |
|
618 | 603 | waveform_picker_regs->start_date = startDate; |
|
619 | 604 | } |
|
620 | 605 | |
|
621 | 606 | void launch_spectral_matrix( unsigned char mode ) |
|
622 | 607 | { |
|
623 | 608 | reset_nb_sm_f0(); |
|
624 | 609 | reset_current_sm_ring_nodes(); |
|
625 | 610 | reset_spectral_matrix_regs(); |
|
626 | 611 | |
|
627 | 612 | // Spectral Matrices simulator |
|
628 | 613 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
629 | 614 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); |
|
630 | 615 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); |
|
631 | 616 | set_local_nb_interrupt_f0_MAX(); |
|
632 | 617 | } |
|
633 | 618 | |
|
634 | 619 | //**************** |
|
635 | 620 | // CLOSING ACTIONS |
|
636 | 621 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time) |
|
637 | 622 | { |
|
638 | 623 | /** This function is used to update the HK packets statistics after a successful TC execution. |
|
639 | 624 | * |
|
640 | 625 | * @param TC points to the TC being processed |
|
641 | 626 | * @param time is the time used to date the TC execution |
|
642 | 627 | * |
|
643 | 628 | */ |
|
644 | 629 | |
|
645 | 630 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; |
|
646 | 631 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; |
|
647 | 632 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; |
|
648 | 633 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; |
|
649 | 634 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; |
|
650 | 635 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; |
|
651 | 636 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0]; |
|
652 | 637 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1]; |
|
653 | 638 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2]; |
|
654 | 639 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3]; |
|
655 | 640 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4]; |
|
656 | 641 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5]; |
|
657 | 642 | } |
|
658 | 643 | |
|
659 | 644 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time) |
|
660 | 645 | { |
|
661 | 646 | /** This function is used to update the HK packets statistics after a TC rejection. |
|
662 | 647 | * |
|
663 | 648 | * @param TC points to the TC being processed |
|
664 | 649 | * @param time is the time used to date the TC rejection |
|
665 | 650 | * |
|
666 | 651 | */ |
|
667 | 652 | |
|
668 | 653 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; |
|
669 | 654 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; |
|
670 | 655 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; |
|
671 | 656 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; |
|
672 | 657 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; |
|
673 | 658 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; |
|
674 | 659 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0]; |
|
675 | 660 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1]; |
|
676 | 661 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2]; |
|
677 | 662 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3]; |
|
678 | 663 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4]; |
|
679 | 664 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5]; |
|
680 | 665 | } |
|
681 | 666 | |
|
682 | 667 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time) |
|
683 | 668 | { |
|
684 | 669 | /** This function is the last step of the TC execution workflow. |
|
685 | 670 | * |
|
686 | 671 | * @param TC points to the TC being processed |
|
687 | 672 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) |
|
688 | 673 | * @param queue_id is the id of the RTEMS message queue used to send TM packets |
|
689 | 674 | * @param time is the time used to date the TC execution |
|
690 | 675 | * |
|
691 | 676 | */ |
|
692 | 677 | |
|
693 | 678 | unsigned int val = 0; |
|
694 | 679 | |
|
695 | 680 | if (result == LFR_SUCCESSFUL) |
|
696 | 681 | { |
|
697 | 682 | if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
698 | 683 | && |
|
699 | 684 | !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
700 | 685 | ) |
|
701 | 686 | { |
|
702 | 687 | send_tm_lfr_tc_exe_success( TC, queue_id, time ); |
|
703 | 688 | } |
|
704 | 689 | update_last_TC_exe( TC, time ); |
|
705 | 690 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; |
|
706 | 691 | val++; |
|
707 | 692 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); |
|
708 | 693 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); |
|
709 | 694 | } |
|
710 | 695 | else |
|
711 | 696 | { |
|
712 | 697 | update_last_TC_rej( TC, time ); |
|
713 | 698 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; |
|
714 | 699 | val++; |
|
715 | 700 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); |
|
716 | 701 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); |
|
717 | 702 | } |
|
718 | 703 | } |
|
719 | 704 | |
|
720 | 705 | //*************************** |
|
721 | 706 | // Interrupt Service Routines |
|
722 | 707 | rtems_isr commutation_isr1( rtems_vector_number vector ) |
|
723 | 708 | { |
|
724 | 709 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
725 | 710 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); |
|
726 | 711 | } |
|
727 | 712 | } |
|
728 | 713 | |
|
729 | 714 | rtems_isr commutation_isr2( rtems_vector_number vector ) |
|
730 | 715 | { |
|
731 | 716 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
732 | 717 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); |
|
733 | 718 | } |
|
734 | 719 | } |
|
735 | 720 | |
|
736 | 721 | //**************** |
|
737 | 722 | // OTHER FUNCTIONS |
|
738 | 723 | void updateLFRCurrentMode() |
|
739 | 724 | { |
|
740 | 725 | /** This function updates the value of the global variable lfrCurrentMode. |
|
741 | 726 | * |
|
742 | 727 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. |
|
743 | 728 | * |
|
744 | 729 | */ |
|
745 | 730 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure |
|
746 | 731 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
747 | 732 | } |
|
748 | 733 |
@@ -1,1300 +1,1305 | |||
|
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 | rtems_isr waveforms_isr( rtems_vector_number vector ) |
|
40 | 40 | { |
|
41 | 41 | /** This is the interrupt sub routine called by the waveform picker core. |
|
42 | 42 | * |
|
43 | 43 | * This ISR launch different actions depending mainly on two pieces of information: |
|
44 | 44 | * 1. the values read in the registers of the waveform picker. |
|
45 | 45 | * 2. the current LFR mode. |
|
46 | 46 | * |
|
47 | 47 | */ |
|
48 | 48 | |
|
49 | 49 | static unsigned char nb_swf = 0; |
|
50 | 50 | |
|
51 | 51 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
52 | 52 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
53 | 53 | { // in modes other than STANDBY and BURST, send the CWF_F3 data |
|
54 | 54 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full |
|
55 | 55 | // (1) change the receiving buffer for the waveform picker |
|
56 | 56 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) { |
|
57 | 57 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b); |
|
58 | 58 | } |
|
59 | 59 | else { |
|
60 | 60 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); |
|
61 | 61 | } |
|
62 | 62 | // (2) send an event for the waveforms transmission |
|
63 | 63 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
64 | 64 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
65 | 65 | } |
|
66 | 66 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] |
|
67 | 67 | } |
|
68 | 68 | } |
|
69 | 69 | |
|
70 | 70 | switch(lfrCurrentMode) |
|
71 | 71 | { |
|
72 | 72 | //******** |
|
73 | 73 | // STANDBY |
|
74 | 74 | case(LFR_MODE_STANDBY): |
|
75 | 75 | break; |
|
76 | 76 | |
|
77 | 77 | //****** |
|
78 | 78 | // NORMAL |
|
79 | 79 | case(LFR_MODE_NORMAL): |
|
80 | 80 | if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits |
|
81 | 81 | { |
|
82 | 82 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
83 | 83 | } |
|
84 | 84 | if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits |
|
85 | 85 | { |
|
86 | 86 | // change F0 ring node |
|
87 | 87 | ring_node_to_send_swf_f0 = current_ring_node_f0; |
|
88 | 88 | current_ring_node_f0 = current_ring_node_f0->next; |
|
89 | 89 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; |
|
90 | 90 | // change F1 ring node |
|
91 | 91 | ring_node_to_send_swf_f1 = current_ring_node_f1; |
|
92 | 92 | current_ring_node_f1 = current_ring_node_f1->next; |
|
93 | 93 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
94 | 94 | // change F2 ring node |
|
95 | 95 | ring_node_to_send_swf_f2 = current_ring_node_f2; |
|
96 | 96 | current_ring_node_f2 = current_ring_node_f2->next; |
|
97 | 97 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
98 | 98 | // |
|
99 | 99 | // if (nb_swf < 2) |
|
100 | 100 | if (true) |
|
101 | 101 | { |
|
102 | 102 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
103 | 103 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
104 | 104 | } |
|
105 | 105 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000] |
|
106 | 106 | nb_swf = nb_swf + 1; |
|
107 | 107 | } |
|
108 | 108 | else |
|
109 | 109 | { |
|
110 | 110 | reset_wfp_burst_enable(); |
|
111 | 111 | nb_swf = 0; |
|
112 | 112 | } |
|
113 | 113 | |
|
114 | 114 | } |
|
115 | 115 | |
|
116 | 116 | break; |
|
117 | 117 | |
|
118 | 118 | //****** |
|
119 | 119 | // BURST |
|
120 | 120 | case(LFR_MODE_BURST): |
|
121 | 121 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
122 | 122 | // (1) change the receiving buffer for the waveform picker |
|
123 | 123 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
124 | 124 | current_ring_node_f2 = current_ring_node_f2->next; |
|
125 | 125 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
126 | 126 | // (2) send an event for the waveforms transmission |
|
127 | 127 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { |
|
128 | 128 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
129 | 129 | } |
|
130 | 130 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
131 | 131 | } |
|
132 | 132 | break; |
|
133 | 133 | |
|
134 | 134 | //***** |
|
135 | 135 | // SBM1 |
|
136 | 136 | case(LFR_MODE_SBM1): |
|
137 | 137 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
138 | 138 | // (1) change the receiving buffer for the waveform picker |
|
139 | 139 | ring_node_to_send_cwf_f1 = current_ring_node_f1; |
|
140 | 140 | current_ring_node_f1 = current_ring_node_f1->next; |
|
141 | 141 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
142 | 142 | // (2) send an event for the waveforms transmission |
|
143 | 143 | if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) { |
|
144 | 144 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
145 | 145 | } |
|
146 | 146 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0 |
|
147 | 147 | } |
|
148 | 148 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
149 | 149 | ring_node_to_send_swf_f1 = current_ring_node_f1->previous; |
|
150 | 150 | } |
|
151 | 151 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit |
|
152 | 152 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
153 | 153 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
154 | 154 | } |
|
155 | 155 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0 |
|
156 | 156 | } |
|
157 | 157 | break; |
|
158 | 158 | |
|
159 | 159 | //***** |
|
160 | 160 | // SBM2 |
|
161 | 161 | case(LFR_MODE_SBM2): |
|
162 | 162 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
163 | 163 | // (1) change the receiving buffer for the waveform picker |
|
164 | 164 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
165 | 165 | current_ring_node_f2 = current_ring_node_f2->next; |
|
166 | 166 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
167 | 167 | // (2) send an event for the waveforms transmission |
|
168 | 168 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { |
|
169 | 169 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
170 | 170 | } |
|
171 | 171 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
172 | 172 | } |
|
173 | 173 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
174 | 174 | ring_node_to_send_swf_f2 = current_ring_node_f2->previous; |
|
175 | 175 | } |
|
176 | 176 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
177 | 177 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
178 | 178 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
179 | 179 | } |
|
180 | 180 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 |
|
181 | 181 | } |
|
182 | 182 | break; |
|
183 | 183 | |
|
184 | 184 | //******** |
|
185 | 185 | // DEFAULT |
|
186 | 186 | default: |
|
187 | 187 | break; |
|
188 | 188 | } |
|
189 | 189 | } |
|
190 | 190 | |
|
191 | 191 | rtems_isr waveforms_isr_alt( rtems_vector_number vector ) |
|
192 | 192 | { |
|
193 | 193 | /** This is the interrupt sub routine called by the waveform picker core. |
|
194 | 194 | * |
|
195 | 195 | * This ISR launch different actions depending mainly on two pieces of information: |
|
196 | 196 | * 1. the values read in the registers of the waveform picker. |
|
197 | 197 | * 2. the current LFR mode. |
|
198 | 198 | * |
|
199 | 199 | */ |
|
200 | 200 | |
|
201 | 201 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
202 | 202 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
203 | 203 | { // in modes other than STANDBY and BURST, send the CWF_F3 data |
|
204 | 204 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full |
|
205 | 205 | // (1) change the receiving buffer for the waveform picker |
|
206 | 206 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) { |
|
207 | 207 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b); |
|
208 | 208 | } |
|
209 | 209 | else { |
|
210 | 210 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); |
|
211 | 211 | } |
|
212 | 212 | // (2) send an event for the waveforms transmission |
|
213 | 213 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
214 | 214 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
215 | 215 | } |
|
216 | 216 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] |
|
217 | 217 | } |
|
218 | 218 | } |
|
219 | 219 | |
|
220 | 220 | switch(lfrCurrentMode) |
|
221 | 221 | { |
|
222 | 222 | //******** |
|
223 | 223 | // STANDBY |
|
224 | 224 | case(LFR_MODE_STANDBY): |
|
225 | 225 | break; |
|
226 | 226 | |
|
227 | 227 | //****** |
|
228 | 228 | // NORMAL |
|
229 | 229 | case(LFR_MODE_NORMAL): |
|
230 | 230 | if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits |
|
231 | 231 | { |
|
232 | 232 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
233 | 233 | } |
|
234 | 234 | if ( (waveform_picker_regs->status & 0x01) == 0x01) // [0001] check the f0 full bit |
|
235 | 235 | { |
|
236 | 236 | // change F0 ring node |
|
237 | 237 | ring_node_to_send_swf_f0 = current_ring_node_f0; |
|
238 | 238 | current_ring_node_f0 = current_ring_node_f0->next; |
|
239 | 239 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; |
|
240 | 240 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1110 1110 1110] |
|
241 | 241 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL_SWF_F0 ) != RTEMS_SUCCESSFUL) { |
|
242 | 242 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
243 | 243 | } |
|
244 | 244 | } |
|
245 | 245 | if ( (waveform_picker_regs->status & 0x02) == 0x02) // [0010] check the f1 full bit |
|
246 | 246 | { |
|
247 | 247 | // change F1 ring node |
|
248 | 248 | ring_node_to_send_swf_f1 = current_ring_node_f1; |
|
249 | 249 | current_ring_node_f1 = current_ring_node_f1->next; |
|
250 | 250 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
251 | 251 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1101 1101 1101] |
|
252 | 252 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL_SWF_F1 ) != RTEMS_SUCCESSFUL) { |
|
253 | 253 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
254 | 254 | } |
|
255 | 255 | } |
|
256 | 256 | if ( (waveform_picker_regs->status & 0x04) == 0x04) // [0100] check the f2 full bit |
|
257 | 257 | { |
|
258 | 258 | // change F2 ring node |
|
259 | 259 | ring_node_to_send_swf_f2 = current_ring_node_f2; |
|
260 | 260 | current_ring_node_f2 = current_ring_node_f2->next; |
|
261 | 261 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
262 | 262 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1011 1011 1011] |
|
263 | 263 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL_SWF_F2 ) != RTEMS_SUCCESSFUL) { |
|
264 | 264 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
265 | 265 | } |
|
266 | 266 | } |
|
267 | 267 | break; |
|
268 | 268 | |
|
269 | 269 | //****** |
|
270 | 270 | // BURST |
|
271 | 271 | case(LFR_MODE_BURST): |
|
272 | 272 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
273 | 273 | // (1) change the receiving buffer for the waveform picker |
|
274 | 274 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
275 | 275 | current_ring_node_f2 = current_ring_node_f2->next; |
|
276 | 276 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
277 | 277 | // (2) send an event for the waveforms transmission |
|
278 | 278 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { |
|
279 | 279 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
280 | 280 | } |
|
281 | 281 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
282 | 282 | } |
|
283 | 283 | break; |
|
284 | 284 | |
|
285 | 285 | //***** |
|
286 | 286 | // SBM1 |
|
287 | 287 | case(LFR_MODE_SBM1): |
|
288 | 288 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
289 | 289 | // (1) change the receiving buffer for the waveform picker |
|
290 | 290 | ring_node_to_send_cwf_f1 = current_ring_node_f1; |
|
291 | 291 | current_ring_node_f1 = current_ring_node_f1->next; |
|
292 | 292 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
293 | 293 | // (2) send an event for the waveforms transmission |
|
294 | 294 | if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) { |
|
295 | 295 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
296 | 296 | } |
|
297 | 297 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0 |
|
298 | 298 | } |
|
299 | 299 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
300 | 300 | ring_node_to_send_swf_f1 = current_ring_node_f1->previous; |
|
301 | 301 | } |
|
302 | 302 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit |
|
303 | 303 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
304 | 304 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
305 | 305 | } |
|
306 | 306 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0 |
|
307 | 307 | } |
|
308 | 308 | break; |
|
309 | 309 | |
|
310 | 310 | //***** |
|
311 | 311 | // SBM2 |
|
312 | 312 | case(LFR_MODE_SBM2): |
|
313 | 313 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
314 | 314 | // (1) change the receiving buffer for the waveform picker |
|
315 | 315 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
316 | 316 | current_ring_node_f2 = current_ring_node_f2->next; |
|
317 | 317 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; |
|
318 | 318 | // (2) send an event for the waveforms transmission |
|
319 | 319 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { |
|
320 | 320 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
321 | 321 | } |
|
322 | 322 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
323 | 323 | } |
|
324 | 324 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
325 | 325 | ring_node_to_send_swf_f2 = current_ring_node_f2->previous; |
|
326 | 326 | } |
|
327 | 327 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
328 | 328 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
329 | 329 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
330 | 330 | } |
|
331 | 331 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 |
|
332 | 332 | } |
|
333 | 333 | break; |
|
334 | 334 | |
|
335 | 335 | //******** |
|
336 | 336 | // DEFAULT |
|
337 | 337 | default: |
|
338 | 338 | break; |
|
339 | 339 | } |
|
340 | 340 | } |
|
341 | 341 | |
|
342 | 342 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
343 | 343 | { |
|
344 | 344 | /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode. |
|
345 | 345 | * |
|
346 | 346 | * @param unused is the starting argument of the RTEMS task |
|
347 | 347 | * |
|
348 | 348 | * The following data packets are sent by this task: |
|
349 | 349 | * - TM_LFR_SCIENCE_NORMAL_SWF_F0 |
|
350 | 350 | * - TM_LFR_SCIENCE_NORMAL_SWF_F1 |
|
351 | 351 | * - TM_LFR_SCIENCE_NORMAL_SWF_F2 |
|
352 | 352 | * |
|
353 | 353 | */ |
|
354 | 354 | |
|
355 | 355 | rtems_event_set event_out; |
|
356 | 356 | rtems_id queue_id; |
|
357 | 357 | rtems_status_code status; |
|
358 | 358 | |
|
359 | 359 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); |
|
360 | 360 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); |
|
361 | 361 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); |
|
362 | 362 | |
|
363 | 363 | init_waveforms(); |
|
364 | 364 | |
|
365 | 365 | status = get_message_queue_id_send( &queue_id ); |
|
366 | 366 | if (status != RTEMS_SUCCESSFUL) |
|
367 | 367 | { |
|
368 | 368 | PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status) |
|
369 | 369 | } |
|
370 | 370 | |
|
371 | 371 | BOOT_PRINTF("in WFRM ***\n") |
|
372 | 372 | |
|
373 | 373 | while(1){ |
|
374 | 374 | // wait for an RTEMS_EVENT |
|
375 | 375 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 |
|
376 | 376 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM |
|
377 | 377 | | RTEMS_EVENT_MODE_NORMAL_SWF_F0 |
|
378 | 378 | | RTEMS_EVENT_MODE_NORMAL_SWF_F1 |
|
379 | 379 | | RTEMS_EVENT_MODE_NORMAL_SWF_F2, |
|
380 | 380 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
381 | 381 | if (event_out == RTEMS_EVENT_MODE_NORMAL) |
|
382 | 382 | { |
|
383 | 383 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
384 | 384 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
385 | 385 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
386 | 386 | } |
|
387 | 387 | if ( (event_out & RTEMS_EVENT_MODE_NORMAL_SWF_F0) == RTEMS_EVENT_MODE_NORMAL_SWF_F0) |
|
388 | 388 | { |
|
389 | 389 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
390 | 390 | } |
|
391 | 391 | if ( (event_out & RTEMS_EVENT_MODE_NORMAL_SWF_F1) == RTEMS_EVENT_MODE_NORMAL_SWF_F1) |
|
392 | 392 | { |
|
393 | 393 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
394 | 394 | } |
|
395 | 395 | if ( (event_out & RTEMS_EVENT_MODE_NORMAL_SWF_F2) == RTEMS_EVENT_MODE_NORMAL_SWF_F2) |
|
396 | 396 | { |
|
397 | 397 | send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
398 | 398 | } |
|
399 | 399 | } |
|
400 | 400 | } |
|
401 | 401 | |
|
402 | 402 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
403 | 403 | { |
|
404 | 404 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3. |
|
405 | 405 | * |
|
406 | 406 | * @param unused is the starting argument of the RTEMS task |
|
407 | 407 | * |
|
408 | 408 | * The following data packet is sent by this task: |
|
409 | 409 | * - TM_LFR_SCIENCE_NORMAL_CWF_F3 |
|
410 | 410 | * |
|
411 | 411 | */ |
|
412 | 412 | |
|
413 | 413 | rtems_event_set event_out; |
|
414 | 414 | rtems_id queue_id; |
|
415 | 415 | rtems_status_code status; |
|
416 | 416 | |
|
417 | 417 | init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 ); |
|
418 | 418 | init_header_continuous_cwf3_light_table( headerCWF_F3_light ); |
|
419 | 419 | |
|
420 | 420 | status = get_message_queue_id_send( &queue_id ); |
|
421 | 421 | if (status != RTEMS_SUCCESSFUL) |
|
422 | 422 | { |
|
423 | 423 | PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status) |
|
424 | 424 | } |
|
425 | 425 | |
|
426 | 426 | BOOT_PRINTF("in CWF3 ***\n") |
|
427 | 427 | |
|
428 | 428 | while(1){ |
|
429 | 429 | // wait for an RTEMS_EVENT |
|
430 | 430 | rtems_event_receive( RTEMS_EVENT_0, |
|
431 | 431 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
432 | 432 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) |
|
433 | 433 | { |
|
434 | 434 | PRINTF("send CWF_LONG_F3\n") |
|
435 | 435 | } |
|
436 | 436 | else |
|
437 | 437 | { |
|
438 | 438 | PRINTF("send CWF_F3 (light)\n") |
|
439 | 439 | } |
|
440 | 440 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) { |
|
441 | 441 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) |
|
442 | 442 | { |
|
443 | 443 | send_waveform_CWF( wf_cont_f3_b, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); |
|
444 | 444 | } |
|
445 | 445 | else |
|
446 | 446 | { |
|
447 | 447 | send_waveform_CWF3_light( wf_cont_f3_b, headerCWF_F3_light, queue_id ); |
|
448 | 448 | } |
|
449 | 449 | } |
|
450 | 450 | else |
|
451 | 451 | { |
|
452 | 452 | if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01) |
|
453 | 453 | { |
|
454 | 454 | send_waveform_CWF( wf_cont_f3_a, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id ); |
|
455 | 455 | } |
|
456 | 456 | else |
|
457 | 457 | { |
|
458 | 458 | send_waveform_CWF3_light( wf_cont_f3_a, headerCWF_F3_light, queue_id ); |
|
459 | 459 | } |
|
460 | 460 | |
|
461 | 461 | } |
|
462 | 462 | } |
|
463 | 463 | } |
|
464 | 464 | |
|
465 | 465 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 |
|
466 | 466 | { |
|
467 | 467 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2. |
|
468 | 468 | * |
|
469 | 469 | * @param unused is the starting argument of the RTEMS task |
|
470 | 470 | * |
|
471 | 471 | * The following data packet is sent by this function: |
|
472 | 472 | * - TM_LFR_SCIENCE_BURST_CWF_F2 |
|
473 | 473 | * - TM_LFR_SCIENCE_SBM2_CWF_F2 |
|
474 | 474 | * |
|
475 | 475 | */ |
|
476 | 476 | |
|
477 | 477 | rtems_event_set event_out; |
|
478 | 478 | rtems_id queue_id; |
|
479 | 479 | rtems_status_code status; |
|
480 | 480 | |
|
481 | 481 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); |
|
482 | 482 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); |
|
483 | 483 | |
|
484 | 484 | status = get_message_queue_id_send( &queue_id ); |
|
485 | 485 | if (status != RTEMS_SUCCESSFUL) |
|
486 | 486 | { |
|
487 | 487 | PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status) |
|
488 | 488 | } |
|
489 | 489 | |
|
490 | 490 | BOOT_PRINTF("in CWF2 ***\n") |
|
491 | 491 | |
|
492 | 492 | while(1){ |
|
493 | 493 | // wait for an RTEMS_EVENT |
|
494 | 494 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, |
|
495 | 495 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
496 | 496 | if (event_out == RTEMS_EVENT_MODE_BURST) |
|
497 | 497 | { |
|
498 | 498 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); |
|
499 | 499 | } |
|
500 | 500 | if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
501 | 501 | { |
|
502 | 502 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
503 | 503 | } |
|
504 | 504 | } |
|
505 | 505 | } |
|
506 | 506 | |
|
507 | 507 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 |
|
508 | 508 | { |
|
509 | 509 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1. |
|
510 | 510 | * |
|
511 | 511 | * @param unused is the starting argument of the RTEMS task |
|
512 | 512 | * |
|
513 | 513 | * The following data packet is sent by this function: |
|
514 | 514 | * - TM_LFR_SCIENCE_SBM1_CWF_F1 |
|
515 | 515 | * |
|
516 | 516 | */ |
|
517 | 517 | |
|
518 | 518 | rtems_event_set event_out; |
|
519 | 519 | rtems_id queue_id; |
|
520 | 520 | rtems_status_code status; |
|
521 | 521 | |
|
522 | 522 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); |
|
523 | 523 | |
|
524 | 524 | status = get_message_queue_id_send( &queue_id ); |
|
525 | 525 | if (status != RTEMS_SUCCESSFUL) |
|
526 | 526 | { |
|
527 | 527 | PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status) |
|
528 | 528 | } |
|
529 | 529 | |
|
530 | 530 | BOOT_PRINTF("in CWF1 ***\n") |
|
531 | 531 | |
|
532 | 532 | while(1){ |
|
533 | 533 | // wait for an RTEMS_EVENT |
|
534 | 534 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, |
|
535 | 535 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
536 | 536 | send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
537 | 537 | } |
|
538 | 538 | } |
|
539 | 539 | |
|
540 | 540 | //****************** |
|
541 | 541 | // general functions |
|
542 | 542 | void init_waveforms( void ) |
|
543 | 543 | { |
|
544 | 544 | int i = 0; |
|
545 | 545 | |
|
546 | 546 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
547 | 547 | { |
|
548 | 548 | //*** |
|
549 | 549 | // F0 |
|
550 | 550 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; // |
|
551 | 551 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; // |
|
552 | 552 | // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; // |
|
553 | 553 | |
|
554 | 554 | //*** |
|
555 | 555 | // F1 |
|
556 | 556 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111; |
|
557 | 557 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333; |
|
558 | 558 | // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; |
|
559 | 559 | |
|
560 | 560 | //*** |
|
561 | 561 | // F2 |
|
562 | 562 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333; |
|
563 | 563 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; |
|
564 | 564 | // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; |
|
565 | 565 | |
|
566 | 566 | //*** |
|
567 | 567 | // F3 |
|
568 | 568 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1; |
|
569 | 569 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2; |
|
570 | 570 | // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000; |
|
571 | 571 | } |
|
572 | 572 | } |
|
573 | 573 | |
|
574 | 574 | void init_waveform_rings( void ) |
|
575 | 575 | { |
|
576 | 576 | unsigned char i; |
|
577 | 577 | |
|
578 | 578 | // F0 RING |
|
579 | 579 | waveform_ring_f0[0].next = (ring_node*) &waveform_ring_f0[1]; |
|
580 | 580 | waveform_ring_f0[0].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-1]; |
|
581 | 581 | waveform_ring_f0[0].buffer_address = (int) &wf_snap_f0[0][0]; |
|
582 | 582 | |
|
583 | 583 | waveform_ring_f0[NB_RING_NODES_F0-1].next = (ring_node*) &waveform_ring_f0[0]; |
|
584 | 584 | waveform_ring_f0[NB_RING_NODES_F0-1].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-2]; |
|
585 | 585 | waveform_ring_f0[NB_RING_NODES_F0-1].buffer_address = (int) &wf_snap_f0[NB_RING_NODES_F0-1][0]; |
|
586 | 586 | |
|
587 | 587 | for(i=1; i<NB_RING_NODES_F0-1; i++) |
|
588 | 588 | { |
|
589 | 589 | waveform_ring_f0[i].next = (ring_node*) &waveform_ring_f0[i+1]; |
|
590 | 590 | waveform_ring_f0[i].previous = (ring_node*) &waveform_ring_f0[i-1]; |
|
591 | 591 | waveform_ring_f0[i].buffer_address = (int) &wf_snap_f0[i][0]; |
|
592 | 592 | } |
|
593 | 593 | |
|
594 | 594 | // F1 RING |
|
595 | 595 | waveform_ring_f1[0].next = (ring_node*) &waveform_ring_f1[1]; |
|
596 | 596 | waveform_ring_f1[0].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-1]; |
|
597 | 597 | waveform_ring_f1[0].buffer_address = (int) &wf_snap_f1[0][0]; |
|
598 | 598 | |
|
599 | 599 | waveform_ring_f1[NB_RING_NODES_F1-1].next = (ring_node*) &waveform_ring_f1[0]; |
|
600 | 600 | waveform_ring_f1[NB_RING_NODES_F1-1].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-2]; |
|
601 | 601 | waveform_ring_f1[NB_RING_NODES_F1-1].buffer_address = (int) &wf_snap_f1[NB_RING_NODES_F1-1][0]; |
|
602 | 602 | |
|
603 | 603 | for(i=1; i<NB_RING_NODES_F1-1; i++) |
|
604 | 604 | { |
|
605 | 605 | waveform_ring_f1[i].next = (ring_node*) &waveform_ring_f1[i+1]; |
|
606 | 606 | waveform_ring_f1[i].previous = (ring_node*) &waveform_ring_f1[i-1]; |
|
607 | 607 | waveform_ring_f1[i].buffer_address = (int) &wf_snap_f1[i][0]; |
|
608 | 608 | } |
|
609 | 609 | |
|
610 | 610 | // F2 RING |
|
611 | 611 | waveform_ring_f2[0].next = (ring_node*) &waveform_ring_f2[1]; |
|
612 | 612 | waveform_ring_f2[0].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-1]; |
|
613 | 613 | waveform_ring_f2[0].buffer_address = (int) &wf_snap_f2[0][0]; |
|
614 | 614 | |
|
615 | 615 | waveform_ring_f2[NB_RING_NODES_F2-1].next = (ring_node*) &waveform_ring_f2[0]; |
|
616 | 616 | waveform_ring_f2[NB_RING_NODES_F2-1].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-2]; |
|
617 | 617 | waveform_ring_f2[NB_RING_NODES_F2-1].buffer_address = (int) &wf_snap_f2[NB_RING_NODES_F2-1][0]; |
|
618 | 618 | |
|
619 | 619 | for(i=1; i<NB_RING_NODES_F2-1; i++) |
|
620 | 620 | { |
|
621 | 621 | waveform_ring_f2[i].next = (ring_node*) &waveform_ring_f2[i+1]; |
|
622 | 622 | waveform_ring_f2[i].previous = (ring_node*) &waveform_ring_f2[i-1]; |
|
623 | 623 | waveform_ring_f2[i].buffer_address = (int) &wf_snap_f2[i][0]; |
|
624 | 624 | } |
|
625 | 625 | |
|
626 | 626 | DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0) |
|
627 | 627 | DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1) |
|
628 | 628 | DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2) |
|
629 | 629 | |
|
630 | 630 | } |
|
631 | 631 | |
|
632 | 632 | void reset_current_ring_nodes( void ) |
|
633 | 633 | { |
|
634 | 634 | current_ring_node_f0 = waveform_ring_f0; |
|
635 | 635 | ring_node_to_send_swf_f0 = waveform_ring_f0; |
|
636 | 636 | |
|
637 | 637 | current_ring_node_f1 = waveform_ring_f1; |
|
638 | 638 | ring_node_to_send_cwf_f1 = waveform_ring_f1; |
|
639 | 639 | ring_node_to_send_swf_f1 = waveform_ring_f1; |
|
640 | 640 | |
|
641 | 641 | current_ring_node_f2 = waveform_ring_f2; |
|
642 | 642 | ring_node_to_send_cwf_f2 = waveform_ring_f2; |
|
643 | 643 | ring_node_to_send_swf_f2 = waveform_ring_f2; |
|
644 | 644 | } |
|
645 | 645 | |
|
646 | 646 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) |
|
647 | 647 | { |
|
648 | 648 | unsigned char i; |
|
649 | 649 | |
|
650 | 650 | for (i=0; i<7; i++) |
|
651 | 651 | { |
|
652 | 652 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
653 | 653 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
654 | 654 | headerSWF[ i ].reserved = DEFAULT_RESERVED; |
|
655 | 655 | headerSWF[ i ].userApplication = CCSDS_USER_APP; |
|
656 | 656 | headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
657 | 657 | headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
658 | 658 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
659 | 659 | if (i == 6) |
|
660 | 660 | { |
|
661 | 661 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8); |
|
662 | 662 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 ); |
|
663 | 663 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8); |
|
664 | 664 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 ); |
|
665 | 665 | } |
|
666 | 666 | else |
|
667 | 667 | { |
|
668 | 668 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8); |
|
669 | 669 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 ); |
|
670 | 670 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8); |
|
671 | 671 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 ); |
|
672 | 672 | } |
|
673 | 673 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
674 | 674 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT |
|
675 | 675 | headerSWF[ i ].pktNr = i+1; // PKT_NR |
|
676 | 676 | // DATA FIELD HEADER |
|
677 | 677 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
678 | 678 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
679 | 679 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
680 | 680 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
681 | 681 | // AUXILIARY DATA HEADER |
|
682 | 682 | headerSWF[ i ].time[0] = 0x00; |
|
683 | 683 | headerSWF[ i ].time[0] = 0x00; |
|
684 | 684 | headerSWF[ i ].time[0] = 0x00; |
|
685 | 685 | headerSWF[ i ].time[0] = 0x00; |
|
686 | 686 | headerSWF[ i ].time[0] = 0x00; |
|
687 | 687 | headerSWF[ i ].time[0] = 0x00; |
|
688 | 688 | headerSWF[ i ].sid = sid; |
|
689 | 689 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
690 | 690 | } |
|
691 | 691 | return LFR_SUCCESSFUL; |
|
692 | 692 | } |
|
693 | 693 | |
|
694 | 694 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
695 | 695 | { |
|
696 | 696 | unsigned int i; |
|
697 | 697 | |
|
698 | 698 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) |
|
699 | 699 | { |
|
700 | 700 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
701 | 701 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
702 | 702 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
703 | 703 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
704 | 704 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) |
|
705 | 705 | { |
|
706 | 706 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8); |
|
707 | 707 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2); |
|
708 | 708 | } |
|
709 | 709 | else |
|
710 | 710 | { |
|
711 | 711 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
712 | 712 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
713 | 713 | } |
|
714 | 714 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
715 | 715 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8); |
|
716 | 716 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 ); |
|
717 | 717 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8); |
|
718 | 718 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF ); |
|
719 | 719 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
720 | 720 | // DATA FIELD HEADER |
|
721 | 721 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
722 | 722 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
723 | 723 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
724 | 724 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
725 | 725 | // AUXILIARY DATA HEADER |
|
726 | 726 | headerCWF[ i ].sid = sid; |
|
727 | 727 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
728 | 728 | headerCWF[ i ].time[0] = 0x00; |
|
729 | 729 | headerCWF[ i ].time[0] = 0x00; |
|
730 | 730 | headerCWF[ i ].time[0] = 0x00; |
|
731 | 731 | headerCWF[ i ].time[0] = 0x00; |
|
732 | 732 | headerCWF[ i ].time[0] = 0x00; |
|
733 | 733 | headerCWF[ i ].time[0] = 0x00; |
|
734 | 734 | } |
|
735 | 735 | return LFR_SUCCESSFUL; |
|
736 | 736 | } |
|
737 | 737 | |
|
738 | 738 | int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
739 | 739 | { |
|
740 | 740 | unsigned int i; |
|
741 | 741 | |
|
742 | 742 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) |
|
743 | 743 | { |
|
744 | 744 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
745 | 745 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
746 | 746 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
747 | 747 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
748 | 748 | |
|
749 | 749 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
750 | 750 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
751 | 751 | |
|
752 | 752 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
753 | 753 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8); |
|
754 | 754 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 ); |
|
755 | 755 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8); |
|
756 | 756 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 ); |
|
757 | 757 | |
|
758 | 758 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
759 | 759 | // DATA FIELD HEADER |
|
760 | 760 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
761 | 761 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
762 | 762 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
763 | 763 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
764 | 764 | // AUXILIARY DATA HEADER |
|
765 | 765 | headerCWF[ i ].sid = SID_NORM_CWF_F3; |
|
766 | 766 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
767 | 767 | headerCWF[ i ].time[0] = 0x00; |
|
768 | 768 | headerCWF[ i ].time[0] = 0x00; |
|
769 | 769 | headerCWF[ i ].time[0] = 0x00; |
|
770 | 770 | headerCWF[ i ].time[0] = 0x00; |
|
771 | 771 | headerCWF[ i ].time[0] = 0x00; |
|
772 | 772 | headerCWF[ i ].time[0] = 0x00; |
|
773 | 773 | } |
|
774 | 774 | return LFR_SUCCESSFUL; |
|
775 | 775 | } |
|
776 | 776 | |
|
777 | 777 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, |
|
778 | 778 | Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ) |
|
779 | 779 | { |
|
780 | 780 | /** This function sends SWF CCSDS packets (F2, F1 or F0). |
|
781 | 781 | * |
|
782 | 782 | * @param waveform points to the buffer containing the data that will be send. |
|
783 | 783 | * @param sid is the source identifier of the data that will be sent. |
|
784 | 784 | * @param headerSWF points to a table of headers that have been prepared for the data transmission. |
|
785 | 785 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
786 | 786 | * contain information to setup the transmission of the data packets. |
|
787 | 787 | * |
|
788 | 788 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
789 | 789 | * |
|
790 | 790 | */ |
|
791 | 791 | |
|
792 | 792 | unsigned int i; |
|
793 | 793 | int ret; |
|
794 | 794 | unsigned int coarseTime; |
|
795 | 795 | unsigned int fineTime; |
|
796 | 796 | rtems_status_code status; |
|
797 | 797 | spw_ioctl_pkt_send spw_ioctl_send_SWF; |
|
798 | 798 | |
|
799 | 799 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header |
|
800 | 800 | spw_ioctl_send_SWF.options = 0; |
|
801 | 801 | |
|
802 | 802 | ret = LFR_DEFAULT; |
|
803 | 803 | |
|
804 | 804 | DEBUG_PRINTF1("sid = %d, ", sid) |
|
805 | 805 | DEBUG_PRINTF2("coarse = %x, fine = %x\n", waveform[0], waveform[1]) |
|
806 | 806 | |
|
807 | 807 | coarseTime = waveform[0]; |
|
808 | 808 | fineTime = waveform[1]; |
|
809 | 809 | |
|
810 | 810 | for (i=0; i<7; i++) // send waveform |
|
811 | 811 | { |
|
812 | 812 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
813 | 813 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; |
|
814 | 814 | // BUILD THE DATA |
|
815 | 815 | if (i==6) { |
|
816 | 816 | spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK; |
|
817 | 817 | } |
|
818 | 818 | else { |
|
819 | 819 | spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK; |
|
820 | 820 | } |
|
821 | 821 | // SET PACKET SEQUENCE COUNTER |
|
822 | 822 | increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid ); |
|
823 | 823 | // SET PACKET TIME |
|
824 | 824 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime ); |
|
825 | 825 | // |
|
826 | 826 | headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
827 | 827 | headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
828 | 828 | headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
829 | 829 | headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
830 | 830 | headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
831 | 831 | headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); |
|
832 | 832 | // SEND PACKET |
|
833 | 833 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
834 | 834 | if (status != RTEMS_SUCCESSFUL) { |
|
835 | 835 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
836 | 836 | ret = LFR_DEFAULT; |
|
837 | 837 | } |
|
838 | 838 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds |
|
839 | 839 | } |
|
840 | 840 | |
|
841 | 841 | return ret; |
|
842 | 842 | } |
|
843 | 843 | |
|
844 | 844 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, |
|
845 | 845 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
846 | 846 | { |
|
847 | 847 | /** This function sends CWF CCSDS packets (F2, F1 or F0). |
|
848 | 848 | * |
|
849 | 849 | * @param waveform points to the buffer containing the data that will be send. |
|
850 | 850 | * @param sid is the source identifier of the data that will be sent. |
|
851 | 851 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
852 | 852 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
853 | 853 | * contain information to setup the transmission of the data packets. |
|
854 | 854 | * |
|
855 | 855 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
856 | 856 | * |
|
857 | 857 | */ |
|
858 | 858 | |
|
859 | 859 | unsigned int i; |
|
860 | 860 | int ret; |
|
861 | 861 | unsigned int coarseTime; |
|
862 | 862 | unsigned int fineTime; |
|
863 | 863 | rtems_status_code status; |
|
864 | 864 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
865 | 865 | |
|
866 | 866 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
867 | 867 | spw_ioctl_send_CWF.options = 0; |
|
868 | 868 | |
|
869 | 869 | ret = LFR_DEFAULT; |
|
870 | 870 | |
|
871 | 871 | coarseTime = waveform[0]; |
|
872 | 872 | fineTime = waveform[1]; |
|
873 | 873 | |
|
874 | 874 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform |
|
875 | 875 | { |
|
876 | 876 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET]; |
|
877 | 877 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
878 | 878 | // BUILD THE DATA |
|
879 | 879 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK; |
|
880 | 880 | // SET PACKET SEQUENCE COUNTER |
|
881 | 881 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid ); |
|
882 | 882 | // SET PACKET TIME |
|
883 | 883 | compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime); |
|
884 | 884 | // |
|
885 | 885 | headerCWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
886 | 886 | headerCWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
887 | 887 | headerCWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
888 | 888 | headerCWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
889 | 889 | headerCWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
890 | 890 | headerCWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); |
|
891 | 891 | // SEND PACKET |
|
892 | 892 | if (sid == SID_NORM_CWF_LONG_F3) |
|
893 | 893 | { |
|
894 | 894 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
895 | 895 | if (status != RTEMS_SUCCESSFUL) { |
|
896 | 896 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
897 | 897 | ret = LFR_DEFAULT; |
|
898 | 898 | } |
|
899 | 899 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
900 | 900 | } |
|
901 | 901 | else |
|
902 | 902 | { |
|
903 | 903 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
904 | 904 | if (status != RTEMS_SUCCESSFUL) { |
|
905 | 905 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
906 | 906 | ret = LFR_DEFAULT; |
|
907 | 907 | } |
|
908 | 908 | } |
|
909 | 909 | } |
|
910 | 910 | |
|
911 | 911 | return ret; |
|
912 | 912 | } |
|
913 | 913 | |
|
914 | 914 | int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
915 | 915 | { |
|
916 | 916 | /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data. |
|
917 | 917 | * |
|
918 | 918 | * @param waveform points to the buffer containing the data that will be send. |
|
919 | 919 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
920 | 920 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
921 | 921 | * contain information to setup the transmission of the data packets. |
|
922 | 922 | * |
|
923 | 923 | * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer |
|
924 | 924 | * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks. |
|
925 | 925 | * |
|
926 | 926 | */ |
|
927 | 927 | |
|
928 | 928 | unsigned int i; |
|
929 | 929 | int ret; |
|
930 | 930 | unsigned int coarseTime; |
|
931 | 931 | unsigned int fineTime; |
|
932 | 932 | rtems_status_code status; |
|
933 | 933 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
934 | 934 | char *sample; |
|
935 | 935 | |
|
936 | 936 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
937 | 937 | spw_ioctl_send_CWF.options = 0; |
|
938 | 938 | |
|
939 | 939 | ret = LFR_DEFAULT; |
|
940 | 940 | |
|
941 | 941 | //********************** |
|
942 | 942 | // BUILD CWF3_light DATA |
|
943 | 943 | for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
944 | 944 | { |
|
945 | 945 | sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ]; |
|
946 | 946 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ]; |
|
947 | 947 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ]; |
|
948 | 948 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ]; |
|
949 | 949 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ]; |
|
950 | 950 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ]; |
|
951 | 951 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ]; |
|
952 | 952 | } |
|
953 | 953 | |
|
954 | 954 | coarseTime = waveform[0]; |
|
955 | 955 | fineTime = waveform[1]; |
|
956 | 956 | |
|
957 | 957 | //********************* |
|
958 | 958 | // SEND CWF3_light DATA |
|
959 | 959 | for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform |
|
960 | 960 | { |
|
961 | 961 | 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]; |
|
962 | 962 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
963 | 963 | // BUILD THE DATA |
|
964 | 964 | spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK; |
|
965 | 965 | // SET PACKET SEQUENCE COUNTER |
|
966 | 966 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 ); |
|
967 | 967 | // SET PACKET TIME |
|
968 | 968 | compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime ); |
|
969 | 969 | // |
|
970 | 970 | headerCWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
971 | 971 | headerCWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
972 | 972 | headerCWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
973 | 973 | headerCWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
974 | 974 | headerCWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
975 | 975 | headerCWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); |
|
976 | 976 | // SEND PACKET |
|
977 | 977 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
978 | 978 | if (status != RTEMS_SUCCESSFUL) { |
|
979 | 979 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); |
|
980 | 980 | ret = LFR_DEFAULT; |
|
981 | 981 | } |
|
982 | 982 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
983 | 983 | } |
|
984 | 984 | |
|
985 | 985 | return ret; |
|
986 | 986 | } |
|
987 | 987 | |
|
988 | 988 | void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime, |
|
989 | 989 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime ) |
|
990 | 990 | { |
|
991 | 991 | unsigned long long int acquisitionTimeAsLong; |
|
992 | 992 | unsigned char localAcquisitionTime[6]; |
|
993 | 993 | double deltaT = 0.; |
|
994 | 994 | |
|
995 | 995 | localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 8 ); |
|
996 | 996 | localAcquisitionTime[1] = (unsigned char) ( coarseTime ); |
|
997 | 997 | localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 24 ); |
|
998 | 998 | localAcquisitionTime[3] = (unsigned char) ( coarseTime >> 16 ); |
|
999 | 999 | localAcquisitionTime[4] = (unsigned char) ( fineTime >> 24 ); |
|
1000 | 1000 | localAcquisitionTime[5] = (unsigned char) ( fineTime >> 16 ); |
|
1001 | 1001 | |
|
1002 | 1002 | acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 ) |
|
1003 | 1003 | + ( (unsigned long long int) localAcquisitionTime[1] << 32 ) |
|
1004 | 1004 | + ( localAcquisitionTime[2] << 24 ) |
|
1005 | 1005 | + ( localAcquisitionTime[3] << 16 ) |
|
1006 | 1006 | + ( localAcquisitionTime[4] << 8 ) |
|
1007 | 1007 | + ( localAcquisitionTime[5] ); |
|
1008 | 1008 | |
|
1009 | 1009 | switch( sid ) |
|
1010 | 1010 | { |
|
1011 | 1011 | case SID_NORM_SWF_F0: |
|
1012 | 1012 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ; |
|
1013 | 1013 | break; |
|
1014 | 1014 | |
|
1015 | 1015 | case SID_NORM_SWF_F1: |
|
1016 | 1016 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ; |
|
1017 | 1017 | break; |
|
1018 | 1018 | |
|
1019 | case SID_NORM_SWF_F2: | |
|
1020 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ; | |
|
1021 | break; | |
|
1022 | ||
|
1019 | 1023 | case SID_SBM1_CWF_F1: |
|
1020 | 1024 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ; |
|
1021 | 1025 | break; |
|
1022 | 1026 | |
|
1023 |
case SID_ |
|
|
1024 |
deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_ |
|
|
1027 | case SID_SBM2_CWF_F2: | |
|
1028 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; | |
|
1025 | 1029 | break; |
|
1026 | 1030 | |
|
1027 |
case SID_ |
|
|
1031 | case SID_BURST_CWF_F2: | |
|
1028 | 1032 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ; |
|
1029 | 1033 | break; |
|
1030 | 1034 | |
|
1031 | 1035 | case SID_NORM_CWF_F3: |
|
1032 | 1036 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ; |
|
1033 | 1037 | break; |
|
1034 | 1038 | |
|
1035 | 1039 | case SID_NORM_CWF_LONG_F3: |
|
1036 | 1040 | deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ; |
|
1037 | 1041 | break; |
|
1038 | 1042 | |
|
1039 | 1043 | default: |
|
1044 | PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid) | |
|
1040 | 1045 | deltaT = 0.; |
|
1041 | 1046 | break; |
|
1042 | 1047 | } |
|
1043 | 1048 | |
|
1044 | 1049 | acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT; |
|
1045 | 1050 | // |
|
1046 | 1051 | acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40); |
|
1047 | 1052 | acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32); |
|
1048 | 1053 | acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24); |
|
1049 | 1054 | acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16); |
|
1050 | 1055 | acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 ); |
|
1051 | 1056 | acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong ); |
|
1052 | 1057 | } |
|
1053 | 1058 | |
|
1054 | 1059 | //************** |
|
1055 | 1060 | // wfp registers |
|
1056 | 1061 | void reset_wfp_burst_enable(void) |
|
1057 | 1062 | { |
|
1058 | 1063 | /** This function resets the waveform picker burst_enable register. |
|
1059 | 1064 | * |
|
1060 | 1065 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. |
|
1061 | 1066 | * |
|
1062 | 1067 | */ |
|
1063 | 1068 | |
|
1064 | 1069 | waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1065 | 1070 | } |
|
1066 | 1071 | |
|
1067 | 1072 | void reset_wfp_status( void ) |
|
1068 | 1073 | { |
|
1069 | 1074 | /** This function resets the waveform picker status register. |
|
1070 | 1075 | * |
|
1071 | 1076 | * All status bits are set to 0 [new_err full_err full]. |
|
1072 | 1077 | * |
|
1073 | 1078 | */ |
|
1074 | 1079 | |
|
1075 | 1080 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1076 | 1081 | } |
|
1077 | 1082 | |
|
1078 | 1083 | void reset_waveform_picker_regs(void) |
|
1079 | 1084 | { |
|
1080 | 1085 | /** This function resets the waveform picker module registers. |
|
1081 | 1086 | * |
|
1082 | 1087 | * The registers affected by this function are located at the following offset addresses: |
|
1083 | 1088 | * - 0x00 data_shaping |
|
1084 | 1089 | * - 0x04 run_burst_enable |
|
1085 | 1090 | * - 0x08 addr_data_f0 |
|
1086 | 1091 | * - 0x0C addr_data_f1 |
|
1087 | 1092 | * - 0x10 addr_data_f2 |
|
1088 | 1093 | * - 0x14 addr_data_f3 |
|
1089 | 1094 | * - 0x18 status |
|
1090 | 1095 | * - 0x1C delta_snapshot |
|
1091 | 1096 | * - 0x20 delta_f0 |
|
1092 | 1097 | * - 0x24 delta_f0_2 |
|
1093 | 1098 | * - 0x28 delta_f1 |
|
1094 | 1099 | * - 0x2c delta_f2 |
|
1095 | 1100 | * - 0x30 nb_data_by_buffer |
|
1096 | 1101 | * - 0x34 nb_snapshot_param |
|
1097 | 1102 | * - 0x38 start_date |
|
1098 | 1103 | * - 0x3c nb_word_in_buffer |
|
1099 | 1104 | * |
|
1100 | 1105 | */ |
|
1101 | 1106 | |
|
1102 | 1107 | waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW |
|
1103 | 1108 | waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] |
|
1104 | 1109 | waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08 |
|
1105 | 1110 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c |
|
1106 | 1111 | waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10 |
|
1107 | 1112 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14 |
|
1108 | 1113 | waveform_picker_regs->status = 0x00; // 0x18 |
|
1109 | 1114 | // |
|
1110 | 1115 | set_wfp_delta_snapshot(); // 0x1c |
|
1111 | 1116 | set_wfp_delta_f0_f0_2(); // 0x20, 0x24 |
|
1112 | 1117 | set_wfp_delta_f1(); // 0x28 |
|
1113 | 1118 | set_wfp_delta_f2(); // 0x2c |
|
1114 | 1119 | DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot) |
|
1115 | 1120 | DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0) |
|
1116 | 1121 | DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2) |
|
1117 | 1122 | DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1) |
|
1118 | 1123 | DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2) |
|
1119 | 1124 | // 2688 = 8 * 336 |
|
1120 | 1125 | waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1 |
|
1121 | 1126 | waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples |
|
1122 | 1127 | waveform_picker_regs->start_date = 0x00; // 0x38 |
|
1123 | 1128 | waveform_picker_regs->nb_word_in_buffer = 0x1f82; // 0x3c *** 2688 * 3 + 2 = 8066 |
|
1124 | 1129 | } |
|
1125 | 1130 | |
|
1126 | 1131 | void set_wfp_data_shaping( void ) |
|
1127 | 1132 | { |
|
1128 | 1133 | /** This function sets the data_shaping register of the waveform picker module. |
|
1129 | 1134 | * |
|
1130 | 1135 | * The value is read from one field of the parameter_dump_packet structure:\n |
|
1131 | 1136 | * bw_sp0_sp1_r0_r1 |
|
1132 | 1137 | * |
|
1133 | 1138 | */ |
|
1134 | 1139 | |
|
1135 | 1140 | unsigned char data_shaping; |
|
1136 | 1141 | |
|
1137 | 1142 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register |
|
1138 | 1143 | // waveform picker : [R1 R0 SP1 SP0 BW] |
|
1139 | 1144 | |
|
1140 | 1145 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; |
|
1141 | 1146 | |
|
1142 | 1147 | waveform_picker_regs->data_shaping = |
|
1143 | 1148 | ( (data_shaping & 0x10) >> 4 ) // BW |
|
1144 | 1149 | + ( (data_shaping & 0x08) >> 2 ) // SP0 |
|
1145 | 1150 | + ( (data_shaping & 0x04) ) // SP1 |
|
1146 | 1151 | + ( (data_shaping & 0x02) << 2 ) // R0 |
|
1147 | 1152 | + ( (data_shaping & 0x01) << 4 ); // R1 |
|
1148 | 1153 | } |
|
1149 | 1154 | |
|
1150 | 1155 | void set_wfp_burst_enable_register( unsigned char mode ) |
|
1151 | 1156 | { |
|
1152 | 1157 | /** This function sets the waveform picker burst_enable register depending on the mode. |
|
1153 | 1158 | * |
|
1154 | 1159 | * @param mode is the LFR mode to launch. |
|
1155 | 1160 | * |
|
1156 | 1161 | * The burst bits shall be before the enable bits. |
|
1157 | 1162 | * |
|
1158 | 1163 | */ |
|
1159 | 1164 | |
|
1160 | 1165 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 |
|
1161 | 1166 | // the burst bits shall be set first, before the enable bits |
|
1162 | 1167 | switch(mode) { |
|
1163 | 1168 | case(LFR_MODE_NORMAL): |
|
1164 | 1169 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable |
|
1165 | 1170 | waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 |
|
1166 | 1171 | break; |
|
1167 | 1172 | case(LFR_MODE_BURST): |
|
1168 | 1173 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1169 | 1174 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2 |
|
1170 | 1175 | break; |
|
1171 | 1176 | case(LFR_MODE_SBM1): |
|
1172 | 1177 | waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled |
|
1173 | 1178 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1174 | 1179 | break; |
|
1175 | 1180 | case(LFR_MODE_SBM2): |
|
1176 | 1181 | waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1177 | 1182 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1178 | 1183 | break; |
|
1179 | 1184 | default: |
|
1180 | 1185 | waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled |
|
1181 | 1186 | break; |
|
1182 | 1187 | } |
|
1183 | 1188 | } |
|
1184 | 1189 | |
|
1185 | 1190 | void set_wfp_delta_snapshot( void ) |
|
1186 | 1191 | { |
|
1187 | 1192 | /** This function sets the delta_snapshot register of the waveform picker module. |
|
1188 | 1193 | * |
|
1189 | 1194 | * The value is read from two (unsigned char) of the parameter_dump_packet structure: |
|
1190 | 1195 | * - sy_lfr_n_swf_p[0] |
|
1191 | 1196 | * - sy_lfr_n_swf_p[1] |
|
1192 | 1197 | * |
|
1193 | 1198 | */ |
|
1194 | 1199 | |
|
1195 | 1200 | unsigned int delta_snapshot; |
|
1196 | 1201 | unsigned int delta_snapshot_in_T2; |
|
1197 | 1202 | |
|
1198 | 1203 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 |
|
1199 | 1204 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; |
|
1200 | 1205 | |
|
1201 | 1206 | delta_snapshot_in_T2 = delta_snapshot * 256; |
|
1202 | 1207 | waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2; // max 4 bytes |
|
1203 | 1208 | } |
|
1204 | 1209 | |
|
1205 | 1210 | void set_wfp_delta_f0_f0_2( void ) |
|
1206 | 1211 | { |
|
1207 | 1212 | unsigned int delta_snapshot; |
|
1208 | 1213 | unsigned int nb_samples_per_snapshot; |
|
1209 | 1214 | float delta_f0_in_float; |
|
1210 | 1215 | |
|
1211 | 1216 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1212 | 1217 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1213 | 1218 | delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.; |
|
1214 | 1219 | |
|
1215 | 1220 | waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float ); |
|
1216 | 1221 | waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits |
|
1217 | 1222 | } |
|
1218 | 1223 | |
|
1219 | 1224 | void set_wfp_delta_f1( void ) |
|
1220 | 1225 | { |
|
1221 | 1226 | unsigned int delta_snapshot; |
|
1222 | 1227 | unsigned int nb_samples_per_snapshot; |
|
1223 | 1228 | float delta_f1_in_float; |
|
1224 | 1229 | |
|
1225 | 1230 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1226 | 1231 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1227 | 1232 | delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.; |
|
1228 | 1233 | |
|
1229 | 1234 | waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float ); |
|
1230 | 1235 | } |
|
1231 | 1236 | |
|
1232 | 1237 | void set_wfp_delta_f2() |
|
1233 | 1238 | { |
|
1234 | 1239 | unsigned int delta_snapshot; |
|
1235 | 1240 | unsigned int nb_samples_per_snapshot; |
|
1236 | 1241 | |
|
1237 | 1242 | delta_snapshot = waveform_picker_regs->delta_snapshot; |
|
1238 | 1243 | nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1]; |
|
1239 | 1244 | |
|
1240 | 1245 | waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2; |
|
1241 | 1246 | } |
|
1242 | 1247 | |
|
1243 | 1248 | //***************** |
|
1244 | 1249 | // local parameters |
|
1245 | 1250 | void set_local_nb_interrupt_f0_MAX( void ) |
|
1246 | 1251 | { |
|
1247 | 1252 | /** This function sets the value of the nb_interrupt_f0_MAX local parameter. |
|
1248 | 1253 | * |
|
1249 | 1254 | * This parameter is used for the SM validation only.\n |
|
1250 | 1255 | * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices |
|
1251 | 1256 | * module before launching a basic processing. |
|
1252 | 1257 | * |
|
1253 | 1258 | */ |
|
1254 | 1259 | |
|
1255 | 1260 | param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256 |
|
1256 | 1261 | + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100; |
|
1257 | 1262 | } |
|
1258 | 1263 | |
|
1259 | 1264 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ) |
|
1260 | 1265 | { |
|
1261 | 1266 | unsigned short *sequence_cnt; |
|
1262 | 1267 | unsigned short segmentation_grouping_flag; |
|
1263 | 1268 | unsigned short new_packet_sequence_control; |
|
1264 | 1269 | |
|
1265 | 1270 | if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2) |
|
1266 | 1271 | || (sid ==SID_NORM_CWF_F3) || (sid==SID_NORM_CWF_LONG_F3) || (sid ==SID_BURST_CWF_F2) ) |
|
1267 | 1272 | { |
|
1268 | 1273 | sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST; |
|
1269 | 1274 | } |
|
1270 | 1275 | else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) ) |
|
1271 | 1276 | { |
|
1272 | 1277 | sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2; |
|
1273 | 1278 | } |
|
1274 | 1279 | else |
|
1275 | 1280 | { |
|
1276 | 1281 | sequence_cnt = NULL; |
|
1277 | 1282 | PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid) |
|
1278 | 1283 | } |
|
1279 | 1284 | |
|
1280 | 1285 | if (sequence_cnt != NULL) |
|
1281 | 1286 | { |
|
1282 | 1287 | segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8; |
|
1283 | 1288 | *sequence_cnt = (*sequence_cnt) & 0x3fff; |
|
1284 | 1289 | |
|
1285 | 1290 | new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ; |
|
1286 | 1291 | |
|
1287 | 1292 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); |
|
1288 | 1293 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); |
|
1289 | 1294 | |
|
1290 | 1295 | // increment the sequence counter for the next packet |
|
1291 | 1296 | if ( *sequence_cnt < SEQ_CNT_MAX) |
|
1292 | 1297 | { |
|
1293 | 1298 | *sequence_cnt = *sequence_cnt + 1; |
|
1294 | 1299 | } |
|
1295 | 1300 | else |
|
1296 | 1301 | { |
|
1297 | 1302 | *sequence_cnt = 0; |
|
1298 | 1303 | } |
|
1299 | 1304 | } |
|
1300 | 1305 | } |
General Comments 0
You need to be logged in to leave comments.
Login now