##// END OF EJS Templates
Rev 1.0.0.6
paul -
r128:66da3a6b53f0 VHDLib206
parent child
Show More
@@ -1,1 +1,1
1 294fc10efc0eadddaba53149ef6dd1e60a0587c6 src/basic_parameters
1 b0a4fa20a3c7bd7e9ca1a1c4fda85d3269653bc8 src/basic_parameters
@@ -1,268 +1,268
1 #############################################################################
1 #############################################################################
2 # Makefile for building: bin/fsw
2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Apr 29 14:02:09 2014
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Fri May 2 15:40:46 2014
4 # Project: fsw-qt.pro
4 # Project: fsw-qt.pro
5 # Template: app
5 # Template: app
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
7 #############################################################################
7 #############################################################################
8
8
9 ####### Compiler, tools and options
9 ####### Compiler, tools and options
10
10
11 CC = sparc-rtems-gcc
11 CC = sparc-rtems-gcc
12 CXX = sparc-rtems-g++
12 CXX = sparc-rtems-g++
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=6 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=6 -DPRINT_MESSAGES_ON_CONSOLE
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/basic_parameters
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/basic_parameters
17 LINK = sparc-rtems-g++
17 LINK = sparc-rtems-g++
18 LFLAGS =
18 LFLAGS =
19 LIBS = $(SUBLIBS)
19 LIBS = $(SUBLIBS)
20 AR = sparc-rtems-ar rcs
20 AR = sparc-rtems-ar rcs
21 RANLIB =
21 RANLIB =
22 QMAKE = /usr/bin/qmake-qt4
22 QMAKE = /usr/bin/qmake-qt4
23 TAR = tar -cf
23 TAR = tar -cf
24 COMPRESS = gzip -9f
24 COMPRESS = gzip -9f
25 COPY = cp -f
25 COPY = cp -f
26 SED = sed
26 SED = sed
27 COPY_FILE = $(COPY)
27 COPY_FILE = $(COPY)
28 COPY_DIR = $(COPY) -r
28 COPY_DIR = $(COPY) -r
29 STRIP = sparc-rtems-strip
29 STRIP = sparc-rtems-strip
30 INSTALL_FILE = install -m 644 -p
30 INSTALL_FILE = install -m 644 -p
31 INSTALL_DIR = $(COPY_DIR)
31 INSTALL_DIR = $(COPY_DIR)
32 INSTALL_PROGRAM = install -m 755 -p
32 INSTALL_PROGRAM = install -m 755 -p
33 DEL_FILE = rm -f
33 DEL_FILE = rm -f
34 SYMLINK = ln -f -s
34 SYMLINK = ln -f -s
35 DEL_DIR = rmdir
35 DEL_DIR = rmdir
36 MOVE = mv -f
36 MOVE = mv -f
37 CHK_DIR_EXISTS= test -d
37 CHK_DIR_EXISTS= test -d
38 MKDIR = mkdir -p
38 MKDIR = mkdir -p
39
39
40 ####### Output directory
40 ####### Output directory
41
41
42 OBJECTS_DIR = obj/
42 OBJECTS_DIR = obj/
43
43
44 ####### Files
44 ####### Files
45
45
46 SOURCES = ../src/wf_handler.c \
46 SOURCES = ../src/wf_handler.c \
47 ../src/tc_handler.c \
47 ../src/tc_handler.c \
48 ../src/fsw_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/basic_parameters/basic_parameters.c \
55 ../src/basic_parameters/basic_parameters.c \
56 ../src/processing/fsw_processing.c \
56 ../src/processing/fsw_processing.c \
57 ../src/processing/avf0_prc0.c \
57 ../src/processing/avf0_prc0.c \
58 ../src/processing/avf1_prc1.c \
58 ../src/processing/avf1_prc1.c \
59 ../src/processing/avf2_prc2.c
59 ../src/processing/avf2_prc2.c
60 OBJECTS = obj/wf_handler.o \
60 OBJECTS = obj/wf_handler.o \
61 obj/tc_handler.o \
61 obj/tc_handler.o \
62 obj/fsw_misc.o \
62 obj/fsw_misc.o \
63 obj/fsw_init.o \
63 obj/fsw_init.o \
64 obj/fsw_globals.o \
64 obj/fsw_globals.o \
65 obj/fsw_spacewire.o \
65 obj/fsw_spacewire.o \
66 obj/tc_load_dump_parameters.o \
66 obj/tc_load_dump_parameters.o \
67 obj/tm_lfr_tc_exe.o \
67 obj/tm_lfr_tc_exe.o \
68 obj/tc_acceptance.o \
68 obj/tc_acceptance.o \
69 obj/basic_parameters.o \
69 obj/basic_parameters.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 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
74 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
75 /usr/lib64/qt4/mkspecs/common/linux.conf \
75 /usr/lib64/qt4/mkspecs/common/linux.conf \
76 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
76 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
77 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
77 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
78 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
78 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
79 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
79 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
80 /usr/lib64/qt4/mkspecs/qconfig.pri \
80 /usr/lib64/qt4/mkspecs/qconfig.pri \
81 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
81 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
82 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
82 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
83 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
83 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
84 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
84 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
85 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
85 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
86 sparc.pri \
86 sparc.pri \
87 /usr/lib64/qt4/mkspecs/features/release.prf \
87 /usr/lib64/qt4/mkspecs/features/release.prf \
88 /usr/lib64/qt4/mkspecs/features/default_post.prf \
88 /usr/lib64/qt4/mkspecs/features/default_post.prf \
89 /usr/lib64/qt4/mkspecs/features/shared.prf \
89 /usr/lib64/qt4/mkspecs/features/shared.prf \
90 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
90 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
91 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
91 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
92 /usr/lib64/qt4/mkspecs/features/resources.prf \
92 /usr/lib64/qt4/mkspecs/features/resources.prf \
93 /usr/lib64/qt4/mkspecs/features/uic.prf \
93 /usr/lib64/qt4/mkspecs/features/uic.prf \
94 /usr/lib64/qt4/mkspecs/features/yacc.prf \
94 /usr/lib64/qt4/mkspecs/features/yacc.prf \
95 /usr/lib64/qt4/mkspecs/features/lex.prf \
95 /usr/lib64/qt4/mkspecs/features/lex.prf \
96 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
96 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
97 fsw-qt.pro
97 fsw-qt.pro
98 QMAKE_TARGET = fsw
98 QMAKE_TARGET = fsw
99 DESTDIR = bin/
99 DESTDIR = bin/
100 TARGET = bin/fsw
100 TARGET = bin/fsw
101
101
102 first: all
102 first: all
103 ####### Implicit rules
103 ####### Implicit rules
104
104
105 .SUFFIXES: .o .c .cpp .cc .cxx .C
105 .SUFFIXES: .o .c .cpp .cc .cxx .C
106
106
107 .cpp.o:
107 .cpp.o:
108 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
108 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
109
109
110 .cc.o:
110 .cc.o:
111 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
111 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
112
112
113 .cxx.o:
113 .cxx.o:
114 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
114 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
115
115
116 .C.o:
116 .C.o:
117 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
117 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
118
118
119 .c.o:
119 .c.o:
120 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
120 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
121
121
122 ####### Build rules
122 ####### Build rules
123
123
124 all: Makefile $(TARGET)
124 all: Makefile $(TARGET)
125
125
126 $(TARGET): $(OBJECTS)
126 $(TARGET): $(OBJECTS)
127 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
127 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
128 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
128 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
129
129
130 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
130 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
131 /usr/lib64/qt4/mkspecs/common/linux.conf \
131 /usr/lib64/qt4/mkspecs/common/linux.conf \
132 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
132 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
133 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
133 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
134 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
134 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
135 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
135 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
136 /usr/lib64/qt4/mkspecs/qconfig.pri \
136 /usr/lib64/qt4/mkspecs/qconfig.pri \
137 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
137 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
138 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
138 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
139 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
139 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
140 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
140 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
141 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
141 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
142 sparc.pri \
142 sparc.pri \
143 /usr/lib64/qt4/mkspecs/features/release.prf \
143 /usr/lib64/qt4/mkspecs/features/release.prf \
144 /usr/lib64/qt4/mkspecs/features/default_post.prf \
144 /usr/lib64/qt4/mkspecs/features/default_post.prf \
145 /usr/lib64/qt4/mkspecs/features/shared.prf \
145 /usr/lib64/qt4/mkspecs/features/shared.prf \
146 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
146 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
147 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
147 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
148 /usr/lib64/qt4/mkspecs/features/resources.prf \
148 /usr/lib64/qt4/mkspecs/features/resources.prf \
149 /usr/lib64/qt4/mkspecs/features/uic.prf \
149 /usr/lib64/qt4/mkspecs/features/uic.prf \
150 /usr/lib64/qt4/mkspecs/features/yacc.prf \
150 /usr/lib64/qt4/mkspecs/features/yacc.prf \
151 /usr/lib64/qt4/mkspecs/features/lex.prf \
151 /usr/lib64/qt4/mkspecs/features/lex.prf \
152 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
152 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
153 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
153 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
154 /usr/lib64/qt4/mkspecs/common/unix.conf:
154 /usr/lib64/qt4/mkspecs/common/unix.conf:
155 /usr/lib64/qt4/mkspecs/common/linux.conf:
155 /usr/lib64/qt4/mkspecs/common/linux.conf:
156 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
156 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
157 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
157 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
158 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
158 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
159 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
159 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
160 /usr/lib64/qt4/mkspecs/qconfig.pri:
160 /usr/lib64/qt4/mkspecs/qconfig.pri:
161 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
161 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
162 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
162 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
163 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
163 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
164 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
164 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
165 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
165 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
166 sparc.pri:
166 sparc.pri:
167 /usr/lib64/qt4/mkspecs/features/release.prf:
167 /usr/lib64/qt4/mkspecs/features/release.prf:
168 /usr/lib64/qt4/mkspecs/features/default_post.prf:
168 /usr/lib64/qt4/mkspecs/features/default_post.prf:
169 /usr/lib64/qt4/mkspecs/features/shared.prf:
169 /usr/lib64/qt4/mkspecs/features/shared.prf:
170 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
170 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
171 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
171 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
172 /usr/lib64/qt4/mkspecs/features/resources.prf:
172 /usr/lib64/qt4/mkspecs/features/resources.prf:
173 /usr/lib64/qt4/mkspecs/features/uic.prf:
173 /usr/lib64/qt4/mkspecs/features/uic.prf:
174 /usr/lib64/qt4/mkspecs/features/yacc.prf:
174 /usr/lib64/qt4/mkspecs/features/yacc.prf:
175 /usr/lib64/qt4/mkspecs/features/lex.prf:
175 /usr/lib64/qt4/mkspecs/features/lex.prf:
176 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
176 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
177 qmake: FORCE
177 qmake: FORCE
178 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
178 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
179
179
180 dist:
180 dist:
181 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
181 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
182 $(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
182 $(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
183
183
184
184
185 clean:compiler_clean
185 clean:compiler_clean
186 -$(DEL_FILE) $(OBJECTS)
186 -$(DEL_FILE) $(OBJECTS)
187 -$(DEL_FILE) *~ core *.core
187 -$(DEL_FILE) *~ core *.core
188
188
189
189
190 ####### Sub-libraries
190 ####### Sub-libraries
191
191
192 distclean: clean
192 distclean: clean
193 -$(DEL_FILE) $(TARGET)
193 -$(DEL_FILE) $(TARGET)
194 -$(DEL_FILE) Makefile
194 -$(DEL_FILE) Makefile
195
195
196
196
197 grmon:
197 grmon:
198 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
198 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
199
199
200 check: first
200 check: first
201
201
202 compiler_rcc_make_all:
202 compiler_rcc_make_all:
203 compiler_rcc_clean:
203 compiler_rcc_clean:
204 compiler_uic_make_all:
204 compiler_uic_make_all:
205 compiler_uic_clean:
205 compiler_uic_clean:
206 compiler_image_collection_make_all: qmake_image_collection.cpp
206 compiler_image_collection_make_all: qmake_image_collection.cpp
207 compiler_image_collection_clean:
207 compiler_image_collection_clean:
208 -$(DEL_FILE) qmake_image_collection.cpp
208 -$(DEL_FILE) qmake_image_collection.cpp
209 compiler_yacc_decl_make_all:
209 compiler_yacc_decl_make_all:
210 compiler_yacc_decl_clean:
210 compiler_yacc_decl_clean:
211 compiler_yacc_impl_make_all:
211 compiler_yacc_impl_make_all:
212 compiler_yacc_impl_clean:
212 compiler_yacc_impl_clean:
213 compiler_lex_make_all:
213 compiler_lex_make_all:
214 compiler_lex_clean:
214 compiler_lex_clean:
215 compiler_clean:
215 compiler_clean:
216
216
217 ####### Compile
217 ####### Compile
218
218
219 obj/wf_handler.o: ../src/wf_handler.c
219 obj/wf_handler.o: ../src/wf_handler.c
220 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
220 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
221
221
222 obj/tc_handler.o: ../src/tc_handler.c
222 obj/tc_handler.o: ../src/tc_handler.c
223 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
223 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
224
224
225 obj/fsw_misc.o: ../src/fsw_misc.c
225 obj/fsw_misc.o: ../src/fsw_misc.c
226 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
226 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
227
227
228 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
228 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
229 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
229 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
230
230
231 obj/fsw_globals.o: ../src/fsw_globals.c
231 obj/fsw_globals.o: ../src/fsw_globals.c
232 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
232 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
233
233
234 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
234 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
235 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
235 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
236
236
237 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
237 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
238 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
238 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
239
239
240 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
240 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
241 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
241 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
242
242
243 obj/tc_acceptance.o: ../src/tc_acceptance.c
243 obj/tc_acceptance.o: ../src/tc_acceptance.c
244 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
244 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
245
245
246 obj/basic_parameters.o: ../src/basic_parameters/basic_parameters.c ../src/basic_parameters/basic_parameters.h
246 obj/basic_parameters.o: ../src/basic_parameters/basic_parameters.c ../src/basic_parameters/basic_parameters.h
247 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/basic_parameters/basic_parameters.c
247 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/basic_parameters/basic_parameters.c
248
248
249 obj/fsw_processing.o: ../src/processing/fsw_processing.c
249 obj/fsw_processing.o: ../src/processing/fsw_processing.c
250 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c
250 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c
251
251
252 obj/avf0_prc0.o: ../src/processing/avf0_prc0.c
252 obj/avf0_prc0.o: ../src/processing/avf0_prc0.c
253 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c
253 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c
254
254
255 obj/avf1_prc1.o: ../src/processing/avf1_prc1.c
255 obj/avf1_prc1.o: ../src/processing/avf1_prc1.c
256 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c
256 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c
257
257
258 obj/avf2_prc2.o: ../src/processing/avf2_prc2.c
258 obj/avf2_prc2.o: ../src/processing/avf2_prc2.c
259 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c
259 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c
260
260
261 ####### Install
261 ####### Install
262
262
263 install: FORCE
263 install: FORCE
264
264
265 uninstall: FORCE
265 uninstall: FORCE
266
266
267 FORCE:
267 FORCE:
268
268
@@ -1,91 +1,91
1 TEMPLATE = app
1 TEMPLATE = app
2 # CONFIG += console v8 sim
2 # CONFIG += console v8 sim
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
4 CONFIG += console verbose cpu_usage_report
4 CONFIG += console verbose
5 CONFIG -= qt
5 CONFIG -= qt
6
6
7 include(./sparc.pri)
7 include(./sparc.pri)
8
8
9 # flight software version
9 # flight software version
10 SWVERSION=-1-0
10 SWVERSION=-1-0
11 DEFINES += SW_VERSION_N1=1 # major
11 DEFINES += SW_VERSION_N1=1 # major
12 DEFINES += SW_VERSION_N2=0 # minor
12 DEFINES += SW_VERSION_N2=0 # minor
13 DEFINES += SW_VERSION_N3=0 # patch
13 DEFINES += SW_VERSION_N3=0 # patch
14 DEFINES += SW_VERSION_N4=6 # internal
14 DEFINES += SW_VERSION_N4=6 # internal
15
15
16 contains( CONFIG, debug_tch ) {
16 contains( CONFIG, debug_tch ) {
17 DEFINES += DEBUG_TCH
17 DEFINES += DEBUG_TCH
18 }
18 }
19
19
20 contains( CONFIG, vhdl_dev ) {
20 contains( CONFIG, vhdl_dev ) {
21 DEFINES += VHDL_DEV
21 DEFINES += VHDL_DEV
22 }
22 }
23
23
24 contains( CONFIG, verbose ) {
24 contains( CONFIG, verbose ) {
25 DEFINES += PRINT_MESSAGES_ON_CONSOLE
25 DEFINES += PRINT_MESSAGES_ON_CONSOLE
26 }
26 }
27
27
28 contains( CONFIG, debug_messages ) {
28 contains( CONFIG, debug_messages ) {
29 DEFINES += DEBUG_MESSAGES
29 DEFINES += DEBUG_MESSAGES
30 }
30 }
31
31
32 contains( CONFIG, cpu_usage_report ) {
32 contains( CONFIG, cpu_usage_report ) {
33 DEFINES += PRINT_TASK_STATISTICS
33 DEFINES += PRINT_TASK_STATISTICS
34 }
34 }
35
35
36 contains( CONFIG, stack_report ) {
36 contains( CONFIG, stack_report ) {
37 DEFINES += PRINT_STACK_REPORT
37 DEFINES += PRINT_STACK_REPORT
38 }
38 }
39
39
40 contains( CONFIG, boot_messages ) {
40 contains( CONFIG, boot_messages ) {
41 DEFINES += BOOT_MESSAGES
41 DEFINES += BOOT_MESSAGES
42 }
42 }
43
43
44 #doxygen.target = doxygen
44 #doxygen.target = doxygen
45 #doxygen.commands = doxygen ../doc/Doxyfile
45 #doxygen.commands = doxygen ../doc/Doxyfile
46 #QMAKE_EXTRA_TARGETS += doxygen
46 #QMAKE_EXTRA_TARGETS += doxygen
47
47
48 TARGET = fsw
48 TARGET = fsw
49
49
50 INCLUDEPATH += \
50 INCLUDEPATH += \
51 ../src \
51 ../src \
52 ../header \
52 ../header \
53 ../header/processing \
53 ../header/processing \
54 ../src/basic_parameters
54 ../src/basic_parameters
55
55
56 SOURCES += \
56 SOURCES += \
57 ../src/wf_handler.c \
57 ../src/wf_handler.c \
58 ../src/tc_handler.c \
58 ../src/tc_handler.c \
59 ../src/fsw_misc.c \
59 ../src/fsw_misc.c \
60 ../src/fsw_init.c \
60 ../src/fsw_init.c \
61 ../src/fsw_globals.c \
61 ../src/fsw_globals.c \
62 ../src/fsw_spacewire.c \
62 ../src/fsw_spacewire.c \
63 ../src/tc_load_dump_parameters.c \
63 ../src/tc_load_dump_parameters.c \
64 ../src/tm_lfr_tc_exe.c \
64 ../src/tm_lfr_tc_exe.c \
65 ../src/tc_acceptance.c \
65 ../src/tc_acceptance.c \
66 ../src/basic_parameters/basic_parameters.c \
66 ../src/basic_parameters/basic_parameters.c \
67 ../src/processing/fsw_processing.c \
67 ../src/processing/fsw_processing.c \
68 ../src/processing/avf0_prc0.c \
68 ../src/processing/avf0_prc0.c \
69 ../src/processing/avf1_prc1.c \
69 ../src/processing/avf1_prc1.c \
70 ../src/processing/avf2_prc2.c
70 ../src/processing/avf2_prc2.c
71
71
72 HEADERS += \
72 HEADERS += \
73 ../header/wf_handler.h \
73 ../header/wf_handler.h \
74 ../header/tc_handler.h \
74 ../header/tc_handler.h \
75 ../header/grlib_regs.h \
75 ../header/grlib_regs.h \
76 ../header/fsw_params.h \
76 ../header/fsw_params.h \
77 ../header/fsw_misc.h \
77 ../header/fsw_misc.h \
78 ../header/fsw_init.h \
78 ../header/fsw_init.h \
79 ../header/ccsds_types.h \
79 ../header/ccsds_types.h \
80 ../header/fsw_spacewire.h \
80 ../header/fsw_spacewire.h \
81 ../header/tc_load_dump_parameters.h \
81 ../header/tc_load_dump_parameters.h \
82 ../header/tm_lfr_tc_exe.h \
82 ../header/tm_lfr_tc_exe.h \
83 ../header/tc_acceptance.h \
83 ../header/tc_acceptance.h \
84 ../header/fsw_params_nb_bytes.h \
84 ../header/fsw_params_nb_bytes.h \
85 ../src/basic_parameters/basic_parameters.h \
85 ../src/basic_parameters/basic_parameters.h \
86 ../header/fsw_params_processing.h \
86 ../header/fsw_params_processing.h \
87 ../header/processing/fsw_processing.h \
87 ../header/processing/fsw_processing.h \
88 ../header/processing/avf0_prc0.h \
88 ../header/processing/avf0_prc0.h \
89 ../header/processing/avf1_prc1.h \
89 ../header/processing/avf1_prc1.h \
90 ../header/processing/avf2_prc2.h
90 ../header/processing/avf2_prc2.h
91
91
@@ -1,201 +1,201
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 3.0.1, 2014-04-29T15:43:03. -->
3 <!-- Written by QtCreator 3.0.1, 2014-05-02T15:40:56. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
7 <value type="int">0</value>
7 <value type="int">0</value>
8 </data>
8 </data>
9 <data>
9 <data>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
11 <valuemap type="QVariantMap">
11 <valuemap type="QVariantMap">
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
16 <value type="QString" key="language">Cpp</value>
16 <value type="QString" key="language">Cpp</value>
17 <valuemap type="QVariantMap" key="value">
17 <valuemap type="QVariantMap" key="value">
18 <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
18 <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
19 </valuemap>
19 </valuemap>
20 </valuemap>
20 </valuemap>
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
22 <value type="QString" key="language">QmlJS</value>
22 <value type="QString" key="language">QmlJS</value>
23 <valuemap type="QVariantMap" key="value">
23 <valuemap type="QVariantMap" key="value">
24 <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
24 <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
25 </valuemap>
25 </valuemap>
26 </valuemap>
26 </valuemap>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
28 <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
28 <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
32 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
32 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
33 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
33 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
34 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
34 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
35 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
35 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
36 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
36 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
37 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
37 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
38 <value type="int" key="EditorConfiguration.TabSize">8</value>
38 <value type="int" key="EditorConfiguration.TabSize">8</value>
39 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
39 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
40 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
40 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
41 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
41 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
42 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
42 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
43 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
43 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
44 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
44 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
45 </valuemap>
45 </valuemap>
46 </data>
46 </data>
47 <data>
47 <data>
48 <variable>ProjectExplorer.Project.PluginSettings</variable>
48 <variable>ProjectExplorer.Project.PluginSettings</variable>
49 <valuemap type="QVariantMap"/>
49 <valuemap type="QVariantMap"/>
50 </data>
50 </data>
51 <data>
51 <data>
52 <variable>ProjectExplorer.Project.Target.0</variable>
52 <variable>ProjectExplorer.Project.Target.0</variable>
53 <valuemap type="QVariantMap">
53 <valuemap type="QVariantMap">
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
61 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value>
61 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value>
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
63 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
63 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
64 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
64 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
67 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
67 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
69 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
69 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
70 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
70 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
71 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
71 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
72 </valuemap>
72 </valuemap>
73 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
73 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
74 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
74 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
77 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
77 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
78 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
78 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
79 <value type="QString">-w</value>
79 <value type="QString">-w</value>
80 <value type="QString">-r</value>
80 <value type="QString">-r</value>
81 </valuelist>
81 </valuelist>
82 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
82 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
84 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
84 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
85 </valuemap>
85 </valuemap>
86 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
86 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
89 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
89 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
90 </valuemap>
90 </valuemap>
91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
92 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
92 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
93 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
93 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
96 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
96 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
97 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
97 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
98 <value type="QString">-w</value>
98 <value type="QString">-w</value>
99 <value type="QString">-r</value>
99 <value type="QString">-r</value>
100 </valuelist>
100 </valuelist>
101 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
101 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
103 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
103 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
104 </valuemap>
104 </valuemap>
105 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
105 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
108 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
108 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
109 </valuemap>
109 </valuemap>
110 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
110 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
111 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
111 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
112 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
112 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
115 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
115 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
116 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
116 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
118 </valuemap>
118 </valuemap>
119 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
119 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
120 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
120 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
122 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
122 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
126 </valuemap>
126 </valuemap>
127 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
127 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
128 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
128 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
129 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
129 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
131 </valuemap>
131 </valuemap>
132 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
132 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
133 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
133 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
134 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
134 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
135 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
135 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
136 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
136 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
137 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
137 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
138 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
138 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
139 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
139 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
140 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
140 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
141 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
141 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
142 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
142 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
143 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
143 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
144 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
144 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
145 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
145 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
146 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
146 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
147 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
147 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
148 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
148 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
149 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
149 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
150 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
150 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
151 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
151 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
152 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
152 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
153 <value type="int">0</value>
153 <value type="int">0</value>
154 <value type="int">1</value>
154 <value type="int">1</value>
155 <value type="int">2</value>
155 <value type="int">2</value>
156 <value type="int">3</value>
156 <value type="int">3</value>
157 <value type="int">4</value>
157 <value type="int">4</value>
158 <value type="int">5</value>
158 <value type="int">5</value>
159 <value type="int">6</value>
159 <value type="int">6</value>
160 <value type="int">7</value>
160 <value type="int">7</value>
161 <value type="int">8</value>
161 <value type="int">8</value>
162 <value type="int">9</value>
162 <value type="int">9</value>
163 <value type="int">10</value>
163 <value type="int">10</value>
164 <value type="int">11</value>
164 <value type="int">11</value>
165 <value type="int">12</value>
165 <value type="int">12</value>
166 <value type="int">13</value>
166 <value type="int">13</value>
167 <value type="int">14</value>
167 <value type="int">14</value>
168 </valuelist>
168 </valuelist>
169 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
169 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
170 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
170 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
171 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
171 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
174 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
174 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
175 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
175 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
176 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
176 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
177 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
177 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
178 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
178 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
179 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
179 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
180 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
180 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
181 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
181 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
182 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
182 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
183 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
183 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
184 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
184 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
185 </valuemap>
185 </valuemap>
186 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
186 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
187 </valuemap>
187 </valuemap>
188 </data>
188 </data>
189 <data>
189 <data>
190 <variable>ProjectExplorer.Project.TargetCount</variable>
190 <variable>ProjectExplorer.Project.TargetCount</variable>
191 <value type="int">1</value>
191 <value type="int">1</value>
192 </data>
192 </data>
193 <data>
193 <data>
194 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
194 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
195 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
195 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
196 </data>
196 </data>
197 <data>
197 <data>
198 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
198 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
199 <value type="int">15</value>
199 <value type="int">15</value>
200 </data>
200 </data>
201 </qtcreator>
201 </qtcreator>
@@ -1,35 +1,36
1 #ifndef AVF0_PRC0_H_INCLUDED
1 #ifndef AVF0_PRC0_H_INCLUDED
2 #define AVF0_PRC0_H_INCLUDED
2 #define AVF0_PRC0_H_INCLUDED
3
3
4 #include "fsw_processing.h"
4 #include "fsw_processing.h"
5 #include "basic_parameters.h"
5
6
6 typedef struct {
7 typedef struct {
7 unsigned int norm_bp1;
8 unsigned int norm_bp1;
8 unsigned int norm_bp2;
9 unsigned int norm_bp2;
9 unsigned int norm_asm;
10 unsigned int norm_asm;
10 unsigned int burst_sbm_bp1;
11 unsigned int burst_sbm_bp1;
11 unsigned int burst_sbm_bp2;
12 unsigned int burst_sbm_bp2;
12 unsigned int burst_bp1;
13 unsigned int burst_bp1;
13 unsigned int burst_bp2;
14 unsigned int burst_bp2;
14 unsigned int sbm1_bp1;
15 unsigned int sbm1_bp1;
15 unsigned int sbm1_bp2;
16 unsigned int sbm1_bp2;
16 unsigned int sbm2_bp1;
17 unsigned int sbm2_bp1;
17 unsigned int sbm2_bp2;
18 unsigned int sbm2_bp2;
18 } nb_sm_before_bp_asm_f0;
19 } nb_sm_before_bp_asm_f0;
19
20
20 //************
21 //************
21 // RTEMS TASKS
22 // RTEMS TASKS
22 rtems_task avf0_task( rtems_task_argument lfrRequestedMode );
23 rtems_task avf0_task( rtems_task_argument lfrRequestedMode );
23 rtems_task prc0_task( rtems_task_argument lfrRequestedMode );
24 rtems_task prc0_task( rtems_task_argument lfrRequestedMode );
24
25
25 //**********
26 //**********
26 // FUNCTIONS
27 // FUNCTIONS
27
28
28 void reset_nb_sm_f0( unsigned char lfrMode );
29 void reset_nb_sm_f0( unsigned char lfrMode );
29
30
30 //*******
31 //*******
31 // EXTERN
32 // EXTERN
32 extern struct ring_node_sm *ring_node_for_averaging_sm_f0;
33 extern struct ring_node_sm *ring_node_for_averaging_sm_f0;
33 extern rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id );
34 extern rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id );
34
35
35 #endif // AVF0_PRC0_H_INCLUDED
36 #endif // AVF0_PRC0_H_INCLUDED
@@ -1,433 +1,434
1 /** General usage functions and RTEMS tasks.
1 /** General usage functions and RTEMS tasks.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 */
6 */
7
7
8 #include "fsw_misc.h"
8 #include "fsw_misc.h"
9
9
10 void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
10 void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
11 unsigned char interrupt_level, rtems_isr (*timer_isr)() )
11 unsigned char interrupt_level, rtems_isr (*timer_isr)() )
12 {
12 {
13 /** This function configures a GPTIMER timer instantiated in the VHDL design.
13 /** This function configures a GPTIMER timer instantiated in the VHDL design.
14 *
14 *
15 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
15 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
16 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
16 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
17 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
17 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
18 * @param interrupt_level is the interrupt level that the timer drives.
18 * @param interrupt_level is the interrupt level that the timer drives.
19 * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer.
19 * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer.
20 *
20 *
21 * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76
21 * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76
22 *
22 *
23 */
23 */
24
24
25 rtems_status_code status;
25 rtems_status_code status;
26 rtems_isr_entry old_isr_handler;
26 rtems_isr_entry old_isr_handler;
27
27
28 gptimer_regs->timer[timer].ctrl = 0x00; // reset the control register
28 gptimer_regs->timer[timer].ctrl = 0x00; // reset the control register
29
29
30 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
30 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
31 if (status!=RTEMS_SUCCESSFUL)
31 if (status!=RTEMS_SUCCESSFUL)
32 {
32 {
33 PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n")
33 PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n")
34 }
34 }
35
35
36 timer_set_clock_divider( gptimer_regs, timer, clock_divider);
36 timer_set_clock_divider( gptimer_regs, timer, clock_divider);
37 }
37 }
38
38
39 void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer)
39 void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer)
40 {
40 {
41 /** This function starts a GPTIMER timer.
41 /** This function starts a GPTIMER timer.
42 *
42 *
43 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
43 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
44 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
44 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
45 *
45 *
46 */
46 */
47
47
48 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
48 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
49 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register
49 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register
50 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer
50 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer
51 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart
51 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart
52 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable
52 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable
53 }
53 }
54
54
55 void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer)
55 void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer)
56 {
56 {
57 /** This function stops a GPTIMER timer.
57 /** This function stops a GPTIMER timer.
58 *
58 *
59 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
59 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
60 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
60 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
61 *
61 *
62 */
62 */
63
63
64 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer
64 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer
65 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable
65 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable
66 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
66 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
67 }
67 }
68
68
69 void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider)
69 void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider)
70 {
70 {
71 /** This function sets the clock divider of a GPTIMER timer.
71 /** This function sets the clock divider of a GPTIMER timer.
72 *
72 *
73 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
73 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
74 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
74 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
75 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
75 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
76 *
76 *
77 */
77 */
78
78
79 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
79 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
80 }
80 }
81
81
82 int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port
82 int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port
83 {
83 {
84 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
84 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
85
85
86 apbuart_regs->ctrl = APBUART_CTRL_REG_MASK_TE;
86 apbuart_regs->ctrl = APBUART_CTRL_REG_MASK_TE;
87
87
88 return 0;
88 return 0;
89 }
89 }
90
90
91 int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register
91 int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register
92 {
92 {
93 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
93 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
94
94
95 apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE;
95 apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE;
96
96
97 return 0;
97 return 0;
98 }
98 }
99
99
100 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
100 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
101 {
101 {
102 /** This function sets the scaler reload register of the apbuart module
102 /** This function sets the scaler reload register of the apbuart module
103 *
103 *
104 * @param regs is the address of the apbuart registers in memory
104 * @param regs is the address of the apbuart registers in memory
105 * @param value is the value that will be stored in the scaler register
105 * @param value is the value that will be stored in the scaler register
106 *
106 *
107 * The value shall be set by the software to get data on the serial interface.
107 * The value shall be set by the software to get data on the serial interface.
108 *
108 *
109 */
109 */
110
110
111 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
111 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
112
112
113 apbuart_regs->scaler = value;
113 apbuart_regs->scaler = value;
114 BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value)
114 BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value)
115 }
115 }
116
116
117 //************
117 //************
118 // RTEMS TASKS
118 // RTEMS TASKS
119
119
120 rtems_task stat_task(rtems_task_argument argument)
120 rtems_task stat_task(rtems_task_argument argument)
121 {
121 {
122 int i;
122 int i;
123 int j;
123 int j;
124 i = 0;
124 i = 0;
125 j = 0;
125 j = 0;
126 BOOT_PRINTF("in STAT *** \n")
126 BOOT_PRINTF("in STAT *** \n")
127 while(1){
127 while(1){
128 rtems_task_wake_after(1000);
128 rtems_task_wake_after(1000);
129 PRINTF1("%d\n", j)
129 PRINTF1("%d\n", j)
130 if (i == CPU_USAGE_REPORT_PERIOD) {
130 if (i == CPU_USAGE_REPORT_PERIOD) {
131 // #ifdef PRINT_TASK_STATISTICS
131 // #ifdef PRINT_TASK_STATISTICS
132 // rtems_cpu_usage_report();
132 // rtems_cpu_usage_report();
133 // rtems_cpu_usage_reset();
133 // rtems_cpu_usage_reset();
134 // #endif
134 // #endif
135 i = 0;
135 i = 0;
136 }
136 }
137 else i++;
137 else i++;
138 j++;
138 j++;
139 }
139 }
140 }
140 }
141
141
142 rtems_task hous_task(rtems_task_argument argument)
142 rtems_task hous_task(rtems_task_argument argument)
143 {
143 {
144 rtems_status_code status;
144 rtems_status_code status;
145 rtems_id queue_id;
145 rtems_id queue_id;
146 rtems_rate_monotonic_period_status period_status;
146 rtems_rate_monotonic_period_status period_status;
147
147
148 status = get_message_queue_id_send( &queue_id );
148 status = get_message_queue_id_send( &queue_id );
149 if (status != RTEMS_SUCCESSFUL)
149 if (status != RTEMS_SUCCESSFUL)
150 {
150 {
151 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
151 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
152 }
152 }
153
153
154 BOOT_PRINTF("in HOUS ***\n")
154 BOOT_PRINTF("in HOUS ***\n")
155
155
156 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
156 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
157 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
157 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
158 if( status != RTEMS_SUCCESSFUL ) {
158 if( status != RTEMS_SUCCESSFUL ) {
159 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
159 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
160 }
160 }
161 }
161 }
162
162
163 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
163 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
164 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
164 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
165 housekeeping_packet.reserved = DEFAULT_RESERVED;
165 housekeeping_packet.reserved = DEFAULT_RESERVED;
166 housekeeping_packet.userApplication = CCSDS_USER_APP;
166 housekeeping_packet.userApplication = CCSDS_USER_APP;
167 housekeeping_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8);
167 housekeeping_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8);
168 housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK);
168 housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK);
169 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
169 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
170 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
170 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
171 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
171 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
172 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
172 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
173 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
173 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
174 housekeeping_packet.serviceType = TM_TYPE_HK;
174 housekeeping_packet.serviceType = TM_TYPE_HK;
175 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
175 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
176 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
176 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
177 housekeeping_packet.sid = SID_HK;
177 housekeeping_packet.sid = SID_HK;
178
178
179 status = rtems_rate_monotonic_cancel(HK_id);
179 status = rtems_rate_monotonic_cancel(HK_id);
180 if( status != RTEMS_SUCCESSFUL ) {
180 if( status != RTEMS_SUCCESSFUL ) {
181 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
181 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
182 }
182 }
183 else {
183 else {
184 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
184 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
185 }
185 }
186
186
187 // startup phase
187 // startup phase
188 status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks );
188 status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks );
189 status = rtems_rate_monotonic_get_status( HK_id, &period_status );
189 status = rtems_rate_monotonic_get_status( HK_id, &period_status );
190 DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state)
190 DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state)
191 while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway
191 while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway
192 {
192 {
193 if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization
193 if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization
194 {
194 {
195 break; // break if LFR is synchronized
195 break; // break if LFR is synchronized
196 }
196 }
197 else
197 else
198 {
198 {
199 status = rtems_rate_monotonic_get_status( HK_id, &period_status );
199 status = rtems_rate_monotonic_get_status( HK_id, &period_status );
200 sched_yield();
200 // sched_yield();
201 status = rtems_task_wake_after( 10 ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 100 ms = 10 * 10 ms
201 }
202 }
202 }
203 }
203 status = rtems_rate_monotonic_cancel(HK_id);
204 status = rtems_rate_monotonic_cancel(HK_id);
204 DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state)
205 DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state)
205
206
206 while(1){ // launch the rate monotonic task
207 while(1){ // launch the rate monotonic task
207 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
208 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
208 if ( status != RTEMS_SUCCESSFUL ) {
209 if ( status != RTEMS_SUCCESSFUL ) {
209 PRINTF1( "in HOUS *** ERR period: %d\n", status);
210 PRINTF1( "in HOUS *** ERR period: %d\n", status);
210 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
211 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
211 }
212 }
212 else {
213 else {
213 increment_seq_counter( housekeeping_packet.packetSequenceControl );
214 increment_seq_counter( housekeeping_packet.packetSequenceControl );
214 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
215 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
215 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
216 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
216 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
217 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
217 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
218 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
218 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
219 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
219 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
220 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
220
221
221 spacewire_update_statistics();
222 spacewire_update_statistics();
222
223
223 // SEND PACKET
224 // SEND PACKET
224 status = rtems_message_queue_urgent( queue_id, &housekeeping_packet,
225 status = rtems_message_queue_urgent( queue_id, &housekeeping_packet,
225 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
226 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
226 if (status != RTEMS_SUCCESSFUL) {
227 if (status != RTEMS_SUCCESSFUL) {
227 PRINTF1("in HOUS *** ERR send: %d\n", status)
228 PRINTF1("in HOUS *** ERR send: %d\n", status)
228 }
229 }
229 }
230 }
230 }
231 }
231
232
232 PRINTF("in HOUS *** deleting task\n")
233 PRINTF("in HOUS *** deleting task\n")
233
234
234 status = rtems_task_delete( RTEMS_SELF ); // should not return
235 status = rtems_task_delete( RTEMS_SELF ); // should not return
235 printf( "rtems_task_delete returned with status of %d.\n", status );
236 printf( "rtems_task_delete returned with status of %d.\n", status );
236 return;
237 return;
237 }
238 }
238
239
239 rtems_task dumb_task( rtems_task_argument unused )
240 rtems_task dumb_task( rtems_task_argument unused )
240 {
241 {
241 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
242 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
242 *
243 *
243 * @param unused is the starting argument of the RTEMS task
244 * @param unused is the starting argument of the RTEMS task
244 *
245 *
245 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
246 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
246 *
247 *
247 */
248 */
248
249
249 unsigned int i;
250 unsigned int i;
250 unsigned int intEventOut;
251 unsigned int intEventOut;
251 unsigned int coarse_time = 0;
252 unsigned int coarse_time = 0;
252 unsigned int fine_time = 0;
253 unsigned int fine_time = 0;
253 rtems_event_set event_out;
254 rtems_event_set event_out;
254
255
255 char *DumbMessages[10] = {"in DUMB *** default", // RTEMS_EVENT_0
256 char *DumbMessages[10] = {"in DUMB *** default", // RTEMS_EVENT_0
256 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
257 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
257 "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
258 "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
258 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
259 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
259 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
260 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
260 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
261 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
261 "ERR HK", // RTEMS_EVENT_6
262 "ERR HK", // RTEMS_EVENT_6
262 "ready for dump", // RTEMS_EVENT_7
263 "ready for dump", // RTEMS_EVENT_7
263 "in DUMB *** spectral_matrices_isr", // RTEMS_EVENT_8
264 "in DUMB *** spectral_matrices_isr", // RTEMS_EVENT_8
264 "tick" // RTEMS_EVENT_9
265 "tick" // RTEMS_EVENT_9
265 };
266 };
266
267
267 BOOT_PRINTF("in DUMB *** \n")
268 BOOT_PRINTF("in DUMB *** \n")
268
269
269 while(1){
270 while(1){
270 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
271 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
271 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7
272 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7
272 | RTEMS_EVENT_8 | RTEMS_EVENT_9,
273 | RTEMS_EVENT_8 | RTEMS_EVENT_9,
273 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
274 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
274 intEventOut = (unsigned int) event_out;
275 intEventOut = (unsigned int) event_out;
275 for ( i=0; i<32; i++)
276 for ( i=0; i<32; i++)
276 {
277 {
277 if ( ((intEventOut >> i) & 0x0001) != 0)
278 if ( ((intEventOut >> i) & 0x0001) != 0)
278 {
279 {
279 coarse_time = time_management_regs->coarse_time;
280 coarse_time = time_management_regs->coarse_time;
280 fine_time = time_management_regs->fine_time;
281 fine_time = time_management_regs->fine_time;
281 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
282 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
282 }
283 }
283 }
284 }
284 }
285 }
285 }
286 }
286
287
287 //*****************************
288 //*****************************
288 // init housekeeping parameters
289 // init housekeeping parameters
289
290
290 void init_housekeeping_parameters( void )
291 void init_housekeeping_parameters( void )
291 {
292 {
292 /** This function initialize the housekeeping_packet global variable with default values.
293 /** This function initialize the housekeeping_packet global variable with default values.
293 *
294 *
294 */
295 */
295
296
296 unsigned int i = 0;
297 unsigned int i = 0;
297 unsigned char *parameters;
298 unsigned char *parameters;
298
299
299 parameters = (unsigned char*) &housekeeping_packet.lfr_status_word;
300 parameters = (unsigned char*) &housekeeping_packet.lfr_status_word;
300 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
301 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
301 {
302 {
302 parameters[i] = 0x00;
303 parameters[i] = 0x00;
303 }
304 }
304 // init status word
305 // init status word
305 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
306 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
306 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
307 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
307 // init software version
308 // init software version
308 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
309 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
309 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
310 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
310 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
311 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
311 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
312 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
312 // init fpga version
313 // init fpga version
313 parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0);
314 parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0);
314 housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1
315 housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1
315 housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2
316 housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2
316 housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3
317 housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3
317 }
318 }
318
319
319 void increment_seq_counter( unsigned char *packet_sequence_control)
320 void increment_seq_counter( unsigned char *packet_sequence_control)
320 {
321 {
321 /** This function increment the sequence counter psased in argument.
322 /** This function increment the sequence counter psased in argument.
322 *
323 *
323 * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0.
324 * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0.
324 *
325 *
325 */
326 */
326
327
327 unsigned short sequence_cnt;
328 unsigned short sequence_cnt;
328 unsigned short segmentation_grouping_flag;
329 unsigned short segmentation_grouping_flag;
329 unsigned short new_packet_sequence_control;
330 unsigned short new_packet_sequence_control;
330
331
331 segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6
332 segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; // keep bits 7 downto 6
332 sequence_cnt = (unsigned short) (
333 sequence_cnt = (unsigned short) (
333 ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0
334 ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0
334 + packet_sequence_control[1]
335 + packet_sequence_control[1]
335 );
336 );
336
337
337 if ( sequence_cnt < SEQ_CNT_MAX)
338 if ( sequence_cnt < SEQ_CNT_MAX)
338 {
339 {
339 sequence_cnt = sequence_cnt + 1;
340 sequence_cnt = sequence_cnt + 1;
340 }
341 }
341 else
342 else
342 {
343 {
343 sequence_cnt = 0;
344 sequence_cnt = 0;
344 }
345 }
345
346
346 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
347 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
347
348
348 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
349 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
349 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
350 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
350 }
351 }
351
352
352 void getTime( unsigned char *time)
353 void getTime( unsigned char *time)
353 {
354 {
354 /** This function write the current local time in the time buffer passed in argument.
355 /** This function write the current local time in the time buffer passed in argument.
355 *
356 *
356 */
357 */
357
358
358 time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
359 time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
359 time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
360 time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
360 time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
361 time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
361 time[3] = (unsigned char) (time_management_regs->coarse_time);
362 time[3] = (unsigned char) (time_management_regs->coarse_time);
362 time[4] = (unsigned char) (time_management_regs->fine_time>>8);
363 time[4] = (unsigned char) (time_management_regs->fine_time>>8);
363 time[5] = (unsigned char) (time_management_regs->fine_time);
364 time[5] = (unsigned char) (time_management_regs->fine_time);
364 }
365 }
365
366
366 unsigned long long int getTimeAsUnsignedLongLongInt( )
367 unsigned long long int getTimeAsUnsignedLongLongInt( )
367 {
368 {
368 /** This function write the current local time in the time buffer passed in argument.
369 /** This function write the current local time in the time buffer passed in argument.
369 *
370 *
370 */
371 */
371 unsigned long long int time;
372 unsigned long long int time;
372
373
373 time = ( (unsigned long long int) (time_management_regs->coarse_time & 0x7fffffff) << 16 )
374 time = ( (unsigned long long int) (time_management_regs->coarse_time & 0x7fffffff) << 16 )
374 + time_management_regs->fine_time;
375 + time_management_regs->fine_time;
375
376
376 return time;
377 return time;
377 }
378 }
378
379
379 void send_dumb_hk( void )
380 void send_dumb_hk( void )
380 {
381 {
381 Packet_TM_LFR_HK_t dummy_hk_packet;
382 Packet_TM_LFR_HK_t dummy_hk_packet;
382 unsigned char *parameters;
383 unsigned char *parameters;
383 unsigned int i;
384 unsigned int i;
384 rtems_id queue_id;
385 rtems_id queue_id;
385
386
386 dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
387 dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
387 dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
388 dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
388 dummy_hk_packet.reserved = DEFAULT_RESERVED;
389 dummy_hk_packet.reserved = DEFAULT_RESERVED;
389 dummy_hk_packet.userApplication = CCSDS_USER_APP;
390 dummy_hk_packet.userApplication = CCSDS_USER_APP;
390 dummy_hk_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8);
391 dummy_hk_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8);
391 dummy_hk_packet.packetID[1] = (unsigned char) (APID_TM_HK);
392 dummy_hk_packet.packetID[1] = (unsigned char) (APID_TM_HK);
392 dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
393 dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
393 dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
394 dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
394 dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
395 dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
395 dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
396 dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
396 dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
397 dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
397 dummy_hk_packet.serviceType = TM_TYPE_HK;
398 dummy_hk_packet.serviceType = TM_TYPE_HK;
398 dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK;
399 dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK;
399 dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND;
400 dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND;
400 dummy_hk_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
401 dummy_hk_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
401 dummy_hk_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
402 dummy_hk_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
402 dummy_hk_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
403 dummy_hk_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
403 dummy_hk_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
404 dummy_hk_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
404 dummy_hk_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
405 dummy_hk_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
405 dummy_hk_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
406 dummy_hk_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
406 dummy_hk_packet.sid = SID_HK;
407 dummy_hk_packet.sid = SID_HK;
407
408
408 // init status word
409 // init status word
409 dummy_hk_packet.lfr_status_word[0] = 0xff;
410 dummy_hk_packet.lfr_status_word[0] = 0xff;
410 dummy_hk_packet.lfr_status_word[1] = 0xff;
411 dummy_hk_packet.lfr_status_word[1] = 0xff;
411 // init software version
412 // init software version
412 dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1;
413 dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1;
413 dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2;
414 dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2;
414 dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3;
415 dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3;
415 dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4;
416 dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4;
416 // init fpga version
417 // init fpga version
417 parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0);
418 parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0);
418 dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1
419 dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1
419 dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2
420 dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2
420 dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3
421 dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3
421
422
422 parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load;
423 parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load;
423
424
424 for (i=0; i<100; i++)
425 for (i=0; i<100; i++)
425 {
426 {
426 parameters[i] = 0xff;
427 parameters[i] = 0xff;
427 }
428 }
428
429
429 get_message_queue_id_send( &queue_id );
430 get_message_queue_id_send( &queue_id );
430
431
431 rtems_message_queue_urgent( queue_id, &dummy_hk_packet,
432 rtems_message_queue_urgent( queue_id, &dummy_hk_packet,
432 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
433 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
433 }
434 }
@@ -1,364 +1,366
1 /** Functions related to data processing.
1 /** Functions related to data processing.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
7 *
7 *
8 */
8 */
9
9
10 #include "avf0_prc0.h"
10 #include "avf0_prc0.h"
11 #include "fsw_processing.h"
11 #include "fsw_processing.h"
12
12
13 nb_sm_before_bp_asm_f0 nb_sm_before_f0;
13 nb_sm_before_bp_asm_f0 nb_sm_before_f0;
14
14
15 //***
15 //***
16 // F0
16 // F0
17 ring_node_asm asm_ring_norm_f0 [ NB_RING_NODES_ASM_NORM_F0 ];
17 ring_node_asm asm_ring_norm_f0 [ NB_RING_NODES_ASM_NORM_F0 ];
18 ring_node_asm asm_ring_burst_sbm_f0[ NB_RING_NODES_ASM_BURST_SBM_F0 ];
18 ring_node_asm asm_ring_burst_sbm_f0[ NB_RING_NODES_ASM_BURST_SBM_F0 ];
19
19
20 float asm_f0_reorganized [ TOTAL_SIZE_SM ];
20 float asm_f0_reorganized [ TOTAL_SIZE_SM ];
21 char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
21 char asm_f0_char [ TIME_OFFSET_IN_BYTES + (TOTAL_SIZE_SM * 2) ];
22 float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F0];
22 float compressed_sm_norm_f0[ TOTAL_SIZE_COMPRESSED_ASM_NORM_F0];
23 float compressed_sm_sbm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 ];
23 float compressed_sm_sbm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 ];
24 unsigned char bp1_norm_f0 [ TOTAL_SIZE_BP1_NORM_F0 ];
25 unsigned char bp1_sbm_f0 [ TOTAL_SIZE_BP1_SBM_F0 ];
24
26
25 //************
27 //************
26 // RTEMS TASKS
28 // RTEMS TASKS
27
29
28 rtems_task avf0_task( rtems_task_argument lfrRequestedMode )
30 rtems_task avf0_task( rtems_task_argument lfrRequestedMode )
29 {
31 {
30 int i;
32 int i;
31
33
32 rtems_event_set event_out;
34 rtems_event_set event_out;
33 rtems_status_code status;
35 rtems_status_code status;
34 rtems_id queue_id_prc0;
36 rtems_id queue_id_prc0;
35 asm_msg msgForMATR;
37 asm_msg msgForMATR;
36 ring_node_sm *ring_node_tab[8];
38 ring_node_sm *ring_node_tab[8];
37 ring_node_asm *current_ring_node_asm_burst_sbm_f0;
39 ring_node_asm *current_ring_node_asm_burst_sbm_f0;
38 ring_node_asm *current_ring_node_asm_norm_f0;
40 ring_node_asm *current_ring_node_asm_norm_f0;
39
41
40 unsigned int nb_norm_bp1;
42 unsigned int nb_norm_bp1;
41 unsigned int nb_norm_bp2;
43 unsigned int nb_norm_bp2;
42 unsigned int nb_norm_asm;
44 unsigned int nb_norm_asm;
43 unsigned int nb_sbm_bp1;
45 unsigned int nb_sbm_bp1;
44 unsigned int nb_sbm_bp2;
46 unsigned int nb_sbm_bp2;
45
47
46 nb_norm_bp1 = 0;
48 nb_norm_bp1 = 0;
47 nb_norm_bp2 = 0;
49 nb_norm_bp2 = 0;
48 nb_norm_asm = 0;
50 nb_norm_asm = 0;
49 nb_sbm_bp1 = 0;
51 nb_sbm_bp1 = 0;
50 nb_sbm_bp2 = 0;
52 nb_sbm_bp2 = 0;
51
53
52 reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions
54 reset_nb_sm_f0( lfrRequestedMode ); // reset the sm counters that drive the BP and ASM computations / transmissions
53 ASM_generic_init_ring( asm_ring_norm_f0, NB_RING_NODES_ASM_NORM_F0 );
55 ASM_generic_init_ring( asm_ring_norm_f0, NB_RING_NODES_ASM_NORM_F0 );
54 ASM_generic_init_ring( asm_ring_burst_sbm_f0, NB_RING_NODES_ASM_BURST_SBM_F0 );
56 ASM_generic_init_ring( asm_ring_burst_sbm_f0, NB_RING_NODES_ASM_BURST_SBM_F0 );
55 current_ring_node_asm_norm_f0 = asm_ring_norm_f0;
57 current_ring_node_asm_norm_f0 = asm_ring_norm_f0;
56 current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0;
58 current_ring_node_asm_burst_sbm_f0 = asm_ring_burst_sbm_f0;
57
59
58 BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
60 BOOT_PRINTF1("in AVFO *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
59
61
60 status = get_message_queue_id_prc0( &queue_id_prc0 );
62 status = get_message_queue_id_prc0( &queue_id_prc0 );
61 if (status != RTEMS_SUCCESSFUL)
63 if (status != RTEMS_SUCCESSFUL)
62 {
64 {
63 PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status)
65 PRINTF1("in MATR *** ERR get_message_queue_id_prc0 %d\n", status)
64 }
66 }
65
67
66 while(1){
68 while(1){
67 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
69 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
68 ring_node_tab[NB_SM_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0;
70 ring_node_tab[NB_SM_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0;
69 for ( i = 2; i < (NB_SM_BEFORE_AVF0+1); i++ )
71 for ( i = 2; i < (NB_SM_BEFORE_AVF0+1); i++ )
70 {
72 {
71 ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous;
73 ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous;
72 ring_node_tab[NB_SM_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0;
74 ring_node_tab[NB_SM_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0;
73 }
75 }
74
76
75 // compute the average and store it in the averaged_sm_f1 buffer
77 // compute the average and store it in the averaged_sm_f1 buffer
76 SM_average( current_ring_node_asm_norm_f0->matrix,
78 SM_average( current_ring_node_asm_norm_f0->matrix,
77 current_ring_node_asm_burst_sbm_f0->matrix,
79 current_ring_node_asm_burst_sbm_f0->matrix,
78 ring_node_tab,
80 ring_node_tab,
79 nb_norm_bp1, nb_sbm_bp1 );
81 nb_norm_bp1, nb_sbm_bp1 );
80
82
81 // update nb_average
83 // update nb_average
82 nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF0;
84 nb_norm_bp1 = nb_norm_bp1 + NB_SM_BEFORE_AVF0;
83 nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF0;
85 nb_norm_bp2 = nb_norm_bp2 + NB_SM_BEFORE_AVF0;
84 nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF0;
86 nb_norm_asm = nb_norm_asm + NB_SM_BEFORE_AVF0;
85 nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF0;
87 nb_sbm_bp1 = nb_sbm_bp1 + NB_SM_BEFORE_AVF0;
86 nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF0;
88 nb_sbm_bp2 = nb_sbm_bp2 + NB_SM_BEFORE_AVF0;
87
89
88 //****************************************
90 //****************************************
89 // initialize the mesage for the MATR task
91 // initialize the mesage for the MATR task
90 msgForMATR.event = 0x00; // this composite event will be sent to the MATR task
92 msgForMATR.event = 0x00; // this composite event will be sent to the MATR task
91 msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f0;
93 msgForMATR.burst_sbm = current_ring_node_asm_burst_sbm_f0;
92 msgForMATR.norm = current_ring_node_asm_norm_f0;
94 msgForMATR.norm = current_ring_node_asm_norm_f0;
93 // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0];
95 // msgForMATR.coarseTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[0];
94 // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1];
96 // msgForMATR.fineTime = ( (unsigned int *) (ring_node_tab[0]->buffer_address) )[1];
95 msgForMATR.coarseTime = time_management_regs->coarse_time;
97 msgForMATR.coarseTime = time_management_regs->coarse_time;
96 msgForMATR.fineTime = time_management_regs->fine_time;
98 msgForMATR.fineTime = time_management_regs->fine_time;
97
99
98 if (nb_sbm_bp1 == nb_sm_before_f0.burst_sbm_bp1)
100 if (nb_sbm_bp1 == nb_sm_before_f0.burst_sbm_bp1)
99 {
101 {
100 nb_sbm_bp1 = 0;
102 nb_sbm_bp1 = 0;
101 // set another ring for the ASM storage
103 // set another ring for the ASM storage
102 current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next;
104 current_ring_node_asm_burst_sbm_f0 = current_ring_node_asm_burst_sbm_f0->next;
103 if ( (lfrCurrentMode == LFR_MODE_BURST)
105 if ( (lfrCurrentMode == LFR_MODE_BURST)
104 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
106 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
105 {
107 {
106 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F0;
108 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP1_F0;
107 }
109 }
108 }
110 }
109
111
110 if (nb_sbm_bp2 == nb_sm_before_f0.burst_sbm_bp2)
112 if (nb_sbm_bp2 == nb_sm_before_f0.burst_sbm_bp2)
111 {
113 {
112 nb_sbm_bp2 = 0;
114 nb_sbm_bp2 = 0;
113 if ( (lfrCurrentMode == LFR_MODE_BURST)
115 if ( (lfrCurrentMode == LFR_MODE_BURST)
114 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
116 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
115 {
117 {
116 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F0;
118 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_BURST_SBM_BP2_F0;
117 }
119 }
118 }
120 }
119
121
120 if (nb_norm_bp1 == nb_sm_before_f0.norm_bp1)
122 if (nb_norm_bp1 == nb_sm_before_f0.norm_bp1)
121 {
123 {
122 nb_norm_bp1 = 0;
124 nb_norm_bp1 = 0;
123 // set another ring for the ASM storage
125 // set another ring for the ASM storage
124 current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next;
126 current_ring_node_asm_norm_f0 = current_ring_node_asm_norm_f0->next;
125 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
127 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
126 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
128 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
127 {
129 {
128 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F0;
130 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP1_F0;
129 }
131 }
130 }
132 }
131
133
132 if (nb_norm_bp2 == nb_sm_before_f0.norm_bp2)
134 if (nb_norm_bp2 == nb_sm_before_f0.norm_bp2)
133 {
135 {
134 nb_norm_bp2 = 0;
136 nb_norm_bp2 = 0;
135 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
137 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
136 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
138 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
137 {
139 {
138 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F0;
140 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_BP2_F0;
139 }
141 }
140 }
142 }
141
143
142 if (nb_norm_asm == nb_sm_before_f0.norm_asm)
144 if (nb_norm_asm == nb_sm_before_f0.norm_asm)
143 {
145 {
144 nb_norm_asm = 0;
146 nb_norm_asm = 0;
145 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
147 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
146 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
148 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
147 {
149 {
148 // PRINTF1("%lld\n", localTime)
150 // PRINTF1("%lld\n", localTime)
149 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F0;
151 msgForMATR.event = msgForMATR.event | RTEMS_EVENT_NORM_ASM_F0;
150 }
152 }
151 }
153 }
152
154
153 //*************************
155 //*************************
154 // send the message to MATR
156 // send the message to MATR
155 if (msgForMATR.event != 0x00)
157 if (msgForMATR.event != 0x00)
156 {
158 {
157 status = rtems_message_queue_send( queue_id_prc0, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0);
159 status = rtems_message_queue_send( queue_id_prc0, (char *) &msgForMATR, MSG_QUEUE_SIZE_PRC0);
158 }
160 }
159
161
160 if (status != RTEMS_SUCCESSFUL) {
162 if (status != RTEMS_SUCCESSFUL) {
161 printf("in AVF0 *** Error sending message to MATR, code %d\n", status);
163 printf("in AVF0 *** Error sending message to MATR, code %d\n", status);
162 }
164 }
163 }
165 }
164 }
166 }
165
167
166 rtems_task prc0_task( rtems_task_argument lfrRequestedMode )
168 rtems_task prc0_task( rtems_task_argument lfrRequestedMode )
167 {
169 {
168 char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
170 char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
169 size_t size; // size of the incoming TC packet
171 size_t size; // size of the incoming TC packet
170 asm_msg *incomingMsg;
172 asm_msg *incomingMsg;
171 //
173 //
172 spw_ioctl_pkt_send spw_ioctl_send_ASM;
174 spw_ioctl_pkt_send spw_ioctl_send_ASM;
173 rtems_status_code status;
175 rtems_status_code status;
174 rtems_id queue_id;
176 rtems_id queue_id;
175 rtems_id queue_id_q_p0;
177 rtems_id queue_id_q_p0;
176 Header_TM_LFR_SCIENCE_ASM_t headerASM;
178 Header_TM_LFR_SCIENCE_ASM_t headerASM;
177 bp_packet_with_spare packet_norm_bp1_f0;
179 bp_packet_with_spare packet_norm_bp1_f0;
178 bp_packet packet_norm_bp2_f0;
180 bp_packet packet_norm_bp2_f0;
179 bp_packet packet_sbm_bp1_f0;
181 bp_packet packet_sbm_bp1_f0;
180 bp_packet packet_sbm_bp2_f0;
182 bp_packet packet_sbm_bp2_f0;
181
183
182 unsigned long long int localTime;
184 unsigned long long int localTime;
183
185
184 ASM_init_header( &headerASM );
186 ASM_init_header( &headerASM );
185
187
186 //*************
188 //*************
187 // NORM headers
189 // NORM headers
188 BP_init_header_with_spare( &packet_norm_bp1_f0.header,
190 BP_init_header_with_spare( &packet_norm_bp1_f0.header,
189 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0,
191 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP1_F0,
190 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 );
192 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0, NB_BINS_COMPRESSED_SM_F0 );
191 BP_init_header( &packet_norm_bp2_f0.header,
193 BP_init_header( &packet_norm_bp2_f0.header,
192 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0,
194 APID_TM_SCIENCE_NORMAL_BURST, SID_NORM_BP2_F0,
193 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0);
195 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0, NB_BINS_COMPRESSED_SM_F0);
194
196
195 //****************************
197 //****************************
196 // BURST SBM1 and SBM2 headers
198 // BURST SBM1 and SBM2 headers
197 if ( lfrRequestedMode == LFR_MODE_BURST )
199 if ( lfrRequestedMode == LFR_MODE_BURST )
198 {
200 {
199 BP_init_header( &packet_sbm_bp1_f0.header,
201 BP_init_header( &packet_sbm_bp1_f0.header,
200 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0,
202 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP1_F0,
201 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
203 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
202 BP_init_header( &packet_sbm_bp2_f0.header,
204 BP_init_header( &packet_sbm_bp2_f0.header,
203 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0,
205 APID_TM_SCIENCE_NORMAL_BURST, SID_BURST_BP2_F0,
204 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
206 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
205 }
207 }
206 else if ( lfrRequestedMode == LFR_MODE_SBM1 )
208 else if ( lfrRequestedMode == LFR_MODE_SBM1 )
207 {
209 {
208 BP_init_header( &packet_sbm_bp1_f0.header,
210 BP_init_header( &packet_sbm_bp1_f0.header,
209 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0,
211 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP1_F0,
210 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
212 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
211 BP_init_header( &packet_sbm_bp2_f0.header,
213 BP_init_header( &packet_sbm_bp2_f0.header,
212 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0,
214 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM1_BP2_F0,
213 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
215 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
214 }
216 }
215 else if ( lfrRequestedMode == LFR_MODE_SBM2 )
217 else if ( lfrRequestedMode == LFR_MODE_SBM2 )
216 {
218 {
217 BP_init_header( &packet_sbm_bp1_f0.header,
219 BP_init_header( &packet_sbm_bp1_f0.header,
218 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0,
220 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP1_F0,
219 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
221 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
220 BP_init_header( &packet_sbm_bp2_f0.header,
222 BP_init_header( &packet_sbm_bp2_f0.header,
221 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0,
223 APID_TM_SCIENCE_SBM1_SBM2, SID_SBM2_BP2_F0,
222 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
224 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0, NB_BINS_COMPRESSED_SM_SBM_F0);
223 }
225 }
224 else
226 else
225 {
227 {
226 PRINTF1("in PRC0 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode)
228 PRINTF1("in PRC0 *** lfrRequestedMode is %d, several headers not initialized\n", (unsigned int) lfrRequestedMode)
227 }
229 }
228
230
229 status = get_message_queue_id_send( &queue_id );
231 status = get_message_queue_id_send( &queue_id );
230 if (status != RTEMS_SUCCESSFUL)
232 if (status != RTEMS_SUCCESSFUL)
231 {
233 {
232 PRINTF1("in PRC0 *** ERR get_message_queue_id_send %d\n", status)
234 PRINTF1("in PRC0 *** ERR get_message_queue_id_send %d\n", status)
233 }
235 }
234 status = get_message_queue_id_prc0( &queue_id_q_p0);
236 status = get_message_queue_id_prc0( &queue_id_q_p0);
235 if (status != RTEMS_SUCCESSFUL)
237 if (status != RTEMS_SUCCESSFUL)
236 {
238 {
237 PRINTF1("in PRC0 *** ERR get_message_queue_id_prc0 %d\n", status)
239 PRINTF1("in PRC0 *** ERR get_message_queue_id_prc0 %d\n", status)
238 }
240 }
239
241
240 BOOT_PRINTF1("in PRC0 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
242 BOOT_PRINTF1("in PRC0 *** lfrRequestedMode = %d\n", (int) lfrRequestedMode)
241
243
242 while(1){
244 while(1){
243 status = rtems_message_queue_receive( queue_id_q_p0, incomingData, &size, //************************************
245 status = rtems_message_queue_receive( queue_id_q_p0, incomingData, &size, //************************************
244 RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0
246 RTEMS_WAIT, RTEMS_NO_TIMEOUT ); // wait for a message coming from AVF0
245
247
246 incomingMsg = (asm_msg*) incomingData;
248 incomingMsg = (asm_msg*) incomingData;
247
249
248 localTime = getTimeAsUnsignedLongLongInt( );
250 localTime = getTimeAsUnsignedLongLongInt( );
249 //****************
251 //****************
250 //****************
252 //****************
251 // BURST SBM1 SBM2
253 // BURST SBM1 SBM2
252 //****************
254 //****************
253 //****************
255 //****************
254 if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F0 )
256 if (incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP1_F0 )
255 {
257 {
256 // 1) compress the matrix for Basic Parameters calculation
258 // 1) compress the matrix for Basic Parameters calculation
257 ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm_f0,
259 ASM_compress_reorganize_and_divide( incomingMsg->burst_sbm->matrix, compressed_sm_sbm_f0,
258 nb_sm_before_f0.burst_sbm_bp1,
260 nb_sm_before_f0.burst_sbm_bp1,
259 NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0,
261 NB_BINS_COMPRESSED_SM_SBM_F0, NB_BINS_TO_AVERAGE_ASM_SBM_F0,
260 ASM_F0_INDICE_START);
262 ASM_F0_INDICE_START);
261 // 2) compute the BP1 set
263 // 2) compute the BP1 set
262
264 // BP1_set( compressed_sm_norm_f0, NB_BINS_COMPRESSED_SM_SBM_F0, bp1_sbm_f0 );
263 // 3) send the BP1 set
265 // 3) send the BP1 set
264 set_time( packet_sbm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
266 set_time( packet_sbm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
265 set_time( packet_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
267 set_time( packet_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
266 BP_send( (char *) &packet_sbm_bp1_f0.header, queue_id,
268 BP_send( (char *) &packet_sbm_bp1_f0.header, queue_id,
267 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA);
269 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA);
268 // 4) compute the BP2 set if needed
270 // 4) compute the BP2 set if needed
269 if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F0 )
271 if ( incomingMsg->event & RTEMS_EVENT_BURST_SBM_BP2_F0 )
270 {
272 {
271 // 1) compute the BP2 set
273 // 1) compute the BP2 set
272
274
273 // 2) send the BP2 set
275 // 2) send the BP2 set
274 set_time( packet_sbm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
276 set_time( packet_sbm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
275 set_time( packet_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
277 set_time( packet_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
276 BP_send( (char *) &packet_sbm_bp2_f0.header, queue_id,
278 BP_send( (char *) &packet_sbm_bp2_f0.header, queue_id,
277 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA);
279 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA);
278 }
280 }
279 }
281 }
280
282
281 //*****
283 //*****
282 //*****
284 //*****
283 // NORM
285 // NORM
284 //*****
286 //*****
285 //*****
287 //*****
286 if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0)
288 if (incomingMsg->event & RTEMS_EVENT_NORM_BP1_F0)
287 {
289 {
288 // 1) compress the matrix for Basic Parameters calculation
290 // 1) compress the matrix for Basic Parameters calculation
289 ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0,
291 ASM_compress_reorganize_and_divide( incomingMsg->norm->matrix, compressed_sm_norm_f0,
290 nb_sm_before_f0.norm_bp1,
292 nb_sm_before_f0.norm_bp1,
291 NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0,
293 NB_BINS_COMPRESSED_SM_F0, NB_BINS_TO_AVERAGE_ASM_F0,
292 ASM_F0_INDICE_START );
294 ASM_F0_INDICE_START );
293 // 2) compute the BP1 set
295 // 2) compute the BP1 set
294
296 // BP1_set( compressed_sm_norm_f0, NB_BINS_COMPRESSED_SM_F0, bp1_norm_f0 );
295 // 3) send the BP1 set
297 // 3) send the BP1 set
296 set_time( packet_norm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
298 set_time( packet_norm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
297 set_time( packet_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
299 set_time( packet_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
298 BP_send( (char *) &packet_norm_bp1_f0.header, queue_id,
300 BP_send( (char *) &packet_norm_bp1_f0.header, queue_id,
299 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA);
301 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA);
300 if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0)
302 if (incomingMsg->event & RTEMS_EVENT_NORM_BP2_F0)
301 {
303 {
302 // 1) compute the BP2 set using the same ASM as the one used for BP1
304 // 1) compute the BP2 set using the same ASM as the one used for BP1
303
305
304 // 2) send the BP2 set
306 // 2) send the BP2 set
305 set_time( packet_norm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
307 set_time( packet_norm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
306 set_time( packet_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
308 set_time( packet_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
307 BP_send( (char *) &packet_norm_bp2_f0.header, queue_id,
309 BP_send( (char *) &packet_norm_bp2_f0.header, queue_id,
308 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA);
310 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA);
309 }
311 }
310 }
312 }
311
313
312 if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0)
314 if (incomingMsg->event & RTEMS_EVENT_NORM_ASM_F0)
313 {
315 {
314 // 1) reorganize the ASM and divide
316 // 1) reorganize the ASM and divide
315 ASM_reorganize_and_divide( incomingMsg->norm->matrix,
317 ASM_reorganize_and_divide( incomingMsg->norm->matrix,
316 asm_f0_reorganized,
318 asm_f0_reorganized,
317 nb_sm_before_f0.norm_bp1 );
319 nb_sm_before_f0.norm_bp1 );
318 // 2) convert the float array in a char array
320 // 2) convert the float array in a char array
319 ASM_convert( asm_f0_reorganized, asm_f0_char);
321 ASM_convert( asm_f0_reorganized, asm_f0_char);
320 // 3) send the spectral matrix packets
322 // 3) send the spectral matrix packets
321 set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime );
323 set_time( headerASM.time , (unsigned char *) &incomingMsg->coarseTime );
322 set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
324 set_time( headerASM.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
323 ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
325 ASM_send( &headerASM, asm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
324 }
326 }
325
327
326 }
328 }
327 }
329 }
328
330
329 //**********
331 //**********
330 // FUNCTIONS
332 // FUNCTIONS
331
333
332 void reset_nb_sm_f0( unsigned char lfrMode )
334 void reset_nb_sm_f0( unsigned char lfrMode )
333 {
335 {
334 nb_sm_before_f0.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 96;
336 nb_sm_before_f0.norm_bp1 = parameter_dump_packet.sy_lfr_n_bp_p0 * 96;
335 nb_sm_before_f0.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 96;
337 nb_sm_before_f0.norm_bp2 = parameter_dump_packet.sy_lfr_n_bp_p1 * 96;
336 nb_sm_before_f0.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 96;
338 nb_sm_before_f0.norm_asm = (parameter_dump_packet.sy_lfr_n_asm_p[0] * 256 + parameter_dump_packet.sy_lfr_n_asm_p[1]) * 96;
337 nb_sm_before_f0.sbm1_bp1 = parameter_dump_packet.sy_lfr_s1_bp_p0 * 24;
339 nb_sm_before_f0.sbm1_bp1 = parameter_dump_packet.sy_lfr_s1_bp_p0 * 24;
338 nb_sm_before_f0.sbm1_bp2 = parameter_dump_packet.sy_lfr_s1_bp_p1 * 96;
340 nb_sm_before_f0.sbm1_bp2 = parameter_dump_packet.sy_lfr_s1_bp_p1 * 96;
339 nb_sm_before_f0.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 96;
341 nb_sm_before_f0.sbm2_bp1 = parameter_dump_packet.sy_lfr_s2_bp_p0 * 96;
340 nb_sm_before_f0.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 96;
342 nb_sm_before_f0.sbm2_bp2 = parameter_dump_packet.sy_lfr_s2_bp_p1 * 96;
341 nb_sm_before_f0.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 96;
343 nb_sm_before_f0.burst_bp1 = parameter_dump_packet.sy_lfr_b_bp_p0 * 96;
342 nb_sm_before_f0.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 96;
344 nb_sm_before_f0.burst_bp2 = parameter_dump_packet.sy_lfr_b_bp_p1 * 96;
343
345
344 if (lfrMode == LFR_MODE_SBM1)
346 if (lfrMode == LFR_MODE_SBM1)
345 {
347 {
346 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm1_bp1;
348 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm1_bp1;
347 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm1_bp2;
349 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm1_bp2;
348 }
350 }
349 else if (lfrMode == LFR_MODE_SBM2)
351 else if (lfrMode == LFR_MODE_SBM2)
350 {
352 {
351 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm2_bp1;
353 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.sbm2_bp1;
352 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm2_bp2;
354 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.sbm2_bp2;
353 }
355 }
354 else if (lfrMode == LFR_MODE_BURST)
356 else if (lfrMode == LFR_MODE_BURST)
355 {
357 {
356 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1;
358 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1;
357 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2;
359 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2;
358 }
360 }
359 else
361 else
360 {
362 {
361 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1;
363 nb_sm_before_f0.burst_sbm_bp1 = nb_sm_before_f0.burst_bp1;
362 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2;
364 nb_sm_before_f0.burst_sbm_bp2 = nb_sm_before_f0.burst_bp2;
363 }
365 }
364 }
366 }
@@ -1,1339 +1,1338
1 /** Functions and tasks related to waveform packet generation.
1 /** Functions and tasks related to waveform packet generation.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to handle waveforms, in snapshot or continuous format.\n
6 * A group of functions to handle waveforms, in snapshot or continuous format.\n
7 *
7 *
8 */
8 */
9
9
10 #include "wf_handler.h"
10 #include "wf_handler.h"
11
11
12 //*****************
12 //*****************
13 // waveform headers
13 // waveform headers
14 // SWF
14 // SWF
15 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7];
15 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7];
16 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
16 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
17 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
17 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
18 // CWF
18 // CWF
19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[ NB_PACKETS_PER_GROUP_OF_CWF ];
19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[ NB_PACKETS_PER_GROUP_OF_CWF ];
20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[ NB_PACKETS_PER_GROUP_OF_CWF ];
20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[ NB_PACKETS_PER_GROUP_OF_CWF ];
21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[ NB_PACKETS_PER_GROUP_OF_CWF ];
21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[ NB_PACKETS_PER_GROUP_OF_CWF ];
22 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[ NB_PACKETS_PER_GROUP_OF_CWF ];
22 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[ NB_PACKETS_PER_GROUP_OF_CWF ];
23 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[ NB_PACKETS_PER_GROUP_OF_CWF_LIGHT ];
23 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[ NB_PACKETS_PER_GROUP_OF_CWF_LIGHT ];
24
24
25 //**************
25 //**************
26 // waveform ring
26 // waveform ring
27 ring_node waveform_ring_f0[NB_RING_NODES_F0];
27 ring_node waveform_ring_f0[NB_RING_NODES_F0];
28 ring_node waveform_ring_f1[NB_RING_NODES_F1];
28 ring_node waveform_ring_f1[NB_RING_NODES_F1];
29 ring_node waveform_ring_f2[NB_RING_NODES_F2];
29 ring_node waveform_ring_f2[NB_RING_NODES_F2];
30 ring_node *current_ring_node_f0;
30 ring_node *current_ring_node_f0;
31 ring_node *ring_node_to_send_swf_f0;
31 ring_node *ring_node_to_send_swf_f0;
32 ring_node *current_ring_node_f1;
32 ring_node *current_ring_node_f1;
33 ring_node *ring_node_to_send_swf_f1;
33 ring_node *ring_node_to_send_swf_f1;
34 ring_node *ring_node_to_send_cwf_f1;
34 ring_node *ring_node_to_send_cwf_f1;
35 ring_node *current_ring_node_f2;
35 ring_node *current_ring_node_f2;
36 ring_node *ring_node_to_send_swf_f2;
36 ring_node *ring_node_to_send_swf_f2;
37 ring_node *ring_node_to_send_cwf_f2;
37 ring_node *ring_node_to_send_cwf_f2;
38
38
39 bool extractSWF = false;
39 bool extractSWF = false;
40 bool swf_f0_ready = false;
40 bool swf_f0_ready = false;
41 bool swf_f1_ready = false;
41 bool swf_f1_ready = false;
42 bool swf_f2_ready = false;
42 bool swf_f2_ready = false;
43
43
44 int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
44 int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
45
45
46 //*********************
46 //*********************
47 // Interrupt SubRoutine
47 // Interrupt SubRoutine
48
48
49 void reset_extractSWF( void )
49 void reset_extractSWF( void )
50 {
50 {
51 extractSWF = false;
51 extractSWF = false;
52 swf_f0_ready = false;
52 swf_f0_ready = false;
53 swf_f1_ready = false;
53 swf_f1_ready = false;
54 swf_f2_ready = false;
54 swf_f2_ready = false;
55 }
55 }
56
56
57 rtems_isr waveforms_isr( rtems_vector_number vector )
57 rtems_isr waveforms_isr( rtems_vector_number vector )
58 {
58 {
59 /** This is the interrupt sub routine called by the waveform picker core.
59 /** This is the interrupt sub routine called by the waveform picker core.
60 *
60 *
61 * This ISR launch different actions depending mainly on two pieces of information:
61 * This ISR launch different actions depending mainly on two pieces of information:
62 * 1. the values read in the registers of the waveform picker.
62 * 1. the values read in the registers of the waveform picker.
63 * 2. the current LFR mode.
63 * 2. the current LFR mode.
64 *
64 *
65 */
65 */
66
66
67 rtems_status_code status;
67 rtems_status_code status;
68
68
69 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
69 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
70 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
70 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
71 { // in modes other than STANDBY and BURST, send the CWF_F3 data
71 { // in modes other than STANDBY and BURST, send the CWF_F3 data
72 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
72 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
73 // (1) change the receiving buffer for the waveform picker
73 // (1) change the receiving buffer for the waveform picker
74 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
74 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
75 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b);
75 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b);
76 }
76 }
77 else {
77 else {
78 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a);
78 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a);
79 }
79 }
80 // (2) send an event for the waveforms transmission
80 // (2) send an event for the waveforms transmission
81 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
81 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
82 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
82 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
83 }
83 }
84 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
84 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
85 }
85 }
86 }
86 }
87
87
88 switch(lfrCurrentMode)
88 switch(lfrCurrentMode)
89 {
89 {
90 //********
90 //********
91 // STANDBY
91 // STANDBY
92 case(LFR_MODE_STANDBY):
92 case(LFR_MODE_STANDBY):
93 break;
93 break;
94
94
95 //******
95 //******
96 // NORMAL
96 // NORMAL
97 case(LFR_MODE_NORMAL):
97 case(LFR_MODE_NORMAL):
98 if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits
98 if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits
99 {
99 {
100 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
100 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
101 }
101 }
102 if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits
102 if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits
103 {
103 {
104 // change F0 ring node
104 // change F0 ring node
105 ring_node_to_send_swf_f0 = current_ring_node_f0;
105 ring_node_to_send_swf_f0 = current_ring_node_f0;
106 current_ring_node_f0 = current_ring_node_f0->next;
106 current_ring_node_f0 = current_ring_node_f0->next;
107 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address;
107 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address;
108 // change F1 ring node
108 // change F1 ring node
109 ring_node_to_send_swf_f1 = current_ring_node_f1;
109 ring_node_to_send_swf_f1 = current_ring_node_f1;
110 current_ring_node_f1 = current_ring_node_f1->next;
110 current_ring_node_f1 = current_ring_node_f1->next;
111 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
111 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
112 // change F2 ring node
112 // change F2 ring node
113 ring_node_to_send_swf_f2 = current_ring_node_f2;
113 ring_node_to_send_swf_f2 = current_ring_node_f2;
114 current_ring_node_f2 = current_ring_node_f2->next;
114 current_ring_node_f2 = current_ring_node_f2->next;
115 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
115 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
116 //
116 //
117 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL)
117 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL)
118 {
118 {
119 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
119 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
120 }
120 }
121 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000]
121 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000]
122 }
122 }
123 break;
123 break;
124
124
125 //******
125 //******
126 // BURST
126 // BURST
127 case(LFR_MODE_BURST):
127 case(LFR_MODE_BURST):
128 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
128 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
129 // (1) change the receiving buffer for the waveform picker
129 // (1) change the receiving buffer for the waveform picker
130 ring_node_to_send_cwf_f2 = current_ring_node_f2;
130 ring_node_to_send_cwf_f2 = current_ring_node_f2;
131 current_ring_node_f2 = current_ring_node_f2->next;
131 current_ring_node_f2 = current_ring_node_f2->next;
132 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
132 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
133 // (2) send an event for the waveforms transmission
133 // (2) send an event for the waveforms transmission
134 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
134 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
135 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
135 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
136 }
136 }
137 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
137 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
138 }
138 }
139 break;
139 break;
140
140
141 //*****
141 //*****
142 // SBM1
142 // SBM1
143 case(LFR_MODE_SBM1):
143 case(LFR_MODE_SBM1):
144 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
144 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
145 // (1) change the receiving buffer for the waveform picker
145 // (1) change the receiving buffer for the waveform picker
146 ring_node_to_send_cwf_f1 = current_ring_node_f1;
146 ring_node_to_send_cwf_f1 = current_ring_node_f1;
147 current_ring_node_f1 = current_ring_node_f1->next;
147 current_ring_node_f1 = current_ring_node_f1->next;
148 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
148 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
149 // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed)
149 // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed)
150 status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 );
150 status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 );
151 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0
151 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0
152 }
152 }
153 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
153 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
154 swf_f0_ready = true;
154 swf_f0_ready = true;
155 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0
155 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0
156 }
156 }
157 if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit
157 if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit
158 swf_f2_ready = true;
158 swf_f2_ready = true;
159 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0
159 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0
160 }
160 }
161 break;
161 break;
162
162
163 //*****
163 //*****
164 // SBM2
164 // SBM2
165 case(LFR_MODE_SBM2):
165 case(LFR_MODE_SBM2):
166 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
166 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
167 // (1) change the receiving buffer for the waveform picker
167 // (1) change the receiving buffer for the waveform picker
168 ring_node_to_send_cwf_f2 = current_ring_node_f2;
168 ring_node_to_send_cwf_f2 = current_ring_node_f2;
169 current_ring_node_f2 = current_ring_node_f2->next;
169 current_ring_node_f2 = current_ring_node_f2->next;
170 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
170 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
171 // (2) send an event for the waveforms transmission
171 // (2) send an event for the waveforms transmission
172 status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 );
172 status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 );
173 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
173 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
174 }
174 }
175 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
175 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
176 swf_f0_ready = true;
176 swf_f0_ready = true;
177 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0
177 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0
178 }
178 }
179 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
179 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
180 swf_f1_ready = true;
180 swf_f1_ready = true;
181 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0
181 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0
182 }
182 }
183 break;
183 break;
184
184
185 //********
185 //********
186 // DEFAULT
186 // DEFAULT
187 default:
187 default:
188 break;
188 break;
189 }
189 }
190 }
190 }
191
191
192 //************
192 //************
193 // RTEMS TASKS
193 // RTEMS TASKS
194
194
195 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
195 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
196 {
196 {
197 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
197 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
198 *
198 *
199 * @param unused is the starting argument of the RTEMS task
199 * @param unused is the starting argument of the RTEMS task
200 *
200 *
201 * The following data packets are sent by this task:
201 * The following data packets are sent by this task:
202 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
202 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
203 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
203 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
204 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
204 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
205 *
205 *
206 */
206 */
207
207
208 rtems_event_set event_out;
208 rtems_event_set event_out;
209 rtems_id queue_id;
209 rtems_id queue_id;
210 rtems_status_code status;
210 rtems_status_code status;
211
211
212 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
212 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
213 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
213 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
214 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
214 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
215
215
216 init_waveforms();
216 init_waveforms();
217
217
218 status = get_message_queue_id_send( &queue_id );
218 status = get_message_queue_id_send( &queue_id );
219 if (status != RTEMS_SUCCESSFUL)
219 if (status != RTEMS_SUCCESSFUL)
220 {
220 {
221 PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status)
221 PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status)
222 }
222 }
223
223
224 BOOT_PRINTF("in WFRM ***\n")
224 BOOT_PRINTF("in WFRM ***\n")
225
225
226 while(1){
226 while(1){
227 // wait for an RTEMS_EVENT
227 // wait for an RTEMS_EVENT
228 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
228 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
229 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
229 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
230 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
230 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
231 if (event_out == RTEMS_EVENT_MODE_NORMAL)
231 if (event_out == RTEMS_EVENT_MODE_NORMAL)
232 {
232 {
233 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n")
233 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);
234 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);
235 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);
236 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
237 }
237 }
238 if (event_out == RTEMS_EVENT_MODE_SBM1)
238 if (event_out == RTEMS_EVENT_MODE_SBM1)
239 {
239 {
240 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n")
240 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);
241 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);
242 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);
243 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
244 }
244 }
245 if (event_out == RTEMS_EVENT_MODE_SBM2)
245 if (event_out == RTEMS_EVENT_MODE_SBM2)
246 {
246 {
247 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n")
247 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);
248 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);
249 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);
250 send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F2, headerSWF_F2, queue_id);
251 }
251 }
252 }
252 }
253 }
253 }
254
254
255 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
255 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
256 {
256 {
257 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
257 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
258 *
258 *
259 * @param unused is the starting argument of the RTEMS task
259 * @param unused is the starting argument of the RTEMS task
260 *
260 *
261 * The following data packet is sent by this task:
261 * The following data packet is sent by this task:
262 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
262 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
263 *
263 *
264 */
264 */
265
265
266 rtems_event_set event_out;
266 rtems_event_set event_out;
267 rtems_id queue_id;
267 rtems_id queue_id;
268 rtems_status_code status;
268 rtems_status_code status;
269
269
270 init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 );
270 init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 );
271 init_header_continuous_cwf3_light_table( headerCWF_F3_light );
271 init_header_continuous_cwf3_light_table( headerCWF_F3_light );
272
272
273 status = get_message_queue_id_send( &queue_id );
273 status = get_message_queue_id_send( &queue_id );
274 if (status != RTEMS_SUCCESSFUL)
274 if (status != RTEMS_SUCCESSFUL)
275 {
275 {
276 PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status)
276 PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status)
277 }
277 }
278
278
279 BOOT_PRINTF("in CWF3 ***\n")
279 BOOT_PRINTF("in CWF3 ***\n")
280
280
281 while(1){
281 while(1){
282 // wait for an RTEMS_EVENT
282 // wait for an RTEMS_EVENT
283 rtems_event_receive( RTEMS_EVENT_0,
283 rtems_event_receive( RTEMS_EVENT_0,
284 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
284 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
285 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
285 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
286 {
286 {
287 PRINTF("send CWF_LONG_F3\n")
287 PRINTF("send CWF_LONG_F3\n")
288 }
288 }
289 else
289 else
290 {
290 {
291 PRINTF("send CWF_F3 (light)\n")
291 PRINTF("send CWF_F3 (light)\n")
292 }
292 }
293 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
293 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
294 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
294 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
295 {
295 {
296 send_waveform_CWF( wf_cont_f3_b, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
296 send_waveform_CWF( wf_cont_f3_b, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
297 }
297 }
298 else
298 else
299 {
299 {
300 send_waveform_CWF3_light( wf_cont_f3_b, headerCWF_F3_light, queue_id );
300 send_waveform_CWF3_light( wf_cont_f3_b, headerCWF_F3_light, queue_id );
301 }
301 }
302 }
302 }
303 else
303 else
304 {
304 {
305 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
305 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
306 {
306 {
307 send_waveform_CWF( wf_cont_f3_a, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
307 send_waveform_CWF( wf_cont_f3_a, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
308 }
308 }
309 else
309 else
310 {
310 {
311 send_waveform_CWF3_light( wf_cont_f3_a, headerCWF_F3_light, queue_id );
311 send_waveform_CWF3_light( wf_cont_f3_a, headerCWF_F3_light, queue_id );
312 }
312 }
313
313
314 }
314 }
315 }
315 }
316 }
316 }
317
317
318 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
318 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
319 {
319 {
320 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
320 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
321 *
321 *
322 * @param unused is the starting argument of the RTEMS task
322 * @param unused is the starting argument of the RTEMS task
323 *
323 *
324 * The following data packet is sent by this function:
324 * The following data packet is sent by this function:
325 * - TM_LFR_SCIENCE_BURST_CWF_F2
325 * - TM_LFR_SCIENCE_BURST_CWF_F2
326 * - TM_LFR_SCIENCE_SBM2_CWF_F2
326 * - TM_LFR_SCIENCE_SBM2_CWF_F2
327 *
327 *
328 */
328 */
329
329
330 rtems_event_set event_out;
330 rtems_event_set event_out;
331 rtems_id queue_id;
331 rtems_id queue_id;
332 rtems_status_code status;
332 rtems_status_code status;
333
333
334 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
334 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
335 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
335 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
336
336
337 status = get_message_queue_id_send( &queue_id );
337 status = get_message_queue_id_send( &queue_id );
338 if (status != RTEMS_SUCCESSFUL)
338 if (status != RTEMS_SUCCESSFUL)
339 {
339 {
340 PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status)
340 PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status)
341 }
341 }
342
342
343 BOOT_PRINTF("in CWF2 ***\n")
343 BOOT_PRINTF("in CWF2 ***\n")
344
344
345 while(1){
345 while(1){
346 // wait for an RTEMS_EVENT
346 // wait for an RTEMS_EVENT
347 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
347 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
348 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
348 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
349 if (event_out == RTEMS_EVENT_MODE_BURST)
349 if (event_out == RTEMS_EVENT_MODE_BURST)
350 {
350 {
351 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
351 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
352 }
352 }
353 if (event_out == RTEMS_EVENT_MODE_SBM2)
353 if (event_out == RTEMS_EVENT_MODE_SBM2)
354 {
354 {
355 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
355 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
356 // launch snapshot extraction if needed
356 // launch snapshot extraction if needed
357 if (extractSWF == true)
357 if (extractSWF == true)
358 {
358 {
359 ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2;
359 ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2;
360 // extract the snapshot
360 // extract the snapshot
361 build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 );
361 build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 );
362 // send the snapshot when built
362 // send the snapshot when built
363 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 );
363 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 );
364 extractSWF = false;
364 extractSWF = false;
365 }
365 }
366 if (swf_f0_ready && swf_f1_ready)
366 if (swf_f0_ready && swf_f1_ready)
367 {
367 {
368 extractSWF = true;
368 extractSWF = true;
369 swf_f0_ready = false;
369 swf_f0_ready = false;
370 swf_f1_ready = false;
370 swf_f1_ready = false;
371 }
371 }
372 }
372 }
373 }
373 }
374 }
374 }
375
375
376 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
376 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
377 {
377 {
378 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
378 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
379 *
379 *
380 * @param unused is the starting argument of the RTEMS task
380 * @param unused is the starting argument of the RTEMS task
381 *
381 *
382 * The following data packet is sent by this function:
382 * The following data packet is sent by this function:
383 * - TM_LFR_SCIENCE_SBM1_CWF_F1
383 * - TM_LFR_SCIENCE_SBM1_CWF_F1
384 *
384 *
385 */
385 */
386
386
387 rtems_event_set event_out;
387 rtems_event_set event_out;
388 rtems_id queue_id;
388 rtems_id queue_id;
389 rtems_status_code status;
389 rtems_status_code status;
390
390
391 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
391 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
392
392
393 status = get_message_queue_id_send( &queue_id );
393 status = get_message_queue_id_send( &queue_id );
394 if (status != RTEMS_SUCCESSFUL)
394 if (status != RTEMS_SUCCESSFUL)
395 {
395 {
396 PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status)
396 PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status)
397 }
397 }
398
398
399 BOOT_PRINTF("in CWF1 ***\n")
399 BOOT_PRINTF("in CWF1 ***\n")
400
400
401 while(1){
401 while(1){
402 // wait for an RTEMS_EVENT
402 // wait for an RTEMS_EVENT
403 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
403 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
404 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
404 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
405 send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
405 send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
406 // launch snapshot extraction if needed
406 // launch snapshot extraction if needed
407 if (extractSWF == true)
407 if (extractSWF == true)
408 {
408 {
409 ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1;
409 ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1;
410 // launch the snapshot extraction
410 // launch the snapshot extraction
411 status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 );
411 status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 );
412 extractSWF = false;
412 extractSWF = false;
413 }
413 }
414 if (swf_f0_ready == true)
414 if (swf_f0_ready == true)
415 {
415 {
416 extractSWF = true;
416 extractSWF = true;
417 swf_f0_ready = false; // this step shall be executed only one time
417 swf_f0_ready = false; // this step shall be executed only one time
418 }
418 }
419 if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction
419 if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction
420 {
420 {
421 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 );
421 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 );
422 swf_f1_ready = false;
422 swf_f1_ready = false;
423 swf_f2_ready = false;
423 swf_f2_ready = false;
424 }
424 }
425 }
425 }
426 }
426 }
427
427
428 rtems_task swbd_task(rtems_task_argument argument)
428 rtems_task swbd_task(rtems_task_argument argument)
429 {
429 {
430 /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers.
430 /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers.
431 *
431 *
432 * @param unused is the starting argument of the RTEMS task
432 * @param unused is the starting argument of the RTEMS task
433 *
433 *
434 */
434 */
435
435
436 rtems_event_set event_out;
436 rtems_event_set event_out;
437
437
438 BOOT_PRINTF("in SWBD ***\n")
438 BOOT_PRINTF("in SWBD ***\n")
439
439
440 while(1){
440 while(1){
441 // wait for an RTEMS_EVENT
441 // wait for an RTEMS_EVENT
442 rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2,
442 rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2,
443 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
443 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
444 if (event_out == RTEMS_EVENT_MODE_SBM1)
444 if (event_out == RTEMS_EVENT_MODE_SBM1)
445 {
445 {
446 build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 );
446 build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 );
447 swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent
447 swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent
448 }
448 }
449 else
449 else
450 {
450 {
451 PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out)
451 PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out)
452 }
452 }
453 }
453 }
454 }
454 }
455
455
456 //******************
456 //******************
457 // general functions
457 // general functions
458 void init_waveforms( void )
458 void init_waveforms( void )
459 {
459 {
460 int i = 0;
460 int i = 0;
461
461
462 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
462 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
463 {
463 {
464 //***
464 //***
465 // F0
465 // F0
466 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
466 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
467 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
467 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
468 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
468 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
469
469
470 //***
470 //***
471 // F1
471 // F1
472 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
472 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
473 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
473 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
474 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
474 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
475
475
476 //***
476 //***
477 // F2
477 // F2
478 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
478 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
479 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
479 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
480 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
480 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
481
481
482 //***
482 //***
483 // F3
483 // F3
484 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
484 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
485 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
485 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
486 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
486 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
487 }
487 }
488 }
488 }
489
489
490 void init_waveform_rings( void )
490 void init_waveform_rings( void )
491 {
491 {
492 unsigned char i;
492 unsigned char i;
493
493
494 // F0 RING
494 // F0 RING
495 waveform_ring_f0[0].next = (ring_node*) &waveform_ring_f0[1];
495 waveform_ring_f0[0].next = (ring_node*) &waveform_ring_f0[1];
496 waveform_ring_f0[0].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-1];
496 waveform_ring_f0[0].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-1];
497 waveform_ring_f0[0].buffer_address = (int) &wf_snap_f0[0][0];
497 waveform_ring_f0[0].buffer_address = (int) &wf_snap_f0[0][0];
498
498
499 waveform_ring_f0[NB_RING_NODES_F0-1].next = (ring_node*) &waveform_ring_f0[0];
499 waveform_ring_f0[NB_RING_NODES_F0-1].next = (ring_node*) &waveform_ring_f0[0];
500 waveform_ring_f0[NB_RING_NODES_F0-1].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-2];
500 waveform_ring_f0[NB_RING_NODES_F0-1].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-2];
501 waveform_ring_f0[NB_RING_NODES_F0-1].buffer_address = (int) &wf_snap_f0[NB_RING_NODES_F0-1][0];
501 waveform_ring_f0[NB_RING_NODES_F0-1].buffer_address = (int) &wf_snap_f0[NB_RING_NODES_F0-1][0];
502
502
503 for(i=1; i<NB_RING_NODES_F0-1; i++)
503 for(i=1; i<NB_RING_NODES_F0-1; i++)
504 {
504 {
505 waveform_ring_f0[i].next = (ring_node*) &waveform_ring_f0[i+1];
505 waveform_ring_f0[i].next = (ring_node*) &waveform_ring_f0[i+1];
506 waveform_ring_f0[i].previous = (ring_node*) &waveform_ring_f0[i-1];
506 waveform_ring_f0[i].previous = (ring_node*) &waveform_ring_f0[i-1];
507 waveform_ring_f0[i].buffer_address = (int) &wf_snap_f0[i][0];
507 waveform_ring_f0[i].buffer_address = (int) &wf_snap_f0[i][0];
508 }
508 }
509
509
510 // F1 RING
510 // F1 RING
511 waveform_ring_f1[0].next = (ring_node*) &waveform_ring_f1[1];
511 waveform_ring_f1[0].next = (ring_node*) &waveform_ring_f1[1];
512 waveform_ring_f1[0].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-1];
512 waveform_ring_f1[0].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-1];
513 waveform_ring_f1[0].buffer_address = (int) &wf_snap_f1[0][0];
513 waveform_ring_f1[0].buffer_address = (int) &wf_snap_f1[0][0];
514
514
515 waveform_ring_f1[NB_RING_NODES_F1-1].next = (ring_node*) &waveform_ring_f1[0];
515 waveform_ring_f1[NB_RING_NODES_F1-1].next = (ring_node*) &waveform_ring_f1[0];
516 waveform_ring_f1[NB_RING_NODES_F1-1].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-2];
516 waveform_ring_f1[NB_RING_NODES_F1-1].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-2];
517 waveform_ring_f1[NB_RING_NODES_F1-1].buffer_address = (int) &wf_snap_f1[NB_RING_NODES_F1-1][0];
517 waveform_ring_f1[NB_RING_NODES_F1-1].buffer_address = (int) &wf_snap_f1[NB_RING_NODES_F1-1][0];
518
518
519 for(i=1; i<NB_RING_NODES_F1-1; i++)
519 for(i=1; i<NB_RING_NODES_F1-1; i++)
520 {
520 {
521 waveform_ring_f1[i].next = (ring_node*) &waveform_ring_f1[i+1];
521 waveform_ring_f1[i].next = (ring_node*) &waveform_ring_f1[i+1];
522 waveform_ring_f1[i].previous = (ring_node*) &waveform_ring_f1[i-1];
522 waveform_ring_f1[i].previous = (ring_node*) &waveform_ring_f1[i-1];
523 waveform_ring_f1[i].buffer_address = (int) &wf_snap_f1[i][0];
523 waveform_ring_f1[i].buffer_address = (int) &wf_snap_f1[i][0];
524 }
524 }
525
525
526 // F2 RING
526 // F2 RING
527 waveform_ring_f2[0].next = (ring_node*) &waveform_ring_f2[1];
527 waveform_ring_f2[0].next = (ring_node*) &waveform_ring_f2[1];
528 waveform_ring_f2[0].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-1];
528 waveform_ring_f2[0].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-1];
529 waveform_ring_f2[0].buffer_address = (int) &wf_snap_f2[0][0];
529 waveform_ring_f2[0].buffer_address = (int) &wf_snap_f2[0][0];
530
530
531 waveform_ring_f2[NB_RING_NODES_F2-1].next = (ring_node*) &waveform_ring_f2[0];
531 waveform_ring_f2[NB_RING_NODES_F2-1].next = (ring_node*) &waveform_ring_f2[0];
532 waveform_ring_f2[NB_RING_NODES_F2-1].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-2];
532 waveform_ring_f2[NB_RING_NODES_F2-1].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-2];
533 waveform_ring_f2[NB_RING_NODES_F2-1].buffer_address = (int) &wf_snap_f2[NB_RING_NODES_F2-1][0];
533 waveform_ring_f2[NB_RING_NODES_F2-1].buffer_address = (int) &wf_snap_f2[NB_RING_NODES_F2-1][0];
534
534
535 for(i=1; i<NB_RING_NODES_F2-1; i++)
535 for(i=1; i<NB_RING_NODES_F2-1; i++)
536 {
536 {
537 waveform_ring_f2[i].next = (ring_node*) &waveform_ring_f2[i+1];
537 waveform_ring_f2[i].next = (ring_node*) &waveform_ring_f2[i+1];
538 waveform_ring_f2[i].previous = (ring_node*) &waveform_ring_f2[i-1];
538 waveform_ring_f2[i].previous = (ring_node*) &waveform_ring_f2[i-1];
539 waveform_ring_f2[i].buffer_address = (int) &wf_snap_f2[i][0];
539 waveform_ring_f2[i].buffer_address = (int) &wf_snap_f2[i][0];
540 }
540 }
541
541
542 DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0)
542 DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0)
543 DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1)
543 DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1)
544 DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2)
544 DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2)
545
545
546 }
546 }
547
547
548 void reset_current_ring_nodes( void )
548 void reset_current_ring_nodes( void )
549 {
549 {
550 current_ring_node_f0 = waveform_ring_f0;
550 current_ring_node_f0 = waveform_ring_f0;
551 ring_node_to_send_swf_f0 = waveform_ring_f0;
551 ring_node_to_send_swf_f0 = waveform_ring_f0;
552
552
553 current_ring_node_f1 = waveform_ring_f1;
553 current_ring_node_f1 = waveform_ring_f1;
554 ring_node_to_send_cwf_f1 = waveform_ring_f1;
554 ring_node_to_send_cwf_f1 = waveform_ring_f1;
555 ring_node_to_send_swf_f1 = waveform_ring_f1;
555 ring_node_to_send_swf_f1 = waveform_ring_f1;
556
556
557 current_ring_node_f2 = waveform_ring_f2;
557 current_ring_node_f2 = waveform_ring_f2;
558 ring_node_to_send_cwf_f2 = waveform_ring_f2;
558 ring_node_to_send_cwf_f2 = waveform_ring_f2;
559 ring_node_to_send_swf_f2 = waveform_ring_f2;
559 ring_node_to_send_swf_f2 = waveform_ring_f2;
560 }
560 }
561
561
562 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
562 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
563 {
563 {
564 unsigned char i;
564 unsigned char i;
565
565
566 for (i=0; i<7; i++)
566 for (i=0; i<7; i++)
567 {
567 {
568 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
568 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
569 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
569 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
570 headerSWF[ i ].reserved = DEFAULT_RESERVED;
570 headerSWF[ i ].reserved = DEFAULT_RESERVED;
571 headerSWF[ i ].userApplication = CCSDS_USER_APP;
571 headerSWF[ i ].userApplication = CCSDS_USER_APP;
572 headerSWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
572 headerSWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
573 headerSWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
573 headerSWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
574 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
574 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
575 if (i == 6)
575 if (i == 6)
576 {
576 {
577 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8);
577 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8);
578 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 );
578 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 );
579 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8);
579 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8);
580 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 );
580 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 );
581 }
581 }
582 else
582 else
583 {
583 {
584 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8);
584 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8);
585 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 );
585 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 );
586 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8);
586 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8);
587 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 );
587 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 );
588 }
588 }
589 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
589 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
590 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
590 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
591 headerSWF[ i ].pktNr = i+1; // PKT_NR
591 headerSWF[ i ].pktNr = i+1; // PKT_NR
592 // DATA FIELD HEADER
592 // DATA FIELD HEADER
593 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
593 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
594 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
594 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
595 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
595 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
596 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
596 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
597 // AUXILIARY DATA HEADER
597 // AUXILIARY DATA HEADER
598 headerSWF[ i ].time[0] = 0x00;
598 headerSWF[ i ].time[0] = 0x00;
599 headerSWF[ i ].time[0] = 0x00;
599 headerSWF[ i ].time[0] = 0x00;
600 headerSWF[ i ].time[0] = 0x00;
600 headerSWF[ i ].time[0] = 0x00;
601 headerSWF[ i ].time[0] = 0x00;
601 headerSWF[ i ].time[0] = 0x00;
602 headerSWF[ i ].time[0] = 0x00;
602 headerSWF[ i ].time[0] = 0x00;
603 headerSWF[ i ].time[0] = 0x00;
603 headerSWF[ i ].time[0] = 0x00;
604 headerSWF[ i ].sid = sid;
604 headerSWF[ i ].sid = sid;
605 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
605 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
606 }
606 }
607 return LFR_SUCCESSFUL;
607 return LFR_SUCCESSFUL;
608 }
608 }
609
609
610 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
610 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
611 {
611 {
612 unsigned int i;
612 unsigned int i;
613
613
614 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++)
614 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++)
615 {
615 {
616 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
616 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
617 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
617 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
618 headerCWF[ i ].reserved = DEFAULT_RESERVED;
618 headerCWF[ i ].reserved = DEFAULT_RESERVED;
619 headerCWF[ i ].userApplication = CCSDS_USER_APP;
619 headerCWF[ i ].userApplication = CCSDS_USER_APP;
620 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
620 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
621 {
621 {
622 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2 >> 8);
622 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2 >> 8);
623 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2);
623 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2);
624 }
624 }
625 else
625 else
626 {
626 {
627 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
627 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
628 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
628 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
629 }
629 }
630 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
630 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
631 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8);
631 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8);
632 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 );
632 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 );
633 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8);
633 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8);
634 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF );
634 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF );
635 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
635 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
636 // DATA FIELD HEADER
636 // DATA FIELD HEADER
637 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
637 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
638 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
638 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
639 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
639 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
640 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
640 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
641 // AUXILIARY DATA HEADER
641 // AUXILIARY DATA HEADER
642 headerCWF[ i ].sid = sid;
642 headerCWF[ i ].sid = sid;
643 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
643 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
644 headerCWF[ i ].time[0] = 0x00;
644 headerCWF[ i ].time[0] = 0x00;
645 headerCWF[ i ].time[0] = 0x00;
645 headerCWF[ i ].time[0] = 0x00;
646 headerCWF[ i ].time[0] = 0x00;
646 headerCWF[ i ].time[0] = 0x00;
647 headerCWF[ i ].time[0] = 0x00;
647 headerCWF[ i ].time[0] = 0x00;
648 headerCWF[ i ].time[0] = 0x00;
648 headerCWF[ i ].time[0] = 0x00;
649 headerCWF[ i ].time[0] = 0x00;
649 headerCWF[ i ].time[0] = 0x00;
650 }
650 }
651 return LFR_SUCCESSFUL;
651 return LFR_SUCCESSFUL;
652 }
652 }
653
653
654 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
654 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
655 {
655 {
656 unsigned int i;
656 unsigned int i;
657
657
658 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++)
658 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++)
659 {
659 {
660 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
660 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
661 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
661 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
662 headerCWF[ i ].reserved = DEFAULT_RESERVED;
662 headerCWF[ i ].reserved = DEFAULT_RESERVED;
663 headerCWF[ i ].userApplication = CCSDS_USER_APP;
663 headerCWF[ i ].userApplication = CCSDS_USER_APP;
664
664
665 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
665 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
666 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
666 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
667
667
668 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
668 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
669 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8);
669 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8);
670 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 );
670 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 );
671 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8);
671 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8);
672 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 );
672 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 );
673
673
674 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
674 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
675 // DATA FIELD HEADER
675 // DATA FIELD HEADER
676 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
676 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
677 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
677 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
678 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
678 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
679 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
679 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
680 // AUXILIARY DATA HEADER
680 // AUXILIARY DATA HEADER
681 headerCWF[ i ].sid = SID_NORM_CWF_F3;
681 headerCWF[ i ].sid = SID_NORM_CWF_F3;
682 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
682 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
683 headerCWF[ i ].time[0] = 0x00;
683 headerCWF[ i ].time[0] = 0x00;
684 headerCWF[ i ].time[0] = 0x00;
684 headerCWF[ i ].time[0] = 0x00;
685 headerCWF[ i ].time[0] = 0x00;
685 headerCWF[ i ].time[0] = 0x00;
686 headerCWF[ i ].time[0] = 0x00;
686 headerCWF[ i ].time[0] = 0x00;
687 headerCWF[ i ].time[0] = 0x00;
687 headerCWF[ i ].time[0] = 0x00;
688 headerCWF[ i ].time[0] = 0x00;
688 headerCWF[ i ].time[0] = 0x00;
689 }
689 }
690 return LFR_SUCCESSFUL;
690 return LFR_SUCCESSFUL;
691 }
691 }
692
692
693 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
693 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
694 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
694 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
695 {
695 {
696 /** This function sends SWF CCSDS packets (F2, F1 or F0).
696 /** This function sends SWF CCSDS packets (F2, F1 or F0).
697 *
697 *
698 * @param waveform points to the buffer containing the data that will be send.
698 * @param waveform points to the buffer containing the data that will be send.
699 * @param sid is the source identifier of the data that will be sent.
699 * @param sid is the source identifier of the data that will be sent.
700 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
700 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
701 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
701 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
702 * contain information to setup the transmission of the data packets.
702 * contain information to setup the transmission of the data packets.
703 *
703 *
704 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
704 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
705 *
705 *
706 */
706 */
707
707
708 unsigned int i;
708 unsigned int i;
709 int ret;
709 int ret;
710 unsigned int coarseTime;
710 unsigned int coarseTime;
711 unsigned int fineTime;
711 unsigned int fineTime;
712 rtems_status_code status;
712 rtems_status_code status;
713 spw_ioctl_pkt_send spw_ioctl_send_SWF;
713 spw_ioctl_pkt_send spw_ioctl_send_SWF;
714
714
715 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
715 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
716 spw_ioctl_send_SWF.options = 0;
716 spw_ioctl_send_SWF.options = 0;
717
717
718 ret = LFR_DEFAULT;
718 ret = LFR_DEFAULT;
719
719
720 coarseTime = waveform[0];
720 coarseTime = waveform[0];
721 fineTime = waveform[1];
721 fineTime = waveform[1];
722
722
723 for (i=0; i<7; i++) // send waveform
723 for (i=0; i<7; i++) // send waveform
724 {
724 {
725 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET];
725 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET];
726 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
726 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
727 // BUILD THE DATA
727 // BUILD THE DATA
728 if (i==6) {
728 if (i==6) {
729 spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK;
729 spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK;
730 }
730 }
731 else {
731 else {
732 spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK;
732 spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK;
733 }
733 }
734 // SET PACKET SEQUENCE COUNTER
734 // SET PACKET SEQUENCE COUNTER
735 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
735 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
736 // SET PACKET TIME
736 // SET PACKET TIME
737 compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime );
737 compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime );
738 //
738 //
739 headerSWF[ i ].time[0] = headerSWF[ i ].acquisitionTime[0];
739 headerSWF[ i ].time[0] = headerSWF[ i ].acquisitionTime[0];
740 headerSWF[ i ].time[1] = headerSWF[ i ].acquisitionTime[1];
740 headerSWF[ i ].time[1] = headerSWF[ i ].acquisitionTime[1];
741 headerSWF[ i ].time[2] = headerSWF[ i ].acquisitionTime[2];
741 headerSWF[ i ].time[2] = headerSWF[ i ].acquisitionTime[2];
742 headerSWF[ i ].time[3] = headerSWF[ i ].acquisitionTime[3];
742 headerSWF[ i ].time[3] = headerSWF[ i ].acquisitionTime[3];
743 headerSWF[ i ].time[4] = headerSWF[ i ].acquisitionTime[4];
743 headerSWF[ i ].time[4] = headerSWF[ i ].acquisitionTime[4];
744 headerSWF[ i ].time[5] = headerSWF[ i ].acquisitionTime[5];
744 headerSWF[ i ].time[5] = headerSWF[ i ].acquisitionTime[5];
745 // SEND PACKET
745 // SEND PACKET
746 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
746 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
747 if (status != RTEMS_SUCCESSFUL) {
747 if (status != RTEMS_SUCCESSFUL) {
748 printf("%d-%d, ERR %d\n", sid, i, (int) status);
748 printf("%d-%d, ERR %d\n", sid, i, (int) status);
749 ret = LFR_DEFAULT;
749 ret = LFR_DEFAULT;
750 }
750 }
751 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
751 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
752 }
752 }
753
753
754 return ret;
754 return ret;
755 }
755 }
756
756
757 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
757 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
758 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
758 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
759 {
759 {
760 /** This function sends CWF CCSDS packets (F2, F1 or F0).
760 /** This function sends CWF CCSDS packets (F2, F1 or F0).
761 *
761 *
762 * @param waveform points to the buffer containing the data that will be send.
762 * @param waveform points to the buffer containing the data that will be send.
763 * @param sid is the source identifier of the data that will be sent.
763 * @param sid is the source identifier of the data that will be sent.
764 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
764 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
765 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
765 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
766 * contain information to setup the transmission of the data packets.
766 * contain information to setup the transmission of the data packets.
767 *
767 *
768 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
768 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
769 *
769 *
770 */
770 */
771
771
772 unsigned int i;
772 unsigned int i;
773 int ret;
773 int ret;
774 unsigned int coarseTime;
774 unsigned int coarseTime;
775 unsigned int fineTime;
775 unsigned int fineTime;
776 rtems_status_code status;
776 rtems_status_code status;
777 spw_ioctl_pkt_send spw_ioctl_send_CWF;
777 spw_ioctl_pkt_send spw_ioctl_send_CWF;
778
778
779 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
779 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
780 spw_ioctl_send_CWF.options = 0;
780 spw_ioctl_send_CWF.options = 0;
781
781
782 ret = LFR_DEFAULT;
782 ret = LFR_DEFAULT;
783
783
784 coarseTime = waveform[0];
784 coarseTime = waveform[0];
785 fineTime = waveform[1];
785 fineTime = waveform[1];
786
786
787 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform
787 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform
788 {
788 {
789 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET];
789 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET];
790 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
790 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
791 // BUILD THE DATA
791 // BUILD THE DATA
792 spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK;
792 spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK;
793 // SET PACKET SEQUENCE COUNTER
793 // SET PACKET SEQUENCE COUNTER
794 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
794 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
795 // SET PACKET TIME
795 // SET PACKET TIME
796 compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime);
796 compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime);
797 //
797 //
798 headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0];
798 headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0];
799 headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1];
799 headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1];
800 headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2];
800 headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2];
801 headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3];
801 headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3];
802 headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4];
802 headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4];
803 headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5];
803 headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5];
804 // SEND PACKET
804 // SEND PACKET
805 if (sid == SID_NORM_CWF_LONG_F3)
805 if (sid == SID_NORM_CWF_LONG_F3)
806 {
806 {
807 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
807 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
808 if (status != RTEMS_SUCCESSFUL) {
808 if (status != RTEMS_SUCCESSFUL) {
809 printf("%d-%d, ERR %d\n", sid, i, (int) status);
809 printf("%d-%d, ERR %d\n", sid, i, (int) status);
810 ret = LFR_DEFAULT;
810 ret = LFR_DEFAULT;
811 }
811 }
812 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
812 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
813 }
813 }
814 else
814 else
815 {
815 {
816 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
816 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
817 if (status != RTEMS_SUCCESSFUL) {
817 if (status != RTEMS_SUCCESSFUL) {
818 printf("%d-%d, ERR %d\n", sid, i, (int) status);
818 printf("%d-%d, ERR %d\n", sid, i, (int) status);
819 ret = LFR_DEFAULT;
819 ret = LFR_DEFAULT;
820 }
820 }
821 }
821 }
822 }
822 }
823
823
824 return ret;
824 return ret;
825 }
825 }
826
826
827 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
827 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
828 {
828 {
829 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
829 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
830 *
830 *
831 * @param waveform points to the buffer containing the data that will be send.
831 * @param waveform points to the buffer containing the data that will be send.
832 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
832 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
833 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
833 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
834 * contain information to setup the transmission of the data packets.
834 * contain information to setup the transmission of the data packets.
835 *
835 *
836 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
836 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
837 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
837 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
838 *
838 *
839 */
839 */
840
840
841 unsigned int i;
841 unsigned int i;
842 int ret;
842 int ret;
843 unsigned int coarseTime;
843 unsigned int coarseTime;
844 unsigned int fineTime;
844 unsigned int fineTime;
845 rtems_status_code status;
845 rtems_status_code status;
846 spw_ioctl_pkt_send spw_ioctl_send_CWF;
846 spw_ioctl_pkt_send spw_ioctl_send_CWF;
847 char *sample;
847 char *sample;
848
848
849 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
849 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
850 spw_ioctl_send_CWF.options = 0;
850 spw_ioctl_send_CWF.options = 0;
851
851
852 ret = LFR_DEFAULT;
852 ret = LFR_DEFAULT;
853
853
854 //**********************
854 //**********************
855 // BUILD CWF3_light DATA
855 // BUILD CWF3_light DATA
856 for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
856 for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
857 {
857 {
858 sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
858 sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
859 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ];
859 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ];
860 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ];
860 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ];
861 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ];
861 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ];
862 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ];
862 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ];
863 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ];
863 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ];
864 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ];
864 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ];
865 }
865 }
866
866
867 coarseTime = waveform[0];
867 coarseTime = waveform[0];
868 fineTime = waveform[1];
868 fineTime = waveform[1];
869
869
870 //*********************
870 //*********************
871 // SEND CWF3_light DATA
871 // SEND CWF3_light DATA
872 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform
872 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform
873 {
873 {
874 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];
874 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];
875 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
875 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
876 // BUILD THE DATA
876 // BUILD THE DATA
877 spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK;
877 spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK;
878 // SET PACKET SEQUENCE COUNTER
878 // SET PACKET SEQUENCE COUNTER
879 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
879 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
880 // SET PACKET TIME
880 // SET PACKET TIME
881 compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime );
881 compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime );
882 //
882 //
883 headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0];
883 headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0];
884 headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1];
884 headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1];
885 headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2];
885 headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2];
886 headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3];
886 headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3];
887 headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4];
887 headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4];
888 headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5];
888 headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5];
889 // SEND PACKET
889 // SEND PACKET
890 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
890 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
891 if (status != RTEMS_SUCCESSFUL) {
891 if (status != RTEMS_SUCCESSFUL) {
892 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
892 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
893 ret = LFR_DEFAULT;
893 ret = LFR_DEFAULT;
894 }
894 }
895 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
895 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
896 }
896 }
897
897
898 return ret;
898 return ret;
899 }
899 }
900
900
901 void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime,
901 void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime,
902 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime )
902 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime )
903 {
903 {
904 unsigned long long int acquisitionTimeAsLong;
904 unsigned long long int acquisitionTimeAsLong;
905 unsigned char localAcquisitionTime[6];
905 unsigned char localAcquisitionTime[6];
906 double deltaT;
906 double deltaT;
907
907
908 deltaT = 0.;
908 deltaT = 0.;
909
909
910 localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 8 );
910 localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 8 );
911 localAcquisitionTime[1] = (unsigned char) ( coarseTime );
911 localAcquisitionTime[1] = (unsigned char) ( coarseTime );
912 localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 24 );
912 localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 24 );
913 localAcquisitionTime[3] = (unsigned char) ( coarseTime >> 16 );
913 localAcquisitionTime[3] = (unsigned char) ( coarseTime >> 16 );
914 localAcquisitionTime[4] = (unsigned char) ( fineTime >> 24 );
914 localAcquisitionTime[4] = (unsigned char) ( fineTime >> 24 );
915 localAcquisitionTime[5] = (unsigned char) ( fineTime >> 16 );
915 localAcquisitionTime[5] = (unsigned char) ( fineTime >> 16 );
916
916
917 acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 )
917 acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 )
918 + ( (unsigned long long int) localAcquisitionTime[1] << 32 )
918 + ( (unsigned long long int) localAcquisitionTime[1] << 32 )
919 + ( localAcquisitionTime[2] << 24 )
919 + ( localAcquisitionTime[2] << 24 )
920 + ( localAcquisitionTime[3] << 16 )
920 + ( localAcquisitionTime[3] << 16 )
921 + ( localAcquisitionTime[4] << 8 )
921 + ( localAcquisitionTime[4] << 8 )
922 + ( localAcquisitionTime[5] );
922 + ( localAcquisitionTime[5] );
923
923
924 switch( sid )
924 switch( sid )
925 {
925 {
926 case SID_NORM_SWF_F0:
926 case SID_NORM_SWF_F0:
927 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ;
927 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ;
928 break;
928 break;
929
929
930 case SID_NORM_SWF_F1:
930 case SID_NORM_SWF_F1:
931 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ;
931 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ;
932 break;
932 break;
933
933
934 case SID_NORM_SWF_F2:
934 case SID_NORM_SWF_F2:
935 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ;
935 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ;
936 break;
936 break;
937
937
938 case SID_SBM1_CWF_F1:
938 case SID_SBM1_CWF_F1:
939 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ;
939 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ;
940 break;
940 break;
941
941
942 case SID_SBM2_CWF_F2:
942 case SID_SBM2_CWF_F2:
943 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
943 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
944 break;
944 break;
945
945
946 case SID_BURST_CWF_F2:
946 case SID_BURST_CWF_F2:
947 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
947 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
948 break;
948 break;
949
949
950 case SID_NORM_CWF_F3:
950 case SID_NORM_CWF_F3:
951 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ;
951 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ;
952 break;
952 break;
953
953
954 case SID_NORM_CWF_LONG_F3:
954 case SID_NORM_CWF_LONG_F3:
955 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ;
955 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ;
956 break;
956 break;
957
957
958 default:
958 default:
959 PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid)
959 PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid)
960 deltaT = 0.;
960 deltaT = 0.;
961 break;
961 break;
962 }
962 }
963
963
964 acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT;
964 acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT;
965 //
965 //
966 acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40);
966 acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40);
967 acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32);
967 acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32);
968 acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24);
968 acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24);
969 acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16);
969 acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16);
970 acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 );
970 acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 );
971 acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong );
971 acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong );
972
972
973 }
973 }
974
974
975 void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel )
975 void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel )
976 {
976 {
977 unsigned int i;
977 unsigned int i;
978 unsigned long long int centerTime_asLong;
978 unsigned long long int centerTime_asLong;
979 unsigned long long int acquisitionTimeF0_asLong;
979 unsigned long long int acquisitionTimeF0_asLong;
980 unsigned long long int acquisitionTime_asLong;
980 unsigned long long int acquisitionTime_asLong;
981 unsigned long long int bufferAcquisitionTime_asLong;
981 unsigned long long int bufferAcquisitionTime_asLong;
982 unsigned char *ptr1;
982 unsigned char *ptr1;
983 unsigned char *ptr2;
983 unsigned char *ptr2;
984 unsigned char nb_ring_nodes;
984 unsigned char nb_ring_nodes;
985 unsigned long long int frequency_asLong;
985 unsigned long long int frequency_asLong;
986 unsigned long long int nbTicksPerSample_asLong;
986 unsigned long long int nbTicksPerSample_asLong;
987 unsigned long long int nbSamplesPart1_asLong;
987 unsigned long long int nbSamplesPart1_asLong;
988 unsigned long long int sampleOffset_asLong;
988 unsigned long long int sampleOffset_asLong;
989
989
990 unsigned int deltaT_F0;
990 unsigned int deltaT_F0;
991 unsigned int deltaT_F1;
991 unsigned int deltaT_F1;
992 unsigned long long int deltaT_F2;
992 unsigned long long int deltaT_F2;
993
993
994 deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667;
994 deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667;
995 deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384;
995 deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384;
996 deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144;
996 deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144;
997 sampleOffset_asLong = 0x00;
997 sampleOffset_asLong = 0x00;
998
998
999 // (1) get the f0 acquisition time
999 // (1) get the f0 acquisition time
1000 build_acquisition_time( &acquisitionTimeF0_asLong, current_ring_node_f0 );
1000 build_acquisition_time( &acquisitionTimeF0_asLong, current_ring_node_f0 );
1001
1001
1002 // (2) compute the central reference time
1002 // (2) compute the central reference time
1003 centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0;
1003 centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0;
1004
1004
1005 // (3) compute the acquisition time of the current snapshot
1005 // (3) compute the acquisition time of the current snapshot
1006 switch(frequencyChannel)
1006 switch(frequencyChannel)
1007 {
1007 {
1008 case 1: // 1 is for F1 = 4096 Hz
1008 case 1: // 1 is for F1 = 4096 Hz
1009 acquisitionTime_asLong = centerTime_asLong - deltaT_F1;
1009 acquisitionTime_asLong = centerTime_asLong - deltaT_F1;
1010 nb_ring_nodes = NB_RING_NODES_F1;
1010 nb_ring_nodes = NB_RING_NODES_F1;
1011 frequency_asLong = 4096;
1011 frequency_asLong = 4096;
1012 nbTicksPerSample_asLong = 16; // 65536 / 4096;
1012 nbTicksPerSample_asLong = 16; // 65536 / 4096;
1013 break;
1013 break;
1014 case 2: // 2 is for F2 = 256 Hz
1014 case 2: // 2 is for F2 = 256 Hz
1015 acquisitionTime_asLong = centerTime_asLong - deltaT_F2;
1015 acquisitionTime_asLong = centerTime_asLong - deltaT_F2;
1016 nb_ring_nodes = NB_RING_NODES_F2;
1016 nb_ring_nodes = NB_RING_NODES_F2;
1017 frequency_asLong = 256;
1017 frequency_asLong = 256;
1018 nbTicksPerSample_asLong = 256; // 65536 / 256;
1018 nbTicksPerSample_asLong = 256; // 65536 / 256;
1019 break;
1019 break;
1020 default:
1020 default:
1021 acquisitionTime_asLong = centerTime_asLong;
1021 acquisitionTime_asLong = centerTime_asLong;
1022 frequency_asLong = 256;
1022 frequency_asLong = 256;
1023 nbTicksPerSample_asLong = 256;
1023 nbTicksPerSample_asLong = 256;
1024 break;
1024 break;
1025 }
1025 }
1026
1026
1027 //****************************************************************************
1027 //****************************************************************************
1028 // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong
1028 // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong
1029 for (i=0; i<nb_ring_nodes; i++)
1029 for (i=0; i<nb_ring_nodes; i++)
1030 {
1030 {
1031 PRINTF1("%d ... ", i)
1031 PRINTF1("%d ... ", i)
1032 build_acquisition_time( &bufferAcquisitionTime_asLong, ring_node_to_send );
1032 build_acquisition_time( &bufferAcquisitionTime_asLong, ring_node_to_send );
1033 if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong)
1033 if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong)
1034 {
1034 {
1035 PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong)
1035 PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong)
1036 break;
1036 break;
1037 }
1037 }
1038 ring_node_to_send = ring_node_to_send->previous;
1038 ring_node_to_send = ring_node_to_send->previous;
1039 }
1039 }
1040
1040
1041 // (5) compute the number of samples to take in the current buffer
1041 // (5) compute the number of samples to take in the current buffer
1042 sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16;
1042 sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16;
1043 nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong;
1043 nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong;
1044 PRINTF2("sampleOffset_asLong = %lld, nbSamplesPart1_asLong = %lld\n", sampleOffset_asLong, nbSamplesPart1_asLong)
1044 PRINTF2("sampleOffset_asLong = %lld, nbSamplesPart1_asLong = %lld\n", sampleOffset_asLong, nbSamplesPart1_asLong)
1045
1045
1046 // (6) compute the final acquisition time
1046 // (6) compute the final acquisition time
1047 acquisitionTime_asLong = bufferAcquisitionTime_asLong +
1047 acquisitionTime_asLong = bufferAcquisitionTime_asLong +
1048 sampleOffset_asLong * nbTicksPerSample_asLong;
1048 sampleOffset_asLong * nbTicksPerSample_asLong;
1049
1049
1050 // (7) copy the acquisition time at the beginning of the extrated snapshot
1050 // (7) copy the acquisition time at the beginning of the extrated snapshot
1051 ptr1 = (unsigned char*) &acquisitionTime_asLong;
1051 ptr1 = (unsigned char*) &acquisitionTime_asLong;
1052 ptr2 = (unsigned char*) wf_snap_extracted;
1052 ptr2 = (unsigned char*) wf_snap_extracted;
1053 ptr2[0] = ptr1[ 2 + 2 ];
1053 ptr2[0] = ptr1[ 2 + 2 ];
1054 ptr2[1] = ptr1[ 3 + 2 ];
1054 ptr2[1] = ptr1[ 3 + 2 ];
1055 ptr2[2] = ptr1[ 0 + 2 ];
1055 ptr2[2] = ptr1[ 0 + 2 ];
1056 ptr2[3] = ptr1[ 1 + 2 ];
1056 ptr2[3] = ptr1[ 1 + 2 ];
1057 ptr2[4] = ptr1[ 4 + 2 ];
1057 ptr2[4] = ptr1[ 4 + 2 ];
1058 ptr2[5] = ptr1[ 5 + 2 ];
1058 ptr2[5] = ptr1[ 5 + 2 ];
1059
1059
1060 // re set the synchronization bit
1060 // re set the synchronization bit
1061
1061
1062
1062
1063 // copy the part 1 of the snapshot in the extracted buffer
1063 // copy the part 1 of the snapshot in the extracted buffer
1064 for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ )
1064 for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ )
1065 {
1065 {
1066 wf_snap_extracted[i + TIME_OFFSET] =
1066 wf_snap_extracted[i + TIME_OFFSET] =
1067 ((int*) ring_node_to_send->buffer_address)[i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) + TIME_OFFSET];
1067 ((int*) ring_node_to_send->buffer_address)[i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) + TIME_OFFSET];
1068 }
1068 }
1069 // copy the part 2 of the snapshot in the extracted buffer
1069 // copy the part 2 of the snapshot in the extracted buffer
1070 ring_node_to_send = ring_node_to_send->next;
1070 ring_node_to_send = ring_node_to_send->next;
1071 for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ )
1071 for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ )
1072 {
1072 {
1073 wf_snap_extracted[i + TIME_OFFSET] =
1073 wf_snap_extracted[i + TIME_OFFSET] =
1074 ((int*) ring_node_to_send->buffer_address)[(i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) + TIME_OFFSET];
1074 ((int*) ring_node_to_send->buffer_address)[(i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) + TIME_OFFSET];
1075 }
1075 }
1076 }
1076 }
1077
1077
1078 void build_acquisition_time( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node )
1078 void build_acquisition_time( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node )
1079 {
1079 {
1080 unsigned char *acquisitionTimeCharPtr;
1080 unsigned char *acquisitionTimeCharPtr;
1081
1081
1082 acquisitionTimeCharPtr = (unsigned char*) current_ring_node->buffer_address;
1082 acquisitionTimeCharPtr = (unsigned char*) current_ring_node->buffer_address;
1083
1083
1084 *acquisitionTimeAslong = 0x00;
1084 *acquisitionTimeAslong = 0x00;
1085 *acquisitionTimeAslong = ( acquisitionTimeCharPtr[0] << 24 )
1085 *acquisitionTimeAslong = ( acquisitionTimeCharPtr[0] << 24 )
1086 + ( acquisitionTimeCharPtr[1] << 16 )
1086 + ( acquisitionTimeCharPtr[1] << 16 )
1087 + ( (unsigned long long int) (acquisitionTimeCharPtr[2] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit
1087 + ( (unsigned long long int) (acquisitionTimeCharPtr[2] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit
1088 + ( (unsigned long long int) acquisitionTimeCharPtr[3] << 32 )
1088 + ( (unsigned long long int) acquisitionTimeCharPtr[3] << 32 )
1089 + ( acquisitionTimeCharPtr[4] << 8 )
1089 + ( acquisitionTimeCharPtr[4] << 8 )
1090 + ( acquisitionTimeCharPtr[5] );
1090 + ( acquisitionTimeCharPtr[5] );
1091 }
1091 }
1092
1092
1093 //**************
1093 //**************
1094 // wfp registers
1094 // wfp registers
1095 void reset_wfp_burst_enable(void)
1095 void reset_wfp_burst_enable(void)
1096 {
1096 {
1097 /** This function resets the waveform picker burst_enable register.
1097 /** This function resets the waveform picker burst_enable register.
1098 *
1098 *
1099 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
1099 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
1100 *
1100 *
1101 */
1101 */
1102
1102
1103 waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1103 waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1104 }
1104 }
1105
1105
1106 void reset_wfp_status( void )
1106 void reset_wfp_status( void )
1107 {
1107 {
1108 /** This function resets the waveform picker status register.
1108 /** This function resets the waveform picker status register.
1109 *
1109 *
1110 * All status bits are set to 0 [new_err full_err full].
1110 * All status bits are set to 0 [new_err full_err full].
1111 *
1111 *
1112 */
1112 */
1113
1113
1114 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1114 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1115 }
1115 }
1116
1116
1117 void reset_waveform_picker_regs(void)
1117 void reset_waveform_picker_regs(void)
1118 {
1118 {
1119 /** This function resets the waveform picker module registers.
1119 /** This function resets the waveform picker module registers.
1120 *
1120 *
1121 * The registers affected by this function are located at the following offset addresses:
1121 * The registers affected by this function are located at the following offset addresses:
1122 * - 0x00 data_shaping
1122 * - 0x00 data_shaping
1123 * - 0x04 run_burst_enable
1123 * - 0x04 run_burst_enable
1124 * - 0x08 addr_data_f0
1124 * - 0x08 addr_data_f0
1125 * - 0x0C addr_data_f1
1125 * - 0x0C addr_data_f1
1126 * - 0x10 addr_data_f2
1126 * - 0x10 addr_data_f2
1127 * - 0x14 addr_data_f3
1127 * - 0x14 addr_data_f3
1128 * - 0x18 status
1128 * - 0x18 status
1129 * - 0x1C delta_snapshot
1129 * - 0x1C delta_snapshot
1130 * - 0x20 delta_f0
1130 * - 0x20 delta_f0
1131 * - 0x24 delta_f0_2
1131 * - 0x24 delta_f0_2
1132 * - 0x28 delta_f1
1132 * - 0x28 delta_f1
1133 * - 0x2c delta_f2
1133 * - 0x2c delta_f2
1134 * - 0x30 nb_data_by_buffer
1134 * - 0x30 nb_data_by_buffer
1135 * - 0x34 nb_snapshot_param
1135 * - 0x34 nb_snapshot_param
1136 * - 0x38 start_date
1136 * - 0x38 start_date
1137 * - 0x3c nb_word_in_buffer
1137 * - 0x3c nb_word_in_buffer
1138 *
1138 *
1139 */
1139 */
1140
1140
1141 set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW
1141 set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW
1142 reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1142 reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1143 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08
1143 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08
1144 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c
1144 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c
1145 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10
1145 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10
1146 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14
1146 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14
1147 reset_wfp_status(); // 0x18
1147 reset_wfp_status(); // 0x18
1148 //
1148 //
1149 set_wfp_delta_snapshot(); // 0x1c
1149 set_wfp_delta_snapshot(); // 0x1c
1150 set_wfp_delta_f0_f0_2(); // 0x20, 0x24
1150 set_wfp_delta_f0_f0_2(); // 0x20, 0x24
1151 set_wfp_delta_f1(); // 0x28
1151 set_wfp_delta_f1(); // 0x28
1152 set_wfp_delta_f2(); // 0x2c
1152 set_wfp_delta_f2(); // 0x2c
1153 DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot)
1153 DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot)
1154 DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0)
1154 DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0)
1155 DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2)
1155 DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2)
1156 DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1)
1156 DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1)
1157 DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2)
1157 DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2)
1158 // 2688 = 8 * 336
1158 // 2688 = 8 * 336
1159 waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1
1159 waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1
1160 waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples
1160 waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples
1161 waveform_picker_regs->start_date = 0x00; // 0x38
1161 waveform_picker_regs->start_date = 0x00; // 0x38
1162 waveform_picker_regs->nb_word_in_buffer = 0x1f82; // 0x3c *** 2688 * 3 + 2 = 8066
1162 waveform_picker_regs->nb_word_in_buffer = 0x1f82; // 0x3c *** 2688 * 3 + 2 = 8066
1163 }
1163 }
1164
1164
1165 void set_wfp_data_shaping( void )
1165 void set_wfp_data_shaping( void )
1166 {
1166 {
1167 /** This function sets the data_shaping register of the waveform picker module.
1167 /** This function sets the data_shaping register of the waveform picker module.
1168 *
1168 *
1169 * The value is read from one field of the parameter_dump_packet structure:\n
1169 * The value is read from one field of the parameter_dump_packet structure:\n
1170 * bw_sp0_sp1_r0_r1
1170 * bw_sp0_sp1_r0_r1
1171 *
1171 *
1172 */
1172 */
1173
1173
1174 unsigned char data_shaping;
1174 unsigned char data_shaping;
1175
1175
1176 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
1176 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
1177 // waveform picker : [R1 R0 SP1 SP0 BW]
1177 // waveform picker : [R1 R0 SP1 SP0 BW]
1178
1178
1179 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
1179 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
1180
1180
1181 waveform_picker_regs->data_shaping =
1181 waveform_picker_regs->data_shaping =
1182 ( (data_shaping & 0x10) >> 4 ) // BW
1182 ( (data_shaping & 0x10) >> 4 ) // BW
1183 + ( (data_shaping & 0x08) >> 2 ) // SP0
1183 + ( (data_shaping & 0x08) >> 2 ) // SP0
1184 + ( (data_shaping & 0x04) ) // SP1
1184 + ( (data_shaping & 0x04) ) // SP1
1185 + ( (data_shaping & 0x02) << 2 ) // R0
1185 + ( (data_shaping & 0x02) << 2 ) // R0
1186 + ( (data_shaping & 0x01) << 4 ); // R1
1186 + ( (data_shaping & 0x01) << 4 ); // R1
1187 }
1187 }
1188
1188
1189 void set_wfp_burst_enable_register( unsigned char mode )
1189 void set_wfp_burst_enable_register( unsigned char mode )
1190 {
1190 {
1191 /** This function sets the waveform picker burst_enable register depending on the mode.
1191 /** This function sets the waveform picker burst_enable register depending on the mode.
1192 *
1192 *
1193 * @param mode is the LFR mode to launch.
1193 * @param mode is the LFR mode to launch.
1194 *
1194 *
1195 * The burst bits shall be before the enable bits.
1195 * The burst bits shall be before the enable bits.
1196 *
1196 *
1197 */
1197 */
1198
1198
1199 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1199 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1200 // the burst bits shall be set first, before the enable bits
1200 // the burst bits shall be set first, before the enable bits
1201 switch(mode) {
1201 switch(mode) {
1202 case(LFR_MODE_NORMAL):
1202 case(LFR_MODE_NORMAL):
1203 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable
1203 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable
1204 waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1204 waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1205 break;
1205 break;
1206 case(LFR_MODE_BURST):
1206 case(LFR_MODE_BURST):
1207 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1207 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1208 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2
1208 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2
1209 break;
1209 break;
1210 case(LFR_MODE_SBM1):
1210 case(LFR_MODE_SBM1):
1211 waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled
1211 waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled
1212 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1212 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1213 break;
1213 break;
1214 case(LFR_MODE_SBM2):
1214 case(LFR_MODE_SBM2):
1215 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1215 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1216 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1216 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1217 break;
1217 break;
1218 default:
1218 default:
1219 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1219 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1220 break;
1220 break;
1221 }
1221 }
1222 }
1222 }
1223
1223
1224 void set_wfp_delta_snapshot( void )
1224 void set_wfp_delta_snapshot( void )
1225 {
1225 {
1226 /** This function sets the delta_snapshot register of the waveform picker module.
1226 /** This function sets the delta_snapshot register of the waveform picker module.
1227 *
1227 *
1228 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
1228 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
1229 * - sy_lfr_n_swf_p[0]
1229 * - sy_lfr_n_swf_p[0]
1230 * - sy_lfr_n_swf_p[1]
1230 * - sy_lfr_n_swf_p[1]
1231 *
1231 *
1232 */
1232 */
1233
1233
1234 unsigned int delta_snapshot;
1234 unsigned int delta_snapshot;
1235 unsigned int delta_snapshot_in_T2;
1235 unsigned int delta_snapshot_in_T2;
1236
1236
1237 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
1237 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
1238 + parameter_dump_packet.sy_lfr_n_swf_p[1];
1238 + parameter_dump_packet.sy_lfr_n_swf_p[1];
1239
1239
1240 delta_snapshot_in_T2 = delta_snapshot * 256;
1240 delta_snapshot_in_T2 = delta_snapshot * 256;
1241 waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2; // max 4 bytes
1241 waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2; // max 4 bytes
1242 }
1242 }
1243
1243
1244 void set_wfp_delta_f0_f0_2( void )
1244 void set_wfp_delta_f0_f0_2( void )
1245 {
1245 {
1246 unsigned int delta_snapshot;
1246 unsigned int delta_snapshot;
1247 unsigned int nb_samples_per_snapshot;
1247 unsigned int nb_samples_per_snapshot;
1248 float delta_f0_in_float;
1248 float delta_f0_in_float;
1249
1249
1250 delta_snapshot = waveform_picker_regs->delta_snapshot;
1250 delta_snapshot = waveform_picker_regs->delta_snapshot;
1251 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1251 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1252 delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.;
1252 delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.;
1253
1253
1254 waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float );
1254 waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float );
1255 waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits
1255 waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits
1256 }
1256 }
1257
1257
1258 void set_wfp_delta_f1( void )
1258 void set_wfp_delta_f1( void )
1259 {
1259 {
1260 unsigned int delta_snapshot;
1260 unsigned int delta_snapshot;
1261 unsigned int nb_samples_per_snapshot;
1261 unsigned int nb_samples_per_snapshot;
1262 float delta_f1_in_float;
1262 float delta_f1_in_float;
1263
1263
1264 delta_snapshot = waveform_picker_regs->delta_snapshot;
1264 delta_snapshot = waveform_picker_regs->delta_snapshot;
1265 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1265 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1266 delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.;
1266 delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.;
1267
1267
1268 waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float );
1268 waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float );
1269 }
1269 }
1270
1270
1271 void set_wfp_delta_f2()
1271 void set_wfp_delta_f2()
1272 {
1272 {
1273 unsigned int delta_snapshot;
1273 unsigned int delta_snapshot;
1274 unsigned int nb_samples_per_snapshot;
1274 unsigned int nb_samples_per_snapshot;
1275
1275
1276 delta_snapshot = waveform_picker_regs->delta_snapshot;
1276 delta_snapshot = waveform_picker_regs->delta_snapshot;
1277 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1277 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1278
1278
1279 waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2;
1279 waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2;
1280 }
1280 }
1281
1281
1282 //*****************
1282 //*****************
1283 // local parameters
1283 // local parameters
1284 void set_local_nb_interrupt_f0_MAX( void )
1284 void set_local_nb_interrupt_f0_MAX( void )
1285 {
1285 {
1286 /** This function sets the value of the nb_interrupt_f0_MAX local parameter.
1286 /** This function sets the value of the nb_interrupt_f0_MAX local parameter.
1287 *
1287 *
1288 * This parameter is used for the SM validation only.\n
1288 * This parameter is used for the SM validation only.\n
1289 * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices
1289 * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices
1290 * module before launching a basic processing.
1290 * module before launching a basic processing.
1291 *
1291 *
1292 */
1292 */
1293
1293
1294 param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256
1294 param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256
1295 + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100;
1295 + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100;
1296 }
1296 }
1297
1297
1298 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1298 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1299 {
1299 {
1300 unsigned short *sequence_cnt;
1300 unsigned short *sequence_cnt;
1301 unsigned short segmentation_grouping_flag;
1301 unsigned short segmentation_grouping_flag;
1302 unsigned short new_packet_sequence_control;
1302 unsigned short new_packet_sequence_control;
1303
1303
1304 if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2)
1304 if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2)
1305 || (sid ==SID_NORM_CWF_F3) || (sid==SID_NORM_CWF_LONG_F3) || (sid ==SID_BURST_CWF_F2) )
1305 || (sid ==SID_NORM_CWF_F3) || (sid==SID_NORM_CWF_LONG_F3) || (sid ==SID_BURST_CWF_F2) )
1306 {
1306 {
1307 sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST;
1307 sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_NORMAL_BURST;
1308 }
1308 }
1309 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) )
1309 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) )
1310 {
1310 {
1311 sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2;
1311 sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_SBM1_SBM2;
1312 }
1312 }
1313 else
1313 else
1314 {
1314 {
1315 sequence_cnt = NULL;
1315 sequence_cnt = (unsigned short *) NULL;
1316 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1316 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1317 }
1317 }
1318
1318
1319 if (sequence_cnt != NULL)
1319 if (sequence_cnt != NULL)
1320 {
1320 {
1321 segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8;
1321 // increment the sequence counter
1322 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1323
1324 new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ;
1325
1326 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1327 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1328
1329 // increment the sequence counter for the next packet
1330 if ( *sequence_cnt < SEQ_CNT_MAX)
1322 if ( *sequence_cnt < SEQ_CNT_MAX)
1331 {
1323 {
1332 *sequence_cnt = *sequence_cnt + 1;
1324 *sequence_cnt = *sequence_cnt + 1;
1333 }
1325 }
1334 else
1326 else
1335 {
1327 {
1336 *sequence_cnt = 0;
1328 *sequence_cnt = 0;
1337 }
1329 }
1330 segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
1331 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1332
1333 new_packet_sequence_control = segmentation_grouping_flag | (*sequence_cnt) ;
1334
1335 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1336 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1338 }
1337 }
1339 }
1338 }
General Comments 0
You need to be logged in to leave comments. Login now