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