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