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