##// END OF EJS Templates
2.0.1.1...
paul -
r168:8af347acc664 patch rev 2
parent child
Show More
@@ -1,11 +1,12
1 syntax: glob
1 syntax: glob
2 *.pdf
2 *.pdf
3 *~
3 *~
4 *.o
4 *.o
5 *.gcno
5 *.zip
6 *.zip
6 tests/*.err
7 tests/*.err
7 doc
8 doc
8 *.srec
9 *.srec
9 FSW-qt/bin/fsw
10 FSW-qt/bin/fsw
10 src/LFR_basic-parameters
11 src/LFR_basic-parameters
11
12
@@ -1,273 +1,273
1 #############################################################################
1 #############################################################################
2 # Makefile for building: bin/fsw
2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.6) on: Thu Sep 25 11:05:34 2014
3 # Generated by qmake (2.01a) (Qt 4.8.6) on: Tue Oct 7 15:14:40 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=2 -DSW_VERSION_N2=0 -DSW_VERSION_N3=1 -DSW_VERSION_N4=1 -DLPP_DPU_DESTID -DPRINT_MESSAGES_ON_CONSOLE
13 DEFINES = -DSW_VERSION_N1=2 -DSW_VERSION_N2=0 -DSW_VERSION_N3=1 -DSW_VERSION_N4=1 -DLPP_DPU_DESTID -DPRINT_MESSAGES_ON_CONSOLE
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/LFR_basic-parameters
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/LFR_basic-parameters
17 LINK = sparc-rtems-g++
17 LINK = sparc-rtems-g++
18 LFLAGS =
18 LFLAGS =
19 LIBS = $(SUBLIBS)
19 LIBS = $(SUBLIBS)
20 AR = sparc-rtems-ar rcs
20 AR = sparc-rtems-ar rcs
21 RANLIB =
21 RANLIB =
22 QMAKE = /usr/bin/qmake-qt4
22 QMAKE = /usr/bin/qmake-qt4
23 TAR = tar -cf
23 TAR = tar -cf
24 COMPRESS = gzip -9f
24 COMPRESS = gzip -9f
25 COPY = cp -f
25 COPY = cp -f
26 SED = sed
26 SED = sed
27 COPY_FILE = $(COPY)
27 COPY_FILE = $(COPY)
28 COPY_DIR = $(COPY) -r
28 COPY_DIR = $(COPY) -r
29 STRIP = sparc-rtems-strip
29 STRIP = sparc-rtems-strip
30 INSTALL_FILE = install -m 644 -p
30 INSTALL_FILE = install -m 644 -p
31 INSTALL_DIR = $(COPY_DIR)
31 INSTALL_DIR = $(COPY_DIR)
32 INSTALL_PROGRAM = install -m 755 -p
32 INSTALL_PROGRAM = install -m 755 -p
33 DEL_FILE = rm -f
33 DEL_FILE = rm -f
34 SYMLINK = ln -f -s
34 SYMLINK = ln -f -s
35 DEL_DIR = rmdir
35 DEL_DIR = rmdir
36 MOVE = mv -f
36 MOVE = mv -f
37 CHK_DIR_EXISTS= test -d
37 CHK_DIR_EXISTS= test -d
38 MKDIR = mkdir -p
38 MKDIR = mkdir -p
39
39
40 ####### Output directory
40 ####### Output directory
41
41
42 OBJECTS_DIR = obj/
42 OBJECTS_DIR = obj/
43
43
44 ####### Files
44 ####### Files
45
45
46 SOURCES = ../src/wf_handler.c \
46 SOURCES = ../src/wf_handler.c \
47 ../src/tc_handler.c \
47 ../src/tc_handler.c \
48 ../src/fsw_misc.c \
48 ../src/fsw_misc.c \
49 ../src/fsw_init.c \
49 ../src/fsw_init.c \
50 ../src/fsw_globals.c \
50 ../src/fsw_globals.c \
51 ../src/fsw_spacewire.c \
51 ../src/fsw_spacewire.c \
52 ../src/tc_load_dump_parameters.c \
52 ../src/tc_load_dump_parameters.c \
53 ../src/tm_lfr_tc_exe.c \
53 ../src/tm_lfr_tc_exe.c \
54 ../src/tc_acceptance.c \
54 ../src/tc_acceptance.c \
55 ../src/processing/fsw_processing.c \
55 ../src/processing/fsw_processing.c \
56 ../src/processing/avf0_prc0.c \
56 ../src/processing/avf0_prc0.c \
57 ../src/processing/avf1_prc1.c \
57 ../src/processing/avf1_prc1.c \
58 ../src/processing/avf2_prc2.c \
58 ../src/processing/avf2_prc2.c \
59 ../src/lfr_cpu_usage_report.c \
59 ../src/lfr_cpu_usage_report.c \
60 ../src/LFR_basic-parameters/basic_parameters.c
60 ../src/LFR_basic-parameters/basic_parameters.c
61 OBJECTS = obj/wf_handler.o \
61 OBJECTS = obj/wf_handler.o \
62 obj/tc_handler.o \
62 obj/tc_handler.o \
63 obj/fsw_misc.o \
63 obj/fsw_misc.o \
64 obj/fsw_init.o \
64 obj/fsw_init.o \
65 obj/fsw_globals.o \
65 obj/fsw_globals.o \
66 obj/fsw_spacewire.o \
66 obj/fsw_spacewire.o \
67 obj/tc_load_dump_parameters.o \
67 obj/tc_load_dump_parameters.o \
68 obj/tm_lfr_tc_exe.o \
68 obj/tm_lfr_tc_exe.o \
69 obj/tc_acceptance.o \
69 obj/tc_acceptance.o \
70 obj/fsw_processing.o \
70 obj/fsw_processing.o \
71 obj/avf0_prc0.o \
71 obj/avf0_prc0.o \
72 obj/avf1_prc1.o \
72 obj/avf1_prc1.o \
73 obj/avf2_prc2.o \
73 obj/avf2_prc2.o \
74 obj/lfr_cpu_usage_report.o \
74 obj/lfr_cpu_usage_report.o \
75 obj/basic_parameters.o
75 obj/basic_parameters.o
76 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
76 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
77 /usr/lib64/qt4/mkspecs/common/linux.conf \
77 /usr/lib64/qt4/mkspecs/common/linux.conf \
78 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
78 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
79 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
79 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
80 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
80 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
81 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
81 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
82 /usr/lib64/qt4/mkspecs/qconfig.pri \
82 /usr/lib64/qt4/mkspecs/qconfig.pri \
83 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
83 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
84 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
84 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
85 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
85 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
86 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
86 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
87 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
87 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
88 sparc.pri \
88 sparc.pri \
89 /usr/lib64/qt4/mkspecs/features/release.prf \
89 /usr/lib64/qt4/mkspecs/features/release.prf \
90 /usr/lib64/qt4/mkspecs/features/default_post.prf \
90 /usr/lib64/qt4/mkspecs/features/default_post.prf \
91 /usr/lib64/qt4/mkspecs/features/shared.prf \
91 /usr/lib64/qt4/mkspecs/features/shared.prf \
92 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
92 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
93 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
93 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
94 /usr/lib64/qt4/mkspecs/features/resources.prf \
94 /usr/lib64/qt4/mkspecs/features/resources.prf \
95 /usr/lib64/qt4/mkspecs/features/uic.prf \
95 /usr/lib64/qt4/mkspecs/features/uic.prf \
96 /usr/lib64/qt4/mkspecs/features/yacc.prf \
96 /usr/lib64/qt4/mkspecs/features/yacc.prf \
97 /usr/lib64/qt4/mkspecs/features/lex.prf \
97 /usr/lib64/qt4/mkspecs/features/lex.prf \
98 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
98 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
99 fsw-qt.pro
99 fsw-qt.pro
100 QMAKE_TARGET = fsw
100 QMAKE_TARGET = fsw
101 DESTDIR = bin/
101 DESTDIR = bin/
102 TARGET = bin/fsw
102 TARGET = bin/fsw
103
103
104 first: all
104 first: all
105 ####### Implicit rules
105 ####### Implicit rules
106
106
107 .SUFFIXES: .o .c .cpp .cc .cxx .C
107 .SUFFIXES: .o .c .cpp .cc .cxx .C
108
108
109 .cpp.o:
109 .cpp.o:
110 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
110 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
111
111
112 .cc.o:
112 .cc.o:
113 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
113 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
114
114
115 .cxx.o:
115 .cxx.o:
116 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
116 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
117
117
118 .C.o:
118 .C.o:
119 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
119 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
120
120
121 .c.o:
121 .c.o:
122 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
122 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
123
123
124 ####### Build rules
124 ####### Build rules
125
125
126 all: Makefile $(TARGET)
126 all: Makefile $(TARGET)
127
127
128 $(TARGET): $(OBJECTS)
128 $(TARGET): $(OBJECTS)
129 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
129 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
130 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
130 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
131
131
132 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
132 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
133 /usr/lib64/qt4/mkspecs/common/linux.conf \
133 /usr/lib64/qt4/mkspecs/common/linux.conf \
134 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
134 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
135 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
135 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
136 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
136 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
137 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
137 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
138 /usr/lib64/qt4/mkspecs/qconfig.pri \
138 /usr/lib64/qt4/mkspecs/qconfig.pri \
139 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
139 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
140 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
140 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
141 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
141 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
142 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
142 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
143 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
143 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
144 sparc.pri \
144 sparc.pri \
145 /usr/lib64/qt4/mkspecs/features/release.prf \
145 /usr/lib64/qt4/mkspecs/features/release.prf \
146 /usr/lib64/qt4/mkspecs/features/default_post.prf \
146 /usr/lib64/qt4/mkspecs/features/default_post.prf \
147 /usr/lib64/qt4/mkspecs/features/shared.prf \
147 /usr/lib64/qt4/mkspecs/features/shared.prf \
148 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
148 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
149 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
149 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
150 /usr/lib64/qt4/mkspecs/features/resources.prf \
150 /usr/lib64/qt4/mkspecs/features/resources.prf \
151 /usr/lib64/qt4/mkspecs/features/uic.prf \
151 /usr/lib64/qt4/mkspecs/features/uic.prf \
152 /usr/lib64/qt4/mkspecs/features/yacc.prf \
152 /usr/lib64/qt4/mkspecs/features/yacc.prf \
153 /usr/lib64/qt4/mkspecs/features/lex.prf \
153 /usr/lib64/qt4/mkspecs/features/lex.prf \
154 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
154 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
155 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
155 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
156 /usr/lib64/qt4/mkspecs/common/unix.conf:
156 /usr/lib64/qt4/mkspecs/common/unix.conf:
157 /usr/lib64/qt4/mkspecs/common/linux.conf:
157 /usr/lib64/qt4/mkspecs/common/linux.conf:
158 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
158 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
159 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
159 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
160 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
160 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
161 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
161 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
162 /usr/lib64/qt4/mkspecs/qconfig.pri:
162 /usr/lib64/qt4/mkspecs/qconfig.pri:
163 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
163 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
164 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
164 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
165 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
165 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
166 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
166 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
167 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
167 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
168 sparc.pri:
168 sparc.pri:
169 /usr/lib64/qt4/mkspecs/features/release.prf:
169 /usr/lib64/qt4/mkspecs/features/release.prf:
170 /usr/lib64/qt4/mkspecs/features/default_post.prf:
170 /usr/lib64/qt4/mkspecs/features/default_post.prf:
171 /usr/lib64/qt4/mkspecs/features/shared.prf:
171 /usr/lib64/qt4/mkspecs/features/shared.prf:
172 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
172 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
173 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
173 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
174 /usr/lib64/qt4/mkspecs/features/resources.prf:
174 /usr/lib64/qt4/mkspecs/features/resources.prf:
175 /usr/lib64/qt4/mkspecs/features/uic.prf:
175 /usr/lib64/qt4/mkspecs/features/uic.prf:
176 /usr/lib64/qt4/mkspecs/features/yacc.prf:
176 /usr/lib64/qt4/mkspecs/features/yacc.prf:
177 /usr/lib64/qt4/mkspecs/features/lex.prf:
177 /usr/lib64/qt4/mkspecs/features/lex.prf:
178 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
178 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
179 qmake: FORCE
179 qmake: FORCE
180 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
180 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
181
181
182 dist:
182 dist:
183 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
183 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
184 $(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
184 $(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
185
185
186
186
187 clean:compiler_clean
187 clean:compiler_clean
188 -$(DEL_FILE) $(OBJECTS)
188 -$(DEL_FILE) $(OBJECTS)
189 -$(DEL_FILE) *~ core *.core
189 -$(DEL_FILE) *~ core *.core
190
190
191
191
192 ####### Sub-libraries
192 ####### Sub-libraries
193
193
194 distclean: clean
194 distclean: clean
195 -$(DEL_FILE) $(TARGET)
195 -$(DEL_FILE) $(TARGET)
196 -$(DEL_FILE) Makefile
196 -$(DEL_FILE) Makefile
197
197
198
198
199 grmon:
199 grmon:
200 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
200 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
201
201
202 check: first
202 check: first
203
203
204 compiler_rcc_make_all:
204 compiler_rcc_make_all:
205 compiler_rcc_clean:
205 compiler_rcc_clean:
206 compiler_uic_make_all:
206 compiler_uic_make_all:
207 compiler_uic_clean:
207 compiler_uic_clean:
208 compiler_image_collection_make_all: qmake_image_collection.cpp
208 compiler_image_collection_make_all: qmake_image_collection.cpp
209 compiler_image_collection_clean:
209 compiler_image_collection_clean:
210 -$(DEL_FILE) qmake_image_collection.cpp
210 -$(DEL_FILE) qmake_image_collection.cpp
211 compiler_yacc_decl_make_all:
211 compiler_yacc_decl_make_all:
212 compiler_yacc_decl_clean:
212 compiler_yacc_decl_clean:
213 compiler_yacc_impl_make_all:
213 compiler_yacc_impl_make_all:
214 compiler_yacc_impl_clean:
214 compiler_yacc_impl_clean:
215 compiler_lex_make_all:
215 compiler_lex_make_all:
216 compiler_lex_clean:
216 compiler_lex_clean:
217 compiler_clean:
217 compiler_clean:
218
218
219 ####### Compile
219 ####### Compile
220
220
221 obj/wf_handler.o: ../src/wf_handler.c
221 obj/wf_handler.o: ../src/wf_handler.c
222 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
222 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
223
223
224 obj/tc_handler.o: ../src/tc_handler.c
224 obj/tc_handler.o: ../src/tc_handler.c
225 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
225 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
226
226
227 obj/fsw_misc.o: ../src/fsw_misc.c
227 obj/fsw_misc.o: ../src/fsw_misc.c
228 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
228 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
229
229
230 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
230 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
231 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
231 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
232
232
233 obj/fsw_globals.o: ../src/fsw_globals.c
233 obj/fsw_globals.o: ../src/fsw_globals.c
234 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
234 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
235
235
236 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
236 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
237 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
237 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
238
238
239 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
239 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
240 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
240 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
241
241
242 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
242 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
243 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
243 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
244
244
245 obj/tc_acceptance.o: ../src/tc_acceptance.c
245 obj/tc_acceptance.o: ../src/tc_acceptance.c
246 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
246 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
247
247
248 obj/fsw_processing.o: ../src/processing/fsw_processing.c
248 obj/fsw_processing.o: ../src/processing/fsw_processing.c
249 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c
249 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c
250
250
251 obj/avf0_prc0.o: ../src/processing/avf0_prc0.c
251 obj/avf0_prc0.o: ../src/processing/avf0_prc0.c
252 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c
252 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c
253
253
254 obj/avf1_prc1.o: ../src/processing/avf1_prc1.c
254 obj/avf1_prc1.o: ../src/processing/avf1_prc1.c
255 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c
255 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c
256
256
257 obj/avf2_prc2.o: ../src/processing/avf2_prc2.c
257 obj/avf2_prc2.o: ../src/processing/avf2_prc2.c
258 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c
258 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c
259
259
260 obj/lfr_cpu_usage_report.o: ../src/lfr_cpu_usage_report.c
260 obj/lfr_cpu_usage_report.o: ../src/lfr_cpu_usage_report.c
261 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/lfr_cpu_usage_report.o ../src/lfr_cpu_usage_report.c
261 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/lfr_cpu_usage_report.o ../src/lfr_cpu_usage_report.c
262
262
263 obj/basic_parameters.o: ../src/LFR_basic-parameters/basic_parameters.c
263 obj/basic_parameters.o: ../src/LFR_basic-parameters/basic_parameters.c
264 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/LFR_basic-parameters/basic_parameters.c
264 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/LFR_basic-parameters/basic_parameters.c
265
265
266 ####### Install
266 ####### Install
267
267
268 install: FORCE
268 install: FORCE
269
269
270 uninstall: FORCE
270 uninstall: FORCE
271
271
272 FORCE:
272 FORCE:
273
273
@@ -1,100 +1,108
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 # lpp_dpu_destid
4 # lpp_dpu_destid
5 CONFIG += console verbose lpp_dpu_destid
5 CONFIG += console verbose lpp_dpu_destid
6 CONFIG -= qt
6 CONFIG -= qt
7
7
8 include(./sparc.pri)
8 include(./sparc.pri)
9
9
10 # flight software version
10 # flight software version
11 SWVERSION=-1-0
11 SWVERSION=-1-0
12 DEFINES += SW_VERSION_N1=2 # major
12 DEFINES += SW_VERSION_N1=2 # major
13 DEFINES += SW_VERSION_N2=0 # minor
13 DEFINES += SW_VERSION_N2=0 # minor
14 DEFINES += SW_VERSION_N3=1 # patch
14 DEFINES += SW_VERSION_N3=1 # patch
15 DEFINES += SW_VERSION_N4=1 # internal
15 DEFINES += SW_VERSION_N4=1 # internal
16
16
17 # <GCOV>
18 #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage
19 #QMAKE_LFLAGS_RELEASE +=
20 #LIBS += -lgcov /opt/GCOV/01A/lib/overload.o -lc
21 # </GCOV>
22
23 # <CHANGE BEFORE FLIGHT>
17 contains( CONFIG, lpp_dpu_destid ) {
24 contains( CONFIG, lpp_dpu_destid ) {
18 DEFINES += LPP_DPU_DESTID
25 DEFINES += LPP_DPU_DESTID
19 }
26 }
27 # </CHANGE BEFORE FLIGHT>
20
28
21 contains( CONFIG, debug_tch ) {
29 contains( CONFIG, debug_tch ) {
22 DEFINES += DEBUG_TCH
30 DEFINES += DEBUG_TCH
23 }
31 }
24
32
25 contains( CONFIG, vhdl_dev ) {
33 contains( CONFIG, vhdl_dev ) {
26 DEFINES += VHDL_DEV
34 DEFINES += VHDL_DEV
27 }
35 }
28
36
29 contains( CONFIG, verbose ) {
37 contains( CONFIG, verbose ) {
30 DEFINES += PRINT_MESSAGES_ON_CONSOLE
38 DEFINES += PRINT_MESSAGES_ON_CONSOLE
31 }
39 }
32
40
33 contains( CONFIG, debug_messages ) {
41 contains( CONFIG, debug_messages ) {
34 DEFINES += DEBUG_MESSAGES
42 DEFINES += DEBUG_MESSAGES
35 }
43 }
36
44
37 contains( CONFIG, cpu_usage_report ) {
45 contains( CONFIG, cpu_usage_report ) {
38 DEFINES += PRINT_TASK_STATISTICS
46 DEFINES += PRINT_TASK_STATISTICS
39 }
47 }
40
48
41 contains( CONFIG, stack_report ) {
49 contains( CONFIG, stack_report ) {
42 DEFINES += PRINT_STACK_REPORT
50 DEFINES += PRINT_STACK_REPORT
43 }
51 }
44
52
45 contains( CONFIG, boot_messages ) {
53 contains( CONFIG, boot_messages ) {
46 DEFINES += BOOT_MESSAGES
54 DEFINES += BOOT_MESSAGES
47 }
55 }
48
56
49 #doxygen.target = doxygen
57 #doxygen.target = doxygen
50 #doxygen.commands = doxygen ../doc/Doxyfile
58 #doxygen.commands = doxygen ../doc/Doxyfile
51 #QMAKE_EXTRA_TARGETS += doxygen
59 #QMAKE_EXTRA_TARGETS += doxygen
52
60
53 TARGET = fsw
61 TARGET = fsw
54
62
55 INCLUDEPATH += \
63 INCLUDEPATH += \
56 ../src \
64 ../src \
57 ../header \
65 ../header \
58 ../header/processing \
66 ../header/processing \
59 ../src/LFR_basic-parameters
67 ../src/LFR_basic-parameters
60
68
61 SOURCES += \
69 SOURCES += \
62 ../src/wf_handler.c \
70 ../src/wf_handler.c \
63 ../src/tc_handler.c \
71 ../src/tc_handler.c \
64 ../src/fsw_misc.c \
72 ../src/fsw_misc.c \
65 ../src/fsw_init.c \
73 ../src/fsw_init.c \
66 ../src/fsw_globals.c \
74 ../src/fsw_globals.c \
67 ../src/fsw_spacewire.c \
75 ../src/fsw_spacewire.c \
68 ../src/tc_load_dump_parameters.c \
76 ../src/tc_load_dump_parameters.c \
69 ../src/tm_lfr_tc_exe.c \
77 ../src/tm_lfr_tc_exe.c \
70 ../src/tc_acceptance.c \
78 ../src/tc_acceptance.c \
71 ../src/processing/fsw_processing.c \
79 ../src/processing/fsw_processing.c \
72 ../src/processing/avf0_prc0.c \
80 ../src/processing/avf0_prc0.c \
73 ../src/processing/avf1_prc1.c \
81 ../src/processing/avf1_prc1.c \
74 ../src/processing/avf2_prc2.c \
82 ../src/processing/avf2_prc2.c \
75 ../src/lfr_cpu_usage_report.c \
83 ../src/lfr_cpu_usage_report.c \
76 ../src/LFR_basic-parameters/basic_parameters.c
84 ../src/LFR_basic-parameters/basic_parameters.c
77
85
78 HEADERS += \
86 HEADERS += \
79 ../header/wf_handler.h \
87 ../header/wf_handler.h \
80 ../header/tc_handler.h \
88 ../header/tc_handler.h \
81 ../header/grlib_regs.h \
89 ../header/grlib_regs.h \
82 ../header/fsw_params.h \
90 ../header/fsw_params.h \
83 ../header/fsw_misc.h \
91 ../header/fsw_misc.h \
84 ../header/fsw_init.h \
92 ../header/fsw_init.h \
85 ../header/ccsds_types.h \
93 ../header/ccsds_types.h \
86 ../header/fsw_spacewire.h \
94 ../header/fsw_spacewire.h \
87 ../header/tc_load_dump_parameters.h \
95 ../header/tc_load_dump_parameters.h \
88 ../header/tm_lfr_tc_exe.h \
96 ../header/tm_lfr_tc_exe.h \
89 ../header/tc_acceptance.h \
97 ../header/tc_acceptance.h \
90 ../header/fsw_params_nb_bytes.h \
98 ../header/fsw_params_nb_bytes.h \
91 ../header/fsw_params_processing.h \
99 ../header/fsw_params_processing.h \
92 ../header/processing/fsw_processing.h \
100 ../header/processing/fsw_processing.h \
93 ../header/processing/avf0_prc0.h \
101 ../header/processing/avf0_prc0.h \
94 ../header/processing/avf1_prc1.h \
102 ../header/processing/avf1_prc1.h \
95 ../header/processing/avf2_prc2.h \
103 ../header/processing/avf2_prc2.h \
96 ../header/fsw_params_wf_handler.h \
104 ../header/fsw_params_wf_handler.h \
97 ../header/lfr_cpu_usage_report.h \
105 ../header/lfr_cpu_usage_report.h \
98 ../src/LFR_basic-parameters/basic_parameters.h \
106 ../src/LFR_basic-parameters/basic_parameters.h \
99 ../src/LFR_basic-parameters/basic_parameters_params.h
107 ../src/LFR_basic-parameters/basic_parameters_params.h
100
108
@@ -1,208 +1,208
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.2.0, 2014-09-25T16:02:43. -->
3 <!-- Written by QtCreator 3.2.0, 2014-10-06T16:01:42. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>EnvironmentId</variable>
6 <variable>EnvironmentId</variable>
7 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
7 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
8 </data>
8 </data>
9 <data>
9 <data>
10 <variable>ProjectExplorer.Project.ActiveTarget</variable>
10 <variable>ProjectExplorer.Project.ActiveTarget</variable>
11 <value type="int">0</value>
11 <value type="int">0</value>
12 </data>
12 </data>
13 <data>
13 <data>
14 <variable>ProjectExplorer.Project.EditorSettings</variable>
14 <variable>ProjectExplorer.Project.EditorSettings</variable>
15 <valuemap type="QVariantMap">
15 <valuemap type="QVariantMap">
16 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
16 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
17 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
17 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
18 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
18 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
19 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
19 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
20 <value type="QString" key="language">Cpp</value>
20 <value type="QString" key="language">Cpp</value>
21 <valuemap type="QVariantMap" key="value">
21 <valuemap type="QVariantMap" key="value">
22 <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
22 <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
23 </valuemap>
23 </valuemap>
24 </valuemap>
24 </valuemap>
25 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
25 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
26 <value type="QString" key="language">QmlJS</value>
26 <value type="QString" key="language">QmlJS</value>
27 <valuemap type="QVariantMap" key="value">
27 <valuemap type="QVariantMap" key="value">
28 <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
28 <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
29 </valuemap>
29 </valuemap>
30 </valuemap>
30 </valuemap>
31 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
31 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
32 <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
32 <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
33 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
33 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
34 <value type="int" key="EditorConfiguration.IndentSize">4</value>
34 <value type="int" key="EditorConfiguration.IndentSize">4</value>
35 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
35 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
36 <value type="int" key="EditorConfiguration.MarginColumn">80</value>
36 <value type="int" key="EditorConfiguration.MarginColumn">80</value>
37 <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
37 <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
38 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
38 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
39 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
39 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
40 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
40 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
41 <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
41 <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
42 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
42 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
43 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
43 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
44 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
44 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
45 <value type="int" key="EditorConfiguration.TabSize">8</value>
45 <value type="int" key="EditorConfiguration.TabSize">8</value>
46 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
46 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
47 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
47 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
48 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
48 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
49 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
49 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
50 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
50 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
51 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
51 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
52 </valuemap>
52 </valuemap>
53 </data>
53 </data>
54 <data>
54 <data>
55 <variable>ProjectExplorer.Project.PluginSettings</variable>
55 <variable>ProjectExplorer.Project.PluginSettings</variable>
56 <valuemap type="QVariantMap"/>
56 <valuemap type="QVariantMap"/>
57 </data>
57 </data>
58 <data>
58 <data>
59 <variable>ProjectExplorer.Project.Target.0</variable>
59 <variable>ProjectExplorer.Project.Target.0</variable>
60 <valuemap type="QVariantMap">
60 <valuemap type="QVariantMap">
61 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
61 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
62 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
62 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
63 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
63 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
64 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
64 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
65 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
65 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
66 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
66 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
67 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
67 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
68 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value>
68 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value>
69 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
69 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
70 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
70 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
71 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
71 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
72 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
72 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
73 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
73 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
74 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
74 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
75 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
75 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
76 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
76 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
77 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
77 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
78 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
78 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
79 </valuemap>
79 </valuemap>
80 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
80 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
81 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
81 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
82 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
82 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
83 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
83 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
84 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
84 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
85 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
85 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
86 <value type="QString">-w</value>
86 <value type="QString">-w</value>
87 <value type="QString">-r</value>
87 <value type="QString">-r</value>
88 </valuelist>
88 </valuelist>
89 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
89 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
90 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
90 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
91 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
91 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
92 </valuemap>
92 </valuemap>
93 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
93 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
96 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
96 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
97 </valuemap>
97 </valuemap>
98 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
98 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
99 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
99 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
100 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
100 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
101 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
101 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
102 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
102 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
103 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
103 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
104 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
104 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
105 <value type="QString">-w</value>
105 <value type="QString">-w</value>
106 <value type="QString">-r</value>
106 <value type="QString">-r</value>
107 </valuelist>
107 </valuelist>
108 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
108 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
109 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
109 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
110 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
110 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
111 </valuemap>
111 </valuemap>
112 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
112 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
115 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
115 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
116 </valuemap>
116 </valuemap>
117 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
117 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
118 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
118 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
119 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
119 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
120 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
120 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
121 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
121 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
122 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
122 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
123 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
123 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
124 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
124 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
125 </valuemap>
125 </valuemap>
126 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
126 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
127 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
127 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
128 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
128 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
129 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
129 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
131 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
131 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
132 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
132 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
133 </valuemap>
133 </valuemap>
134 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
134 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
136 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
136 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
137 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
137 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
138 </valuemap>
138 </valuemap>
139 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
139 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
140 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
140 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
141 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
141 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
142 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
142 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
143 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
143 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
144 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
144 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
145 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
145 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
146 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
146 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
147 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
147 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
148 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
148 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
149 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
149 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
150 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
150 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
151 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
151 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
152 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
152 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
153 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
153 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
154 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
154 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
155 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
155 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
156 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
156 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
157 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
157 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
158 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
158 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
159 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
159 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
160 <value type="int">0</value>
160 <value type="int">0</value>
161 <value type="int">1</value>
161 <value type="int">1</value>
162 <value type="int">2</value>
162 <value type="int">2</value>
163 <value type="int">3</value>
163 <value type="int">3</value>
164 <value type="int">4</value>
164 <value type="int">4</value>
165 <value type="int">5</value>
165 <value type="int">5</value>
166 <value type="int">6</value>
166 <value type="int">6</value>
167 <value type="int">7</value>
167 <value type="int">7</value>
168 <value type="int">8</value>
168 <value type="int">8</value>
169 <value type="int">9</value>
169 <value type="int">9</value>
170 <value type="int">10</value>
170 <value type="int">10</value>
171 <value type="int">11</value>
171 <value type="int">11</value>
172 <value type="int">12</value>
172 <value type="int">12</value>
173 <value type="int">13</value>
173 <value type="int">13</value>
174 <value type="int">14</value>
174 <value type="int">14</value>
175 </valuelist>
175 </valuelist>
176 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
176 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
177 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
177 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
178 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
178 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
179 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
179 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
180 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
180 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
181 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
181 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
182 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
182 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
183 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
183 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
184 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
184 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
185 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
185 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
186 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
186 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
187 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
187 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
188 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
188 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
189 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
189 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
190 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
190 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
191 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
191 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
192 </valuemap>
192 </valuemap>
193 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
193 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
194 </valuemap>
194 </valuemap>
195 </data>
195 </data>
196 <data>
196 <data>
197 <variable>ProjectExplorer.Project.TargetCount</variable>
197 <variable>ProjectExplorer.Project.TargetCount</variable>
198 <value type="int">1</value>
198 <value type="int">1</value>
199 </data>
199 </data>
200 <data>
200 <data>
201 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
201 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
202 <value type="int">16</value>
202 <value type="int">16</value>
203 </data>
203 </data>
204 <data>
204 <data>
205 <variable>Version</variable>
205 <variable>Version</variable>
206 <value type="int">16</value>
206 <value type="int">16</value>
207 </data>
207 </data>
208 </qtcreator>
208 </qtcreator>
@@ -1,255 +1,256
1 #ifndef FSW_PARAMS_H_INCLUDED
1 #ifndef FSW_PARAMS_H_INCLUDED
2 #define FSW_PARAMS_H_INCLUDED
2 #define FSW_PARAMS_H_INCLUDED
3
3
4 #include "grlib_regs.h"
4 #include "grlib_regs.h"
5 #include "fsw_params_processing.h"
5 #include "fsw_params_processing.h"
6 #include "fsw_params_nb_bytes.h"
6 #include "fsw_params_nb_bytes.h"
7 #include "tm_byte_positions.h"
7 #include "tm_byte_positions.h"
8 #include "ccsds_types.h"
8 #include "ccsds_types.h"
9
9
10 #define GRSPW_DEVICE_NAME "/dev/grspw0"
10 #define GRSPW_DEVICE_NAME "/dev/grspw0"
11 #define UART_DEVICE_NAME "/dev/console"
11 #define UART_DEVICE_NAME "/dev/console"
12
12
13 typedef struct ring_node
13 typedef struct ring_node
14 {
14 {
15 struct ring_node *previous;
15 struct ring_node *previous;
16 int buffer_address;
16 int buffer_address;
17 struct ring_node *next;
17 struct ring_node *next;
18 unsigned int status;
18 unsigned int status;
19 } ring_node;
19 } ring_node;
20
20
21 //************************
21 //************************
22 // flight software version
22 // flight software version
23 // this parameters is handled by the Qt project options
23 // this parameters is handled by the Qt project options
24
24
25 #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk
25 #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk
26 #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk
26 #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk
27 #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688
27 #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688
28 #define TIME_OFFSET 2
28 #define TIME_OFFSET 2
29 #define TIME_OFFSET_IN_BYTES 8
29 #define TIME_OFFSET_IN_BYTES 8
30 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
30 //#define WAVEFORM_EXTENDED_HEADER_OFFSET 22
31 #define NB_BYTES_SWF_BLK (2 * 6)
31 #define NB_BYTES_SWF_BLK (2 * 6)
32 #define NB_WORDS_SWF_BLK 3
32 #define NB_WORDS_SWF_BLK 3
33 #define NB_BYTES_CWF3_LIGHT_BLK 6
33 #define NB_BYTES_CWF3_LIGHT_BLK 6
34 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
34 //#define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
35 #define NB_RING_NODES_F0 3 // AT LEAST 3
35 #define NB_RING_NODES_F0 3 // AT LEAST 3
36 #define NB_RING_NODES_F1 5 // AT LEAST 3
36 #define NB_RING_NODES_F1 5 // AT LEAST 3
37 #define NB_RING_NODES_F2 5 // AT LEAST 3
37 #define NB_RING_NODES_F2 5 // AT LEAST 3
38 #define NB_RING_NODES_F3 3 // AT LEAST 3
38 #define NB_RING_NODES_F3 3 // AT LEAST 3
39
39
40 //**********
40 //**********
41 // LFR MODES
41 // LFR MODES
42 #define LFR_MODE_STANDBY 0
42 #define LFR_MODE_STANDBY 0
43 #define LFR_MODE_NORMAL 1
43 #define LFR_MODE_NORMAL 1
44 #define LFR_MODE_BURST 2
44 #define LFR_MODE_BURST 2
45 #define LFR_MODE_SBM1 3
45 #define LFR_MODE_SBM1 3
46 #define LFR_MODE_SBM2 4
46 #define LFR_MODE_SBM2 4
47
47
48 #define TDS_MODE_LFM 5
48 #define TDS_MODE_LFM 5
49 #define TDS_MODE_STANDBY 0
49 #define TDS_MODE_STANDBY 0
50 #define TDS_MODE_NORMAL 1
50 #define TDS_MODE_NORMAL 1
51 #define TDS_MODE_BURST 2
51 #define TDS_MODE_BURST 2
52 #define TDS_MODE_SBM1 3
52 #define TDS_MODE_SBM1 3
53 #define TDS_MODE_SBM2 4
53 #define TDS_MODE_SBM2 4
54
54
55 #define THR_MODE_STANDBY 0
55 #define THR_MODE_STANDBY 0
56 #define THR_MODE_NORMAL 1
56 #define THR_MODE_NORMAL 1
57 #define THR_MODE_BURST 2
57 #define THR_MODE_BURST 2
58
58
59 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
59 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
60 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
60 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
61 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
61 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
62 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
62 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
63 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
63 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
64 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
64 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
65 #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6
65 #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6
66 #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7
66 #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7
67 #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 // ASM only in NORM mode
67 #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 // ASM only in NORM mode
68 #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9
68 #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9
69 #define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10
69 #define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10
70 #define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11 // ASM only in NORM mode
70 #define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11 // ASM only in NORM mode
71 #define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12
71 #define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12
72 #define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13
72 #define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13
73 #define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14 // ASM only in NORM mode
73 #define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14 // ASM only in NORM mode
74 #define RTEMS_EVENT_SBM_BP1_F0 RTEMS_EVENT_15
74 #define RTEMS_EVENT_SBM_BP1_F0 RTEMS_EVENT_15
75 #define RTEMS_EVENT_SBM_BP2_F0 RTEMS_EVENT_16
75 #define RTEMS_EVENT_SBM_BP2_F0 RTEMS_EVENT_16
76 #define RTEMS_EVENT_SBM_BP1_F1 RTEMS_EVENT_17
76 #define RTEMS_EVENT_SBM_BP1_F1 RTEMS_EVENT_17
77 #define RTEMS_EVENT_SBM_BP2_F1 RTEMS_EVENT_18
77 #define RTEMS_EVENT_SBM_BP2_F1 RTEMS_EVENT_18
78 #define RTEMS_EVENT_BURST_BP1_F0 RTEMS_EVENT_19
78 #define RTEMS_EVENT_BURST_BP1_F0 RTEMS_EVENT_19
79 #define RTEMS_EVENT_BURST_BP2_F0 RTEMS_EVENT_20
79 #define RTEMS_EVENT_BURST_BP2_F0 RTEMS_EVENT_20
80 #define RTEMS_EVENT_BURST_BP1_F1 RTEMS_EVENT_21
80 #define RTEMS_EVENT_BURST_BP1_F1 RTEMS_EVENT_21
81 #define RTEMS_EVENT_BURST_BP2_F1 RTEMS_EVENT_22
81 #define RTEMS_EVENT_BURST_BP2_F1 RTEMS_EVENT_22
82
82
83 //****************************
83 //****************************
84 // LFR DEFAULT MODE PARAMETERS
84 // LFR DEFAULT MODE PARAMETERS
85 // COMMON
85 // COMMON
86 #define DEFAULT_SY_LFR_COMMON0 0x00
86 #define DEFAULT_SY_LFR_COMMON0 0x00
87 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
87 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
88 // NORM
88 // NORM
89 #define DFLT_SY_LFR_N_SWF_L 2048 // nb sample
89 #define DFLT_SY_LFR_N_SWF_L 2048 // nb sample
90 #define DFLT_SY_LFR_N_SWF_P 300 // sec
90 #define DFLT_SY_LFR_N_SWF_P 300 // sec
91 #define DFLT_SY_LFR_N_ASM_P 3600 // sec
91 #define DFLT_SY_LFR_N_ASM_P 3600 // sec
92 #define DFLT_SY_LFR_N_BP_P0 4 // sec
92 #define DFLT_SY_LFR_N_BP_P0 4 // sec
93 #define DFLT_SY_LFR_N_BP_P1 20 // sec
93 #define DFLT_SY_LFR_N_BP_P1 20 // sec
94 #define DFLT_SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3
94 #define DFLT_SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3
95 #define MIN_DELTA_SNAPSHOT 16 // sec
95 #define MIN_DELTA_SNAPSHOT 16 // sec
96 // BURST
96 // BURST
97 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
97 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
98 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
98 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
99 // SBM1
99 // SBM1
100 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
100 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
101 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
101 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
102 // SBM2
102 // SBM2
103 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
103 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
104 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
104 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
105 // ADDITIONAL PARAMETERS
105 // ADDITIONAL PARAMETERS
106 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
106 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
107 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
107 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
108 // STATUS WORD
108 // STATUS WORD
109 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
109 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
110 #define DEFAULT_STATUS_WORD_BYTE1 0x00
110 #define DEFAULT_STATUS_WORD_BYTE1 0x00
111 //
111 //
112 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
112 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
113 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
113 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
114 //****************************
114 //****************************
115
115
116 //*****************************
116 //*****************************
117 // APB REGISTERS BASE ADDRESSES
117 // APB REGISTERS BASE ADDRESSES
118 #define REGS_ADDR_APBUART 0x80000100
118 #define REGS_ADDR_APBUART 0x80000100
119 #define REGS_ADDR_GPTIMER 0x80000300
119 #define REGS_ADDR_GPTIMER 0x80000300
120 #define REGS_ADDR_GRSPW 0x80000500
120 #define REGS_ADDR_GRSPW 0x80000500
121 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
121 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
122 #define REGS_ADDR_GRGPIO 0x80000b00
122 #define REGS_ADDR_GRGPIO 0x80000b00
123
123
124 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
124 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
125 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f50
125 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f50
126 #define REGS_ADDR_VHDL_VERSION 0x80000ff0
126 #define REGS_ADDR_VHDL_VERSION 0x80000ff0
127
127
128 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
128 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
129 #define APBUART_CTRL_REG_MASK_TE 0x00000002
129 #define APBUART_CTRL_REG_MASK_TE 0x00000002
130 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
130 // scaler value = system_clock_frequency / ( baud_rate * 8 ) - 1
131 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400
131
132
132 //**********
133 //**********
133 // IRQ LINES
134 // IRQ LINES
134 #define IRQ_SM_SIMULATOR 9
135 #define IRQ_SM_SIMULATOR 9
135 #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels
136 #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels
136 #define IRQ_WAVEFORM_PICKER 14
137 #define IRQ_WAVEFORM_PICKER 14
137 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
138 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
138 #define IRQ_SPECTRAL_MATRIX 6
139 #define IRQ_SPECTRAL_MATRIX 6
139 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
140 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
140
141
141 //*****
142 //*****
142 // TIME
143 // TIME
143 #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416
144 #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416
144 #define TIMER_SM_SIMULATOR 1
145 #define TIMER_SM_SIMULATOR 1
145 #define HK_PERIOD 100 // 100 * 10ms => 1s
146 #define HK_PERIOD 100 // 100 * 10ms => 1s
146 #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000
147 #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000
147 #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s
148 #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s
148
149
149 //**********
150 //**********
150 // LPP CODES
151 // LPP CODES
151 #define LFR_SUCCESSFUL 0
152 #define LFR_SUCCESSFUL 0
152 #define LFR_DEFAULT 1
153 #define LFR_DEFAULT 1
153 #define LFR_EXE_ERROR 2
154 #define LFR_EXE_ERROR 2
154
155
155 //******
156 //******
156 // RTEMS
157 // RTEMS
157 #define TASKID_RECV 1
158 #define TASKID_RECV 1
158 #define TASKID_ACTN 2
159 #define TASKID_ACTN 2
159 #define TASKID_SPIQ 3
160 #define TASKID_SPIQ 3
160 #define TASKID_STAT 4
161 #define TASKID_STAT 4
161 #define TASKID_AVF0 5
162 #define TASKID_AVF0 5
162 #define TASKID_SWBD 6
163 #define TASKID_SWBD 6
163 #define TASKID_WFRM 7
164 #define TASKID_WFRM 7
164 #define TASKID_DUMB 8
165 #define TASKID_DUMB 8
165 #define TASKID_HOUS 9
166 #define TASKID_HOUS 9
166 #define TASKID_PRC0 10
167 #define TASKID_PRC0 10
167 #define TASKID_CWF3 11
168 #define TASKID_CWF3 11
168 #define TASKID_CWF2 12
169 #define TASKID_CWF2 12
169 #define TASKID_CWF1 13
170 #define TASKID_CWF1 13
170 #define TASKID_SEND 14
171 #define TASKID_SEND 14
171 #define TASKID_WTDG 15
172 #define TASKID_WTDG 15
172 #define TASKID_AVF1 16
173 #define TASKID_AVF1 16
173 #define TASKID_PRC1 17
174 #define TASKID_PRC1 17
174 #define TASKID_AVF2 18
175 #define TASKID_AVF2 18
175 #define TASKID_PRC2 19
176 #define TASKID_PRC2 19
176
177
177 #define TASK_PRIORITY_SPIQ 5
178 #define TASK_PRIORITY_SPIQ 5
178 #define TASK_PRIORITY_WTDG 20
179 #define TASK_PRIORITY_WTDG 20
179 #define TASK_PRIORITY_HOUS 30
180 #define TASK_PRIORITY_HOUS 30
180 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
181 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
181 #define TASK_PRIORITY_CWF2 35 //
182 #define TASK_PRIORITY_CWF2 35 //
182 #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it
183 #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it
183 #define TASK_PRIORITY_WFRM 40
184 #define TASK_PRIORITY_WFRM 40
184 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
185 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
185 #define TASK_PRIORITY_SEND 45
186 #define TASK_PRIORITY_SEND 45
186 #define TASK_PRIORITY_RECV 50
187 #define TASK_PRIORITY_RECV 50
187 #define TASK_PRIORITY_ACTN 50
188 #define TASK_PRIORITY_ACTN 50
188 #define TASK_PRIORITY_AVF0 60
189 #define TASK_PRIORITY_AVF0 60
189 #define TASK_PRIORITY_AVF1 70
190 #define TASK_PRIORITY_AVF1 70
190 #define TASK_PRIORITY_PRC0 100
191 #define TASK_PRIORITY_PRC0 100
191 #define TASK_PRIORITY_PRC1 100
192 #define TASK_PRIORITY_PRC1 100
192 #define TASK_PRIORITY_AVF2 110
193 #define TASK_PRIORITY_AVF2 110
193 #define TASK_PRIORITY_PRC2 110
194 #define TASK_PRIORITY_PRC2 110
194 #define TASK_PRIORITY_STAT 200
195 #define TASK_PRIORITY_STAT 200
195 #define TASK_PRIORITY_DUMB 200
196 #define TASK_PRIORITY_DUMB 200
196
197
197 #define MSG_QUEUE_COUNT_RECV 10
198 #define MSG_QUEUE_COUNT_RECV 10
198 #define MSG_QUEUE_COUNT_SEND 50
199 #define MSG_QUEUE_COUNT_SEND 50
199 #define MSG_QUEUE_COUNT_PRC0 10
200 #define MSG_QUEUE_COUNT_PRC0 10
200 #define MSG_QUEUE_COUNT_PRC1 10
201 #define MSG_QUEUE_COUNT_PRC1 10
201 #define MSG_QUEUE_COUNT_PRC2 5
202 #define MSG_QUEUE_COUNT_PRC2 5
202 #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1
203 #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1
203 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
204 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
204 #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers
205 #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers
205 #define MSG_QUEUE_SIZE_PRC1 20 // two pointers and one rtems_event + 2 integers
206 #define MSG_QUEUE_SIZE_PRC1 20 // two pointers and one rtems_event + 2 integers
206 #define MSG_QUEUE_SIZE_PRC2 20 // two pointers and one rtems_event + 2 integers
207 #define MSG_QUEUE_SIZE_PRC2 20 // two pointers and one rtems_event + 2 integers
207
208
208 #define QUEUE_RECV 0
209 #define QUEUE_RECV 0
209 #define QUEUE_SEND 1
210 #define QUEUE_SEND 1
210 #define QUEUE_PRC0 2
211 #define QUEUE_PRC0 2
211 #define QUEUE_PRC1 3
212 #define QUEUE_PRC1 3
212 #define QUEUE_PRC2 4
213 #define QUEUE_PRC2 4
213
214
214 //*******
215 //*******
215 // MACROS
216 // MACROS
216 #ifdef PRINT_MESSAGES_ON_CONSOLE
217 #ifdef PRINT_MESSAGES_ON_CONSOLE
217 #define PRINTF(x) printf(x);
218 #define PRINTF(x) printf(x);
218 #define PRINTF1(x,y) printf(x,y);
219 #define PRINTF1(x,y) printf(x,y);
219 #define PRINTF2(x,y,z) printf(x,y,z);
220 #define PRINTF2(x,y,z) printf(x,y,z);
220 #else
221 #else
221 #define PRINTF(x) ;
222 #define PRINTF(x) ;
222 #define PRINTF1(x,y) ;
223 #define PRINTF1(x,y) ;
223 #define PRINTF2(x,y,z) ;
224 #define PRINTF2(x,y,z) ;
224 #endif
225 #endif
225
226
226 #ifdef BOOT_MESSAGES
227 #ifdef BOOT_MESSAGES
227 #define BOOT_PRINTF(x) printf(x);
228 #define BOOT_PRINTF(x) printf(x);
228 #define BOOT_PRINTF1(x,y) printf(x,y);
229 #define BOOT_PRINTF1(x,y) printf(x,y);
229 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
230 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
230 #else
231 #else
231 #define BOOT_PRINTF(x) ;
232 #define BOOT_PRINTF(x) ;
232 #define BOOT_PRINTF1(x,y) ;
233 #define BOOT_PRINTF1(x,y) ;
233 #define BOOT_PRINTF2(x,y,z) ;
234 #define BOOT_PRINTF2(x,y,z) ;
234 #endif
235 #endif
235
236
236 #ifdef DEBUG_MESSAGES
237 #ifdef DEBUG_MESSAGES
237 #define DEBUG_PRINTF(x) printf(x);
238 #define DEBUG_PRINTF(x) printf(x);
238 #define DEBUG_PRINTF1(x,y) printf(x,y);
239 #define DEBUG_PRINTF1(x,y) printf(x,y);
239 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
240 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
240 #else
241 #else
241 #define DEBUG_PRINTF(x) ;
242 #define DEBUG_PRINTF(x) ;
242 #define DEBUG_PRINTF1(x,y) ;
243 #define DEBUG_PRINTF1(x,y) ;
243 #define DEBUG_PRINTF2(x,y,z) ;
244 #define DEBUG_PRINTF2(x,y,z) ;
244 #endif
245 #endif
245
246
246 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
247 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
247
248
248 struct param_local_str{
249 struct param_local_str{
249 unsigned int local_sbm1_nb_cwf_sent;
250 unsigned int local_sbm1_nb_cwf_sent;
250 unsigned int local_sbm1_nb_cwf_max;
251 unsigned int local_sbm1_nb_cwf_max;
251 unsigned int local_sbm2_nb_cwf_sent;
252 unsigned int local_sbm2_nb_cwf_sent;
252 unsigned int local_sbm2_nb_cwf_max;
253 unsigned int local_sbm2_nb_cwf_max;
253 };
254 };
254
255
255 #endif // FSW_PARAMS_H_INCLUDED
256 #endif // FSW_PARAMS_H_INCLUDED
@@ -1,92 +1,92
1 #ifndef WF_HANDLER_H_INCLUDED
1 #ifndef WF_HANDLER_H_INCLUDED
2 #define WF_HANDLER_H_INCLUDED
2 #define WF_HANDLER_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <grspw.h>
5 #include <grspw.h>
6 #include <stdio.h>
6 #include <stdio.h>
7 #include <math.h>
7 #include <math.h>
8
8
9 #include "fsw_params.h"
9 #include "fsw_params.h"
10 #include "fsw_spacewire.h"
10 #include "fsw_spacewire.h"
11 #include "fsw_misc.h"
11 #include "fsw_misc.h"
12 #include "fsw_params_wf_handler.h"
12 #include "fsw_params_wf_handler.h"
13
13
14 #define pi 3.1415
14 #define pi 3.1415
15
15
16 extern int fdSPW;
16 extern int fdSPW;
17
17
18 //*****************
18 //*****************
19 // waveform buffers
19 // waveform buffers
20 extern volatile int wf_snap_f0[ ];
20 extern volatile int wf_snap_f0[ ];
21 extern volatile int wf_snap_f1[ ];
21 extern volatile int wf_snap_f1[ ];
22 extern volatile int wf_snap_f2[ ];
22 extern volatile int wf_snap_f2[ ];
23 extern volatile int wf_cont_f3[ ];
23 extern volatile int wf_cont_f3[ ];
24 extern char wf_cont_f3_light[ ];
24 extern char wf_cont_f3_light[ ];
25
25
26 extern waveform_picker_regs_new_t *waveform_picker_regs;
26 extern waveform_picker_regs_new_t *waveform_picker_regs;
27 extern time_management_regs_t *time_management_regs;
27 extern time_management_regs_t *time_management_regs;
28 extern Packet_TM_LFR_HK_t housekeeping_packet;
28 extern Packet_TM_LFR_HK_t housekeeping_packet;
29 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
29 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
30 extern struct param_local_str param_local;
30 extern struct param_local_str param_local;
31
31
32 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
32 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
33 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
33 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
34
34
35 extern rtems_id Task_id[20]; /* array of task ids */
35 extern rtems_id Task_id[20]; /* array of task ids */
36
36
37 extern unsigned char lfrCurrentMode;
37 extern unsigned char lfrCurrentMode;
38
38
39 //**********
39 //**********
40 // RTEMS_ISR
40 // RTEMS_ISR
41 void reset_extractSWF( void );
41 void reset_extractSWF( void );
42 rtems_isr waveforms_isr( rtems_vector_number vector );
42 rtems_isr waveforms_isr( rtems_vector_number vector );
43
43
44 //***********
44 //***********
45 // RTEMS_TASK
45 // RTEMS_TASK
46 rtems_task wfrm_task( rtems_task_argument argument );
46 rtems_task wfrm_task( rtems_task_argument argument );
47 rtems_task cwf3_task( rtems_task_argument argument );
47 rtems_task cwf3_task( rtems_task_argument argument );
48 rtems_task cwf2_task( rtems_task_argument argument );
48 rtems_task cwf2_task( rtems_task_argument argument );
49 rtems_task cwf1_task( rtems_task_argument argument );
49 rtems_task cwf1_task( rtems_task_argument argument );
50 rtems_task swbd_task( rtems_task_argument argument );
50 rtems_task swbd_task( rtems_task_argument argument );
51
51
52 //******************
52 //******************
53 // general functions
53 // general functions
54 void WFP_init_rings( void );
54 void WFP_init_rings( void );
55 void init_waveform_ring( ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] );
55 void init_waveform_ring( ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] );
56 void WFP_reset_current_ring_nodes( void );
56 void WFP_reset_current_ring_nodes( void );
57 //
57 //
58 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
58 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
59 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
59 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
60 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
60 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
61 //
61 //
62 int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
62 int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
63 int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
63 int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
64 int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
64 int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
65 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
65 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
66 //
66 //
67 void compute_acquisition_time(unsigned int coarseTime, unsigned int fineTime,
67 void compute_acquisition_time(unsigned int coarseTime, unsigned int fineTime,
68 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char *acquisitionTime );
68 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char *acquisitionTime );
69 void build_snapshot_from_ring(ring_node *ring_node_to_send , unsigned char frequencyChannel );
69 void build_snapshot_from_ring(ring_node *ring_node_to_send , unsigned char frequencyChannel );
70 void build_acquisition_time( unsigned long long int * acquisitionTimeAslong, ring_node *current_ring_node );
70 void snapshot_resynchronization( unsigned char *timePtr );
71 //
71 //
72 rtems_id get_pkts_queue_id( void );
72 rtems_id get_pkts_queue_id( void );
73
73
74 //**************
74 //**************
75 // wfp registers
75 // wfp registers
76 // RESET
76 // RESET
77 void reset_wfp_burst_enable( void );
77 void reset_wfp_burst_enable( void );
78 void reset_wfp_status(void);
78 void reset_wfp_status(void);
79 void reset_waveform_picker_regs( void );
79 void reset_waveform_picker_regs( void );
80 // SET
80 // SET
81 void set_wfp_data_shaping(void);
81 void set_wfp_data_shaping(void);
82 void set_wfp_burst_enable_register( unsigned char mode );
82 void set_wfp_burst_enable_register( unsigned char mode );
83 void set_wfp_delta_snapshot( void );
83 void set_wfp_delta_snapshot( void );
84 void set_wfp_delta_f0_f0_2( void );
84 void set_wfp_delta_f0_f0_2( void );
85 void set_wfp_delta_f1( void );
85 void set_wfp_delta_f1( void );
86 void set_wfp_delta_f2( void );
86 void set_wfp_delta_f2( void );
87
87
88 //*****************
88 //*****************
89 // local parameters
89 // local parameters
90 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid );
90 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid );
91
91
92 #endif // WF_HANDLER_H_INCLUDED
92 #endif // WF_HANDLER_H_INCLUDED
@@ -1,947 +1,949
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 printf("this is the end!!!\n");
149 exit(0);
148 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
150 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
149 return LFR_DEFAULT;
151 return LFR_DEFAULT;
150 }
152 }
151
153
152 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
154 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
153 {
155 {
154 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
156 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
155 *
157 *
156 * @param TC points to the TeleCommand packet that is being processed
158 * @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
159 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
158 *
160 *
159 */
161 */
160
162
161 rtems_status_code status;
163 rtems_status_code status;
162 unsigned char requestedMode;
164 unsigned char requestedMode;
163 unsigned int *transitionCoarseTime_ptr;
165 unsigned int *transitionCoarseTime_ptr;
164 unsigned int transitionCoarseTime;
166 unsigned int transitionCoarseTime;
165 unsigned char * bytePosPtr;
167 unsigned char * bytePosPtr;
166
168
167 bytePosPtr = (unsigned char *) &TC->packetID;
169 bytePosPtr = (unsigned char *) &TC->packetID;
168
170
169 requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ];
171 requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ];
170 transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] );
172 transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] );
171 transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff;
173 transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff;
172
174
173 status = check_mode_value( requestedMode );
175 status = check_mode_value( requestedMode );
174
176
175 if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent
177 if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent
176 {
178 {
177 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode );
179 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode );
178 }
180 }
179 else // the mode value is consistent, check the transition
181 else // the mode value is consistent, check the transition
180 {
182 {
181 status = check_mode_transition(requestedMode);
183 status = check_mode_transition(requestedMode);
182 if (status != LFR_SUCCESSFUL)
184 if (status != LFR_SUCCESSFUL)
183 {
185 {
184 PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n")
186 PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n")
185 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
187 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
186 }
188 }
187 }
189 }
188
190
189 if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode
191 if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode
190 {
192 {
191 status = check_transition_date( transitionCoarseTime );
193 status = check_transition_date( transitionCoarseTime );
192 if (status != LFR_SUCCESSFUL)
194 if (status != LFR_SUCCESSFUL)
193 {
195 {
194 PRINTF("ERR *** in action_enter_mode *** check_transition_date\n")
196 PRINTF("ERR *** in action_enter_mode *** check_transition_date\n")
195 send_tm_lfr_tc_exe_inconsistent( TC, queue_id,
197 send_tm_lfr_tc_exe_inconsistent( TC, queue_id,
196 BYTE_POS_CP_LFR_ENTER_MODE_TIME,
198 BYTE_POS_CP_LFR_ENTER_MODE_TIME,
197 bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] );
199 bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] );
198 }
200 }
199 }
201 }
200
202
201 if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode
203 if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode
202 {
204 {
203 PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode);
205 PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode);
204 status = enter_mode( requestedMode, transitionCoarseTime );
206 status = enter_mode( requestedMode, transitionCoarseTime );
205 }
207 }
206
208
207 return status;
209 return status;
208 }
210 }
209
211
210 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
212 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
211 {
213 {
212 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
214 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
213 *
215 *
214 * @param TC points to the TeleCommand packet that is being processed
216 * @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
217 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
216 *
218 *
217 * @return LFR directive status code:
219 * @return LFR directive status code:
218 * - LFR_DEFAULT
220 * - LFR_DEFAULT
219 * - LFR_SUCCESSFUL
221 * - LFR_SUCCESSFUL
220 *
222 *
221 */
223 */
222
224
223 unsigned int val;
225 unsigned int val;
224 int result;
226 int result;
225 unsigned int status;
227 unsigned int status;
226 unsigned char mode;
228 unsigned char mode;
227 unsigned char * bytePosPtr;
229 unsigned char * bytePosPtr;
228
230
229 bytePosPtr = (unsigned char *) &TC->packetID;
231 bytePosPtr = (unsigned char *) &TC->packetID;
230
232
231 // check LFR mode
233 // check LFR mode
232 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1;
234 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1;
233 status = check_update_info_hk_lfr_mode( mode );
235 status = check_update_info_hk_lfr_mode( mode );
234 if (status == LFR_SUCCESSFUL) // check TDS mode
236 if (status == LFR_SUCCESSFUL) // check TDS mode
235 {
237 {
236 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4;
238 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4;
237 status = check_update_info_hk_tds_mode( mode );
239 status = check_update_info_hk_tds_mode( mode );
238 }
240 }
239 if (status == LFR_SUCCESSFUL) // check THR mode
241 if (status == LFR_SUCCESSFUL) // check THR mode
240 {
242 {
241 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f);
243 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f);
242 status = check_update_info_hk_thr_mode( mode );
244 status = check_update_info_hk_thr_mode( mode );
243 }
245 }
244 if (status == LFR_SUCCESSFUL) // if the parameter check is successful
246 if (status == LFR_SUCCESSFUL) // if the parameter check is successful
245 {
247 {
246 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
248 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
247 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
249 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
248 val++;
250 val++;
249 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
251 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);
252 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
251 }
253 }
252
254
253 result = status;
255 result = status;
254
256
255 return result;
257 return result;
256 }
258 }
257
259
258 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
260 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
259 {
261 {
260 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
262 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
261 *
263 *
262 * @param TC points to the TeleCommand packet that is being processed
264 * @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
265 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
264 *
266 *
265 */
267 */
266
268
267 int result;
269 int result;
268 unsigned char lfrMode;
270 unsigned char lfrMode;
269
271
270 result = LFR_DEFAULT;
272 result = LFR_DEFAULT;
271 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
273 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
272
274
273 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
275 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
274 result = LFR_DEFAULT;
276 result = LFR_DEFAULT;
275
277
276 return result;
278 return result;
277 }
279 }
278
280
279 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
281 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
280 {
282 {
281 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
283 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
282 *
284 *
283 * @param TC points to the TeleCommand packet that is being processed
285 * @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
286 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
285 *
287 *
286 */
288 */
287
289
288 int result;
290 int result;
289 unsigned char lfrMode;
291 unsigned char lfrMode;
290
292
291 result = LFR_DEFAULT;
293 result = LFR_DEFAULT;
292 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
294 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
293
295
294 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
296 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
295 result = LFR_DEFAULT;
297 result = LFR_DEFAULT;
296
298
297 return result;
299 return result;
298 }
300 }
299
301
300 int action_update_time(ccsdsTelecommandPacket_t *TC)
302 int action_update_time(ccsdsTelecommandPacket_t *TC)
301 {
303 {
302 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
304 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
303 *
305 *
304 * @param TC points to the TeleCommand packet that is being processed
306 * @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
307 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
306 *
308 *
307 * @return LFR_SUCCESSFUL
309 * @return LFR_SUCCESSFUL
308 *
310 *
309 */
311 */
310
312
311 unsigned int val;
313 unsigned int val;
312
314
313 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
315 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
314 + (TC->dataAndCRC[1] << 16)
316 + (TC->dataAndCRC[1] << 16)
315 + (TC->dataAndCRC[2] << 8)
317 + (TC->dataAndCRC[2] << 8)
316 + TC->dataAndCRC[3];
318 + TC->dataAndCRC[3];
317
319
318 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
320 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
319 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
321 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
320 val++;
322 val++;
321 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);
322 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);
323
325
324 return LFR_SUCCESSFUL;
326 return LFR_SUCCESSFUL;
325 }
327 }
326
328
327 //*******************
329 //*******************
328 // ENTERING THE MODES
330 // ENTERING THE MODES
329 int check_mode_value( unsigned char requestedMode )
331 int check_mode_value( unsigned char requestedMode )
330 {
332 {
331 int status;
333 int status;
332
334
333 if ( (requestedMode != LFR_MODE_STANDBY)
335 if ( (requestedMode != LFR_MODE_STANDBY)
334 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
336 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
335 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
337 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
336 {
338 {
337 status = LFR_DEFAULT;
339 status = LFR_DEFAULT;
338 }
340 }
339 else
341 else
340 {
342 {
341 status = LFR_SUCCESSFUL;
343 status = LFR_SUCCESSFUL;
342 }
344 }
343
345
344 return status;
346 return status;
345 }
347 }
346
348
347 int check_mode_transition( unsigned char requestedMode )
349 int check_mode_transition( unsigned char requestedMode )
348 {
350 {
349 /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
351 /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
350 *
352 *
351 * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
353 * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
352 *
354 *
353 * @return LFR directive status codes:
355 * @return LFR directive status codes:
354 * - LFR_SUCCESSFUL - the transition is authorized
356 * - LFR_SUCCESSFUL - the transition is authorized
355 * - LFR_DEFAULT - the transition is not authorized
357 * - LFR_DEFAULT - the transition is not authorized
356 *
358 *
357 */
359 */
358
360
359 int status;
361 int status;
360
362
361 switch (requestedMode)
363 switch (requestedMode)
362 {
364 {
363 case LFR_MODE_STANDBY:
365 case LFR_MODE_STANDBY:
364 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
366 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
365 status = LFR_DEFAULT;
367 status = LFR_DEFAULT;
366 }
368 }
367 else
369 else
368 {
370 {
369 status = LFR_SUCCESSFUL;
371 status = LFR_SUCCESSFUL;
370 }
372 }
371 break;
373 break;
372 case LFR_MODE_NORMAL:
374 case LFR_MODE_NORMAL:
373 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
375 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
374 status = LFR_DEFAULT;
376 status = LFR_DEFAULT;
375 }
377 }
376 else {
378 else {
377 status = LFR_SUCCESSFUL;
379 status = LFR_SUCCESSFUL;
378 }
380 }
379 break;
381 break;
380 case LFR_MODE_BURST:
382 case LFR_MODE_BURST:
381 if ( lfrCurrentMode == LFR_MODE_BURST ) {
383 if ( lfrCurrentMode == LFR_MODE_BURST ) {
382 status = LFR_DEFAULT;
384 status = LFR_DEFAULT;
383 }
385 }
384 else {
386 else {
385 status = LFR_SUCCESSFUL;
387 status = LFR_SUCCESSFUL;
386 }
388 }
387 break;
389 break;
388 case LFR_MODE_SBM1:
390 case LFR_MODE_SBM1:
389 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
391 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
390 status = LFR_DEFAULT;
392 status = LFR_DEFAULT;
391 }
393 }
392 else {
394 else {
393 status = LFR_SUCCESSFUL;
395 status = LFR_SUCCESSFUL;
394 }
396 }
395 break;
397 break;
396 case LFR_MODE_SBM2:
398 case LFR_MODE_SBM2:
397 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
399 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
398 status = LFR_DEFAULT;
400 status = LFR_DEFAULT;
399 }
401 }
400 else {
402 else {
401 status = LFR_SUCCESSFUL;
403 status = LFR_SUCCESSFUL;
402 }
404 }
403 break;
405 break;
404 default:
406 default:
405 status = LFR_DEFAULT;
407 status = LFR_DEFAULT;
406 break;
408 break;
407 }
409 }
408
410
409 return status;
411 return status;
410 }
412 }
411
413
412 int check_transition_date( unsigned int transitionCoarseTime )
414 int check_transition_date( unsigned int transitionCoarseTime )
413 {
415 {
414 int status;
416 int status;
415 unsigned int localCoarseTime;
417 unsigned int localCoarseTime;
416 unsigned int deltaCoarseTime;
418 unsigned int deltaCoarseTime;
417
419
418 status = LFR_SUCCESSFUL;
420 status = LFR_SUCCESSFUL;
419
421
420 if (transitionCoarseTime == 0) // transition time = 0 means an instant transition
422 if (transitionCoarseTime == 0) // transition time = 0 means an instant transition
421 {
423 {
422 status = LFR_SUCCESSFUL;
424 status = LFR_SUCCESSFUL;
423 }
425 }
424 else
426 else
425 {
427 {
426 localCoarseTime = time_management_regs->coarse_time & 0x7fffffff;
428 localCoarseTime = time_management_regs->coarse_time & 0x7fffffff;
427
429
428 if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322
430 if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322
429 {
431 {
430 status = LFR_DEFAULT;
432 status = LFR_DEFAULT;
431 PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime)
433 PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime)
432 }
434 }
433
435
434 if (status == LFR_SUCCESSFUL)
436 if (status == LFR_SUCCESSFUL)
435 {
437 {
436 deltaCoarseTime = transitionCoarseTime - localCoarseTime;
438 deltaCoarseTime = transitionCoarseTime - localCoarseTime;
437 if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323
439 if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323
438 {
440 {
439 status = LFR_DEFAULT;
441 status = LFR_DEFAULT;
440 PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime)
442 PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime)
441 }
443 }
442 }
444 }
443 }
445 }
444
446
445 return status;
447 return status;
446 }
448 }
447
449
448 int stop_current_mode( void )
450 int stop_current_mode( void )
449 {
451 {
450 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
452 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
451 *
453 *
452 * @return RTEMS directive status codes:
454 * @return RTEMS directive status codes:
453 * - RTEMS_SUCCESSFUL - task restarted successfully
455 * - RTEMS_SUCCESSFUL - task restarted successfully
454 * - RTEMS_INVALID_ID - task id invalid
456 * - RTEMS_INVALID_ID - task id invalid
455 * - RTEMS_ALREADY_SUSPENDED - task already suspended
457 * - RTEMS_ALREADY_SUSPENDED - task already suspended
456 *
458 *
457 */
459 */
458
460
459 rtems_status_code status;
461 rtems_status_code status;
460
462
461 status = RTEMS_SUCCESSFUL;
463 status = RTEMS_SUCCESSFUL;
462
464
463 // (1) mask interruptions
465 // (1) mask interruptions
464 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
466 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
465 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
467 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
466
468
467 // (2) clear interruptions
469 // (2) clear interruptions
468 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
470 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
469 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
471 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
470
472
471 // (3) reset waveform picker registers
473 // (3) reset waveform picker registers
472 reset_wfp_burst_enable(); // reset burst and enable bits
474 reset_wfp_burst_enable(); // reset burst and enable bits
473 reset_wfp_status(); // reset all the status bits
475 reset_wfp_status(); // reset all the status bits
474
476
475 // (4) reset spectral matrices registers
477 // (4) reset spectral matrices registers
476 set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices
478 set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices
477 set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0
479 set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0
478 reset_extractSWF(); // reset the extractSWF flag to false
480 reset_extractSWF(); // reset the extractSWF flag to false
479
481
480 // <Spectral Matrices simulator>
482 // <Spectral Matrices simulator>
481 LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator
483 LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator
482 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
484 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
483 LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator
485 LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator
484 // </Spectral Matrices simulator>
486 // </Spectral Matrices simulator>
485
487
486 // suspend several tasks
488 // suspend several tasks
487 if (lfrCurrentMode != LFR_MODE_STANDBY) {
489 if (lfrCurrentMode != LFR_MODE_STANDBY) {
488 status = suspend_science_tasks();
490 status = suspend_science_tasks();
489 }
491 }
490
492
491 if (status != RTEMS_SUCCESSFUL)
493 if (status != RTEMS_SUCCESSFUL)
492 {
494 {
493 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
495 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
494 }
496 }
495
497
496 return status;
498 return status;
497 }
499 }
498
500
499 int enter_mode( unsigned char mode, unsigned int transitionCoarseTime )
501 int enter_mode( unsigned char mode, unsigned int transitionCoarseTime )
500 {
502 {
501 /** This function is launched after a mode transition validation.
503 /** This function is launched after a mode transition validation.
502 *
504 *
503 * @param mode is the mode in which LFR will be put.
505 * @param mode is the mode in which LFR will be put.
504 *
506 *
505 * @return RTEMS directive status codes:
507 * @return RTEMS directive status codes:
506 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
508 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
507 * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully
509 * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully
508 *
510 *
509 */
511 */
510
512
511 rtems_status_code status;
513 rtems_status_code status;
512
514
513 //**********************
515 //**********************
514 // STOP THE CURRENT MODE
516 // STOP THE CURRENT MODE
515 status = stop_current_mode();
517 status = stop_current_mode();
516 if (status != RTEMS_SUCCESSFUL)
518 if (status != RTEMS_SUCCESSFUL)
517 {
519 {
518 PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode)
520 PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode)
519 }
521 }
520
522
521 //*************************
523 //*************************
522 // ENTER THE REQUESTED MODE
524 // ENTER THE REQUESTED MODE
523 if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST)
525 if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST)
524 || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) )
526 || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) )
525 {
527 {
526 #ifdef PRINT_TASK_STATISTICS
528 #ifdef PRINT_TASK_STATISTICS
527 rtems_cpu_usage_reset();
529 rtems_cpu_usage_reset();
528 maxCount = 0;
530 maxCount = 0;
529 #endif
531 #endif
530 status = restart_science_tasks( mode );
532 status = restart_science_tasks( mode );
531 launch_waveform_picker( mode, transitionCoarseTime );
533 launch_waveform_picker( mode, transitionCoarseTime );
532 launch_spectral_matrix( );
534 launch_spectral_matrix( );
533 // launch_spectral_matrix_simu( );
535 // launch_spectral_matrix_simu( );
534 }
536 }
535 else if ( mode == LFR_MODE_STANDBY )
537 else if ( mode == LFR_MODE_STANDBY )
536 {
538 {
537 #ifdef PRINT_TASK_STATISTICS
539 #ifdef PRINT_TASK_STATISTICS
538 rtems_cpu_usage_report();
540 rtems_cpu_usage_report();
539 #endif
541 #endif
540
542
541 #ifdef PRINT_STACK_REPORT
543 #ifdef PRINT_STACK_REPORT
542 PRINTF("stack report selected\n")
544 PRINTF("stack report selected\n")
543 rtems_stack_checker_report_usage();
545 rtems_stack_checker_report_usage();
544 #endif
546 #endif
545 PRINTF1("maxCount = %d\n", maxCount)
547 PRINTF1("maxCount = %d\n", maxCount)
546 }
548 }
547 else
549 else
548 {
550 {
549 status = RTEMS_UNSATISFIED;
551 status = RTEMS_UNSATISFIED;
550 }
552 }
551
553
552 if (status != RTEMS_SUCCESSFUL)
554 if (status != RTEMS_SUCCESSFUL)
553 {
555 {
554 PRINTF1("ERR *** in enter_mode *** status = %d\n", status)
556 PRINTF1("ERR *** in enter_mode *** status = %d\n", status)
555 status = RTEMS_UNSATISFIED;
557 status = RTEMS_UNSATISFIED;
556 }
558 }
557
559
558 return status;
560 return status;
559 }
561 }
560
562
561 int restart_science_tasks(unsigned char lfrRequestedMode )
563 int restart_science_tasks(unsigned char lfrRequestedMode )
562 {
564 {
563 /** This function is used to restart all science tasks.
565 /** This function is used to restart all science tasks.
564 *
566 *
565 * @return RTEMS directive status codes:
567 * @return RTEMS directive status codes:
566 * - RTEMS_SUCCESSFUL - task restarted successfully
568 * - RTEMS_SUCCESSFUL - task restarted successfully
567 * - RTEMS_INVALID_ID - task id invalid
569 * - RTEMS_INVALID_ID - task id invalid
568 * - RTEMS_INCORRECT_STATE - task never started
570 * - RTEMS_INCORRECT_STATE - task never started
569 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
571 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
570 *
572 *
571 * Science tasks are AVF0, PRC0, WFRM, CWF3, CW2, CWF1
573 * Science tasks are AVF0, PRC0, WFRM, CWF3, CW2, CWF1
572 *
574 *
573 */
575 */
574
576
575 rtems_status_code status[10];
577 rtems_status_code status[10];
576 rtems_status_code ret;
578 rtems_status_code ret;
577
579
578 ret = RTEMS_SUCCESSFUL;
580 ret = RTEMS_SUCCESSFUL;
579
581
580 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode );
582 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode );
581 if (status[0] != RTEMS_SUCCESSFUL)
583 if (status[0] != RTEMS_SUCCESSFUL)
582 {
584 {
583 PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[0])
585 PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[0])
584 }
586 }
585
587
586 status[1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode );
588 status[1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode );
587 if (status[1] != RTEMS_SUCCESSFUL)
589 if (status[1] != RTEMS_SUCCESSFUL)
588 {
590 {
589 PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[1])
591 PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[1])
590 }
592 }
591
593
592 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
594 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
593 if (status[2] != RTEMS_SUCCESSFUL)
595 if (status[2] != RTEMS_SUCCESSFUL)
594 {
596 {
595 PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[2])
597 PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[2])
596 }
598 }
597
599
598 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
600 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
599 if (status[3] != RTEMS_SUCCESSFUL)
601 if (status[3] != RTEMS_SUCCESSFUL)
600 {
602 {
601 PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[3])
603 PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[3])
602 }
604 }
603
605
604 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
606 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
605 if (status[4] != RTEMS_SUCCESSFUL)
607 if (status[4] != RTEMS_SUCCESSFUL)
606 {
608 {
607 PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[4])
609 PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[4])
608 }
610 }
609
611
610 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
612 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
611 if (status[5] != RTEMS_SUCCESSFUL)
613 if (status[5] != RTEMS_SUCCESSFUL)
612 {
614 {
613 PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[5])
615 PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[5])
614 }
616 }
615
617
616 status[6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode );
618 status[6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode );
617 if (status[6] != RTEMS_SUCCESSFUL)
619 if (status[6] != RTEMS_SUCCESSFUL)
618 {
620 {
619 PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[6])
621 PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[6])
620 }
622 }
621
623
622 status[7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode );
624 status[7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode );
623 if (status[7] != RTEMS_SUCCESSFUL)
625 if (status[7] != RTEMS_SUCCESSFUL)
624 {
626 {
625 PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7])
627 PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7])
626 }
628 }
627
629
628 status[8] = rtems_task_restart( Task_id[TASKID_AVF2], 1 );
630 status[8] = rtems_task_restart( Task_id[TASKID_AVF2], 1 );
629 if (status[8] != RTEMS_SUCCESSFUL)
631 if (status[8] != RTEMS_SUCCESSFUL)
630 {
632 {
631 PRINTF1("in restart_science_task *** AVF2 ERR %d\n", status[8])
633 PRINTF1("in restart_science_task *** AVF2 ERR %d\n", status[8])
632 }
634 }
633
635
634 status[9] = rtems_task_restart( Task_id[TASKID_PRC2], 1 );
636 status[9] = rtems_task_restart( Task_id[TASKID_PRC2], 1 );
635 if (status[9] != RTEMS_SUCCESSFUL)
637 if (status[9] != RTEMS_SUCCESSFUL)
636 {
638 {
637 PRINTF1("in restart_science_task *** PRC2 ERR %d\n", status[9])
639 PRINTF1("in restart_science_task *** PRC2 ERR %d\n", status[9])
638 }
640 }
639
641
640 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) ||
642 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) ||
641 (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) ||
643 (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) ||
642 (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ||
644 (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ||
643 (status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) ||
645 (status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) ||
644 (status[8] != RTEMS_SUCCESSFUL) || (status[9] != RTEMS_SUCCESSFUL) )
646 (status[8] != RTEMS_SUCCESSFUL) || (status[9] != RTEMS_SUCCESSFUL) )
645 {
647 {
646 ret = RTEMS_UNSATISFIED;
648 ret = RTEMS_UNSATISFIED;
647 }
649 }
648
650
649 return ret;
651 return ret;
650 }
652 }
651
653
652 int suspend_science_tasks()
654 int suspend_science_tasks()
653 {
655 {
654 /** This function suspends the science tasks.
656 /** This function suspends the science tasks.
655 *
657 *
656 * @return RTEMS directive status codes:
658 * @return RTEMS directive status codes:
657 * - RTEMS_SUCCESSFUL - task restarted successfully
659 * - RTEMS_SUCCESSFUL - task restarted successfully
658 * - RTEMS_INVALID_ID - task id invalid
660 * - RTEMS_INVALID_ID - task id invalid
659 * - RTEMS_ALREADY_SUSPENDED - task already suspended
661 * - RTEMS_ALREADY_SUSPENDED - task already suspended
660 *
662 *
661 */
663 */
662
664
663 rtems_status_code status;
665 rtems_status_code status;
664
666
665 status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0
667 status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0
666 if (status != RTEMS_SUCCESSFUL)
668 if (status != RTEMS_SUCCESSFUL)
667 {
669 {
668 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
670 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
669 }
671 }
670 if (status == RTEMS_SUCCESSFUL) // suspend PRC0
672 if (status == RTEMS_SUCCESSFUL) // suspend PRC0
671 {
673 {
672 status = rtems_task_suspend( Task_id[TASKID_PRC0] );
674 status = rtems_task_suspend( Task_id[TASKID_PRC0] );
673 if (status != RTEMS_SUCCESSFUL)
675 if (status != RTEMS_SUCCESSFUL)
674 {
676 {
675 PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status)
677 PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status)
676 }
678 }
677 }
679 }
678 if (status == RTEMS_SUCCESSFUL) // suspend AVF1
680 if (status == RTEMS_SUCCESSFUL) // suspend AVF1
679 {
681 {
680 status = rtems_task_suspend( Task_id[TASKID_AVF1] );
682 status = rtems_task_suspend( Task_id[TASKID_AVF1] );
681 if (status != RTEMS_SUCCESSFUL)
683 if (status != RTEMS_SUCCESSFUL)
682 {
684 {
683 PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status)
685 PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status)
684 }
686 }
685 }
687 }
686 if (status == RTEMS_SUCCESSFUL) // suspend PRC1
688 if (status == RTEMS_SUCCESSFUL) // suspend PRC1
687 {
689 {
688 status = rtems_task_suspend( Task_id[TASKID_PRC1] );
690 status = rtems_task_suspend( Task_id[TASKID_PRC1] );
689 if (status != RTEMS_SUCCESSFUL)
691 if (status != RTEMS_SUCCESSFUL)
690 {
692 {
691 PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status)
693 PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status)
692 }
694 }
693 }
695 }
694 if (status == RTEMS_SUCCESSFUL) // suspend AVF2
696 if (status == RTEMS_SUCCESSFUL) // suspend AVF2
695 {
697 {
696 status = rtems_task_suspend( Task_id[TASKID_AVF2] );
698 status = rtems_task_suspend( Task_id[TASKID_AVF2] );
697 if (status != RTEMS_SUCCESSFUL)
699 if (status != RTEMS_SUCCESSFUL)
698 {
700 {
699 PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status)
701 PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status)
700 }
702 }
701 }
703 }
702 if (status == RTEMS_SUCCESSFUL) // suspend PRC2
704 if (status == RTEMS_SUCCESSFUL) // suspend PRC2
703 {
705 {
704 status = rtems_task_suspend( Task_id[TASKID_PRC2] );
706 status = rtems_task_suspend( Task_id[TASKID_PRC2] );
705 if (status != RTEMS_SUCCESSFUL)
707 if (status != RTEMS_SUCCESSFUL)
706 {
708 {
707 PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status)
709 PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status)
708 }
710 }
709 }
711 }
710 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
712 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
711 {
713 {
712 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
714 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
713 if (status != RTEMS_SUCCESSFUL)
715 if (status != RTEMS_SUCCESSFUL)
714 {
716 {
715 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
717 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
716 }
718 }
717 }
719 }
718 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
720 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
719 {
721 {
720 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
722 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
721 if (status != RTEMS_SUCCESSFUL)
723 if (status != RTEMS_SUCCESSFUL)
722 {
724 {
723 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
725 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
724 }
726 }
725 }
727 }
726 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
728 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
727 {
729 {
728 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
730 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
729 if (status != RTEMS_SUCCESSFUL)
731 if (status != RTEMS_SUCCESSFUL)
730 {
732 {
731 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
733 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
732 }
734 }
733 }
735 }
734 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
736 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
735 {
737 {
736 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
738 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
737 if (status != RTEMS_SUCCESSFUL)
739 if (status != RTEMS_SUCCESSFUL)
738 {
740 {
739 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
741 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
740 }
742 }
741 }
743 }
742
744
743 return status;
745 return status;
744 }
746 }
745
747
746 void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime )
748 void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime )
747 {
749 {
748 WFP_reset_current_ring_nodes();
750 WFP_reset_current_ring_nodes();
749 reset_waveform_picker_regs();
751 reset_waveform_picker_regs();
750 set_wfp_burst_enable_register( mode );
752 set_wfp_burst_enable_register( mode );
751
753
752 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
754 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
753 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
755 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
754
756
755 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000]
757 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000]
756 if (transitionCoarseTime == 0)
758 if (transitionCoarseTime == 0)
757 {
759 {
758 waveform_picker_regs->start_date = time_management_regs->coarse_time;
760 waveform_picker_regs->start_date = time_management_regs->coarse_time;
759 }
761 }
760 else
762 else
761 {
763 {
762 waveform_picker_regs->start_date = transitionCoarseTime;
764 waveform_picker_regs->start_date = transitionCoarseTime;
763 }
765 }
764
766
765 PRINTF1("commutation coarse time = %d\n", transitionCoarseTime)
767 PRINTF1("commutation coarse time = %d\n", transitionCoarseTime)
766 }
768 }
767
769
768 void launch_spectral_matrix( void )
770 void launch_spectral_matrix( void )
769 {
771 {
770 SM_reset_current_ring_nodes();
772 SM_reset_current_ring_nodes();
771 reset_spectral_matrix_regs();
773 reset_spectral_matrix_regs();
772 reset_nb_sm();
774 reset_nb_sm();
773
775
774 struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO;
776 struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO;
775 grgpio_regs->io_port_direction_register =
777 grgpio_regs->io_port_direction_register =
776 grgpio_regs->io_port_direction_register | 0x01; // [0000 0001], 0 = output disabled, 1 = output enabled
778 grgpio_regs->io_port_direction_register | 0x01; // [0000 0001], 0 = output disabled, 1 = output enabled
777 grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfffffffe; // set the bit 0 to 0
779 grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfffffffe; // set the bit 0 to 0
778 set_irq_on_new_ready_matrix( 1 );
780 set_irq_on_new_ready_matrix( 1 );
779 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX );
781 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX );
780 LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX );
782 LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX );
781 set_run_matrix_spectral( 1 );
783 set_run_matrix_spectral( 1 );
782 }
784 }
783
785
784 void launch_spectral_matrix_simu( void )
786 void launch_spectral_matrix_simu( void )
785 {
787 {
786 SM_reset_current_ring_nodes();
788 SM_reset_current_ring_nodes();
787 reset_spectral_matrix_regs();
789 reset_spectral_matrix_regs();
788 reset_nb_sm();
790 reset_nb_sm();
789
791
790 // Spectral Matrices simulator
792 // Spectral Matrices simulator
791 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
793 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
792 LEON_Clear_interrupt( IRQ_SM_SIMULATOR );
794 LEON_Clear_interrupt( IRQ_SM_SIMULATOR );
793 LEON_Unmask_interrupt( IRQ_SM_SIMULATOR );
795 LEON_Unmask_interrupt( IRQ_SM_SIMULATOR );
794 }
796 }
795
797
796 void set_irq_on_new_ready_matrix( unsigned char value )
798 void set_irq_on_new_ready_matrix( unsigned char value )
797 {
799 {
798 if (value == 1)
800 if (value == 1)
799 {
801 {
800 spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01;
802 spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01;
801 }
803 }
802 else
804 else
803 {
805 {
804 spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110
806 spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110
805 }
807 }
806 }
808 }
807
809
808 void set_run_matrix_spectral( unsigned char value )
810 void set_run_matrix_spectral( unsigned char value )
809 {
811 {
810 if (value == 1)
812 if (value == 1)
811 {
813 {
812 spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1
814 spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1
813 }
815 }
814 else
816 else
815 {
817 {
816 spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0
818 spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0
817 }
819 }
818 }
820 }
819
821
820 //****************
822 //****************
821 // CLOSING ACTIONS
823 // CLOSING ACTIONS
822 void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time )
824 void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time )
823 {
825 {
824 /** This function is used to update the HK packets statistics after a successful TC execution.
826 /** This function is used to update the HK packets statistics after a successful TC execution.
825 *
827 *
826 * @param TC points to the TC being processed
828 * @param TC points to the TC being processed
827 * @param time is the time used to date the TC execution
829 * @param time is the time used to date the TC execution
828 *
830 *
829 */
831 */
830
832
831 unsigned int val;
833 unsigned int val;
832
834
833 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
835 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
834 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
836 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
835 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
837 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
836 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
838 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
837 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
839 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
838 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
840 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
839 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
841 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
840 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
842 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
841 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
843 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
842 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
844 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
843 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
845 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
844 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
846 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
845
847
846 val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1];
848 val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1];
847 val++;
849 val++;
848 housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8);
850 housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8);
849 housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val);
851 housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val);
850 }
852 }
851
853
852 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time )
854 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time )
853 {
855 {
854 /** This function is used to update the HK packets statistics after a TC rejection.
856 /** This function is used to update the HK packets statistics after a TC rejection.
855 *
857 *
856 * @param TC points to the TC being processed
858 * @param TC points to the TC being processed
857 * @param time is the time used to date the TC rejection
859 * @param time is the time used to date the TC rejection
858 *
860 *
859 */
861 */
860
862
861 unsigned int val;
863 unsigned int val;
862
864
863 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
865 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
864 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
866 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
865 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
867 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
866 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
868 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
867 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
869 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
868 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
870 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
869 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
871 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
870 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
872 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
871 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
873 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
872 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
874 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
873 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
875 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
874 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
876 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
875
877
876 val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1];
878 val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1];
877 val++;
879 val++;
878 housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8);
880 housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8);
879 housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val);
881 housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val);
880 }
882 }
881
883
882 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id )
884 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id )
883 {
885 {
884 /** This function is the last step of the TC execution workflow.
886 /** This function is the last step of the TC execution workflow.
885 *
887 *
886 * @param TC points to the TC being processed
888 * @param TC points to the TC being processed
887 * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
889 * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
888 * @param queue_id is the id of the RTEMS message queue used to send TM packets
890 * @param queue_id is the id of the RTEMS message queue used to send TM packets
889 * @param time is the time used to date the TC execution
891 * @param time is the time used to date the TC execution
890 *
892 *
891 */
893 */
892
894
893 unsigned char requestedMode;
895 unsigned char requestedMode;
894
896
895 if (result == LFR_SUCCESSFUL)
897 if (result == LFR_SUCCESSFUL)
896 {
898 {
897 if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
899 if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
898 &
900 &
899 !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
901 !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
900 )
902 )
901 {
903 {
902 send_tm_lfr_tc_exe_success( TC, queue_id );
904 send_tm_lfr_tc_exe_success( TC, queue_id );
903 }
905 }
904 if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) )
906 if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) )
905 {
907 {
906 //**********************************
908 //**********************************
907 // UPDATE THE LFRMODE LOCAL VARIABLE
909 // UPDATE THE LFRMODE LOCAL VARIABLE
908 requestedMode = TC->dataAndCRC[1];
910 requestedMode = TC->dataAndCRC[1];
909 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d);
911 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d);
910 updateLFRCurrentMode();
912 updateLFRCurrentMode();
911 }
913 }
912 }
914 }
913 else if (result == LFR_EXE_ERROR)
915 else if (result == LFR_EXE_ERROR)
914 {
916 {
915 send_tm_lfr_tc_exe_error( TC, queue_id );
917 send_tm_lfr_tc_exe_error( TC, queue_id );
916 }
918 }
917 }
919 }
918
920
919 //***************************
921 //***************************
920 // Interrupt Service Routines
922 // Interrupt Service Routines
921 rtems_isr commutation_isr1( rtems_vector_number vector )
923 rtems_isr commutation_isr1( rtems_vector_number vector )
922 {
924 {
923 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
925 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
924 printf("In commutation_isr1 *** Error sending event to DUMB\n");
926 printf("In commutation_isr1 *** Error sending event to DUMB\n");
925 }
927 }
926 }
928 }
927
929
928 rtems_isr commutation_isr2( rtems_vector_number vector )
930 rtems_isr commutation_isr2( rtems_vector_number vector )
929 {
931 {
930 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
932 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
931 printf("In commutation_isr2 *** Error sending event to DUMB\n");
933 printf("In commutation_isr2 *** Error sending event to DUMB\n");
932 }
934 }
933 }
935 }
934
936
935 //****************
937 //****************
936 // OTHER FUNCTIONS
938 // OTHER FUNCTIONS
937 void updateLFRCurrentMode()
939 void updateLFRCurrentMode()
938 {
940 {
939 /** This function updates the value of the global variable lfrCurrentMode.
941 /** This function updates the value of the global variable lfrCurrentMode.
940 *
942 *
941 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
943 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
942 *
944 *
943 */
945 */
944 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
946 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
945 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
947 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
946 }
948 }
947
949
@@ -1,1323 +1,1367
1 /** Functions and tasks related to waveform packet generation.
1 /** Functions and tasks related to waveform packet generation.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to handle waveforms, in snapshot or continuous format.\n
6 * A group of functions to handle waveforms, in snapshot or continuous format.\n
7 *
7 *
8 */
8 */
9
9
10 #include "wf_handler.h"
10 #include "wf_handler.h"
11
11
12 //*****************
12 //*****************
13 // waveform headers
13 // waveform headers
14 // SWF
14 // SWF
15 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7];
15 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7];
16 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
16 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
17 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
17 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
18 // CWF
18 // CWF
19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[ NB_PACKETS_PER_GROUP_OF_CWF ];
19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[ NB_PACKETS_PER_GROUP_OF_CWF ];
20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[ NB_PACKETS_PER_GROUP_OF_CWF ];
20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[ NB_PACKETS_PER_GROUP_OF_CWF ];
21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[ NB_PACKETS_PER_GROUP_OF_CWF ];
21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[ NB_PACKETS_PER_GROUP_OF_CWF ];
22 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[ NB_PACKETS_PER_GROUP_OF_CWF ];
22 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[ NB_PACKETS_PER_GROUP_OF_CWF ];
23 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[ NB_PACKETS_PER_GROUP_OF_CWF_LIGHT ];
23 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[ NB_PACKETS_PER_GROUP_OF_CWF_LIGHT ];
24
24
25 //**************
25 //**************
26 // waveform ring
26 // waveform ring
27 ring_node waveform_ring_f0[NB_RING_NODES_F0];
27 ring_node waveform_ring_f0[NB_RING_NODES_F0];
28 ring_node waveform_ring_f1[NB_RING_NODES_F1];
28 ring_node waveform_ring_f1[NB_RING_NODES_F1];
29 ring_node waveform_ring_f2[NB_RING_NODES_F2];
29 ring_node waveform_ring_f2[NB_RING_NODES_F2];
30 ring_node waveform_ring_f3[NB_RING_NODES_F3];
30 ring_node waveform_ring_f3[NB_RING_NODES_F3];
31 ring_node *current_ring_node_f0;
31 ring_node *current_ring_node_f0;
32 ring_node *ring_node_to_send_swf_f0;
32 ring_node *ring_node_to_send_swf_f0;
33 ring_node *current_ring_node_f1;
33 ring_node *current_ring_node_f1;
34 ring_node *ring_node_to_send_swf_f1;
34 ring_node *ring_node_to_send_swf_f1;
35 ring_node *ring_node_to_send_cwf_f1;
35 ring_node *ring_node_to_send_cwf_f1;
36 ring_node *current_ring_node_f2;
36 ring_node *current_ring_node_f2;
37 ring_node *ring_node_to_send_swf_f2;
37 ring_node *ring_node_to_send_swf_f2;
38 ring_node *ring_node_to_send_cwf_f2;
38 ring_node *ring_node_to_send_cwf_f2;
39 ring_node *current_ring_node_f3;
39 ring_node *current_ring_node_f3;
40 ring_node *ring_node_to_send_cwf_f3;
40 ring_node *ring_node_to_send_cwf_f3;
41
41
42 bool extractSWF = false;
42 bool extractSWF = false;
43 bool swf_f0_ready = false;
43 bool swf_f0_ready = false;
44 bool swf_f1_ready = false;
44 bool swf_f1_ready = false;
45 bool swf_f2_ready = false;
45 bool swf_f2_ready = false;
46
46
47 int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
47 int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
48
48
49 //*********************
49 //*********************
50 // Interrupt SubRoutine
50 // Interrupt SubRoutine
51
51
52 void reset_extractSWF( void )
52 void reset_extractSWF( void )
53 {
53 {
54 extractSWF = false;
54 extractSWF = false;
55 swf_f0_ready = false;
55 swf_f0_ready = false;
56 swf_f1_ready = false;
56 swf_f1_ready = false;
57 swf_f2_ready = false;
57 swf_f2_ready = false;
58 }
58 }
59
59
60 rtems_isr waveforms_isr( rtems_vector_number vector )
60 rtems_isr waveforms_isr( rtems_vector_number vector )
61 {
61 {
62 /** This is the interrupt sub routine called by the waveform picker core.
62 /** This is the interrupt sub routine called by the waveform picker core.
63 *
63 *
64 * This ISR launch different actions depending mainly on two pieces of information:
64 * This ISR launch different actions depending mainly on two pieces of information:
65 * 1. the values read in the registers of the waveform picker.
65 * 1. the values read in the registers of the waveform picker.
66 * 2. the current LFR mode.
66 * 2. the current LFR mode.
67 *
67 *
68 */
68 */
69
69
70 rtems_status_code status;
70 rtems_status_code status;
71 rtems_status_code spare_status;
71 rtems_status_code spare_status;
72
72
73 if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_BURST) // in BURST the data are used to place v, e1 and e2 in the HK packet
73 if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_BURST) // in BURST the data are used to place v, e1 and e2 in the HK packet
74 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
74 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
75 { // in modes other than STANDBY and BURST, send the CWF_F3 data
75 { // in modes other than STANDBY and BURST, send the CWF_F3 data
76 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
76 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
77 // (1) change the receiving buffer for the waveform picker
77 // (1) change the receiving buffer for the waveform picker
78 ring_node_to_send_cwf_f3 = current_ring_node_f3;
78 ring_node_to_send_cwf_f3 = current_ring_node_f3;
79 current_ring_node_f3 = current_ring_node_f3->next;
79 current_ring_node_f3 = current_ring_node_f3->next;
80 waveform_picker_regs->addr_data_f3 = current_ring_node_f3->buffer_address;
80 waveform_picker_regs->addr_data_f3 = current_ring_node_f3->buffer_address;
81 // (2) send an event for the waveforms transmission
81 // (2) send an event for the waveforms transmission
82 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
82 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
83 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
83 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
84 }
84 }
85 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2);
85 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2);
86 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
86 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
87 }
87 }
88 }
88 }
89
89
90 switch(lfrCurrentMode)
90 switch(lfrCurrentMode)
91 {
91 {
92 //********
92 //********
93 // STANDBY
93 // STANDBY
94 case(LFR_MODE_STANDBY):
94 case(LFR_MODE_STANDBY):
95 break;
95 break;
96
96
97 //******
97 //******
98 // NORMAL
98 // NORMAL
99 case(LFR_MODE_NORMAL):
99 case(LFR_MODE_NORMAL):
100 if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits
100 if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits
101 {
101 {
102 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
102 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
103 }
103 }
104 if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits
104 if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits
105 {
105 {
106 // change F0 ring node
106 // change F0 ring node
107 ring_node_to_send_swf_f0 = current_ring_node_f0;
107 ring_node_to_send_swf_f0 = current_ring_node_f0;
108 current_ring_node_f0 = current_ring_node_f0->next;
108 current_ring_node_f0 = current_ring_node_f0->next;
109 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address;
109 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address;
110 // change F1 ring node
110 // change F1 ring node
111 ring_node_to_send_swf_f1 = current_ring_node_f1;
111 ring_node_to_send_swf_f1 = current_ring_node_f1;
112 current_ring_node_f1 = current_ring_node_f1->next;
112 current_ring_node_f1 = current_ring_node_f1->next;
113 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
113 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
114 // change F2 ring node
114 // change F2 ring node
115 ring_node_to_send_swf_f2 = current_ring_node_f2;
115 ring_node_to_send_swf_f2 = current_ring_node_f2;
116 current_ring_node_f2 = current_ring_node_f2->next;
116 current_ring_node_f2 = current_ring_node_f2->next;
117 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
117 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
118 //
118 //
119 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL)
119 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL)
120 {
120 {
121 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
121 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
122 }
122 }
123 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000]
123 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000]
124 }
124 }
125 break;
125 break;
126
126
127 //******
127 //******
128 // BURST
128 // BURST
129 case(LFR_MODE_BURST):
129 case(LFR_MODE_BURST):
130 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
130 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
131 // (1) change the receiving buffer for the waveform picker
131 // (1) change the receiving buffer for the waveform picker
132 ring_node_to_send_cwf_f2 = current_ring_node_f2;
132 ring_node_to_send_cwf_f2 = current_ring_node_f2;
133 current_ring_node_f2 = current_ring_node_f2->next;
133 current_ring_node_f2 = current_ring_node_f2->next;
134 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
134 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
135 // (2) send an event for the waveforms transmission
135 // (2) send an event for the waveforms transmission
136 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
136 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
137 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
137 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
138 }
138 }
139 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
139 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
140 }
140 }
141 break;
141 break;
142
142
143 //*****
143 //*****
144 // SBM1
144 // SBM1
145 case(LFR_MODE_SBM1):
145 case(LFR_MODE_SBM1):
146 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
146 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
147 // (1) change the receiving buffer for the waveform picker
147 // (1) change the receiving buffer for the waveform picker
148 ring_node_to_send_cwf_f1 = current_ring_node_f1;
148 ring_node_to_send_cwf_f1 = current_ring_node_f1;
149 current_ring_node_f1 = current_ring_node_f1->next;
149 current_ring_node_f1 = current_ring_node_f1->next;
150 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
150 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
151 // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed)
151 // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed)
152 status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 );
152 status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 );
153 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0
153 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0
154 }
154 }
155 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
155 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
156 swf_f0_ready = true;
156 swf_f0_ready = true;
157 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0
157 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0
158 }
158 }
159 if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit
159 if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit
160 swf_f2_ready = true;
160 swf_f2_ready = true;
161 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0
161 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0
162 }
162 }
163 break;
163 break;
164
164
165 //*****
165 //*****
166 // SBM2
166 // SBM2
167 case(LFR_MODE_SBM2):
167 case(LFR_MODE_SBM2):
168 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
168 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
169 // (1) change the receiving buffer for the waveform picker
169 // (1) change the receiving buffer for the waveform picker
170 ring_node_to_send_cwf_f2 = current_ring_node_f2;
170 ring_node_to_send_cwf_f2 = current_ring_node_f2;
171 current_ring_node_f2 = current_ring_node_f2->next;
171 current_ring_node_f2 = current_ring_node_f2->next;
172 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
172 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
173 // (2) send an event for the waveforms transmission
173 // (2) send an event for the waveforms transmission
174 status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 );
174 status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 );
175 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
175 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
176 }
176 }
177 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
177 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
178 swf_f0_ready = true;
178 swf_f0_ready = true;
179 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0
179 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0
180 }
180 }
181 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
181 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
182 swf_f1_ready = true;
182 swf_f1_ready = true;
183 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0
183 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0
184 }
184 }
185 break;
185 break;
186
186
187 //********
187 //********
188 // DEFAULT
188 // DEFAULT
189 default:
189 default:
190 break;
190 break;
191 }
191 }
192 }
192 }
193
193
194 //************
194 //************
195 // RTEMS TASKS
195 // RTEMS TASKS
196
196
197 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
197 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
198 {
198 {
199 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
199 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
200 *
200 *
201 * @param unused is the starting argument of the RTEMS task
201 * @param unused is the starting argument of the RTEMS task
202 *
202 *
203 * The following data packets are sent by this task:
203 * The following data packets are sent by this task:
204 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
204 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
205 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
205 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
206 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
206 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
207 *
207 *
208 */
208 */
209
209
210 rtems_event_set event_out;
210 rtems_event_set event_out;
211 rtems_id queue_id;
211 rtems_id queue_id;
212 rtems_status_code status;
212 rtems_status_code status;
213 bool resynchronisationEngaged;
214
215 resynchronisationEngaged = false;
213
216
214 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
217 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
215 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
218 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
216 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
219 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
217
220
218 status = get_message_queue_id_send( &queue_id );
221 status = get_message_queue_id_send( &queue_id );
219 if (status != RTEMS_SUCCESSFUL)
222 if (status != RTEMS_SUCCESSFUL)
220 {
223 {
221 PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status)
224 PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status)
222 }
225 }
223
226
224 BOOT_PRINTF("in WFRM ***\n")
227 BOOT_PRINTF("in WFRM ***\n")
225
228
226 while(1){
229 while(1){
227 // wait for an RTEMS_EVENT
230 // wait for an RTEMS_EVENT
228 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
231 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
229 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
232 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
230 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
233 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
234 if(resynchronisationEngaged == false)
235 { // engage resynchronisation
236 snapshot_resynchronization( (unsigned char *) ring_node_to_send_swf_f0->buffer_address);
237 resynchronisationEngaged = true;
238 }
239 else
240 { // reset delta_snapshot to the nominal value
241 PRINTF("no resynchronisation, reset delta_snapshot to the nominal value\n")
242 set_wfp_delta_snapshot();
243 resynchronisationEngaged = false;
244 }
245 //
246
231 if (event_out == RTEMS_EVENT_MODE_NORMAL)
247 if (event_out == RTEMS_EVENT_MODE_NORMAL)
232 {
248 {
233 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n")
249 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n")
234 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
250 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
235 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
251 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
236 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
252 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
237 }
253 }
238 if (event_out == RTEMS_EVENT_MODE_SBM1)
254 if (event_out == RTEMS_EVENT_MODE_SBM1)
239 {
255 {
240 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n")
256 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n")
241 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
257 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
242 send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F1, headerSWF_F1, queue_id);
258 send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F1, headerSWF_F1, queue_id);
243 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
259 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
244 }
260 }
245 if (event_out == RTEMS_EVENT_MODE_SBM2)
261 if (event_out == RTEMS_EVENT_MODE_SBM2)
246 {
262 {
247 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n")
263 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n")
248 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
264 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
249 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
265 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
250 send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F2, headerSWF_F2, queue_id);
266 send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F2, headerSWF_F2, queue_id);
251 }
267 }
252 }
268 }
253 }
269 }
254
270
255 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
271 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
256 {
272 {
257 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
273 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
258 *
274 *
259 * @param unused is the starting argument of the RTEMS task
275 * @param unused is the starting argument of the RTEMS task
260 *
276 *
261 * The following data packet is sent by this task:
277 * The following data packet is sent by this task:
262 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
278 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
263 *
279 *
264 */
280 */
265
281
266 rtems_event_set event_out;
282 rtems_event_set event_out;
267 rtems_id queue_id;
283 rtems_id queue_id;
268 rtems_status_code status;
284 rtems_status_code status;
269
285
270 init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 );
286 init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 );
271 init_header_continuous_cwf3_light_table( headerCWF_F3_light );
287 init_header_continuous_cwf3_light_table( headerCWF_F3_light );
272
288
273 status = get_message_queue_id_send( &queue_id );
289 status = get_message_queue_id_send( &queue_id );
274 if (status != RTEMS_SUCCESSFUL)
290 if (status != RTEMS_SUCCESSFUL)
275 {
291 {
276 PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status)
292 PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status)
277 }
293 }
278
294
279 BOOT_PRINTF("in CWF3 ***\n")
295 BOOT_PRINTF("in CWF3 ***\n")
280
296
281 while(1){
297 while(1){
282 // wait for an RTEMS_EVENT
298 // wait for an RTEMS_EVENT
283 rtems_event_receive( RTEMS_EVENT_0,
299 rtems_event_receive( RTEMS_EVENT_0,
284 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
300 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
285 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
301 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
286 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode==LFR_MODE_SBM2) )
302 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode==LFR_MODE_SBM2) )
287 {
303 {
288 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
304 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
289 {
305 {
290 PRINTF("send CWF_LONG_F3\n")
306 PRINTF("send CWF_LONG_F3\n")
291 send_waveform_CWF(
307 send_waveform_CWF(
292 (volatile int*) ring_node_to_send_cwf_f3->buffer_address,
308 (volatile int*) ring_node_to_send_cwf_f3->buffer_address,
293 SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
309 SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
294 }
310 }
295 else
311 else
296 {
312 {
297 PRINTF("send CWF_F3 (light)\n")
313 PRINTF("send CWF_F3 (light)\n")
298 send_waveform_CWF3_light(
314 send_waveform_CWF3_light(
299 (volatile int*) ring_node_to_send_cwf_f3->buffer_address,
315 (volatile int*) ring_node_to_send_cwf_f3->buffer_address,
300 headerCWF_F3_light, queue_id );
316 headerCWF_F3_light, queue_id );
301 }
317 }
302
318
303 }
319 }
304 else
320 else
305 {
321 {
306 PRINTF1("in CWF3 *** lfrCurrentMode is %d, no data will be sent\n", lfrCurrentMode)
322 PRINTF1("in CWF3 *** lfrCurrentMode is %d, no data will be sent\n", lfrCurrentMode)
307 }
323 }
308 }
324 }
309 }
325 }
310
326
311 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
327 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
312 {
328 {
313 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
329 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
314 *
330 *
315 * @param unused is the starting argument of the RTEMS task
331 * @param unused is the starting argument of the RTEMS task
316 *
332 *
317 * The following data packet is sent by this function:
333 * The following data packet is sent by this function:
318 * - TM_LFR_SCIENCE_BURST_CWF_F2
334 * - TM_LFR_SCIENCE_BURST_CWF_F2
319 * - TM_LFR_SCIENCE_SBM2_CWF_F2
335 * - TM_LFR_SCIENCE_SBM2_CWF_F2
320 *
336 *
321 */
337 */
322
338
323 rtems_event_set event_out;
339 rtems_event_set event_out;
324 rtems_id queue_id;
340 rtems_id queue_id;
325 rtems_status_code status;
341 rtems_status_code status;
326
342
327 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
343 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
328 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
344 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
329
345
330 status = get_message_queue_id_send( &queue_id );
346 status = get_message_queue_id_send( &queue_id );
331 if (status != RTEMS_SUCCESSFUL)
347 if (status != RTEMS_SUCCESSFUL)
332 {
348 {
333 PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status)
349 PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status)
334 }
350 }
335
351
336 BOOT_PRINTF("in CWF2 ***\n")
352 BOOT_PRINTF("in CWF2 ***\n")
337
353
338 while(1){
354 while(1){
339 // wait for an RTEMS_EVENT
355 // wait for an RTEMS_EVENT
340 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
356 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
341 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
357 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
342 if (event_out == RTEMS_EVENT_MODE_BURST)
358 if (event_out == RTEMS_EVENT_MODE_BURST)
343 {
359 {
344 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
360 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
345 }
361 }
346 if (event_out == RTEMS_EVENT_MODE_SBM2)
362 if (event_out == RTEMS_EVENT_MODE_SBM2)
347 {
363 {
348 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
364 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
349 // launch snapshot extraction if needed
365 // launch snapshot extraction if needed
350 if (extractSWF == true)
366 if (extractSWF == true)
351 {
367 {
352 ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2;
368 ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2;
353 // extract the snapshot
369 // extract the snapshot
354 build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 );
370 build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 );
355 // send the snapshot when built
371 // send the snapshot when built
356 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 );
372 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 );
357 extractSWF = false;
373 extractSWF = false;
358 }
374 }
359 if (swf_f0_ready && swf_f1_ready)
375 if (swf_f0_ready && swf_f1_ready)
360 {
376 {
361 extractSWF = true;
377 extractSWF = true;
362 swf_f0_ready = false;
378 swf_f0_ready = false;
363 swf_f1_ready = false;
379 swf_f1_ready = false;
364 }
380 }
365 }
381 }
366 }
382 }
367 }
383 }
368
384
369 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
385 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
370 {
386 {
371 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
387 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
372 *
388 *
373 * @param unused is the starting argument of the RTEMS task
389 * @param unused is the starting argument of the RTEMS task
374 *
390 *
375 * The following data packet is sent by this function:
391 * The following data packet is sent by this function:
376 * - TM_LFR_SCIENCE_SBM1_CWF_F1
392 * - TM_LFR_SCIENCE_SBM1_CWF_F1
377 *
393 *
378 */
394 */
379
395
380 rtems_event_set event_out;
396 rtems_event_set event_out;
381 rtems_id queue_id;
397 rtems_id queue_id;
382 rtems_status_code status;
398 rtems_status_code status;
383
399
384 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
400 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
385
401
386 status = get_message_queue_id_send( &queue_id );
402 status = get_message_queue_id_send( &queue_id );
387 if (status != RTEMS_SUCCESSFUL)
403 if (status != RTEMS_SUCCESSFUL)
388 {
404 {
389 PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status)
405 PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status)
390 }
406 }
391
407
392 BOOT_PRINTF("in CWF1 ***\n")
408 BOOT_PRINTF("in CWF1 ***\n")
393
409
394 while(1){
410 while(1){
395 // wait for an RTEMS_EVENT
411 // wait for an RTEMS_EVENT
396 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
412 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
397 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
413 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
398 send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
414 send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
399 // launch snapshot extraction if needed
415 // launch snapshot extraction if needed
400 if (extractSWF == true)
416 if (extractSWF == true)
401 {
417 {
402 ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1;
418 ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1;
403 // launch the snapshot extraction
419 // launch the snapshot extraction
404 status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 );
420 status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 );
405 extractSWF = false;
421 extractSWF = false;
406 }
422 }
407 if (swf_f0_ready == true)
423 if (swf_f0_ready == true)
408 {
424 {
409 extractSWF = true;
425 extractSWF = true;
410 swf_f0_ready = false; // this step shall be executed only one time
426 swf_f0_ready = false; // this step shall be executed only one time
411 }
427 }
412 if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction
428 if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction
413 {
429 {
414 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 );
430 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 );
415 swf_f1_ready = false;
431 swf_f1_ready = false;
416 swf_f2_ready = false;
432 swf_f2_ready = false;
417 }
433 }
418 }
434 }
419 }
435 }
420
436
421 rtems_task swbd_task(rtems_task_argument argument)
437 rtems_task swbd_task(rtems_task_argument argument)
422 {
438 {
423 /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers.
439 /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers.
424 *
440 *
425 * @param unused is the starting argument of the RTEMS task
441 * @param unused is the starting argument of the RTEMS task
426 *
442 *
427 */
443 */
428
444
429 rtems_event_set event_out;
445 rtems_event_set event_out;
430
446
431 BOOT_PRINTF("in SWBD ***\n")
447 BOOT_PRINTF("in SWBD ***\n")
432
448
433 while(1){
449 while(1){
434 // wait for an RTEMS_EVENT
450 // wait for an RTEMS_EVENT
435 rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2,
451 rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2,
436 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
452 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
437 if (event_out == RTEMS_EVENT_MODE_SBM1)
453 if (event_out == RTEMS_EVENT_MODE_SBM1)
438 {
454 {
439 build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 );
455 build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 );
440 swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent
456 swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent
441 }
457 }
442 else
458 else
443 {
459 {
444 PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out)
460 PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out)
445 }
461 }
446 }
462 }
447 }
463 }
448
464
449 //******************
465 //******************
450 // general functions
466 // general functions
451
467
452 void WFP_init_rings( void )
468 void WFP_init_rings( void )
453 {
469 {
454 // F0 RING
470 // F0 RING
455 init_waveform_ring( waveform_ring_f0, NB_RING_NODES_F0, wf_snap_f0 );
471 init_waveform_ring( waveform_ring_f0, NB_RING_NODES_F0, wf_snap_f0 );
456 // F1 RING
472 // F1 RING
457 init_waveform_ring( waveform_ring_f1, NB_RING_NODES_F1, wf_snap_f1 );
473 init_waveform_ring( waveform_ring_f1, NB_RING_NODES_F1, wf_snap_f1 );
458 // F2 RING
474 // F2 RING
459 init_waveform_ring( waveform_ring_f2, NB_RING_NODES_F2, wf_snap_f2 );
475 init_waveform_ring( waveform_ring_f2, NB_RING_NODES_F2, wf_snap_f2 );
460 // F3 RING
476 // F3 RING
461 init_waveform_ring( waveform_ring_f3, NB_RING_NODES_F3, wf_cont_f3 );
477 init_waveform_ring( waveform_ring_f3, NB_RING_NODES_F3, wf_cont_f3 );
462
478
463 DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0)
479 DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0)
464 DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1)
480 DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1)
465 DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2)
481 DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2)
466 DEBUG_PRINTF1("waveform_ring_f3 @%x\n", (unsigned int) waveform_ring_f3)
482 DEBUG_PRINTF1("waveform_ring_f3 @%x\n", (unsigned int) waveform_ring_f3)
467 }
483 }
468
484
469 void init_waveform_ring(ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] )
485 void init_waveform_ring(ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] )
470 {
486 {
471 unsigned char i;
487 unsigned char i;
472
488
473 waveform_ring[0].next = (ring_node*) &waveform_ring[ 1 ];
489 waveform_ring[0].next = (ring_node*) &waveform_ring[ 1 ];
474 waveform_ring[0].previous = (ring_node*) &waveform_ring[ nbNodes - 1 ];
490 waveform_ring[0].previous = (ring_node*) &waveform_ring[ nbNodes - 1 ];
475 waveform_ring[0].buffer_address = (int) &wfrm[0];
491 waveform_ring[0].buffer_address = (int) &wfrm[0];
476
492
477 waveform_ring[nbNodes-1].next = (ring_node*) &waveform_ring[ 0 ];
493 waveform_ring[nbNodes-1].next = (ring_node*) &waveform_ring[ 0 ];
478 waveform_ring[nbNodes-1].previous = (ring_node*) &waveform_ring[ nbNodes - 2 ];
494 waveform_ring[nbNodes-1].previous = (ring_node*) &waveform_ring[ nbNodes - 2 ];
479 waveform_ring[nbNodes-1].buffer_address = (int) &wfrm[ (nbNodes-1) * WFRM_BUFFER ];
495 waveform_ring[nbNodes-1].buffer_address = (int) &wfrm[ (nbNodes-1) * WFRM_BUFFER ];
480
496
481 for(i=1; i<nbNodes-1; i++)
497 for(i=1; i<nbNodes-1; i++)
482 {
498 {
483 waveform_ring[i].next = (ring_node*) &waveform_ring[ i + 1 ];
499 waveform_ring[i].next = (ring_node*) &waveform_ring[ i + 1 ];
484 waveform_ring[i].previous = (ring_node*) &waveform_ring[ i - 1 ];
500 waveform_ring[i].previous = (ring_node*) &waveform_ring[ i - 1 ];
485 waveform_ring[i].buffer_address = (int) &wfrm[ i * WFRM_BUFFER ];
501 waveform_ring[i].buffer_address = (int) &wfrm[ i * WFRM_BUFFER ];
486 }
502 }
487 }
503 }
488
504
489 void WFP_reset_current_ring_nodes( void )
505 void WFP_reset_current_ring_nodes( void )
490 {
506 {
491 current_ring_node_f0 = waveform_ring_f0;
507 current_ring_node_f0 = waveform_ring_f0;
492 ring_node_to_send_swf_f0 = waveform_ring_f0;
508 ring_node_to_send_swf_f0 = waveform_ring_f0;
493
509
494 current_ring_node_f1 = waveform_ring_f1;
510 current_ring_node_f1 = waveform_ring_f1;
495 ring_node_to_send_cwf_f1 = waveform_ring_f1;
511 ring_node_to_send_cwf_f1 = waveform_ring_f1;
496 ring_node_to_send_swf_f1 = waveform_ring_f1;
512 ring_node_to_send_swf_f1 = waveform_ring_f1;
497
513
498 current_ring_node_f2 = waveform_ring_f2;
514 current_ring_node_f2 = waveform_ring_f2;
499 ring_node_to_send_cwf_f2 = waveform_ring_f2;
515 ring_node_to_send_cwf_f2 = waveform_ring_f2;
500 ring_node_to_send_swf_f2 = waveform_ring_f2;
516 ring_node_to_send_swf_f2 = waveform_ring_f2;
501
517
502 current_ring_node_f3 = waveform_ring_f3;
518 current_ring_node_f3 = waveform_ring_f3;
503 ring_node_to_send_cwf_f3 = waveform_ring_f3;
519 ring_node_to_send_cwf_f3 = waveform_ring_f3;
504 }
520 }
505
521
506 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
522 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
507 {
523 {
508 unsigned char i;
524 unsigned char i;
509 int return_value;
525 int return_value;
510
526
511 return_value = LFR_SUCCESSFUL;
527 return_value = LFR_SUCCESSFUL;
512
528
513 for (i=0; i<7; i++)
529 for (i=0; i<7; i++)
514 {
530 {
515 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
531 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
516 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
532 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
517 headerSWF[ i ].reserved = DEFAULT_RESERVED;
533 headerSWF[ i ].reserved = DEFAULT_RESERVED;
518 headerSWF[ i ].userApplication = CCSDS_USER_APP;
534 headerSWF[ i ].userApplication = CCSDS_USER_APP;
519 headerSWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
535 headerSWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
520 headerSWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
536 headerSWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
521 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
537 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
522 if (i == 6)
538 if (i == 6)
523 {
539 {
524 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8);
540 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8);
525 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 );
541 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 );
526 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8);
542 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8);
527 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 );
543 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 );
528 }
544 }
529 else
545 else
530 {
546 {
531 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8);
547 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8);
532 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 );
548 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 );
533 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8);
549 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8);
534 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 );
550 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 );
535 }
551 }
536 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
552 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
537 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
553 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
538 headerSWF[ i ].pktNr = i+1; // PKT_NR
554 headerSWF[ i ].pktNr = i+1; // PKT_NR
539 // DATA FIELD HEADER
555 // DATA FIELD HEADER
540 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
556 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
541 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
557 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
542 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
558 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
543 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
559 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
544 // AUXILIARY DATA HEADER
560 // AUXILIARY DATA HEADER
545 headerSWF[ i ].time[0] = 0x00;
561 headerSWF[ i ].time[0] = 0x00;
546 headerSWF[ i ].time[0] = 0x00;
562 headerSWF[ i ].time[0] = 0x00;
547 headerSWF[ i ].time[0] = 0x00;
563 headerSWF[ i ].time[0] = 0x00;
548 headerSWF[ i ].time[0] = 0x00;
564 headerSWF[ i ].time[0] = 0x00;
549 headerSWF[ i ].time[0] = 0x00;
565 headerSWF[ i ].time[0] = 0x00;
550 headerSWF[ i ].time[0] = 0x00;
566 headerSWF[ i ].time[0] = 0x00;
551 headerSWF[ i ].sid = sid;
567 headerSWF[ i ].sid = sid;
552 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
568 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
553 }
569 }
554
570
555 return return_value;
571 return return_value;
556 }
572 }
557
573
558 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
574 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
559 {
575 {
560 unsigned int i;
576 unsigned int i;
561 int return_value;
577 int return_value;
562
578
563 return_value = LFR_SUCCESSFUL;
579 return_value = LFR_SUCCESSFUL;
564
580
565 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++)
581 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++)
566 {
582 {
567 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
583 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
568 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
584 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
569 headerCWF[ i ].reserved = DEFAULT_RESERVED;
585 headerCWF[ i ].reserved = DEFAULT_RESERVED;
570 headerCWF[ i ].userApplication = CCSDS_USER_APP;
586 headerCWF[ i ].userApplication = CCSDS_USER_APP;
571 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
587 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
572 {
588 {
573 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2 >> 8);
589 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2 >> 8);
574 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2);
590 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2);
575 }
591 }
576 else
592 else
577 {
593 {
578 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
594 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
579 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
595 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
580 }
596 }
581 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
597 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
582 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8);
598 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8);
583 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 );
599 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 );
584 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8);
600 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8);
585 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF );
601 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF );
586 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
602 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
587 // DATA FIELD HEADER
603 // DATA FIELD HEADER
588 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
604 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
589 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
605 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
590 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
606 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
591 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
607 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
592 // AUXILIARY DATA HEADER
608 // AUXILIARY DATA HEADER
593 headerCWF[ i ].sid = sid;
609 headerCWF[ i ].sid = sid;
594 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
610 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
595 headerCWF[ i ].time[0] = 0x00;
611 headerCWF[ i ].time[0] = 0x00;
596 headerCWF[ i ].time[0] = 0x00;
612 headerCWF[ i ].time[0] = 0x00;
597 headerCWF[ i ].time[0] = 0x00;
613 headerCWF[ i ].time[0] = 0x00;
598 headerCWF[ i ].time[0] = 0x00;
614 headerCWF[ i ].time[0] = 0x00;
599 headerCWF[ i ].time[0] = 0x00;
615 headerCWF[ i ].time[0] = 0x00;
600 headerCWF[ i ].time[0] = 0x00;
616 headerCWF[ i ].time[0] = 0x00;
601 }
617 }
602
618
603 return return_value;
619 return return_value;
604 }
620 }
605
621
606 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
622 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
607 {
623 {
608 unsigned int i;
624 unsigned int i;
609 int return_value;
625 int return_value;
610
626
611 return_value = LFR_SUCCESSFUL;
627 return_value = LFR_SUCCESSFUL;
612
628
613 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++)
629 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++)
614 {
630 {
615 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
631 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
616 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
632 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
617 headerCWF[ i ].reserved = DEFAULT_RESERVED;
633 headerCWF[ i ].reserved = DEFAULT_RESERVED;
618 headerCWF[ i ].userApplication = CCSDS_USER_APP;
634 headerCWF[ i ].userApplication = CCSDS_USER_APP;
619
635
620 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
636 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
621 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
637 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
622
638
623 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
639 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
624 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8);
640 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8);
625 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 );
641 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 );
626 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8);
642 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8);
627 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 );
643 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 );
628
644
629 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
645 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
630 // DATA FIELD HEADER
646 // DATA FIELD HEADER
631 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
647 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
632 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
648 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
633 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
649 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
634 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
650 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
635 // AUXILIARY DATA HEADER
651 // AUXILIARY DATA HEADER
636 headerCWF[ i ].sid = SID_NORM_CWF_F3;
652 headerCWF[ i ].sid = SID_NORM_CWF_F3;
637 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
653 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
638 headerCWF[ i ].time[0] = 0x00;
654 headerCWF[ i ].time[0] = 0x00;
639 headerCWF[ i ].time[0] = 0x00;
655 headerCWF[ i ].time[0] = 0x00;
640 headerCWF[ i ].time[0] = 0x00;
656 headerCWF[ i ].time[0] = 0x00;
641 headerCWF[ i ].time[0] = 0x00;
657 headerCWF[ i ].time[0] = 0x00;
642 headerCWF[ i ].time[0] = 0x00;
658 headerCWF[ i ].time[0] = 0x00;
643 headerCWF[ i ].time[0] = 0x00;
659 headerCWF[ i ].time[0] = 0x00;
644 }
660 }
645
661
646 return return_value;
662 return return_value;
647 }
663 }
648
664
649 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
665 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
650 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
666 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
651 {
667 {
652 /** This function sends SWF CCSDS packets (F2, F1 or F0).
668 /** This function sends SWF CCSDS packets (F2, F1 or F0).
653 *
669 *
654 * @param waveform points to the buffer containing the data that will be send.
670 * @param waveform points to the buffer containing the data that will be send.
655 * @param sid is the source identifier of the data that will be sent.
671 * @param sid is the source identifier of the data that will be sent.
656 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
672 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
657 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
673 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
658 * contain information to setup the transmission of the data packets.
674 * contain information to setup the transmission of the data packets.
659 *
675 *
660 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
676 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
661 *
677 *
662 */
678 */
663
679
664 unsigned int i;
680 unsigned int i;
665 int ret;
681 int ret;
666 unsigned int coarseTime;
682 unsigned int coarseTime;
667 unsigned int fineTime;
683 unsigned int fineTime;
668 rtems_status_code status;
684 rtems_status_code status;
669 spw_ioctl_pkt_send spw_ioctl_send_SWF;
685 spw_ioctl_pkt_send spw_ioctl_send_SWF;
670
686
671 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
687 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
672 spw_ioctl_send_SWF.options = 0;
688 spw_ioctl_send_SWF.options = 0;
673
689
674 ret = LFR_DEFAULT;
690 ret = LFR_DEFAULT;
675
691
676 coarseTime = waveform[0];
692 coarseTime = waveform[0];
677 fineTime = waveform[1];
693 fineTime = waveform[1];
678
694
679 for (i=0; i<7; i++) // send waveform
695 for (i=0; i<7; i++) // send waveform
680 {
696 {
681 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET];
697 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET];
682 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
698 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
683 // BUILD THE DATA
699 // BUILD THE DATA
684 if (i==6) {
700 if (i==6) {
685 spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK;
701 spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK;
686 }
702 }
687 else {
703 else {
688 spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK;
704 spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK;
689 }
705 }
690 // SET PACKET SEQUENCE COUNTER
706 // SET PACKET SEQUENCE COUNTER
691 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
707 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
692 // SET PACKET TIME
708 // SET PACKET TIME
693 compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime );
709 compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime );
694 //
710 //
695 headerSWF[ i ].time[0] = headerSWF[ i ].acquisitionTime[0];
711 headerSWF[ i ].time[0] = headerSWF[ i ].acquisitionTime[0];
696 headerSWF[ i ].time[1] = headerSWF[ i ].acquisitionTime[1];
712 headerSWF[ i ].time[1] = headerSWF[ i ].acquisitionTime[1];
697 headerSWF[ i ].time[2] = headerSWF[ i ].acquisitionTime[2];
713 headerSWF[ i ].time[2] = headerSWF[ i ].acquisitionTime[2];
698 headerSWF[ i ].time[3] = headerSWF[ i ].acquisitionTime[3];
714 headerSWF[ i ].time[3] = headerSWF[ i ].acquisitionTime[3];
699 headerSWF[ i ].time[4] = headerSWF[ i ].acquisitionTime[4];
715 headerSWF[ i ].time[4] = headerSWF[ i ].acquisitionTime[4];
700 headerSWF[ i ].time[5] = headerSWF[ i ].acquisitionTime[5];
716 headerSWF[ i ].time[5] = headerSWF[ i ].acquisitionTime[5];
701 // SEND PACKET
717 // SEND PACKET
702 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
718 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
703 if (status != RTEMS_SUCCESSFUL) {
719 if (status != RTEMS_SUCCESSFUL) {
704 printf("%d-%d, ERR %d\n", sid, i, (int) status);
720 printf("%d-%d, ERR %d\n", sid, i, (int) status);
705 ret = LFR_DEFAULT;
721 ret = LFR_DEFAULT;
706 }
722 }
707 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
723 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
708 }
724 }
709
725
710 return ret;
726 return ret;
711 }
727 }
712
728
713 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
729 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
714 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
730 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
715 {
731 {
716 /** This function sends CWF CCSDS packets (F2, F1 or F0).
732 /** This function sends CWF CCSDS packets (F2, F1 or F0).
717 *
733 *
718 * @param waveform points to the buffer containing the data that will be send.
734 * @param waveform points to the buffer containing the data that will be send.
719 * @param sid is the source identifier of the data that will be sent.
735 * @param sid is the source identifier of the data that will be sent.
720 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
736 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
721 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
737 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
722 * contain information to setup the transmission of the data packets.
738 * contain information to setup the transmission of the data packets.
723 *
739 *
724 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
740 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
725 *
741 *
726 */
742 */
727
743
728 unsigned int i;
744 unsigned int i;
729 int ret;
745 int ret;
730 unsigned int coarseTime;
746 unsigned int coarseTime;
731 unsigned int fineTime;
747 unsigned int fineTime;
732 rtems_status_code status;
748 rtems_status_code status;
733 spw_ioctl_pkt_send spw_ioctl_send_CWF;
749 spw_ioctl_pkt_send spw_ioctl_send_CWF;
734
750
735 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
751 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
736 spw_ioctl_send_CWF.options = 0;
752 spw_ioctl_send_CWF.options = 0;
737
753
738 ret = LFR_DEFAULT;
754 ret = LFR_DEFAULT;
739
755
740 coarseTime = waveform[0];
756 coarseTime = waveform[0];
741 fineTime = waveform[1];
757 fineTime = waveform[1];
742
758
743 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform
759 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform
744 {
760 {
745 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET];
761 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET];
746 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
762 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
747 // BUILD THE DATA
763 // BUILD THE DATA
748 spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK;
764 spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK;
749 // SET PACKET SEQUENCE COUNTER
765 // SET PACKET SEQUENCE COUNTER
750 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
766 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
751 // SET PACKET TIME
767 // SET PACKET TIME
752 compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime);
768 compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime);
753 //
769 //
754 headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0];
770 headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0];
755 headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1];
771 headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1];
756 headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2];
772 headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2];
757 headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3];
773 headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3];
758 headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4];
774 headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4];
759 headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5];
775 headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5];
760 // SEND PACKET
776 // SEND PACKET
761 if (sid == SID_NORM_CWF_LONG_F3)
777 if (sid == SID_NORM_CWF_LONG_F3)
762 {
778 {
763 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
779 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
764 if (status != RTEMS_SUCCESSFUL) {
780 if (status != RTEMS_SUCCESSFUL) {
765 printf("%d-%d, ERR %d\n", sid, i, (int) status);
781 printf("%d-%d, ERR %d\n", sid, i, (int) status);
766 ret = LFR_DEFAULT;
782 ret = LFR_DEFAULT;
767 }
783 }
768 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
784 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
769 }
785 }
770 else
786 else
771 {
787 {
772 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
788 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
773 if (status != RTEMS_SUCCESSFUL) {
789 if (status != RTEMS_SUCCESSFUL) {
774 printf("%d-%d, ERR %d\n", sid, i, (int) status);
790 printf("%d-%d, ERR %d\n", sid, i, (int) status);
775 ret = LFR_DEFAULT;
791 ret = LFR_DEFAULT;
776 }
792 }
777 }
793 }
778 }
794 }
779
795
780 return ret;
796 return ret;
781 }
797 }
782
798
783 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
799 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
784 {
800 {
785 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
801 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
786 *
802 *
787 * @param waveform points to the buffer containing the data that will be send.
803 * @param waveform points to the buffer containing the data that will be send.
788 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
804 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
789 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
805 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
790 * contain information to setup the transmission of the data packets.
806 * contain information to setup the transmission of the data packets.
791 *
807 *
792 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
808 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
793 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
809 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
794 *
810 *
795 */
811 */
796
812
797 unsigned int i;
813 unsigned int i;
798 int ret;
814 int ret;
799 unsigned int coarseTime;
815 unsigned int coarseTime;
800 unsigned int fineTime;
816 unsigned int fineTime;
801 rtems_status_code status;
817 rtems_status_code status;
802 spw_ioctl_pkt_send spw_ioctl_send_CWF;
818 spw_ioctl_pkt_send spw_ioctl_send_CWF;
803 char *sample;
819 char *sample;
804
820
805 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
821 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
806 spw_ioctl_send_CWF.options = 0;
822 spw_ioctl_send_CWF.options = 0;
807
823
808 ret = LFR_DEFAULT;
824 ret = LFR_DEFAULT;
809
825
810 //**********************
826 //**********************
811 // BUILD CWF3_light DATA
827 // BUILD CWF3_light DATA
812 for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
828 for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
813 {
829 {
814 sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
830 sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
815 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ];
831 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ];
816 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ];
832 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ];
817 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ];
833 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ];
818 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ];
834 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ];
819 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ];
835 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ];
820 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ];
836 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ];
821 }
837 }
822
838
823 coarseTime = waveform[0];
839 coarseTime = waveform[0];
824 fineTime = waveform[1];
840 fineTime = waveform[1];
825
841
826 //*********************
842 //*********************
827 // SEND CWF3_light DATA
843 // SEND CWF3_light DATA
828 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform
844 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform
829 {
845 {
830 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES];
846 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES];
831 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
847 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
832 // BUILD THE DATA
848 // BUILD THE DATA
833 spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK;
849 spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK;
834 // SET PACKET SEQUENCE COUNTER
850 // SET PACKET SEQUENCE COUNTER
835 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
851 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
836 // SET PACKET TIME
852 // SET PACKET TIME
837 compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime );
853 compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime );
838 //
854 //
839 headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0];
855 headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0];
840 headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1];
856 headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1];
841 headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2];
857 headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2];
842 headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3];
858 headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3];
843 headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4];
859 headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4];
844 headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5];
860 headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5];
845 // SEND PACKET
861 // SEND PACKET
846 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
862 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
847 if (status != RTEMS_SUCCESSFUL) {
863 if (status != RTEMS_SUCCESSFUL) {
848 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
864 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
849 ret = LFR_DEFAULT;
865 ret = LFR_DEFAULT;
850 }
866 }
851 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
867 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
852 }
868 }
853
869
854 return ret;
870 return ret;
855 }
871 }
856
872
857 void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime,
873 void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime,
858 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime )
874 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime )
859 {
875 {
860 unsigned long long int acquisitionTimeAsLong;
876 unsigned long long int acquisitionTimeAsLong;
861 unsigned char localAcquisitionTime[6];
877 unsigned char localAcquisitionTime[6];
862 double deltaT;
878 double deltaT;
863
879
864 deltaT = 0.;
880 deltaT = 0.;
865
881
866 localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 24 );
882 localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 24 );
867 localAcquisitionTime[1] = (unsigned char) ( coarseTime >> 16 );
883 localAcquisitionTime[1] = (unsigned char) ( coarseTime >> 16 );
868 localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 8 );
884 localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 8 );
869 localAcquisitionTime[3] = (unsigned char) ( coarseTime );
885 localAcquisitionTime[3] = (unsigned char) ( coarseTime );
870 localAcquisitionTime[4] = (unsigned char) ( fineTime >> 8 );
886 localAcquisitionTime[4] = (unsigned char) ( fineTime >> 8 );
871 localAcquisitionTime[5] = (unsigned char) ( fineTime );
887 localAcquisitionTime[5] = (unsigned char) ( fineTime );
872
888
873 acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 )
889 acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 )
874 + ( (unsigned long long int) localAcquisitionTime[1] << 32 )
890 + ( (unsigned long long int) localAcquisitionTime[1] << 32 )
875 + ( (unsigned long long int) localAcquisitionTime[2] << 24 )
891 + ( (unsigned long long int) localAcquisitionTime[2] << 24 )
876 + ( (unsigned long long int) localAcquisitionTime[3] << 16 )
892 + ( (unsigned long long int) localAcquisitionTime[3] << 16 )
877 + ( (unsigned long long int) localAcquisitionTime[4] << 8 )
893 + ( (unsigned long long int) localAcquisitionTime[4] << 8 )
878 + ( (unsigned long long int) localAcquisitionTime[5] );
894 + ( (unsigned long long int) localAcquisitionTime[5] );
879
895
880 switch( sid )
896 switch( sid )
881 {
897 {
882 case SID_NORM_SWF_F0:
898 case SID_NORM_SWF_F0:
883 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ;
899 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ;
884 break;
900 break;
885
901
886 case SID_NORM_SWF_F1:
902 case SID_NORM_SWF_F1:
887 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ;
903 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ;
888 break;
904 break;
889
905
890 case SID_NORM_SWF_F2:
906 case SID_NORM_SWF_F2:
891 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ;
907 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ;
892 break;
908 break;
893
909
894 case SID_SBM1_CWF_F1:
910 case SID_SBM1_CWF_F1:
895 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ;
911 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ;
896 break;
912 break;
897
913
898 case SID_SBM2_CWF_F2:
914 case SID_SBM2_CWF_F2:
899 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
915 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
900 break;
916 break;
901
917
902 case SID_BURST_CWF_F2:
918 case SID_BURST_CWF_F2:
903 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
919 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
904 break;
920 break;
905
921
906 case SID_NORM_CWF_F3:
922 case SID_NORM_CWF_F3:
907 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ;
923 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ;
908 break;
924 break;
909
925
910 case SID_NORM_CWF_LONG_F3:
926 case SID_NORM_CWF_LONG_F3:
911 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ;
927 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ;
912 break;
928 break;
913
929
914 default:
930 default:
915 PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid)
931 PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid)
916 deltaT = 0.;
932 deltaT = 0.;
917 break;
933 break;
918 }
934 }
919
935
920 acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT;
936 acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT;
921 //
937 //
922 acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40);
938 acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40);
923 acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32);
939 acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32);
924 acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24);
940 acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24);
925 acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16);
941 acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16);
926 acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 );
942 acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 );
927 acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong );
943 acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong );
928
944
929 }
945 }
930
946
931 void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel )
947 void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel )
932 {
948 {
933 unsigned int i;
949 unsigned int i;
934 unsigned long long int centerTime_asLong;
950 unsigned long long int centerTime_asLong;
935 unsigned long long int acquisitionTimeF0_asLong;
951 unsigned long long int acquisitionTimeF0_asLong;
936 unsigned long long int acquisitionTime_asLong;
952 unsigned long long int acquisitionTime_asLong;
937 unsigned long long int bufferAcquisitionTime_asLong;
953 unsigned long long int bufferAcquisitionTime_asLong;
938 unsigned char *ptr1;
954 unsigned char *ptr1;
939 unsigned char *ptr2;
955 unsigned char *ptr2;
940 unsigned char *timeCharPtr;
956 unsigned char *timeCharPtr;
941 unsigned char nb_ring_nodes;
957 unsigned char nb_ring_nodes;
942 unsigned long long int frequency_asLong;
958 unsigned long long int frequency_asLong;
943 unsigned long long int nbTicksPerSample_asLong;
959 unsigned long long int nbTicksPerSample_asLong;
944 unsigned long long int nbSamplesPart1_asLong;
960 unsigned long long int nbSamplesPart1_asLong;
945 unsigned long long int sampleOffset_asLong;
961 unsigned long long int sampleOffset_asLong;
946
962
947 unsigned int deltaT_F0;
963 unsigned int deltaT_F0;
948 unsigned int deltaT_F1;
964 unsigned int deltaT_F1;
949 unsigned long long int deltaT_F2;
965 unsigned long long int deltaT_F2;
950
966
951 deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667;
967 deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667;
952 deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384;
968 deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384;
953 deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144;
969 deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144;
954 sampleOffset_asLong = 0x00;
970 sampleOffset_asLong = 0x00;
955
971
956 // (1) get the f0 acquisition time
972 // (1) get the f0 acquisition time
957 build_acquisition_time( &acquisitionTimeF0_asLong, current_ring_node_f0 );
973 acquisitionTimeF0_asLong = get_acquisition_time( (unsigned char *) current_ring_node_f0->buffer_address );
958
974
959 // (2) compute the central reference time
975 // (2) compute the central reference time
960 centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0;
976 centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0;
961
977
962 // (3) compute the acquisition time of the current snapshot
978 // (3) compute the acquisition time of the current snapshot
963 switch(frequencyChannel)
979 switch(frequencyChannel)
964 {
980 {
965 case 1: // 1 is for F1 = 4096 Hz
981 case 1: // 1 is for F1 = 4096 Hz
966 acquisitionTime_asLong = centerTime_asLong - deltaT_F1;
982 acquisitionTime_asLong = centerTime_asLong - deltaT_F1;
967 nb_ring_nodes = NB_RING_NODES_F1;
983 nb_ring_nodes = NB_RING_NODES_F1;
968 frequency_asLong = 4096;
984 frequency_asLong = 4096;
969 nbTicksPerSample_asLong = 16; // 65536 / 4096;
985 nbTicksPerSample_asLong = 16; // 65536 / 4096;
970 break;
986 break;
971 case 2: // 2 is for F2 = 256 Hz
987 case 2: // 2 is for F2 = 256 Hz
972 acquisitionTime_asLong = centerTime_asLong - deltaT_F2;
988 acquisitionTime_asLong = centerTime_asLong - deltaT_F2;
973 nb_ring_nodes = NB_RING_NODES_F2;
989 nb_ring_nodes = NB_RING_NODES_F2;
974 frequency_asLong = 256;
990 frequency_asLong = 256;
975 nbTicksPerSample_asLong = 256; // 65536 / 256;
991 nbTicksPerSample_asLong = 256; // 65536 / 256;
976 break;
992 break;
977 default:
993 default:
978 acquisitionTime_asLong = centerTime_asLong;
994 acquisitionTime_asLong = centerTime_asLong;
979 frequency_asLong = 256;
995 frequency_asLong = 256;
980 nbTicksPerSample_asLong = 256;
996 nbTicksPerSample_asLong = 256;
981 break;
997 break;
982 }
998 }
983
999
984 //****************************************************************************
1000 //****************************************************************************
985 // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong
1001 // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong
986 for (i=0; i<nb_ring_nodes; i++)
1002 for (i=0; i<nb_ring_nodes; i++)
987 {
1003 {
988 PRINTF1("%d ... ", i)
1004 PRINTF1("%d ... ", i)
989 build_acquisition_time( &bufferAcquisitionTime_asLong, ring_node_to_send );
1005 bufferAcquisitionTime_asLong = get_acquisition_time( (unsigned char *) ring_node_to_send->buffer_address );
990 if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong)
1006 if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong)
991 {
1007 {
992 PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong)
1008 PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong)
993 break;
1009 break;
994 }
1010 }
995 ring_node_to_send = ring_node_to_send->previous;
1011 ring_node_to_send = ring_node_to_send->previous;
996 }
1012 }
997
1013
998 // (5) compute the number of samples to take in the current buffer
1014 // (5) compute the number of samples to take in the current buffer
999 sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16;
1015 sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16;
1000 nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong;
1016 nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong;
1001 PRINTF2("sampleOffset_asLong = %llx, nbSamplesPart1_asLong = %llx\n", sampleOffset_asLong, nbSamplesPart1_asLong)
1017 PRINTF2("sampleOffset_asLong = %llx, nbSamplesPart1_asLong = %llx\n", sampleOffset_asLong, nbSamplesPart1_asLong)
1002
1018
1003 // (6) compute the final acquisition time
1019 // (6) compute the final acquisition time
1004 acquisitionTime_asLong = bufferAcquisitionTime_asLong +
1020 acquisitionTime_asLong = bufferAcquisitionTime_asLong +
1005 sampleOffset_asLong * nbTicksPerSample_asLong;
1021 sampleOffset_asLong * nbTicksPerSample_asLong;
1006
1022
1007 // (7) copy the acquisition time at the beginning of the extrated snapshot
1023 // (7) copy the acquisition time at the beginning of the extrated snapshot
1008 ptr1 = (unsigned char*) &acquisitionTime_asLong;
1024 ptr1 = (unsigned char*) &acquisitionTime_asLong;
1009 ptr2 = (unsigned char*) wf_snap_extracted;
1025 ptr2 = (unsigned char*) wf_snap_extracted;
1010 ptr2[0] = ptr1[ 0 + 2 ];
1026 ptr2[0] = ptr1[ 0 + 2 ];
1011 ptr2[1] = ptr1[ 1 + 2 ];
1027 ptr2[1] = ptr1[ 1 + 2 ];
1012 ptr2[2] = ptr1[ 2 + 2 ];
1028 ptr2[2] = ptr1[ 2 + 2 ];
1013 ptr2[3] = ptr1[ 3 + 2 ];
1029 ptr2[3] = ptr1[ 3 + 2 ];
1014 ptr2[6] = ptr1[ 4 + 2 ];
1030 ptr2[6] = ptr1[ 4 + 2 ];
1015 ptr2[7] = ptr1[ 5 + 2 ];
1031 ptr2[7] = ptr1[ 5 + 2 ];
1016
1032
1017 // re set the synchronization bit
1033 // re set the synchronization bit
1018 timeCharPtr = (unsigned char*) ring_node_to_send->buffer_address;
1034 timeCharPtr = (unsigned char*) ring_node_to_send->buffer_address;
1019 ptr2[0] = ptr2[0] | (timeCharPtr[0] & 0x80); // [1000 0000]
1035 ptr2[0] = ptr2[0] | (timeCharPtr[0] & 0x80); // [1000 0000]
1020
1036
1021 if ( (nbSamplesPart1_asLong >= NB_SAMPLES_PER_SNAPSHOT) | (nbSamplesPart1_asLong < 0) )
1037 if ( (nbSamplesPart1_asLong >= NB_SAMPLES_PER_SNAPSHOT) | (nbSamplesPart1_asLong < 0) )
1022 {
1038 {
1023 nbSamplesPart1_asLong = 0;
1039 nbSamplesPart1_asLong = 0;
1024 }
1040 }
1025 // copy the part 1 of the snapshot in the extracted buffer
1041 // copy the part 1 of the snapshot in the extracted buffer
1026 for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ )
1042 for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ )
1027 {
1043 {
1028 wf_snap_extracted[i + TIME_OFFSET] =
1044 wf_snap_extracted[i + TIME_OFFSET] =
1029 ((int*) ring_node_to_send->buffer_address)[i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) + TIME_OFFSET];
1045 ((int*) ring_node_to_send->buffer_address)[i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) + TIME_OFFSET];
1030 }
1046 }
1031 // copy the part 2 of the snapshot in the extracted buffer
1047 // copy the part 2 of the snapshot in the extracted buffer
1032 ring_node_to_send = ring_node_to_send->next;
1048 ring_node_to_send = ring_node_to_send->next;
1033 for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ )
1049 for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ )
1034 {
1050 {
1035 wf_snap_extracted[i + TIME_OFFSET] =
1051 wf_snap_extracted[i + TIME_OFFSET] =
1036 ((int*) ring_node_to_send->buffer_address)[(i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) + TIME_OFFSET];
1052 ((int*) ring_node_to_send->buffer_address)[(i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) + TIME_OFFSET];
1037 }
1053 }
1038 }
1054 }
1039
1055
1040 void build_acquisition_time( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node )
1056 void snapshot_resynchronization( unsigned char *timePtr )
1041 {
1057 {
1042 unsigned char *acquisitionTimeCharPtr;
1058 unsigned long long int acquisitionTime;
1059 unsigned long long int centerTime;
1060 unsigned long long int previousTick;
1061 unsigned long long int nextTick;
1062 unsigned long long int deltaPreviousTick;
1063 unsigned long long int deltaNextTick;
1064 unsigned int deltaTickInF2;
1065 double deltaPrevious;
1066 double deltaNext;
1043
1067
1044 acquisitionTimeCharPtr = (unsigned char*) current_ring_node->buffer_address;
1068 acquisitionTime = get_acquisition_time( timePtr );
1069
1070 // compute center time
1071 centerTime = acquisitionTime + 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667;
1072 previousTick = centerTime - (centerTime & 0xffff);
1073 nextTick = previousTick + 65536;
1045
1074
1046 *acquisitionTimeAslong = 0x00;
1075 deltaPreviousTick = centerTime - previousTick;
1047 *acquisitionTimeAslong = ( (unsigned long long int) (acquisitionTimeCharPtr[0] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit
1076 deltaNextTick = nextTick - centerTime;
1048 + ( (unsigned long long int) acquisitionTimeCharPtr[1] << 32 )
1077
1049 + ( (unsigned long long int) acquisitionTimeCharPtr[2] << 24 )
1078 deltaPrevious = ((double) deltaPreviousTick) / 65536. * 1000.;
1050 + ( (unsigned long long int) acquisitionTimeCharPtr[3] << 16 )
1079 deltaNext = ((double) deltaNextTick) / 65536. * 1000.;
1051 + ( (unsigned long long int) acquisitionTimeCharPtr[6] << 8 )
1080
1052 + ( (unsigned long long int) acquisitionTimeCharPtr[7] );
1081 printf("delta previous = %f ms, delta next = %f ms\n", deltaPrevious, deltaNext);
1082 printf("delta previous = %llu, delta next = %llu\n", deltaPreviousTick, deltaNextTick);
1083
1084 // which tick is the closest
1085 if (deltaPreviousTick > deltaNextTick)
1086 {
1087 deltaTickInF2 = floor( (deltaNext * 256. / 1000.) ); // the division by 2 is important here
1088 waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot + deltaTickInF2;
1089 printf("correction of = + %u\n", deltaTickInF2);
1090 }
1091 else
1092 {
1093 deltaTickInF2 = floor( (deltaPrevious * 256. / 1000.) ); // the division by 2 is important here
1094 waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot - deltaTickInF2;
1095 printf("correction of = - %u\n", deltaTickInF2);
1096 }
1053 }
1097 }
1054
1098
1055 //**************
1099 //**************
1056 // wfp registers
1100 // wfp registers
1057 void reset_wfp_burst_enable(void)
1101 void reset_wfp_burst_enable(void)
1058 {
1102 {
1059 /** This function resets the waveform picker burst_enable register.
1103 /** This function resets the waveform picker burst_enable register.
1060 *
1104 *
1061 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
1105 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
1062 *
1106 *
1063 */
1107 */
1064
1108
1065 waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1109 waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1066 }
1110 }
1067
1111
1068 void reset_wfp_status( void )
1112 void reset_wfp_status( void )
1069 {
1113 {
1070 /** This function resets the waveform picker status register.
1114 /** This function resets the waveform picker status register.
1071 *
1115 *
1072 * All status bits are set to 0 [new_err full_err full].
1116 * All status bits are set to 0 [new_err full_err full].
1073 *
1117 *
1074 */
1118 */
1075
1119
1076 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1120 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1077 }
1121 }
1078
1122
1079 void reset_waveform_picker_regs(void)
1123 void reset_waveform_picker_regs(void)
1080 {
1124 {
1081 /** This function resets the waveform picker module registers.
1125 /** This function resets the waveform picker module registers.
1082 *
1126 *
1083 * The registers affected by this function are located at the following offset addresses:
1127 * The registers affected by this function are located at the following offset addresses:
1084 * - 0x00 data_shaping
1128 * - 0x00 data_shaping
1085 * - 0x04 run_burst_enable
1129 * - 0x04 run_burst_enable
1086 * - 0x08 addr_data_f0
1130 * - 0x08 addr_data_f0
1087 * - 0x0C addr_data_f1
1131 * - 0x0C addr_data_f1
1088 * - 0x10 addr_data_f2
1132 * - 0x10 addr_data_f2
1089 * - 0x14 addr_data_f3
1133 * - 0x14 addr_data_f3
1090 * - 0x18 status
1134 * - 0x18 status
1091 * - 0x1C delta_snapshot
1135 * - 0x1C delta_snapshot
1092 * - 0x20 delta_f0
1136 * - 0x20 delta_f0
1093 * - 0x24 delta_f0_2
1137 * - 0x24 delta_f0_2
1094 * - 0x28 delta_f1
1138 * - 0x28 delta_f1
1095 * - 0x2c delta_f2
1139 * - 0x2c delta_f2
1096 * - 0x30 nb_data_by_buffer
1140 * - 0x30 nb_data_by_buffer
1097 * - 0x34 nb_snapshot_param
1141 * - 0x34 nb_snapshot_param
1098 * - 0x38 start_date
1142 * - 0x38 start_date
1099 * - 0x3c nb_word_in_buffer
1143 * - 0x3c nb_word_in_buffer
1100 *
1144 *
1101 */
1145 */
1102
1146
1103 set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW
1147 set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW
1104 reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1148 reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1105 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08
1149 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08
1106 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c
1150 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c
1107 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10
1151 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10
1108 waveform_picker_regs->addr_data_f3 = current_ring_node_f3->buffer_address; // 0x14
1152 waveform_picker_regs->addr_data_f3 = current_ring_node_f3->buffer_address; // 0x14
1109 reset_wfp_status(); // 0x18
1153 reset_wfp_status(); // 0x18
1110 //
1154 //
1111 set_wfp_delta_snapshot(); // 0x1c
1155 set_wfp_delta_snapshot(); // 0x1c
1112 set_wfp_delta_f0_f0_2(); // 0x20, 0x24
1156 set_wfp_delta_f0_f0_2(); // 0x20, 0x24
1113 set_wfp_delta_f1(); // 0x28
1157 set_wfp_delta_f1(); // 0x28
1114 set_wfp_delta_f2(); // 0x2c
1158 set_wfp_delta_f2(); // 0x2c
1115 DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot)
1159 DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot)
1116 DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0)
1160 DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0)
1117 DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2)
1161 DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2)
1118 DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1)
1162 DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1)
1119 DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2)
1163 DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2)
1120 // 2688 = 8 * 336
1164 // 2688 = 8 * 336
1121 waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1
1165 waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1
1122 waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples
1166 waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples
1123 waveform_picker_regs->start_date = 0x00; // 0x38
1167 waveform_picker_regs->start_date = 0x00; // 0x38
1124 waveform_picker_regs->nb_word_in_buffer = 0x1f82; // 0x3c *** 2688 * 3 + 2 = 8066
1168 waveform_picker_regs->nb_word_in_buffer = 0x1f82; // 0x3c *** 2688 * 3 + 2 = 8066
1125 }
1169 }
1126
1170
1127 void set_wfp_data_shaping( void )
1171 void set_wfp_data_shaping( void )
1128 {
1172 {
1129 /** This function sets the data_shaping register of the waveform picker module.
1173 /** This function sets the data_shaping register of the waveform picker module.
1130 *
1174 *
1131 * The value is read from one field of the parameter_dump_packet structure:\n
1175 * The value is read from one field of the parameter_dump_packet structure:\n
1132 * bw_sp0_sp1_r0_r1
1176 * bw_sp0_sp1_r0_r1
1133 *
1177 *
1134 */
1178 */
1135
1179
1136 unsigned char data_shaping;
1180 unsigned char data_shaping;
1137
1181
1138 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
1182 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
1139 // waveform picker : [R1 R0 SP1 SP0 BW]
1183 // waveform picker : [R1 R0 SP1 SP0 BW]
1140
1184
1141 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
1185 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
1142
1186
1143 waveform_picker_regs->data_shaping =
1187 waveform_picker_regs->data_shaping =
1144 ( (data_shaping & 0x10) >> 4 ) // BW
1188 ( (data_shaping & 0x10) >> 4 ) // BW
1145 + ( (data_shaping & 0x08) >> 2 ) // SP0
1189 + ( (data_shaping & 0x08) >> 2 ) // SP0
1146 + ( (data_shaping & 0x04) ) // SP1
1190 + ( (data_shaping & 0x04) ) // SP1
1147 + ( (data_shaping & 0x02) << 2 ) // R0
1191 + ( (data_shaping & 0x02) << 2 ) // R0
1148 + ( (data_shaping & 0x01) << 4 ); // R1
1192 + ( (data_shaping & 0x01) << 4 ); // R1
1149 }
1193 }
1150
1194
1151 void set_wfp_burst_enable_register( unsigned char mode )
1195 void set_wfp_burst_enable_register( unsigned char mode )
1152 {
1196 {
1153 /** This function sets the waveform picker burst_enable register depending on the mode.
1197 /** This function sets the waveform picker burst_enable register depending on the mode.
1154 *
1198 *
1155 * @param mode is the LFR mode to launch.
1199 * @param mode is the LFR mode to launch.
1156 *
1200 *
1157 * The burst bits shall be before the enable bits.
1201 * The burst bits shall be before the enable bits.
1158 *
1202 *
1159 */
1203 */
1160
1204
1161 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1205 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1162 // the burst bits shall be set first, before the enable bits
1206 // the burst bits shall be set first, before the enable bits
1163 switch(mode) {
1207 switch(mode) {
1164 case(LFR_MODE_NORMAL):
1208 case(LFR_MODE_NORMAL):
1165 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable
1209 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable
1166 waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1210 waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1167 break;
1211 break;
1168 case(LFR_MODE_BURST):
1212 case(LFR_MODE_BURST):
1169 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1213 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1170 // waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2
1214 // waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2
1171 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1100] enable f3 AND f2
1215 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1100] enable f3 AND f2
1172 break;
1216 break;
1173 case(LFR_MODE_SBM1):
1217 case(LFR_MODE_SBM1):
1174 waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled
1218 waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled
1175 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1219 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1176 break;
1220 break;
1177 case(LFR_MODE_SBM2):
1221 case(LFR_MODE_SBM2):
1178 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1222 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1179 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1223 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1180 break;
1224 break;
1181 default:
1225 default:
1182 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1226 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1183 break;
1227 break;
1184 }
1228 }
1185 }
1229 }
1186
1230
1187 void set_wfp_delta_snapshot( void )
1231 void set_wfp_delta_snapshot( void )
1188 {
1232 {
1189 /** This function sets the delta_snapshot register of the waveform picker module.
1233 /** This function sets the delta_snapshot register of the waveform picker module.
1190 *
1234 *
1191 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
1235 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
1192 * - sy_lfr_n_swf_p[0]
1236 * - sy_lfr_n_swf_p[0]
1193 * - sy_lfr_n_swf_p[1]
1237 * - sy_lfr_n_swf_p[1]
1194 *
1238 *
1195 */
1239 */
1196
1240
1197 unsigned int delta_snapshot;
1241 unsigned int delta_snapshot;
1198 unsigned int delta_snapshot_in_T2;
1242 unsigned int delta_snapshot_in_T2;
1199
1243
1200 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
1244 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
1201 + parameter_dump_packet.sy_lfr_n_swf_p[1];
1245 + parameter_dump_packet.sy_lfr_n_swf_p[1];
1202
1246
1203 delta_snapshot_in_T2 = delta_snapshot * 256;
1247 delta_snapshot_in_T2 = delta_snapshot * 256;
1204 waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2 - 1; // max 4 bytes
1248 waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2 - 1; // max 4 bytes
1205 }
1249 }
1206
1250
1207 void set_wfp_delta_f0_f0_2( void )
1251 void set_wfp_delta_f0_f0_2( void )
1208 {
1252 {
1209 unsigned int delta_snapshot;
1253 unsigned int delta_snapshot;
1210 unsigned int nb_samples_per_snapshot;
1254 unsigned int nb_samples_per_snapshot;
1211 float delta_f0_in_float;
1255 float delta_f0_in_float;
1212
1256
1213 delta_snapshot = waveform_picker_regs->delta_snapshot;
1257 delta_snapshot = waveform_picker_regs->delta_snapshot;
1214 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1258 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1215 delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.;
1259 delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.;
1216
1260
1217 waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float );
1261 waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float );
1218 waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits
1262 waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits
1219 }
1263 }
1220
1264
1221 void set_wfp_delta_f1( void )
1265 void set_wfp_delta_f1( void )
1222 {
1266 {
1223 unsigned int delta_snapshot;
1267 unsigned int delta_snapshot;
1224 unsigned int nb_samples_per_snapshot;
1268 unsigned int nb_samples_per_snapshot;
1225 float delta_f1_in_float;
1269 float delta_f1_in_float;
1226
1270
1227 delta_snapshot = waveform_picker_regs->delta_snapshot;
1271 delta_snapshot = waveform_picker_regs->delta_snapshot;
1228 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1272 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1229 delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.;
1273 delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.;
1230
1274
1231 waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float );
1275 waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float );
1232 }
1276 }
1233
1277
1234 void set_wfp_delta_f2()
1278 void set_wfp_delta_f2()
1235 {
1279 {
1236 unsigned int delta_snapshot;
1280 unsigned int delta_snapshot;
1237 unsigned int nb_samples_per_snapshot;
1281 unsigned int nb_samples_per_snapshot;
1238
1282
1239 delta_snapshot = waveform_picker_regs->delta_snapshot;
1283 delta_snapshot = waveform_picker_regs->delta_snapshot;
1240 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1284 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1241
1285
1242 waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2;
1286 waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2;
1243 }
1287 }
1244
1288
1245 //*****************
1289 //*****************
1246 // local parameters
1290 // local parameters
1247
1291
1248 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1292 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1249 {
1293 {
1250 /** This function increments the parameter "sequence_cnt" depending on the sid passed in argument.
1294 /** This function increments the parameter "sequence_cnt" depending on the sid passed in argument.
1251 *
1295 *
1252 * @param packet_sequence_control is a pointer toward the parameter sequence_cnt to update.
1296 * @param packet_sequence_control is a pointer toward the parameter sequence_cnt to update.
1253 * @param sid is the source identifier of the packet being updated.
1297 * @param sid is the source identifier of the packet being updated.
1254 *
1298 *
1255 * REQ-LFR-SRS-5240 / SSS-CP-FS-590
1299 * REQ-LFR-SRS-5240 / SSS-CP-FS-590
1256 * The sequence counters shall wrap around from 2^14 to zero.
1300 * The sequence counters shall wrap around from 2^14 to zero.
1257 * The sequence counter shall start at zero at startup.
1301 * The sequence counter shall start at zero at startup.
1258 *
1302 *
1259 * REQ-LFR-SRS-5239 / SSS-CP-FS-580
1303 * REQ-LFR-SRS-5239 / SSS-CP-FS-580
1260 * All TM_LFR_SCIENCE_ packets are sent to ground, i.e. destination id = 0
1304 * All TM_LFR_SCIENCE_ packets are sent to ground, i.e. destination id = 0
1261 *
1305 *
1262 */
1306 */
1263
1307
1264 unsigned short *sequence_cnt;
1308 unsigned short *sequence_cnt;
1265 unsigned short segmentation_grouping_flag;
1309 unsigned short segmentation_grouping_flag;
1266 unsigned short new_packet_sequence_control;
1310 unsigned short new_packet_sequence_control;
1267 rtems_mode initial_mode_set;
1311 rtems_mode initial_mode_set;
1268 rtems_mode current_mode_set;
1312 rtems_mode current_mode_set;
1269 rtems_status_code status;
1313 rtems_status_code status;
1270
1314
1271 //******************************************
1315 //******************************************
1272 // CHANGE THE MODE OF THE CALLING RTEMS TASK
1316 // CHANGE THE MODE OF THE CALLING RTEMS TASK
1273 status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &initial_mode_set );
1317 status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &initial_mode_set );
1274
1318
1275 if ( (sid == SID_NORM_SWF_F0) || (sid == SID_NORM_SWF_F1) || (sid == SID_NORM_SWF_F2)
1319 if ( (sid == SID_NORM_SWF_F0) || (sid == SID_NORM_SWF_F1) || (sid == SID_NORM_SWF_F2)
1276 || (sid == SID_NORM_CWF_F3) || (sid == SID_NORM_CWF_LONG_F3)
1320 || (sid == SID_NORM_CWF_F3) || (sid == SID_NORM_CWF_LONG_F3)
1277 || (sid == SID_BURST_CWF_F2)
1321 || (sid == SID_BURST_CWF_F2)
1278 || (sid == SID_NORM_ASM_F0) || (sid == SID_NORM_ASM_F1) || (sid == SID_NORM_ASM_F2)
1322 || (sid == SID_NORM_ASM_F0) || (sid == SID_NORM_ASM_F1) || (sid == SID_NORM_ASM_F2)
1279 || (sid == SID_NORM_BP1_F0) || (sid == SID_NORM_BP1_F1) || (sid == SID_NORM_BP1_F2)
1323 || (sid == SID_NORM_BP1_F0) || (sid == SID_NORM_BP1_F1) || (sid == SID_NORM_BP1_F2)
1280 || (sid == SID_NORM_BP2_F0) || (sid == SID_NORM_BP2_F1) || (sid == SID_NORM_BP2_F2)
1324 || (sid == SID_NORM_BP2_F0) || (sid == SID_NORM_BP2_F1) || (sid == SID_NORM_BP2_F2)
1281 || (sid == SID_BURST_BP1_F0) || (sid == SID_BURST_BP2_F0)
1325 || (sid == SID_BURST_BP1_F0) || (sid == SID_BURST_BP2_F0)
1282 || (sid == SID_BURST_BP1_F1) || (sid == SID_BURST_BP2_F1) )
1326 || (sid == SID_BURST_BP1_F1) || (sid == SID_BURST_BP2_F1) )
1283 {
1327 {
1284 sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_NORMAL_BURST;
1328 sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_NORMAL_BURST;
1285 }
1329 }
1286 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2)
1330 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2)
1287 || (sid == SID_SBM1_BP1_F0) || (sid == SID_SBM1_BP2_F0)
1331 || (sid == SID_SBM1_BP1_F0) || (sid == SID_SBM1_BP2_F0)
1288 || (sid == SID_SBM2_BP1_F0) || (sid == SID_SBM2_BP2_F0)
1332 || (sid == SID_SBM2_BP1_F0) || (sid == SID_SBM2_BP2_F0)
1289 || (sid == SID_SBM2_BP1_F1) || (sid == SID_SBM2_BP2_F1) )
1333 || (sid == SID_SBM2_BP1_F1) || (sid == SID_SBM2_BP2_F1) )
1290 {
1334 {
1291 sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_SBM1_SBM2;
1335 sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_SBM1_SBM2;
1292 }
1336 }
1293 else
1337 else
1294 {
1338 {
1295 sequence_cnt = (unsigned short *) NULL;
1339 sequence_cnt = (unsigned short *) NULL;
1296 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1340 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1297 }
1341 }
1298
1342
1299 if (sequence_cnt != NULL)
1343 if (sequence_cnt != NULL)
1300 {
1344 {
1301 segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
1345 segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
1302 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1346 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1303
1347
1304 new_packet_sequence_control = segmentation_grouping_flag | (*sequence_cnt) ;
1348 new_packet_sequence_control = segmentation_grouping_flag | (*sequence_cnt) ;
1305
1349
1306 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1350 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1307 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1351 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1308
1352
1309 // increment the sequence counter
1353 // increment the sequence counter
1310 if ( *sequence_cnt < SEQ_CNT_MAX)
1354 if ( *sequence_cnt < SEQ_CNT_MAX)
1311 {
1355 {
1312 *sequence_cnt = *sequence_cnt + 1;
1356 *sequence_cnt = *sequence_cnt + 1;
1313 }
1357 }
1314 else
1358 else
1315 {
1359 {
1316 *sequence_cnt = 0;
1360 *sequence_cnt = 0;
1317 }
1361 }
1318 }
1362 }
1319
1363
1320 //***********************************
1364 //***********************************
1321 // RESET THE MODE OF THE CALLING TASK
1365 // RESET THE MODE OF THE CALLING TASK
1322 status = rtems_task_mode( initial_mode_set, RTEMS_PREEMPT_MASK, &current_mode_set );
1366 status = rtems_task_mode( initial_mode_set, RTEMS_PREEMPT_MASK, &current_mode_set );
1323 }
1367 }
General Comments 0
You need to be logged in to leave comments. Login now