##// END OF EJS Templates
The flight software is now compatible with the VHDL 0.1.32...
paul -
r171:13f27d43af32 VHDL_0_1_28
parent child
Show More
@@ -1,273 +1,273
1 #############################################################################
1 #############################################################################
2 # Makefile for building: bin/fsw
2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.6) on: Fri Oct 24 13:25:08 2014
3 # Generated by qmake (2.01a) (Qt 4.8.6) on: Thu Nov 6 16:03:39 2014
4 # Project: fsw-qt.pro
4 # Project: fsw-qt.pro
5 # Template: app
5 # Template: app
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
7 #############################################################################
7 #############################################################################
8
8
9 ####### Compiler, tools and options
9 ####### Compiler, tools and options
10
10
11 CC = sparc-rtems-gcc
11 CC = sparc-rtems-gcc
12 CXX = sparc-rtems-g++
12 CXX = sparc-rtems-g++
13 DEFINES = -DSW_VERSION_N1=2 -DSW_VERSION_N2=0 -DSW_VERSION_N3=1 -DSW_VERSION_N4=1 -DLPP_DPU_DESTID -DPRINT_MESSAGES_ON_CONSOLE
13 DEFINES = -DSW_VERSION_N1=2 -DSW_VERSION_N2=0 -DSW_VERSION_N3=1 -DSW_VERSION_N4=1 -DLPP_DPU_DESTID -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS
14 CFLAGS = -pipe -O3 -fprofile-arcs -ftest-coverage -Wall $(DEFINES)
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/LFR_basic-parameters
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/LFR_basic-parameters
17 LINK = sparc-rtems-g++
17 LINK = sparc-rtems-g++
18 LFLAGS =
18 LFLAGS =
19 LIBS = $(SUBLIBS) -lgcov /opt/GCOV/01A/lib/overload.o -lc
19 LIBS = $(SUBLIBS)
20 AR = sparc-rtems-ar rcs
20 AR = sparc-rtems-ar rcs
21 RANLIB =
21 RANLIB =
22 QMAKE = /usr/bin/qmake-qt4
22 QMAKE = /usr/bin/qmake-qt4
23 TAR = tar -cf
23 TAR = tar -cf
24 COMPRESS = gzip -9f
24 COMPRESS = gzip -9f
25 COPY = cp -f
25 COPY = cp -f
26 SED = sed
26 SED = sed
27 COPY_FILE = $(COPY)
27 COPY_FILE = $(COPY)
28 COPY_DIR = $(COPY) -r
28 COPY_DIR = $(COPY) -r
29 STRIP = sparc-rtems-strip
29 STRIP = sparc-rtems-strip
30 INSTALL_FILE = install -m 644 -p
30 INSTALL_FILE = install -m 644 -p
31 INSTALL_DIR = $(COPY_DIR)
31 INSTALL_DIR = $(COPY_DIR)
32 INSTALL_PROGRAM = install -m 755 -p
32 INSTALL_PROGRAM = install -m 755 -p
33 DEL_FILE = rm -f
33 DEL_FILE = rm -f
34 SYMLINK = ln -f -s
34 SYMLINK = ln -f -s
35 DEL_DIR = rmdir
35 DEL_DIR = rmdir
36 MOVE = mv -f
36 MOVE = mv -f
37 CHK_DIR_EXISTS= test -d
37 CHK_DIR_EXISTS= test -d
38 MKDIR = mkdir -p
38 MKDIR = mkdir -p
39
39
40 ####### Output directory
40 ####### Output directory
41
41
42 OBJECTS_DIR = obj/
42 OBJECTS_DIR = obj/
43
43
44 ####### Files
44 ####### Files
45
45
46 SOURCES = ../src/wf_handler.c \
46 SOURCES = ../src/wf_handler.c \
47 ../src/tc_handler.c \
47 ../src/tc_handler.c \
48 ../src/fsw_misc.c \
48 ../src/fsw_misc.c \
49 ../src/fsw_init.c \
49 ../src/fsw_init.c \
50 ../src/fsw_globals.c \
50 ../src/fsw_globals.c \
51 ../src/fsw_spacewire.c \
51 ../src/fsw_spacewire.c \
52 ../src/tc_load_dump_parameters.c \
52 ../src/tc_load_dump_parameters.c \
53 ../src/tm_lfr_tc_exe.c \
53 ../src/tm_lfr_tc_exe.c \
54 ../src/tc_acceptance.c \
54 ../src/tc_acceptance.c \
55 ../src/processing/fsw_processing.c \
55 ../src/processing/fsw_processing.c \
56 ../src/processing/avf0_prc0.c \
56 ../src/processing/avf0_prc0.c \
57 ../src/processing/avf1_prc1.c \
57 ../src/processing/avf1_prc1.c \
58 ../src/processing/avf2_prc2.c \
58 ../src/processing/avf2_prc2.c \
59 ../src/lfr_cpu_usage_report.c \
59 ../src/lfr_cpu_usage_report.c \
60 ../src/LFR_basic-parameters/basic_parameters.c
60 ../src/LFR_basic-parameters/basic_parameters.c
61 OBJECTS = obj/wf_handler.o \
61 OBJECTS = obj/wf_handler.o \
62 obj/tc_handler.o \
62 obj/tc_handler.o \
63 obj/fsw_misc.o \
63 obj/fsw_misc.o \
64 obj/fsw_init.o \
64 obj/fsw_init.o \
65 obj/fsw_globals.o \
65 obj/fsw_globals.o \
66 obj/fsw_spacewire.o \
66 obj/fsw_spacewire.o \
67 obj/tc_load_dump_parameters.o \
67 obj/tc_load_dump_parameters.o \
68 obj/tm_lfr_tc_exe.o \
68 obj/tm_lfr_tc_exe.o \
69 obj/tc_acceptance.o \
69 obj/tc_acceptance.o \
70 obj/fsw_processing.o \
70 obj/fsw_processing.o \
71 obj/avf0_prc0.o \
71 obj/avf0_prc0.o \
72 obj/avf1_prc1.o \
72 obj/avf1_prc1.o \
73 obj/avf2_prc2.o \
73 obj/avf2_prc2.o \
74 obj/lfr_cpu_usage_report.o \
74 obj/lfr_cpu_usage_report.o \
75 obj/basic_parameters.o
75 obj/basic_parameters.o
76 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
76 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
77 /usr/lib64/qt4/mkspecs/common/linux.conf \
77 /usr/lib64/qt4/mkspecs/common/linux.conf \
78 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
78 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
79 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
79 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
80 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
80 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
81 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
81 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
82 /usr/lib64/qt4/mkspecs/qconfig.pri \
82 /usr/lib64/qt4/mkspecs/qconfig.pri \
83 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
83 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
84 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
84 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
85 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
85 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
86 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
86 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
87 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
87 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
88 sparc.pri \
88 sparc.pri \
89 /usr/lib64/qt4/mkspecs/features/release.prf \
89 /usr/lib64/qt4/mkspecs/features/release.prf \
90 /usr/lib64/qt4/mkspecs/features/default_post.prf \
90 /usr/lib64/qt4/mkspecs/features/default_post.prf \
91 /usr/lib64/qt4/mkspecs/features/shared.prf \
91 /usr/lib64/qt4/mkspecs/features/shared.prf \
92 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
92 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
93 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
93 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
94 /usr/lib64/qt4/mkspecs/features/resources.prf \
94 /usr/lib64/qt4/mkspecs/features/resources.prf \
95 /usr/lib64/qt4/mkspecs/features/uic.prf \
95 /usr/lib64/qt4/mkspecs/features/uic.prf \
96 /usr/lib64/qt4/mkspecs/features/yacc.prf \
96 /usr/lib64/qt4/mkspecs/features/yacc.prf \
97 /usr/lib64/qt4/mkspecs/features/lex.prf \
97 /usr/lib64/qt4/mkspecs/features/lex.prf \
98 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
98 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
99 fsw-qt.pro
99 fsw-qt.pro
100 QMAKE_TARGET = fsw
100 QMAKE_TARGET = fsw
101 DESTDIR = bin/
101 DESTDIR = bin/
102 TARGET = bin/fsw
102 TARGET = bin/fsw
103
103
104 first: all
104 first: all
105 ####### Implicit rules
105 ####### Implicit rules
106
106
107 .SUFFIXES: .o .c .cpp .cc .cxx .C
107 .SUFFIXES: .o .c .cpp .cc .cxx .C
108
108
109 .cpp.o:
109 .cpp.o:
110 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
110 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
111
111
112 .cc.o:
112 .cc.o:
113 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
113 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
114
114
115 .cxx.o:
115 .cxx.o:
116 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
116 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
117
117
118 .C.o:
118 .C.o:
119 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
119 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
120
120
121 .c.o:
121 .c.o:
122 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
122 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
123
123
124 ####### Build rules
124 ####### Build rules
125
125
126 all: Makefile $(TARGET)
126 all: Makefile $(TARGET)
127
127
128 $(TARGET): $(OBJECTS)
128 $(TARGET): $(OBJECTS)
129 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
129 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
130 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
130 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
131
131
132 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
132 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
133 /usr/lib64/qt4/mkspecs/common/linux.conf \
133 /usr/lib64/qt4/mkspecs/common/linux.conf \
134 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
134 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
135 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
135 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
136 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
136 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
137 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
137 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
138 /usr/lib64/qt4/mkspecs/qconfig.pri \
138 /usr/lib64/qt4/mkspecs/qconfig.pri \
139 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
139 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
140 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
140 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
141 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
141 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
142 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
142 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
143 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
143 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
144 sparc.pri \
144 sparc.pri \
145 /usr/lib64/qt4/mkspecs/features/release.prf \
145 /usr/lib64/qt4/mkspecs/features/release.prf \
146 /usr/lib64/qt4/mkspecs/features/default_post.prf \
146 /usr/lib64/qt4/mkspecs/features/default_post.prf \
147 /usr/lib64/qt4/mkspecs/features/shared.prf \
147 /usr/lib64/qt4/mkspecs/features/shared.prf \
148 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
148 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
149 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
149 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
150 /usr/lib64/qt4/mkspecs/features/resources.prf \
150 /usr/lib64/qt4/mkspecs/features/resources.prf \
151 /usr/lib64/qt4/mkspecs/features/uic.prf \
151 /usr/lib64/qt4/mkspecs/features/uic.prf \
152 /usr/lib64/qt4/mkspecs/features/yacc.prf \
152 /usr/lib64/qt4/mkspecs/features/yacc.prf \
153 /usr/lib64/qt4/mkspecs/features/lex.prf \
153 /usr/lib64/qt4/mkspecs/features/lex.prf \
154 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
154 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
155 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
155 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
156 /usr/lib64/qt4/mkspecs/common/unix.conf:
156 /usr/lib64/qt4/mkspecs/common/unix.conf:
157 /usr/lib64/qt4/mkspecs/common/linux.conf:
157 /usr/lib64/qt4/mkspecs/common/linux.conf:
158 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
158 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
159 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
159 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
160 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
160 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
161 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
161 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
162 /usr/lib64/qt4/mkspecs/qconfig.pri:
162 /usr/lib64/qt4/mkspecs/qconfig.pri:
163 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
163 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
164 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
164 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
165 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
165 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
166 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
166 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
167 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
167 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
168 sparc.pri:
168 sparc.pri:
169 /usr/lib64/qt4/mkspecs/features/release.prf:
169 /usr/lib64/qt4/mkspecs/features/release.prf:
170 /usr/lib64/qt4/mkspecs/features/default_post.prf:
170 /usr/lib64/qt4/mkspecs/features/default_post.prf:
171 /usr/lib64/qt4/mkspecs/features/shared.prf:
171 /usr/lib64/qt4/mkspecs/features/shared.prf:
172 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
172 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
173 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
173 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
174 /usr/lib64/qt4/mkspecs/features/resources.prf:
174 /usr/lib64/qt4/mkspecs/features/resources.prf:
175 /usr/lib64/qt4/mkspecs/features/uic.prf:
175 /usr/lib64/qt4/mkspecs/features/uic.prf:
176 /usr/lib64/qt4/mkspecs/features/yacc.prf:
176 /usr/lib64/qt4/mkspecs/features/yacc.prf:
177 /usr/lib64/qt4/mkspecs/features/lex.prf:
177 /usr/lib64/qt4/mkspecs/features/lex.prf:
178 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
178 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
179 qmake: FORCE
179 qmake: FORCE
180 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
180 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
181
181
182 dist:
182 dist:
183 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
183 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
184 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0
184 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0
185
185
186
186
187 clean:compiler_clean
187 clean:compiler_clean
188 -$(DEL_FILE) $(OBJECTS)
188 -$(DEL_FILE) $(OBJECTS)
189 -$(DEL_FILE) *~ core *.core
189 -$(DEL_FILE) *~ core *.core
190
190
191
191
192 ####### Sub-libraries
192 ####### Sub-libraries
193
193
194 distclean: clean
194 distclean: clean
195 -$(DEL_FILE) $(TARGET)
195 -$(DEL_FILE) $(TARGET)
196 -$(DEL_FILE) Makefile
196 -$(DEL_FILE) Makefile
197
197
198
198
199 grmon:
199 grmon:
200 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
200 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
201
201
202 check: first
202 check: first
203
203
204 compiler_rcc_make_all:
204 compiler_rcc_make_all:
205 compiler_rcc_clean:
205 compiler_rcc_clean:
206 compiler_uic_make_all:
206 compiler_uic_make_all:
207 compiler_uic_clean:
207 compiler_uic_clean:
208 compiler_image_collection_make_all: qmake_image_collection.cpp
208 compiler_image_collection_make_all: qmake_image_collection.cpp
209 compiler_image_collection_clean:
209 compiler_image_collection_clean:
210 -$(DEL_FILE) qmake_image_collection.cpp
210 -$(DEL_FILE) qmake_image_collection.cpp
211 compiler_yacc_decl_make_all:
211 compiler_yacc_decl_make_all:
212 compiler_yacc_decl_clean:
212 compiler_yacc_decl_clean:
213 compiler_yacc_impl_make_all:
213 compiler_yacc_impl_make_all:
214 compiler_yacc_impl_clean:
214 compiler_yacc_impl_clean:
215 compiler_lex_make_all:
215 compiler_lex_make_all:
216 compiler_lex_clean:
216 compiler_lex_clean:
217 compiler_clean:
217 compiler_clean:
218
218
219 ####### Compile
219 ####### Compile
220
220
221 obj/wf_handler.o: ../src/wf_handler.c
221 obj/wf_handler.o: ../src/wf_handler.c
222 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
222 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
223
223
224 obj/tc_handler.o: ../src/tc_handler.c
224 obj/tc_handler.o: ../src/tc_handler.c
225 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
225 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
226
226
227 obj/fsw_misc.o: ../src/fsw_misc.c
227 obj/fsw_misc.o: ../src/fsw_misc.c
228 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
228 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
229
229
230 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
230 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
231 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
231 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
232
232
233 obj/fsw_globals.o: ../src/fsw_globals.c
233 obj/fsw_globals.o: ../src/fsw_globals.c
234 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
234 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
235
235
236 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
236 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
237 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
237 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
238
238
239 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
239 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
240 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
240 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
241
241
242 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
242 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
243 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
243 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
244
244
245 obj/tc_acceptance.o: ../src/tc_acceptance.c
245 obj/tc_acceptance.o: ../src/tc_acceptance.c
246 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
246 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
247
247
248 obj/fsw_processing.o: ../src/processing/fsw_processing.c
248 obj/fsw_processing.o: ../src/processing/fsw_processing.c
249 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c
249 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/processing/fsw_processing.c
250
250
251 obj/avf0_prc0.o: ../src/processing/avf0_prc0.c
251 obj/avf0_prc0.o: ../src/processing/avf0_prc0.c
252 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c
252 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf0_prc0.o ../src/processing/avf0_prc0.c
253
253
254 obj/avf1_prc1.o: ../src/processing/avf1_prc1.c
254 obj/avf1_prc1.o: ../src/processing/avf1_prc1.c
255 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c
255 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf1_prc1.o ../src/processing/avf1_prc1.c
256
256
257 obj/avf2_prc2.o: ../src/processing/avf2_prc2.c
257 obj/avf2_prc2.o: ../src/processing/avf2_prc2.c
258 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c
258 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c
259
259
260 obj/lfr_cpu_usage_report.o: ../src/lfr_cpu_usage_report.c
260 obj/lfr_cpu_usage_report.o: ../src/lfr_cpu_usage_report.c
261 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/lfr_cpu_usage_report.o ../src/lfr_cpu_usage_report.c
261 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/lfr_cpu_usage_report.o ../src/lfr_cpu_usage_report.c
262
262
263 obj/basic_parameters.o: ../src/LFR_basic-parameters/basic_parameters.c
263 obj/basic_parameters.o: ../src/LFR_basic-parameters/basic_parameters.c
264 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/LFR_basic-parameters/basic_parameters.c
264 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../src/LFR_basic-parameters/basic_parameters.c
265
265
266 ####### Install
266 ####### Install
267
267
268 install: FORCE
268 install: FORCE
269
269
270 uninstall: FORCE
270 uninstall: FORCE
271
271
272 FORCE:
272 FORCE:
273
273
@@ -1,108 +1,107
1 TEMPLATE = app
1 TEMPLATE = app
2 # CONFIG += console v8 sim
2 # CONFIG += console v8 sim
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
4 # lpp_dpu_destid
4 # lpp_dpu_destid
5 CONFIG += console verbose lpp_dpu_destid
5 CONFIG += console verbose lpp_dpu_destid cpu_usage_report
6 CONFIG -= qt
6 CONFIG -= qt
7
7
8 include(./sparc.pri)
8 include(./sparc.pri)
9
9
10 # flight software version
10 # flight software version
11 SWVERSION=-1-0
11 SWVERSION=-1-0
12 DEFINES += SW_VERSION_N1=2 # major
12 DEFINES += SW_VERSION_N1=2 # major
13 DEFINES += SW_VERSION_N2=0 # minor
13 DEFINES += SW_VERSION_N2=0 # minor
14 DEFINES += SW_VERSION_N3=1 # patch
14 DEFINES += SW_VERSION_N3=1 # patch
15 DEFINES += SW_VERSION_N4=1 # internal
15 DEFINES += SW_VERSION_N4=1 # internal
16
16
17 # <GCOV>
17 # <GCOV>
18 QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage
18 #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage
19 #QMAKE_LFLAGS_RELEASE +=
19 #LIBS += -lgcov /opt/GCOV/01A/lib/overload.o -lc
20 LIBS += -lgcov /opt/GCOV/01A/lib/overload.o -lc
21 # </GCOV>
20 # </GCOV>
22
21
23 # <CHANGE BEFORE FLIGHT>
22 # <CHANGE BEFORE FLIGHT>
24 contains( CONFIG, lpp_dpu_destid ) {
23 contains( CONFIG, lpp_dpu_destid ) {
25 DEFINES += LPP_DPU_DESTID
24 DEFINES += LPP_DPU_DESTID
26 }
25 }
27 # </CHANGE BEFORE FLIGHT>
26 # </CHANGE BEFORE FLIGHT>
28
27
29 contains( CONFIG, debug_tch ) {
28 contains( CONFIG, debug_tch ) {
30 DEFINES += DEBUG_TCH
29 DEFINES += DEBUG_TCH
31 }
30 }
32
31
33 contains( CONFIG, vhdl_dev ) {
32 contains( CONFIG, vhdl_dev ) {
34 DEFINES += VHDL_DEV
33 DEFINES += VHDL_DEV
35 }
34 }
36
35
37 contains( CONFIG, verbose ) {
36 contains( CONFIG, verbose ) {
38 DEFINES += PRINT_MESSAGES_ON_CONSOLE
37 DEFINES += PRINT_MESSAGES_ON_CONSOLE
39 }
38 }
40
39
41 contains( CONFIG, debug_messages ) {
40 contains( CONFIG, debug_messages ) {
42 DEFINES += DEBUG_MESSAGES
41 DEFINES += DEBUG_MESSAGES
43 }
42 }
44
43
45 contains( CONFIG, cpu_usage_report ) {
44 contains( CONFIG, cpu_usage_report ) {
46 DEFINES += PRINT_TASK_STATISTICS
45 DEFINES += PRINT_TASK_STATISTICS
47 }
46 }
48
47
49 contains( CONFIG, stack_report ) {
48 contains( CONFIG, stack_report ) {
50 DEFINES += PRINT_STACK_REPORT
49 DEFINES += PRINT_STACK_REPORT
51 }
50 }
52
51
53 contains( CONFIG, boot_messages ) {
52 contains( CONFIG, boot_messages ) {
54 DEFINES += BOOT_MESSAGES
53 DEFINES += BOOT_MESSAGES
55 }
54 }
56
55
57 #doxygen.target = doxygen
56 #doxygen.target = doxygen
58 #doxygen.commands = doxygen ../doc/Doxyfile
57 #doxygen.commands = doxygen ../doc/Doxyfile
59 #QMAKE_EXTRA_TARGETS += doxygen
58 #QMAKE_EXTRA_TARGETS += doxygen
60
59
61 TARGET = fsw
60 TARGET = fsw
62
61
63 INCLUDEPATH += \
62 INCLUDEPATH += \
64 ../src \
63 ../src \
65 ../header \
64 ../header \
66 ../header/processing \
65 ../header/processing \
67 ../src/LFR_basic-parameters
66 ../src/LFR_basic-parameters
68
67
69 SOURCES += \
68 SOURCES += \
70 ../src/wf_handler.c \
69 ../src/wf_handler.c \
71 ../src/tc_handler.c \
70 ../src/tc_handler.c \
72 ../src/fsw_misc.c \
71 ../src/fsw_misc.c \
73 ../src/fsw_init.c \
72 ../src/fsw_init.c \
74 ../src/fsw_globals.c \
73 ../src/fsw_globals.c \
75 ../src/fsw_spacewire.c \
74 ../src/fsw_spacewire.c \
76 ../src/tc_load_dump_parameters.c \
75 ../src/tc_load_dump_parameters.c \
77 ../src/tm_lfr_tc_exe.c \
76 ../src/tm_lfr_tc_exe.c \
78 ../src/tc_acceptance.c \
77 ../src/tc_acceptance.c \
79 ../src/processing/fsw_processing.c \
78 ../src/processing/fsw_processing.c \
80 ../src/processing/avf0_prc0.c \
79 ../src/processing/avf0_prc0.c \
81 ../src/processing/avf1_prc1.c \
80 ../src/processing/avf1_prc1.c \
82 ../src/processing/avf2_prc2.c \
81 ../src/processing/avf2_prc2.c \
83 ../src/lfr_cpu_usage_report.c \
82 ../src/lfr_cpu_usage_report.c \
84 ../src/LFR_basic-parameters/basic_parameters.c
83 ../src/LFR_basic-parameters/basic_parameters.c
85
84
86 HEADERS += \
85 HEADERS += \
87 ../header/wf_handler.h \
86 ../header/wf_handler.h \
88 ../header/tc_handler.h \
87 ../header/tc_handler.h \
89 ../header/grlib_regs.h \
88 ../header/grlib_regs.h \
90 ../header/fsw_params.h \
89 ../header/fsw_params.h \
91 ../header/fsw_misc.h \
90 ../header/fsw_misc.h \
92 ../header/fsw_init.h \
91 ../header/fsw_init.h \
93 ../header/ccsds_types.h \
92 ../header/ccsds_types.h \
94 ../header/fsw_spacewire.h \
93 ../header/fsw_spacewire.h \
95 ../header/tc_load_dump_parameters.h \
94 ../header/tc_load_dump_parameters.h \
96 ../header/tm_lfr_tc_exe.h \
95 ../header/tm_lfr_tc_exe.h \
97 ../header/tc_acceptance.h \
96 ../header/tc_acceptance.h \
98 ../header/fsw_params_nb_bytes.h \
97 ../header/fsw_params_nb_bytes.h \
99 ../header/fsw_params_processing.h \
98 ../header/fsw_params_processing.h \
100 ../header/processing/fsw_processing.h \
99 ../header/processing/fsw_processing.h \
101 ../header/processing/avf0_prc0.h \
100 ../header/processing/avf0_prc0.h \
102 ../header/processing/avf1_prc1.h \
101 ../header/processing/avf1_prc1.h \
103 ../header/processing/avf2_prc2.h \
102 ../header/processing/avf2_prc2.h \
104 ../header/fsw_params_wf_handler.h \
103 ../header/fsw_params_wf_handler.h \
105 ../header/lfr_cpu_usage_report.h \
104 ../header/lfr_cpu_usage_report.h \
106 ../src/LFR_basic-parameters/basic_parameters.h \
105 ../src/LFR_basic-parameters/basic_parameters.h \
107 ../src/LFR_basic-parameters/basic_parameters_params.h
106 ../src/LFR_basic-parameters/basic_parameters_params.h
108
107
@@ -1,208 +1,208
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 3.2.0, 2014-10-22T14:31:55. -->
3 <!-- Written by QtCreator 3.2.1, 2014-11-05T17:29:44. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>EnvironmentId</variable>
6 <variable>EnvironmentId</variable>
7 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
7 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
8 </data>
8 </data>
9 <data>
9 <data>
10 <variable>ProjectExplorer.Project.ActiveTarget</variable>
10 <variable>ProjectExplorer.Project.ActiveTarget</variable>
11 <value type="int">0</value>
11 <value type="int">0</value>
12 </data>
12 </data>
13 <data>
13 <data>
14 <variable>ProjectExplorer.Project.EditorSettings</variable>
14 <variable>ProjectExplorer.Project.EditorSettings</variable>
15 <valuemap type="QVariantMap">
15 <valuemap type="QVariantMap">
16 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
16 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
17 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
17 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
18 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
18 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
19 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
19 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
20 <value type="QString" key="language">Cpp</value>
20 <value type="QString" key="language">Cpp</value>
21 <valuemap type="QVariantMap" key="value">
21 <valuemap type="QVariantMap" key="value">
22 <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
22 <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
23 </valuemap>
23 </valuemap>
24 </valuemap>
24 </valuemap>
25 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
25 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
26 <value type="QString" key="language">QmlJS</value>
26 <value type="QString" key="language">QmlJS</value>
27 <valuemap type="QVariantMap" key="value">
27 <valuemap type="QVariantMap" key="value">
28 <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
28 <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
29 </valuemap>
29 </valuemap>
30 </valuemap>
30 </valuemap>
31 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
31 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
32 <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
32 <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
33 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
33 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
34 <value type="int" key="EditorConfiguration.IndentSize">4</value>
34 <value type="int" key="EditorConfiguration.IndentSize">4</value>
35 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
35 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
36 <value type="int" key="EditorConfiguration.MarginColumn">80</value>
36 <value type="int" key="EditorConfiguration.MarginColumn">80</value>
37 <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
37 <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
38 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
38 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
39 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
39 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
40 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
40 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
41 <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
41 <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
42 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
42 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
43 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
43 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
44 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
44 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
45 <value type="int" key="EditorConfiguration.TabSize">8</value>
45 <value type="int" key="EditorConfiguration.TabSize">8</value>
46 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
46 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
47 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
47 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
48 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
48 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
49 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
49 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
50 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
50 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
51 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
51 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
52 </valuemap>
52 </valuemap>
53 </data>
53 </data>
54 <data>
54 <data>
55 <variable>ProjectExplorer.Project.PluginSettings</variable>
55 <variable>ProjectExplorer.Project.PluginSettings</variable>
56 <valuemap type="QVariantMap"/>
56 <valuemap type="QVariantMap"/>
57 </data>
57 </data>
58 <data>
58 <data>
59 <variable>ProjectExplorer.Project.Target.0</variable>
59 <variable>ProjectExplorer.Project.Target.0</variable>
60 <valuemap type="QVariantMap">
60 <valuemap type="QVariantMap">
61 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
61 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
62 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
62 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
63 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
63 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
64 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
64 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
65 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
65 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
66 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
66 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
67 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
67 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
68 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value>
68 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory"></value>
69 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
69 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
70 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
70 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
71 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
71 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
72 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
72 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
73 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
73 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
74 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
74 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
75 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
75 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
76 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
76 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
77 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
77 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
78 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
78 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
79 </valuemap>
79 </valuemap>
80 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
80 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
81 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
81 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
82 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
82 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
83 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
83 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
84 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
84 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
85 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
85 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
86 <value type="QString">-w</value>
86 <value type="QString">-w</value>
87 <value type="QString">-r</value>
87 <value type="QString">-r</value>
88 </valuelist>
88 </valuelist>
89 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
89 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
90 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
90 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
91 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
91 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
92 </valuemap>
92 </valuemap>
93 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
93 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
96 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
96 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
97 </valuemap>
97 </valuemap>
98 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
98 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
99 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
99 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
100 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
100 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
101 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
101 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
102 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
102 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
103 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
103 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
104 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
104 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
105 <value type="QString">-w</value>
105 <value type="QString">-w</value>
106 <value type="QString">-r</value>
106 <value type="QString">-r</value>
107 </valuelist>
107 </valuelist>
108 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
108 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
109 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
109 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
110 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
110 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
111 </valuemap>
111 </valuemap>
112 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
112 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
115 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
115 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
116 </valuemap>
116 </valuemap>
117 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
117 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
118 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
118 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
119 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
119 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
120 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
120 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
121 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
121 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
122 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
122 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
123 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
123 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
124 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
124 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
125 </valuemap>
125 </valuemap>
126 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
126 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
127 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
127 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
128 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
128 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
129 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
129 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
130 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
131 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
131 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
132 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
132 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
133 </valuemap>
133 </valuemap>
134 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
134 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
136 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
136 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
137 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
137 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
138 </valuemap>
138 </valuemap>
139 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
139 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
140 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
140 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
141 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
141 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
142 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
142 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
143 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
143 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
144 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
144 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
145 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
145 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
146 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
146 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
147 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
147 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
148 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
148 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
149 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
149 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
150 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
150 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
151 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
151 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
152 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
152 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
153 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
153 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
154 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
154 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
155 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
155 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
156 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
156 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
157 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
157 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
158 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
158 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
159 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
159 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
160 <value type="int">0</value>
160 <value type="int">0</value>
161 <value type="int">1</value>
161 <value type="int">1</value>
162 <value type="int">2</value>
162 <value type="int">2</value>
163 <value type="int">3</value>
163 <value type="int">3</value>
164 <value type="int">4</value>
164 <value type="int">4</value>
165 <value type="int">5</value>
165 <value type="int">5</value>
166 <value type="int">6</value>
166 <value type="int">6</value>
167 <value type="int">7</value>
167 <value type="int">7</value>
168 <value type="int">8</value>
168 <value type="int">8</value>
169 <value type="int">9</value>
169 <value type="int">9</value>
170 <value type="int">10</value>
170 <value type="int">10</value>
171 <value type="int">11</value>
171 <value type="int">11</value>
172 <value type="int">12</value>
172 <value type="int">12</value>
173 <value type="int">13</value>
173 <value type="int">13</value>
174 <value type="int">14</value>
174 <value type="int">14</value>
175 </valuelist>
175 </valuelist>
176 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
176 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
177 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
177 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
178 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
178 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
179 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
179 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
180 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
180 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
181 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
181 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
182 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
182 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
183 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
183 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
184 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
184 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
185 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
185 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
186 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
186 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
187 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
187 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
188 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
188 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
189 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
189 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
190 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
190 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
191 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
191 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
192 </valuemap>
192 </valuemap>
193 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
193 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
194 </valuemap>
194 </valuemap>
195 </data>
195 </data>
196 <data>
196 <data>
197 <variable>ProjectExplorer.Project.TargetCount</variable>
197 <variable>ProjectExplorer.Project.TargetCount</variable>
198 <value type="int">1</value>
198 <value type="int">1</value>
199 </data>
199 </data>
200 <data>
200 <data>
201 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
201 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
202 <value type="int">16</value>
202 <value type="int">16</value>
203 </data>
203 </data>
204 <data>
204 <data>
205 <variable>Version</variable>
205 <variable>Version</variable>
206 <value type="int">16</value>
206 <value type="int">16</value>
207 </data>
207 </data>
208 </qtcreator>
208 </qtcreator>
@@ -1,45 +1,47
1 #ifndef FSW_MISC_H_INCLUDED
1 #ifndef FSW_MISC_H_INCLUDED
2 #define FSW_MISC_H_INCLUDED
2 #define FSW_MISC_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <stdio.h>
5 #include <stdio.h>
6 #include <grspw.h>
6 #include <grspw.h>
7
7
8 #include "fsw_params.h"
8 #include "fsw_params.h"
9 #include "fsw_spacewire.h"
9 #include "fsw_spacewire.h"
10 #include "lfr_cpu_usage_report.h"
10 #include "lfr_cpu_usage_report.h"
11
11
12 rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic
12 rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic
13 rtems_id HK_id; // id of the HK rate monotonic period
13 rtems_id HK_id; // id of the HK rate monotonic period
14
14
15 void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
15 void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
16 unsigned char interrupt_level, rtems_isr (*timer_isr)() );
16 unsigned char interrupt_level, rtems_isr (*timer_isr)() );
17 void timer_start( gptimer_regs_t *gptimer_regs, unsigned char timer );
17 void timer_start( gptimer_regs_t *gptimer_regs, unsigned char timer );
18 void timer_stop( gptimer_regs_t *gptimer_regs, unsigned char timer );
18 void timer_stop( gptimer_regs_t *gptimer_regs, unsigned char timer );
19 void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider);
19 void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider);
20
20
21 // SERIAL LINK
21 // SERIAL LINK
22 int send_console_outputs_on_apbuart_port( void );
22 int send_console_outputs_on_apbuart_port( void );
23 int enable_apbuart_transmitter( void );
23 int enable_apbuart_transmitter( void );
24 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value);
24 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value);
25
25
26 // RTEMS TASKS
26 // RTEMS TASKS
27 rtems_task stat_task( rtems_task_argument argument );
27 rtems_task stat_task( rtems_task_argument argument );
28 rtems_task hous_task( rtems_task_argument argument );
28 rtems_task hous_task( rtems_task_argument argument );
29 rtems_task dumb_task( rtems_task_argument unused );
29 rtems_task dumb_task( rtems_task_argument unused );
30
30
31 void init_housekeeping_parameters( void );
31 void init_housekeeping_parameters( void );
32 void increment_seq_counter(unsigned short *packetSequenceControl);
32 void increment_seq_counter(unsigned short *packetSequenceControl);
33 void getTime( unsigned char *time);
33 void getTime( unsigned char *time);
34 unsigned long long int getTimeAsUnsignedLongLongInt( );
34 unsigned long long int getTimeAsUnsignedLongLongInt( );
35 void send_dumb_hk( void );
35 void send_dumb_hk( void );
36 void get_v_e1_e2_f3 (unsigned char *spacecraft_potential);
36 void get_v_e1_e2_f3(unsigned char *spacecraft_potential);
37 void get_v_e1_e2_f3_alt(unsigned char *spacecraft_potential);
37 void get_cpu_load( unsigned char *resource_statistics );
38 void get_cpu_load( unsigned char *resource_statistics );
38
39
39 extern int sched_yield( void );
40 extern int sched_yield( void );
40 extern void rtems_cpu_usage_reset();
41 extern void rtems_cpu_usage_reset();
41 extern ring_node *current_ring_node_f3;
42 extern ring_node *current_ring_node_f3;
42 extern ring_node *ring_node_to_send_cwf_f3;
43 extern ring_node *ring_node_to_send_cwf_f3;
44 extern ring_node waveform_ring_f3[];
43 extern unsigned short sequenceCounterHK;
45 extern unsigned short sequenceCounterHK;
44
46
45 #endif // FSW_MISC_H_INCLUDED
47 #endif // FSW_MISC_H_INCLUDED
@@ -1,259 +1,259
1 #ifndef FSW_PARAMS_H_INCLUDED
1 #ifndef FSW_PARAMS_H_INCLUDED
2 #define FSW_PARAMS_H_INCLUDED
2 #define FSW_PARAMS_H_INCLUDED
3
3
4 #include "grlib_regs.h"
4 #include "grlib_regs.h"
5 #include "fsw_params_processing.h"
5 #include "fsw_params_processing.h"
6 #include "fsw_params_nb_bytes.h"
6 #include "fsw_params_nb_bytes.h"
7 #include "tm_byte_positions.h"
7 #include "tm_byte_positions.h"
8 #include "ccsds_types.h"
8 #include "ccsds_types.h"
9
9
10 #define GRSPW_DEVICE_NAME "/dev/grspw0"
10 #define GRSPW_DEVICE_NAME "/dev/grspw0"
11 #define UART_DEVICE_NAME "/dev/console"
11 #define UART_DEVICE_NAME "/dev/console"
12
12
13 typedef struct ring_node
13 typedef struct ring_node
14 {
14 {
15 struct ring_node *previous;
15 struct ring_node *previous;
16 struct ring_node *next;
17 unsigned int coarseTime;
18 unsigned int fineTime;
16 int buffer_address;
19 int buffer_address;
17 struct ring_node *next;
18 unsigned int status;
20 unsigned int status;
19 unsigned coarseTime;
20 unsigned int fineTime;
21 } ring_node;
21 } ring_node;
22
22
23 //************************
23 //************************
24 // flight software version
24 // flight software version
25 // this parameters is handled by the Qt project options
25 // this parameters is handled by the Qt project options
26
26
27 #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk
27 #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk
28 #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk
28 #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk
29 #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688
29 #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688
30 #define TIME_OFFSET 2
30 #define TIME_OFFSET 2
31 #define TIME_OFFSET_IN_BYTES 8
31 #define TIME_OFFSET_IN_BYTES 8
32 //#define WAVEFORM_EXTENDED_HEADER_OFFSET 22
32 //#define WAVEFORM_EXTENDED_HEADER_OFFSET 22
33 #define NB_BYTES_SWF_BLK (2 * 6)
33 #define NB_BYTES_SWF_BLK (2 * 6)
34 #define NB_WORDS_SWF_BLK 3
34 #define NB_WORDS_SWF_BLK 3
35 #define NB_BYTES_CWF3_LIGHT_BLK 6
35 #define NB_BYTES_CWF3_LIGHT_BLK 6
36 //#define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
36 //#define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
37 #define NB_RING_NODES_F0 3 // AT LEAST 3
37 #define NB_RING_NODES_F0 3 // AT LEAST 3
38 #define NB_RING_NODES_F1 5 // AT LEAST 3
38 #define NB_RING_NODES_F1 5 // AT LEAST 3
39 #define NB_RING_NODES_F2 5 // AT LEAST 3
39 #define NB_RING_NODES_F2 5 // AT LEAST 3
40 #define NB_RING_NODES_F3 3 // AT LEAST 3
40 #define NB_RING_NODES_F3 3 // AT LEAST 3
41
41
42 //**********
42 //**********
43 // LFR MODES
43 // LFR MODES
44 #define LFR_MODE_STANDBY 0
44 #define LFR_MODE_STANDBY 0
45 #define LFR_MODE_NORMAL 1
45 #define LFR_MODE_NORMAL 1
46 #define LFR_MODE_BURST 2
46 #define LFR_MODE_BURST 2
47 #define LFR_MODE_SBM1 3
47 #define LFR_MODE_SBM1 3
48 #define LFR_MODE_SBM2 4
48 #define LFR_MODE_SBM2 4
49
49
50 #define TDS_MODE_LFM 5
50 #define TDS_MODE_LFM 5
51 #define TDS_MODE_STANDBY 0
51 #define TDS_MODE_STANDBY 0
52 #define TDS_MODE_NORMAL 1
52 #define TDS_MODE_NORMAL 1
53 #define TDS_MODE_BURST 2
53 #define TDS_MODE_BURST 2
54 #define TDS_MODE_SBM1 3
54 #define TDS_MODE_SBM1 3
55 #define TDS_MODE_SBM2 4
55 #define TDS_MODE_SBM2 4
56
56
57 #define THR_MODE_STANDBY 0
57 #define THR_MODE_STANDBY 0
58 #define THR_MODE_NORMAL 1
58 #define THR_MODE_NORMAL 1
59 #define THR_MODE_BURST 2
59 #define THR_MODE_BURST 2
60
60
61 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
61 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
62 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
62 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
63 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
63 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
64 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
64 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
65 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
65 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
66 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
66 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
67 #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6
67 #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6
68 #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7
68 #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7
69 #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 // ASM only in NORM mode
69 #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 // ASM only in NORM mode
70 #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9
70 #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9
71 #define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10
71 #define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10
72 #define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11 // ASM only in NORM mode
72 #define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11 // ASM only in NORM mode
73 #define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12
73 #define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12
74 #define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13
74 #define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13
75 #define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14 // ASM only in NORM mode
75 #define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14 // ASM only in NORM mode
76 #define RTEMS_EVENT_SBM_BP1_F0 RTEMS_EVENT_15
76 #define RTEMS_EVENT_SBM_BP1_F0 RTEMS_EVENT_15
77 #define RTEMS_EVENT_SBM_BP2_F0 RTEMS_EVENT_16
77 #define RTEMS_EVENT_SBM_BP2_F0 RTEMS_EVENT_16
78 #define RTEMS_EVENT_SBM_BP1_F1 RTEMS_EVENT_17
78 #define RTEMS_EVENT_SBM_BP1_F1 RTEMS_EVENT_17
79 #define RTEMS_EVENT_SBM_BP2_F1 RTEMS_EVENT_18
79 #define RTEMS_EVENT_SBM_BP2_F1 RTEMS_EVENT_18
80 #define RTEMS_EVENT_BURST_BP1_F0 RTEMS_EVENT_19
80 #define RTEMS_EVENT_BURST_BP1_F0 RTEMS_EVENT_19
81 #define RTEMS_EVENT_BURST_BP2_F0 RTEMS_EVENT_20
81 #define RTEMS_EVENT_BURST_BP2_F0 RTEMS_EVENT_20
82 #define RTEMS_EVENT_BURST_BP1_F1 RTEMS_EVENT_21
82 #define RTEMS_EVENT_BURST_BP1_F1 RTEMS_EVENT_21
83 #define RTEMS_EVENT_BURST_BP2_F1 RTEMS_EVENT_22
83 #define RTEMS_EVENT_BURST_BP2_F1 RTEMS_EVENT_22
84
84
85 //****************************
85 //****************************
86 // LFR DEFAULT MODE PARAMETERS
86 // LFR DEFAULT MODE PARAMETERS
87 // COMMON
87 // COMMON
88 #define DEFAULT_SY_LFR_COMMON0 0x00
88 #define DEFAULT_SY_LFR_COMMON0 0x00
89 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
89 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
90 // NORM
90 // NORM
91 #define DFLT_SY_LFR_N_SWF_L 2048 // nb sample
91 #define DFLT_SY_LFR_N_SWF_L 2048 // nb sample
92 #define DFLT_SY_LFR_N_SWF_P 300 // sec
92 #define DFLT_SY_LFR_N_SWF_P 300 // sec
93 #define DFLT_SY_LFR_N_ASM_P 3600 // sec
93 #define DFLT_SY_LFR_N_ASM_P 3600 // sec
94 #define DFLT_SY_LFR_N_BP_P0 4 // sec
94 #define DFLT_SY_LFR_N_BP_P0 4 // sec
95 #define DFLT_SY_LFR_N_BP_P1 20 // sec
95 #define DFLT_SY_LFR_N_BP_P1 20 // sec
96 #define DFLT_SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3
96 #define DFLT_SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3
97 #define MIN_DELTA_SNAPSHOT 16 // sec
97 #define MIN_DELTA_SNAPSHOT 16 // sec
98 // BURST
98 // BURST
99 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
99 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
100 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
100 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
101 // SBM1
101 // SBM1
102 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
102 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
103 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
103 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
104 // SBM2
104 // SBM2
105 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
105 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
106 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
106 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
107 // ADDITIONAL PARAMETERS
107 // ADDITIONAL PARAMETERS
108 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
108 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
109 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
109 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
110 // STATUS WORD
110 // STATUS WORD
111 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
111 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
112 #define DEFAULT_STATUS_WORD_BYTE1 0x00
112 #define DEFAULT_STATUS_WORD_BYTE1 0x00
113 //
113 //
114 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
114 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
115 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
115 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
116 //****************************
116 //****************************
117
117
118 //*****************************
118 //*****************************
119 // APB REGISTERS BASE ADDRESSES
119 // APB REGISTERS BASE ADDRESSES
120 #define REGS_ADDR_APBUART 0x80000100
120 #define REGS_ADDR_APBUART 0x80000100
121 #define REGS_ADDR_GPTIMER 0x80000300
121 #define REGS_ADDR_GPTIMER 0x80000300
122 #define REGS_ADDR_GRSPW 0x80000500
122 #define REGS_ADDR_GRSPW 0x80000500
123 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
123 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
124 #define REGS_ADDR_GRGPIO 0x80000b00
124 #define REGS_ADDR_GRGPIO 0x80000b00
125
125
126 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
126 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
127 //#define REGS_ADDR_WAVEFORM_PICKER 0x80000f50
127 //#define REGS_ADDR_WAVEFORM_PICKER 0x80000f50
128 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f54 // PDB >= 0.1.28
128 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f54 // PDB >= 0.1.28
129 #define REGS_ADDR_VHDL_VERSION 0x80000ff0
129 #define REGS_ADDR_VHDL_VERSION 0x80000ff0
130
130
131 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
131 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
132 #define APBUART_CTRL_REG_MASK_TE 0x00000002
132 #define APBUART_CTRL_REG_MASK_TE 0x00000002
133 // scaler value = system_clock_frequency / ( baud_rate * 8 ) - 1
133 // scaler value = system_clock_frequency / ( baud_rate * 8 ) - 1
134 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400
134 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400
135
135
136 //**********
136 //**********
137 // IRQ LINES
137 // IRQ LINES
138 #define IRQ_SM_SIMULATOR 9
138 #define IRQ_SM_SIMULATOR 9
139 #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels
139 #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels
140 #define IRQ_WAVEFORM_PICKER 14
140 #define IRQ_WAVEFORM_PICKER 14
141 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
141 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
142 #define IRQ_SPECTRAL_MATRIX 6
142 #define IRQ_SPECTRAL_MATRIX 6
143 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
143 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
144
144
145 //*****
145 //*****
146 // TIME
146 // TIME
147 #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416
147 #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416
148 #define TIMER_SM_SIMULATOR 1
148 #define TIMER_SM_SIMULATOR 1
149 #define HK_PERIOD 100 // 100 * 10ms => 1s
149 #define HK_PERIOD 100 // 100 * 10ms => 1s
150 #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000
150 #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000
151 #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s
151 #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s
152
152
153 //**********
153 //**********
154 // LPP CODES
154 // LPP CODES
155 #define LFR_SUCCESSFUL 0
155 #define LFR_SUCCESSFUL 0
156 #define LFR_DEFAULT 1
156 #define LFR_DEFAULT 1
157 #define LFR_EXE_ERROR 2
157 #define LFR_EXE_ERROR 2
158
158
159 //******
159 //******
160 // RTEMS
160 // RTEMS
161 #define TASKID_RECV 1
161 #define TASKID_RECV 1
162 #define TASKID_ACTN 2
162 #define TASKID_ACTN 2
163 #define TASKID_SPIQ 3
163 #define TASKID_SPIQ 3
164 #define TASKID_STAT 4
164 #define TASKID_STAT 4
165 #define TASKID_AVF0 5
165 #define TASKID_AVF0 5
166 #define TASKID_SWBD 6
166 #define TASKID_SWBD 6
167 #define TASKID_WFRM 7
167 #define TASKID_WFRM 7
168 #define TASKID_DUMB 8
168 #define TASKID_DUMB 8
169 #define TASKID_HOUS 9
169 #define TASKID_HOUS 9
170 #define TASKID_PRC0 10
170 #define TASKID_PRC0 10
171 #define TASKID_CWF3 11
171 #define TASKID_CWF3 11
172 #define TASKID_CWF2 12
172 #define TASKID_CWF2 12
173 #define TASKID_CWF1 13
173 #define TASKID_CWF1 13
174 #define TASKID_SEND 14
174 #define TASKID_SEND 14
175 #define TASKID_WTDG 15
175 #define TASKID_WTDG 15
176 #define TASKID_AVF1 16
176 #define TASKID_AVF1 16
177 #define TASKID_PRC1 17
177 #define TASKID_PRC1 17
178 #define TASKID_AVF2 18
178 #define TASKID_AVF2 18
179 #define TASKID_PRC2 19
179 #define TASKID_PRC2 19
180
180
181 #define TASK_PRIORITY_SPIQ 5
181 #define TASK_PRIORITY_SPIQ 5
182 #define TASK_PRIORITY_WTDG 20
182 #define TASK_PRIORITY_WTDG 20
183 #define TASK_PRIORITY_HOUS 30
183 #define TASK_PRIORITY_HOUS 30
184 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
184 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
185 #define TASK_PRIORITY_CWF2 35 //
185 #define TASK_PRIORITY_CWF2 35 //
186 #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it
186 #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it
187 #define TASK_PRIORITY_WFRM 40
187 #define TASK_PRIORITY_WFRM 40
188 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
188 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
189 #define TASK_PRIORITY_SEND 45
189 #define TASK_PRIORITY_SEND 45
190 #define TASK_PRIORITY_RECV 50
190 #define TASK_PRIORITY_RECV 50
191 #define TASK_PRIORITY_ACTN 50
191 #define TASK_PRIORITY_ACTN 50
192 #define TASK_PRIORITY_AVF0 60
192 #define TASK_PRIORITY_AVF0 60
193 #define TASK_PRIORITY_AVF1 70
193 #define TASK_PRIORITY_AVF1 70
194 #define TASK_PRIORITY_PRC0 100
194 #define TASK_PRIORITY_PRC0 100
195 #define TASK_PRIORITY_PRC1 100
195 #define TASK_PRIORITY_PRC1 100
196 #define TASK_PRIORITY_AVF2 110
196 #define TASK_PRIORITY_AVF2 110
197 #define TASK_PRIORITY_PRC2 110
197 #define TASK_PRIORITY_PRC2 110
198 #define TASK_PRIORITY_STAT 200
198 #define TASK_PRIORITY_STAT 200
199 #define TASK_PRIORITY_DUMB 200
199 #define TASK_PRIORITY_DUMB 200
200
200
201 #define MSG_QUEUE_COUNT_RECV 10
201 #define MSG_QUEUE_COUNT_RECV 10
202 #define MSG_QUEUE_COUNT_SEND 50
202 #define MSG_QUEUE_COUNT_SEND 50
203 #define MSG_QUEUE_COUNT_PRC0 10
203 #define MSG_QUEUE_COUNT_PRC0 10
204 #define MSG_QUEUE_COUNT_PRC1 10
204 #define MSG_QUEUE_COUNT_PRC1 10
205 #define MSG_QUEUE_COUNT_PRC2 5
205 #define MSG_QUEUE_COUNT_PRC2 5
206 #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1
206 #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1
207 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
207 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
208 #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers
208 #define MSG_QUEUE_SIZE_PRC0 20 // two pointers and one rtems_event + 2 integers
209 #define MSG_QUEUE_SIZE_PRC1 20 // two pointers and one rtems_event + 2 integers
209 #define MSG_QUEUE_SIZE_PRC1 20 // two pointers and one rtems_event + 2 integers
210 #define MSG_QUEUE_SIZE_PRC2 20 // two pointers and one rtems_event + 2 integers
210 #define MSG_QUEUE_SIZE_PRC2 20 // two pointers and one rtems_event + 2 integers
211
211
212 #define QUEUE_RECV 0
212 #define QUEUE_RECV 0
213 #define QUEUE_SEND 1
213 #define QUEUE_SEND 1
214 #define QUEUE_PRC0 2
214 #define QUEUE_PRC0 2
215 #define QUEUE_PRC1 3
215 #define QUEUE_PRC1 3
216 #define QUEUE_PRC2 4
216 #define QUEUE_PRC2 4
217
217
218 //*******
218 //*******
219 // MACROS
219 // MACROS
220 #ifdef PRINT_MESSAGES_ON_CONSOLE
220 #ifdef PRINT_MESSAGES_ON_CONSOLE
221 #define PRINTF(x) printf(x);
221 #define PRINTF(x) printf(x);
222 #define PRINTF1(x,y) printf(x,y);
222 #define PRINTF1(x,y) printf(x,y);
223 #define PRINTF2(x,y,z) printf(x,y,z);
223 #define PRINTF2(x,y,z) printf(x,y,z);
224 #else
224 #else
225 #define PRINTF(x) ;
225 #define PRINTF(x) ;
226 #define PRINTF1(x,y) ;
226 #define PRINTF1(x,y) ;
227 #define PRINTF2(x,y,z) ;
227 #define PRINTF2(x,y,z) ;
228 #endif
228 #endif
229
229
230 #ifdef BOOT_MESSAGES
230 #ifdef BOOT_MESSAGES
231 #define BOOT_PRINTF(x) printf(x);
231 #define BOOT_PRINTF(x) printf(x);
232 #define BOOT_PRINTF1(x,y) printf(x,y);
232 #define BOOT_PRINTF1(x,y) printf(x,y);
233 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
233 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
234 #else
234 #else
235 #define BOOT_PRINTF(x) ;
235 #define BOOT_PRINTF(x) ;
236 #define BOOT_PRINTF1(x,y) ;
236 #define BOOT_PRINTF1(x,y) ;
237 #define BOOT_PRINTF2(x,y,z) ;
237 #define BOOT_PRINTF2(x,y,z) ;
238 #endif
238 #endif
239
239
240 #ifdef DEBUG_MESSAGES
240 #ifdef DEBUG_MESSAGES
241 #define DEBUG_PRINTF(x) printf(x);
241 #define DEBUG_PRINTF(x) printf(x);
242 #define DEBUG_PRINTF1(x,y) printf(x,y);
242 #define DEBUG_PRINTF1(x,y) printf(x,y);
243 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
243 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
244 #else
244 #else
245 #define DEBUG_PRINTF(x) ;
245 #define DEBUG_PRINTF(x) ;
246 #define DEBUG_PRINTF1(x,y) ;
246 #define DEBUG_PRINTF1(x,y) ;
247 #define DEBUG_PRINTF2(x,y,z) ;
247 #define DEBUG_PRINTF2(x,y,z) ;
248 #endif
248 #endif
249
249
250 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
250 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
251
251
252 struct param_local_str{
252 struct param_local_str{
253 unsigned int local_sbm1_nb_cwf_sent;
253 unsigned int local_sbm1_nb_cwf_sent;
254 unsigned int local_sbm1_nb_cwf_max;
254 unsigned int local_sbm1_nb_cwf_max;
255 unsigned int local_sbm2_nb_cwf_sent;
255 unsigned int local_sbm2_nb_cwf_sent;
256 unsigned int local_sbm2_nb_cwf_max;
256 unsigned int local_sbm2_nb_cwf_max;
257 };
257 };
258
258
259 #endif // FSW_PARAMS_H_INCLUDED
259 #endif // FSW_PARAMS_H_INCLUDED
@@ -1,122 +1,124
1 #ifndef GRLIB_REGS_H_INCLUDED
1 #ifndef GRLIB_REGS_H_INCLUDED
2 #define GRLIB_REGS_H_INCLUDED
2 #define GRLIB_REGS_H_INCLUDED
3
3
4 #define NB_GPTIMER 3
4 #define NB_GPTIMER 3
5
5
6 struct apbuart_regs_str{
6 struct apbuart_regs_str{
7 volatile unsigned int data;
7 volatile unsigned int data;
8 volatile unsigned int status;
8 volatile unsigned int status;
9 volatile unsigned int ctrl;
9 volatile unsigned int ctrl;
10 volatile unsigned int scaler;
10 volatile unsigned int scaler;
11 volatile unsigned int fifoDebug;
11 volatile unsigned int fifoDebug;
12 };
12 };
13
13
14 struct grgpio_regs_str{
14 struct grgpio_regs_str{
15 volatile int io_port_data_register;
15 volatile int io_port_data_register;
16 int io_port_output_register;
16 int io_port_output_register;
17 int io_port_direction_register;
17 int io_port_direction_register;
18 int interrupt_mak_register;
18 int interrupt_mak_register;
19 int interrupt_polarity_register;
19 int interrupt_polarity_register;
20 int interrupt_edge_register;
20 int interrupt_edge_register;
21 int bypass_register;
21 int bypass_register;
22 int reserved;
22 int reserved;
23 // 0x20-0x3c interrupt map register(s)
23 // 0x20-0x3c interrupt map register(s)
24 };
24 };
25
25
26 typedef struct {
26 typedef struct {
27 volatile unsigned int counter;
27 volatile unsigned int counter;
28 volatile unsigned int reload;
28 volatile unsigned int reload;
29 volatile unsigned int ctrl;
29 volatile unsigned int ctrl;
30 volatile unsigned int unused;
30 volatile unsigned int unused;
31 } timer_regs_t;
31 } timer_regs_t;
32
32
33 typedef struct {
33 typedef struct {
34 volatile unsigned int scaler_value;
34 volatile unsigned int scaler_value;
35 volatile unsigned int scaler_reload;
35 volatile unsigned int scaler_reload;
36 volatile unsigned int conf;
36 volatile unsigned int conf;
37 volatile unsigned int unused0;
37 volatile unsigned int unused0;
38 timer_regs_t timer[NB_GPTIMER];
38 timer_regs_t timer[NB_GPTIMER];
39 } gptimer_regs_t;
39 } gptimer_regs_t;
40
40
41 typedef struct {
41 typedef struct {
42 volatile int ctrl; // bit 0 forces the load of the coarse_time_load value and resets the fine_time
42 volatile int ctrl; // bit 0 forces the load of the coarse_time_load value and resets the fine_time
43 // bit 1 is the soft reset for the time management module
44 // bit 2 is the soft reset for the waveform picker and the spectral matrix modules, set to 1 after HW reset
43 volatile int coarse_time_load;
45 volatile int coarse_time_load;
44 volatile int coarse_time;
46 volatile int coarse_time;
45 volatile int fine_time;
47 volatile int fine_time;
46 } time_management_regs_t;
48 } time_management_regs_t;
47
49
48 // PDB >= 0.1.28
50 // PDB >= 0.1.28
49 typedef struct{
51 typedef struct{
50 int data_shaping; // 0x00 00 *** R1 R0 SP1 SP0 BW
52 int data_shaping; // 0x00 00 *** R1 R0 SP1 SP0 BW
51 int run_burst_enable; // 0x04 01 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
53 int run_burst_enable; // 0x04 01 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
52 int addr_data_f0_0; // 0x08
54 int addr_data_f0_0; // 0x08
53 int addr_data_f0_1; // 0x0c
55 int addr_data_f0_1; // 0x0c
54 int addr_data_f1_0; // 0x10
56 int addr_data_f1_0; // 0x10
55 int addr_data_f1_1; // 0x14
57 int addr_data_f1_1; // 0x14
56 int addr_data_f2_0; // 0x18
58 int addr_data_f2_0; // 0x18
57 int addr_data_f2_1; // 0x1c
59 int addr_data_f2_1; // 0x1c
58 int addr_data_f3_0; // 0x20
60 int addr_data_f3_0; // 0x20
59 int addr_data_f3_1; // 0x24
61 int addr_data_f3_1; // 0x24
60 volatile int status; // 0x28
62 volatile int status; // 0x28
61 int delta_snapshot; // 0x2c
63 int delta_snapshot; // 0x2c
62 int delta_f0; // 0x30
64 int delta_f0; // 0x30
63 int delta_f0_2; // 0x34
65 int delta_f0_2; // 0x34
64 int delta_f1; // 0x38
66 int delta_f1; // 0x38
65 int delta_f2; // 0x3c
67 int delta_f2; // 0x3c
66 int nb_data_by_buffer; // 0x40 number of samples in a buffer = 2688
68 int nb_data_by_buffer; // 0x40 number of samples in a buffer = 2688
67 int snapshot_param; // 0x44
69 int snapshot_param; // 0x44
68 int start_date; // 0x48
70 int start_date; // 0x48
69 //
71 //
70 volatile unsigned int f0_0_coarse_time; // 0x4c
72 volatile unsigned int f0_0_coarse_time; // 0x4c
71 volatile unsigned int f0_0_fine_time; // 0x50
73 volatile unsigned int f0_0_fine_time; // 0x50
72 volatile unsigned int f0_1_coarse_time; // 0x54
74 volatile unsigned int f0_1_coarse_time; // 0x54
73 volatile unsigned int f0_1_fine_time; // 0x58
75 volatile unsigned int f0_1_fine_time; // 0x58
74 //
76 //
75 volatile unsigned int f1_0_coarse_time; // 0x5c
77 volatile unsigned int f1_0_coarse_time; // 0x5c
76 volatile unsigned int f1_0_fine_time; // 0x60
78 volatile unsigned int f1_0_fine_time; // 0x60
77 volatile unsigned int f1_1_coarse_time; // 0x64
79 volatile unsigned int f1_1_coarse_time; // 0x64
78 volatile unsigned int f1_1_fine_time; // 0x68
80 volatile unsigned int f1_1_fine_time; // 0x68
79 //
81 //
80 volatile unsigned int f2_0_coarse_time; // 0x6c
82 volatile unsigned int f2_0_coarse_time; // 0x6c
81 volatile unsigned int f2_0_fine_time; // 0x70
83 volatile unsigned int f2_0_fine_time; // 0x70
82 volatile unsigned int f2_1_coarse_time; // 0x74
84 volatile unsigned int f2_1_coarse_time; // 0x74
83 volatile unsigned int f2_1_fine_time; // 0x78
85 volatile unsigned int f2_1_fine_time; // 0x78
84 //
86 //
85 volatile unsigned int f3_0_coarse_time; // 0x7c
87 volatile unsigned int f3_0_coarse_time; // 0x7c
86 volatile unsigned int f3_0_fine_time; // 0x80
88 volatile unsigned int f3_0_fine_time; // 0x80
87 volatile unsigned int f3_1_coarse_time; // 0x84
89 volatile unsigned int f3_1_coarse_time; // 0x84
88 volatile unsigned int f3_1_fine_time; // 0x88
90 volatile unsigned int f3_1_fine_time; // 0x88
89 //
91 //
90 unsigned int buffer_length; // 0x8c = buffer length in burst 2688 / 16 = 168
92 unsigned int buffer_length; // 0x8c = buffer length in burst 2688 / 16 = 168
91 } waveform_picker_regs_0_1_18_t;
93 } waveform_picker_regs_0_1_18_t;
92
94
93 typedef struct {
95 typedef struct {
94 volatile int config; // 0x00
96 volatile int config; // 0x00
95 volatile int status; // 0x04
97 volatile int status; // 0x04
96 volatile int f0_0_address; // 0x08
98 volatile int f0_0_address; // 0x08
97 volatile int f0_1_address; // 0x0C
99 volatile int f0_1_address; // 0x0C
98 //
100 //
99 volatile int f1_0_address; // 0x10
101 volatile int f1_0_address; // 0x10
100 volatile int f1_1_address; // 0x14
102 volatile int f1_1_address; // 0x14
101 volatile int f2_0_address; // 0x18
103 volatile int f2_0_address; // 0x18
102 volatile int f2_1_address; // 0x1C
104 volatile int f2_1_address; // 0x1C
103 //
105 //
104 volatile unsigned int f0_0_coarse_time; // 0x20
106 volatile unsigned int f0_0_coarse_time; // 0x20
105 volatile unsigned int f0_0_fine_time; // 0x24
107 volatile unsigned int f0_0_fine_time; // 0x24
106 volatile unsigned int f0_1_coarse_time; // 0x28
108 volatile unsigned int f0_1_coarse_time; // 0x28
107 volatile unsigned int f0_1_fine_time; // 0x2C
109 volatile unsigned int f0_1_fine_time; // 0x2C
108 //
110 //
109 volatile unsigned int f1_0_coarse_time; // 0x30
111 volatile unsigned int f1_0_coarse_time; // 0x30
110 volatile unsigned int f1_0_fine_time; // 0x34
112 volatile unsigned int f1_0_fine_time; // 0x34
111 volatile unsigned int f1_1_coarse_time; // 0x38
113 volatile unsigned int f1_1_coarse_time; // 0x38
112 volatile unsigned int f1_1_time_time; // 0x3C
114 volatile unsigned int f1_1_time_time; // 0x3C
113 //
115 //
114 volatile unsigned int f2_0_coarse_time; // 0x40
116 volatile unsigned int f2_0_coarse_time; // 0x40
115 volatile unsigned int f2_0_fine_time; // 0x44
117 volatile unsigned int f2_0_fine_time; // 0x44
116 volatile unsigned int f2_1_coarse_time; // 0x48
118 volatile unsigned int f2_1_coarse_time; // 0x48
117 volatile unsigned int f2_1_fine_time; // 0x4C
119 volatile unsigned int f2_1_fine_time; // 0x4C
118 //
120 //
119 unsigned int matrix_length; // 0x50, length of a spectral matrix in burst 3200 / 16 = 200 = 0xc8
121 unsigned int matrix_length; // 0x50, length of a spectral matrix in burst 3200 / 16 = 200 = 0xc8
120 } spectral_matrix_regs_t;
122 } spectral_matrix_regs_t;
121
123
122 #endif // GRLIB_REGS_H_INCLUDED
124 #endif // GRLIB_REGS_H_INCLUDED
@@ -1,243 +1,244
1 #ifndef FSW_PROCESSING_H_INCLUDED
1 #ifndef FSW_PROCESSING_H_INCLUDED
2 #define FSW_PROCESSING_H_INCLUDED
2 #define FSW_PROCESSING_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <grspw.h>
5 #include <grspw.h>
6 #include <math.h>
6 #include <math.h>
7 #include <stdlib.h> // abs() is in the stdlib
7 #include <stdlib.h> // abs() is in the stdlib
8 #include <stdio.h> // printf()
8 #include <stdio.h> // printf()
9 #include <math.h>
9 #include <math.h>
10
10
11 #include "fsw_params.h"
11 #include "fsw_params.h"
12 #include "fsw_spacewire.h"
12 #include "fsw_spacewire.h"
13
13
14 typedef struct ring_node_sm
14 typedef struct ring_node_sm
15 {
15 {
16 struct ring_node_sm *previous;
16 struct ring_node_sm *previous;
17 struct ring_node_sm *next;
17 struct ring_node_sm *next;
18 int buffer_address;
18 int buffer_address;
19 unsigned int status;
19 unsigned int status;
20 unsigned int coarseTime;
20 unsigned int coarseTime;
21 unsigned int fineTime;
21 unsigned int fineTime;
22 } ring_node_sm;
22 } ring_node_sm;
23
23
24 typedef struct ring_node_asm
24 typedef struct ring_node_asm
25 {
25 {
26 struct ring_node_asm *next;
26 struct ring_node_asm *next;
27 float matrix[ TOTAL_SIZE_SM ];
27 float matrix[ TOTAL_SIZE_SM ];
28 unsigned int status;
28 unsigned int status;
29 } ring_node_asm;
29 } ring_node_asm;
30
30
31 typedef struct
31 typedef struct
32 {
32 {
33 Header_TM_LFR_SCIENCE_BP_t header;
33 Header_TM_LFR_SCIENCE_BP_t header;
34 unsigned char data[ 30 * 22 ]; // MAX size is 22 * 30 [TM_LFR_SCIENCE_BURST_BP2_F1]
34 unsigned char data[ 30 * 22 ]; // MAX size is 22 * 30 [TM_LFR_SCIENCE_BURST_BP2_F1]
35 } bp_packet;
35 } bp_packet;
36
36
37 typedef struct
37 typedef struct
38 {
38 {
39 Header_TM_LFR_SCIENCE_BP_with_spare_t header;
39 Header_TM_LFR_SCIENCE_BP_with_spare_t header;
40 unsigned char data[ 9 * 13 ]; // only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1
40 unsigned char data[ 9 * 13 ]; // only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1
41 } bp_packet_with_spare;
41 } bp_packet_with_spare;
42
42
43 typedef struct
43 typedef struct
44 {
44 {
45 ring_node_asm *norm;
45 ring_node_asm *norm;
46 ring_node_asm *burst_sbm;
46 ring_node_asm *burst_sbm;
47 rtems_event_set event;
47 rtems_event_set event;
48 unsigned int coarseTime;
48 unsigned int coarseTime;
49 unsigned int fineTime;
49 unsigned int fineTime;
50 } asm_msg;
50 } asm_msg;
51
51
52 extern volatile int sm_f0[ ];
52 extern volatile int sm_f0[ ];
53 extern volatile int sm_f1[ ];
53 extern volatile int sm_f1[ ];
54 extern volatile int sm_f2[ ];
54 extern volatile int sm_f2[ ];
55
55
56 // parameters
56 // parameters
57 extern struct param_local_str param_local;
57 extern struct param_local_str param_local;
58
58
59 // registers
59 // registers
60 extern time_management_regs_t *time_management_regs;
60 extern time_management_regs_t *time_management_regs;
61 extern spectral_matrix_regs_t *spectral_matrix_regs;
61 extern spectral_matrix_regs_t *spectral_matrix_regs;
62
62
63 extern rtems_name misc_name[5];
63 extern rtems_name misc_name[5];
64 extern rtems_id Task_id[20]; /* array of task ids */
64 extern rtems_id Task_id[20]; /* array of task ids */
65
65
66 // ISR
66 // ISR
67 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
67 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
68 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
68 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
69
69
70 //******************
70 //******************
71 // Spectral Matrices
71 // Spectral Matrices
72 void reset_nb_sm( void );
72 void reset_nb_sm( void );
73 // SM
73 // SM
74 void SM_init_rings( void );
74 void SM_init_rings( void );
75 void SM_reset_current_ring_nodes( void );
75 void SM_reset_current_ring_nodes( void );
76 void SM_generic_init_ring(ring_node_sm *ring, unsigned char nbNodes, volatile int sm_f[] );
76 void SM_generic_init_ring(ring_node_sm *ring, unsigned char nbNodes, volatile int sm_f[] );
77 // ASM
77 // ASM
78 void ASM_generic_init_ring(ring_node_asm *ring, unsigned char nbNodes );
78 void ASM_generic_init_ring(ring_node_asm *ring, unsigned char nbNodes );
79 void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header);
79 void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header);
80 void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
80 void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
81 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id);
81 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id);
82
82
83 //*****************
83 //*****************
84 // Basic Parameters
84 // Basic Parameters
85
85
86 void BP_reset_current_ring_nodes( void );
86 void BP_reset_current_ring_nodes( void );
87 void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header,
87 void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header,
88 unsigned int apid, unsigned char sid,
88 unsigned int apid, unsigned char sid,
89 unsigned int packetLength , unsigned char blkNr);
89 unsigned int packetLength , unsigned char blkNr);
90 void BP_init_header_with_spare( Header_TM_LFR_SCIENCE_BP_with_spare_t *header,
90 void BP_init_header_with_spare( Header_TM_LFR_SCIENCE_BP_with_spare_t *header,
91 unsigned int apid, unsigned char sid,
91 unsigned int apid, unsigned char sid,
92 unsigned int packetLength, unsigned char blkNr );
92 unsigned int packetLength, unsigned char blkNr );
93 void BP_send( char *data,
93 void BP_send( char *data,
94 rtems_id queue_id ,
94 rtems_id queue_id ,
95 unsigned int nbBytesToSend , unsigned int sid );
95 unsigned int nbBytesToSend , unsigned int sid );
96
96
97 //******************
97 //******************
98 // general functions
98 // general functions
99 void reset_sm_status( void );
99 void reset_spectral_matrix_regs( void );
100 void reset_spectral_matrix_regs( void );
100 void set_time(unsigned char *time, unsigned char *timeInBuffer );
101 void set_time(unsigned char *time, unsigned char *timeInBuffer );
101 unsigned long long int get_acquisition_time( unsigned char *timePtr );
102 unsigned long long int get_acquisition_time( unsigned char *timePtr );
102 void close_matrix_actions(unsigned int *nb_sm, unsigned int nb_sm_before_avf, rtems_id avf_task_id,
103 void close_matrix_actions(unsigned int *nb_sm, unsigned int nb_sm_before_avf, rtems_id avf_task_id,
103 ring_node_sm *node_for_averaging, ring_node_sm *ringNode, unsigned long long int time);
104 ring_node_sm *node_for_averaging, ring_node_sm *ringNode, unsigned long long int time);
104 unsigned char getSID( rtems_event_set event );
105 unsigned char getSID( rtems_event_set event );
105
106
106 extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
107 extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
107 extern rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
108 extern rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
108
109
109 //***************************************
110 //***************************************
110 // DEFINITIONS OF STATIC INLINE FUNCTIONS
111 // DEFINITIONS OF STATIC INLINE FUNCTIONS
111 static inline void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
112 static inline void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
112 ring_node_sm *ring_node_tab[],
113 ring_node_sm *ring_node_tab[],
113 unsigned int nbAverageNORM, unsigned int nbAverageSBM );
114 unsigned int nbAverageNORM, unsigned int nbAverageSBM );
114 static inline void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized,
115 static inline void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized,
115 float divider );
116 float divider );
116 static inline void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat,
117 static inline void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat,
117 float divider,
118 float divider,
118 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart);
119 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart);
119 static inline void ASM_convert(volatile float *input_matrix, char *output_matrix);
120 static inline void ASM_convert(volatile float *input_matrix, char *output_matrix);
120
121
121 void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
122 void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
122 ring_node_sm *ring_node_tab[],
123 ring_node_sm *ring_node_tab[],
123 unsigned int nbAverageNORM, unsigned int nbAverageSBM )
124 unsigned int nbAverageNORM, unsigned int nbAverageSBM )
124 {
125 {
125 float sum;
126 float sum;
126 unsigned int i;
127 unsigned int i;
127
128
128 for(i=0; i<TOTAL_SIZE_SM; i++)
129 for(i=0; i<TOTAL_SIZE_SM; i++)
129 {
130 {
130 sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ]
131 sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ]
131 + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ]
132 + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ]
132 + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ]
133 + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ]
133 + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ]
134 + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ]
134 + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ]
135 + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ]
135 + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ]
136 + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ]
136 + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ]
137 + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ]
137 + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ];
138 + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ];
138
139
139 if ( (nbAverageNORM == 0) && (nbAverageSBM == 0) )
140 if ( (nbAverageNORM == 0) && (nbAverageSBM == 0) )
140 {
141 {
141 averaged_spec_mat_NORM[ i ] = sum;
142 averaged_spec_mat_NORM[ i ] = sum;
142 averaged_spec_mat_SBM[ i ] = sum;
143 averaged_spec_mat_SBM[ i ] = sum;
143 }
144 }
144 else if ( (nbAverageNORM != 0) && (nbAverageSBM != 0) )
145 else if ( (nbAverageNORM != 0) && (nbAverageSBM != 0) )
145 {
146 {
146 averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum );
147 averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum );
147 averaged_spec_mat_SBM[ i ] = ( averaged_spec_mat_SBM[ i ] + sum );
148 averaged_spec_mat_SBM[ i ] = ( averaged_spec_mat_SBM[ i ] + sum );
148 }
149 }
149 else if ( (nbAverageNORM != 0) && (nbAverageSBM == 0) )
150 else if ( (nbAverageNORM != 0) && (nbAverageSBM == 0) )
150 {
151 {
151 averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum );
152 averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum );
152 averaged_spec_mat_SBM[ i ] = sum;
153 averaged_spec_mat_SBM[ i ] = sum;
153 }
154 }
154 else
155 else
155 {
156 {
156 PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNORM, nbAverageSBM)
157 PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNORM, nbAverageSBM)
157 }
158 }
158 }
159 }
159 }
160 }
160
161
161 void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider )
162 void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider )
162 {
163 {
163 int frequencyBin;
164 int frequencyBin;
164 int asmComponent;
165 int asmComponent;
165 unsigned int offsetAveragedSpecMatReorganized;
166 unsigned int offsetAveragedSpecMatReorganized;
166 unsigned int offsetAveragedSpecMat;
167 unsigned int offsetAveragedSpecMat;
167
168
168 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
169 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
169 {
170 {
170 for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ )
171 for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ )
171 {
172 {
172 offsetAveragedSpecMatReorganized =
173 offsetAveragedSpecMatReorganized =
173 frequencyBin * NB_VALUES_PER_SM
174 frequencyBin * NB_VALUES_PER_SM
174 + asmComponent;
175 + asmComponent;
175 offsetAveragedSpecMat =
176 offsetAveragedSpecMat =
176 asmComponent * NB_BINS_PER_SM
177 asmComponent * NB_BINS_PER_SM
177 + frequencyBin;
178 + frequencyBin;
178 averaged_spec_mat_reorganized[offsetAveragedSpecMatReorganized ] =
179 averaged_spec_mat_reorganized[offsetAveragedSpecMatReorganized ] =
179 averaged_spec_mat[ offsetAveragedSpecMat ] / divider;
180 averaged_spec_mat[ offsetAveragedSpecMat ] / divider;
180 }
181 }
181 }
182 }
182 }
183 }
183
184
184 void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider,
185 void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider,
185 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart )
186 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart )
186 {
187 {
187 int frequencyBin;
188 int frequencyBin;
188 int asmComponent;
189 int asmComponent;
189 int offsetASM;
190 int offsetASM;
190 int offsetCompressed;
191 int offsetCompressed;
191 int k;
192 int k;
192
193
193 // build data
194 // build data
194 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
195 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
195 {
196 {
196 for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ )
197 for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ )
197 {
198 {
198 offsetCompressed = // NO TIME OFFSET
199 offsetCompressed = // NO TIME OFFSET
199 frequencyBin * NB_VALUES_PER_SM
200 frequencyBin * NB_VALUES_PER_SM
200 + asmComponent;
201 + asmComponent;
201 offsetASM = // NO TIME OFFSET
202 offsetASM = // NO TIME OFFSET
202 asmComponent * NB_BINS_PER_SM
203 asmComponent * NB_BINS_PER_SM
203 + ASMIndexStart
204 + ASMIndexStart
204 + frequencyBin * nbBinsToAverage;
205 + frequencyBin * nbBinsToAverage;
205 compressed_spec_mat[ offsetCompressed ] = 0;
206 compressed_spec_mat[ offsetCompressed ] = 0;
206 for ( k = 0; k < nbBinsToAverage; k++ )
207 for ( k = 0; k < nbBinsToAverage; k++ )
207 {
208 {
208 compressed_spec_mat[offsetCompressed ] =
209 compressed_spec_mat[offsetCompressed ] =
209 ( compressed_spec_mat[ offsetCompressed ]
210 ( compressed_spec_mat[ offsetCompressed ]
210 + averaged_spec_mat[ offsetASM + k ] ) / (divider * nbBinsToAverage);
211 + averaged_spec_mat[ offsetASM + k ] ) / (divider * nbBinsToAverage);
211 }
212 }
212 }
213 }
213 }
214 }
214 }
215 }
215
216
216 void ASM_convert( volatile float *input_matrix, char *output_matrix)
217 void ASM_convert( volatile float *input_matrix, char *output_matrix)
217 {
218 {
218 unsigned int frequencyBin;
219 unsigned int frequencyBin;
219 unsigned int asmComponent;
220 unsigned int asmComponent;
220 char * pt_char_input;
221 char * pt_char_input;
221 char * pt_char_output;
222 char * pt_char_output;
222 unsigned int offsetInput;
223 unsigned int offsetInput;
223 unsigned int offsetOutput;
224 unsigned int offsetOutput;
224
225
225 pt_char_input = (char*) &input_matrix;
226 pt_char_input = (char*) &input_matrix;
226 pt_char_output = (char*) &output_matrix;
227 pt_char_output = (char*) &output_matrix;
227
228
228 // convert all other data
229 // convert all other data
229 for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++)
230 for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++)
230 {
231 {
231 for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++)
232 for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++)
232 {
233 {
233 offsetInput = (frequencyBin*NB_VALUES_PER_SM) + asmComponent ;
234 offsetInput = (frequencyBin*NB_VALUES_PER_SM) + asmComponent ;
234 offsetOutput = 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) ;
235 offsetOutput = 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) ;
235 pt_char_input = (char*) &input_matrix [ offsetInput ];
236 pt_char_input = (char*) &input_matrix [ offsetInput ];
236 pt_char_output = (char*) &output_matrix[ offsetOutput ];
237 pt_char_output = (char*) &output_matrix[ offsetOutput ];
237 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
238 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
238 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
239 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
239 }
240 }
240 }
241 }
241 }
242 }
242
243
243 #endif // FSW_PROCESSING_H_INCLUDED
244 #endif // FSW_PROCESSING_H_INCLUDED
@@ -1,62 +1,64
1 #ifndef TC_HANDLER_H_INCLUDED
1 #ifndef TC_HANDLER_H_INCLUDED
2 #define TC_HANDLER_H_INCLUDED
2 #define TC_HANDLER_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <leon.h>
5 #include <leon.h>
6
6
7 #include "tc_load_dump_parameters.h"
7 #include "tc_load_dump_parameters.h"
8 #include "tc_acceptance.h"
8 #include "tc_acceptance.h"
9 #include "tm_lfr_tc_exe.h"
9 #include "tm_lfr_tc_exe.h"
10 #include "wf_handler.h"
10 #include "wf_handler.h"
11 #include "fsw_processing.h"
11 #include "fsw_processing.h"
12
12
13 #include "lfr_cpu_usage_report.h"
13 #include "lfr_cpu_usage_report.h"
14
14
15 // MODE PARAMETERS
15 // MODE PARAMETERS
16 extern unsigned int maxCount;
16 extern unsigned int maxCount;
17
17
18 //****
18 //****
19 // ISR
19 // ISR
20 rtems_isr commutation_isr1( rtems_vector_number vector );
20 rtems_isr commutation_isr1( rtems_vector_number vector );
21 rtems_isr commutation_isr2( rtems_vector_number vector );
21 rtems_isr commutation_isr2( rtems_vector_number vector );
22
22
23 //***********
23 //***********
24 // RTEMS TASK
24 // RTEMS TASK
25 rtems_task actn_task( rtems_task_argument unused );
25 rtems_task actn_task( rtems_task_argument unused );
26
26
27 //***********
27 //***********
28 // TC ACTIONS
28 // TC ACTIONS
29 int action_reset( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
29 int action_reset( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
30 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
30 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
31 int action_update_info( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
31 int action_update_info( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
32 int action_enable_calibration( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
32 int action_enable_calibration( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
33 int action_disable_calibration( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
33 int action_disable_calibration( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
34 int action_update_time( ccsdsTelecommandPacket_t *TC);
34 int action_update_time( ccsdsTelecommandPacket_t *TC);
35
35
36 // mode transition
36 // mode transition
37 int check_mode_value( unsigned char requestedMode );
37 int check_mode_value( unsigned char requestedMode );
38 int check_mode_transition( unsigned char requestedMode );
38 int check_mode_transition( unsigned char requestedMode );
39 int check_transition_date( unsigned int transitionCoarseTime );
39 int check_transition_date( unsigned int transitionCoarseTime );
40 int stop_current_mode( void );
40 int stop_current_mode( void );
41 int enter_mode( unsigned char mode , unsigned int transitionCoarseTime );
41 int enter_mode( unsigned char mode , unsigned int transitionCoarseTime );
42 int restart_science_tasks(unsigned char lfrRequestedMode );
42 int restart_science_tasks( unsigned char lfrRequestedMode );
43 int suspend_science_tasks();
43 int suspend_science_tasks();
44 void launch_waveform_picker(unsigned char mode , unsigned int transitionCoarseTime);
44 void launch_waveform_picker( unsigned char mode , unsigned int transitionCoarseTime );
45 void launch_spectral_matrix( void );
45 void launch_spectral_matrix( void );
46 void launch_spectral_matrix_simu( void );
46 void launch_spectral_matrix_simu( void );
47 void set_irq_on_new_ready_matrix(unsigned char value );
47 void set_sm_irq_onNewMatrix( unsigned char value );
48 void set_run_matrix_spectral( unsigned char value );
48 void set_sm_irq_onError( unsigned char value );
49
49
50 // other functions
50 // other functions
51 void updateLFRCurrentMode();
51 void updateLFRCurrentMode();
52 void set_lfr_soft_reset( unsigned char value );
53 void reset_lfr( void );
52 void update_last_TC_exe( ccsdsTelecommandPacket_t *TC , unsigned char *time );
54 void update_last_TC_exe( ccsdsTelecommandPacket_t *TC , unsigned char *time );
53 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC , unsigned char *time );
55 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC , unsigned char *time );
54 void close_action( ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id );
56 void close_action( ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id );
55
57
56 extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id );
58 extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id );
57 extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id );
59 extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id );
58
60
59 #endif // TC_HANDLER_H_INCLUDED
61 #endif // TC_HANDLER_H_INCLUDED
60
62
61
63
62
64
@@ -1,92 +1,93
1 #ifndef WF_HANDLER_H_INCLUDED
1 #ifndef WF_HANDLER_H_INCLUDED
2 #define WF_HANDLER_H_INCLUDED
2 #define WF_HANDLER_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <grspw.h>
5 #include <grspw.h>
6 #include <stdio.h>
6 #include <stdio.h>
7 #include <math.h>
7 #include <math.h>
8
8
9 #include "fsw_params.h"
9 #include "fsw_params.h"
10 #include "fsw_spacewire.h"
10 #include "fsw_spacewire.h"
11 #include "fsw_misc.h"
11 #include "fsw_misc.h"
12 #include "fsw_params_wf_handler.h"
12 #include "fsw_params_wf_handler.h"
13
13
14 #define pi 3.1415
14 #define pi 3.1415
15
15
16 extern int fdSPW;
16 extern int fdSPW;
17
17
18 //*****************
18 //*****************
19 // waveform buffers
19 // waveform buffers
20 extern volatile int wf_snap_f0[ ];
20 extern volatile int wf_snap_f0[ ];
21 extern volatile int wf_snap_f1[ ];
21 extern volatile int wf_snap_f1[ ];
22 extern volatile int wf_snap_f2[ ];
22 extern volatile int wf_snap_f2[ ];
23 extern volatile int wf_cont_f3[ ];
23 extern volatile int wf_cont_f3[ ];
24 extern char wf_cont_f3_light[ ];
24 extern char wf_cont_f3_light[ ];
25
25
26 extern waveform_picker_regs_0_1_18_t *waveform_picker_regs;
26 extern waveform_picker_regs_0_1_18_t *waveform_picker_regs;
27 extern time_management_regs_t *time_management_regs;
27 extern time_management_regs_t *time_management_regs;
28 extern Packet_TM_LFR_HK_t housekeeping_packet;
28 extern Packet_TM_LFR_HK_t housekeeping_packet;
29 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
29 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
30 extern struct param_local_str param_local;
30 extern struct param_local_str param_local;
31
31
32 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
32 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
33 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
33 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
34
34
35 extern rtems_id Task_id[20]; /* array of task ids */
35 extern rtems_id Task_id[20]; /* array of task ids */
36
36
37 extern unsigned char lfrCurrentMode;
37 extern unsigned char lfrCurrentMode;
38
38
39 //**********
39 //**********
40 // RTEMS_ISR
40 // RTEMS_ISR
41 void reset_extractSWF( void );
41 void reset_extractSWF( void );
42 rtems_isr waveforms_isr( rtems_vector_number vector );
42 rtems_isr waveforms_isr( rtems_vector_number vector );
43
43
44 //***********
44 //***********
45 // RTEMS_TASK
45 // RTEMS_TASK
46 rtems_task wfrm_task( rtems_task_argument argument );
46 rtems_task wfrm_task( rtems_task_argument argument );
47 rtems_task cwf3_task( rtems_task_argument argument );
47 rtems_task cwf3_task( rtems_task_argument argument );
48 rtems_task cwf2_task( rtems_task_argument argument );
48 rtems_task cwf2_task( rtems_task_argument argument );
49 rtems_task cwf1_task( rtems_task_argument argument );
49 rtems_task cwf1_task( rtems_task_argument argument );
50 rtems_task swbd_task( rtems_task_argument argument );
50 rtems_task swbd_task( rtems_task_argument argument );
51
51
52 //******************
52 //******************
53 // general functions
53 // general functions
54 void WFP_init_rings( void );
54 void WFP_init_rings( void );
55 void init_waveform_ring( ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] );
55 void init_waveform_ring( ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] );
56 void WFP_reset_current_ring_nodes( void );
56 void WFP_reset_current_ring_nodes( void );
57 //
57 //
58 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
58 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
59 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
59 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
60 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
60 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
61 //
61 //
62 int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
62 int send_waveform_SWF( ring_node *ring_node_to_send, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
63 int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
63 int send_waveform_CWF( ring_node *ring_node_to_send, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
64 int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
64 int send_waveform_CWF3_light( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
65 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
65 int send_ring_node_CWF( ring_node *ring_node_to_send );
66 //
66 //
67 void compute_acquisition_time(unsigned int coarseTime, unsigned int fineTime,
67 void compute_acquisition_time(unsigned int coarseTime, unsigned int fineTime,
68 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char *acquisitionTime );
68 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char *acquisitionTime );
69 void build_snapshot_from_ring(ring_node *ring_node_to_send , unsigned char frequencyChannel );
69 void build_snapshot_from_ring(ring_node *ring_node_to_send , unsigned char frequencyChannel );
70 void snapshot_resynchronization( unsigned char *timePtr );
70 void snapshot_resynchronization( unsigned char *timePtr );
71 //
71 //
72 rtems_id get_pkts_queue_id( void );
72 rtems_id get_pkts_queue_id( void );
73
73
74 //**************
74 //**************
75 // wfp registers
75 // wfp registers
76 // RESET
76 // RESET
77 void reset_wfp_burst_enable( void );
77 void reset_wfp_burst_enable( void );
78 void reset_wfp_status(void);
78 void reset_wfp_status( void );
79 void reset_wfp_buffer_addresses( void );
79 void reset_waveform_picker_regs( void );
80 void reset_waveform_picker_regs( void );
80 // SET
81 // SET
81 void set_wfp_data_shaping(void);
82 void set_wfp_data_shaping(void);
82 void set_wfp_burst_enable_register( unsigned char mode );
83 void set_wfp_burst_enable_register( unsigned char mode );
83 void set_wfp_delta_snapshot( void );
84 void set_wfp_delta_snapshot( void );
84 void set_wfp_delta_f0_f0_2( void );
85 void set_wfp_delta_f0_f0_2( void );
85 void set_wfp_delta_f1( void );
86 void set_wfp_delta_f1( void );
86 void set_wfp_delta_f2( void );
87 void set_wfp_delta_f2( void );
87
88
88 //*****************
89 //*****************
89 // local parameters
90 // local parameters
90 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid );
91 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid );
91
92
92 #endif // WF_HANDLER_H_INCLUDED
93 #endif // WF_HANDLER_H_INCLUDED
@@ -1,780 +1,782
1 /** This is the RTEMS initialization module.
1 /** This is the RTEMS initialization module.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * This module contains two very different information:
6 * This module contains two very different information:
7 * - specific instructions to configure the compilation of the RTEMS executive
7 * - specific instructions to configure the compilation of the RTEMS executive
8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
9 *
9 *
10 */
10 */
11
11
12 //*************************
12 //*************************
13 // GPL reminder to be added
13 // GPL reminder to be added
14 //*************************
14 //*************************
15
15
16 #include <rtems.h>
16 #include <rtems.h>
17
17
18 /* configuration information */
18 /* configuration information */
19
19
20 #define CONFIGURE_INIT
20 #define CONFIGURE_INIT
21
21
22 #include <bsp.h> /* for device driver prototypes */
22 #include <bsp.h> /* for device driver prototypes */
23
23
24 /* configuration information */
24 /* configuration information */
25
25
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
28
28
29 #define CONFIGURE_MAXIMUM_TASKS 20
29 #define CONFIGURE_MAXIMUM_TASKS 20
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
35 #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT)
35 #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT)
36 #define CONFIGURE_MAXIMUM_DRIVERS 16
36 #define CONFIGURE_MAXIMUM_DRIVERS 16
37 #define CONFIGURE_MAXIMUM_PERIODS 5
37 #define CONFIGURE_MAXIMUM_PERIODS 5
38 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
38 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
39 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 5
39 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 5
40 #ifdef PRINT_STACK_REPORT
40 #ifdef PRINT_STACK_REPORT
41 #define CONFIGURE_STACK_CHECKER_ENABLED
41 #define CONFIGURE_STACK_CHECKER_ENABLED
42 #endif
42 #endif
43
43
44 #include <rtems/confdefs.h>
44 #include <rtems/confdefs.h>
45
45
46 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
46 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
47 #ifdef RTEMS_DRVMGR_STARTUP
47 #ifdef RTEMS_DRVMGR_STARTUP
48 #ifdef LEON3
48 #ifdef LEON3
49 /* Add Timer and UART Driver */
49 /* Add Timer and UART Driver */
50 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
50 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
51 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
51 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
52 #endif
52 #endif
53 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
53 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
54 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
54 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
55 #endif
55 #endif
56 #endif
56 #endif
57 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
57 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
58 #include <drvmgr/drvmgr_confdefs.h>
58 #include <drvmgr/drvmgr_confdefs.h>
59 #endif
59 #endif
60
60
61 #include "fsw_init.h"
61 #include "fsw_init.h"
62 #include "fsw_config.c"
62 #include "fsw_config.c"
63
63
64 rtems_task Init( rtems_task_argument ignored )
64 rtems_task Init( rtems_task_argument ignored )
65 {
65 {
66 /** This is the RTEMS INIT taks, it the first task launched by the system.
66 /** This is the RTEMS INIT taks, it the first task launched by the system.
67 *
67 *
68 * @param unused is the starting argument of the RTEMS task
68 * @param unused is the starting argument of the RTEMS task
69 *
69 *
70 * The INIT task create and run all other RTEMS tasks.
70 * The INIT task create and run all other RTEMS tasks.
71 *
71 *
72 */
72 */
73
73
74 unsigned char *vhdlVersion;
74 unsigned char *vhdlVersion;
75
75
76 reset_lfr();
77
76 reset_local_time();
78 reset_local_time();
77
79
78 rtems_cpu_usage_reset();
80 rtems_cpu_usage_reset();
79
81
80 rtems_status_code status;
82 rtems_status_code status;
81 rtems_status_code status_spw;
83 rtems_status_code status_spw;
82 rtems_isr_entry old_isr_handler;
84 rtems_isr_entry old_isr_handler;
83
85
84 // UART settings
86 // UART settings
85 send_console_outputs_on_apbuart_port();
87 send_console_outputs_on_apbuart_port();
86 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
88 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
87 enable_apbuart_transmitter();
89 enable_apbuart_transmitter();
88 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
90 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
89
91
90 PRINTF("\n\n\n\n\n")
92 PRINTF("\n\n\n\n\n")
91 PRINTF("*************************\n")
93 PRINTF("*************************\n")
92 PRINTF("** LFR Flight Software **\n")
94 PRINTF("** LFR Flight Software **\n")
93 PRINTF1("** %d.", SW_VERSION_N1)
95 PRINTF1("** %d.", SW_VERSION_N1)
94 PRINTF1("%d." , SW_VERSION_N2)
96 PRINTF1("%d." , SW_VERSION_N2)
95 PRINTF1("%d." , SW_VERSION_N3)
97 PRINTF1("%d." , SW_VERSION_N3)
96 PRINTF1("%d **\n", SW_VERSION_N4)
98 PRINTF1("%d **\n", SW_VERSION_N4)
97
99
98 vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION);
100 vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION);
99 PRINTF("** VHDL **\n")
101 PRINTF("** VHDL **\n")
100 PRINTF1("** %d.", vhdlVersion[1])
102 PRINTF1("** %d.", vhdlVersion[1])
101 PRINTF1("%d." , vhdlVersion[2])
103 PRINTF1("%d." , vhdlVersion[2])
102 PRINTF1("%d **\n", vhdlVersion[3])
104 PRINTF1("%d **\n", vhdlVersion[3])
103 PRINTF("*************************\n")
105 PRINTF("*************************\n")
104 PRINTF("\n\n")
106 PRINTF("\n\n")
105
107
106 init_parameter_dump();
108 init_parameter_dump();
107 init_local_mode_parameters();
109 init_local_mode_parameters();
108 init_housekeeping_parameters();
110 init_housekeeping_parameters();
109
111
110 // waveform picker initialization
112 // waveform picker initialization
111 WFP_init_rings(); // initialize the waveform rings
113 WFP_init_rings(); // initialize the waveform rings
112 WFP_reset_current_ring_nodes();
114 WFP_reset_current_ring_nodes();
113 reset_waveform_picker_regs();
115 reset_waveform_picker_regs();
114
116
115 // spectral matrices initialization
117 // spectral matrices initialization
116 SM_init_rings(); // initialize spectral matrices rings
118 SM_init_rings(); // initialize spectral matrices rings
117 SM_reset_current_ring_nodes();
119 SM_reset_current_ring_nodes();
118 reset_spectral_matrix_regs();
120 reset_spectral_matrix_regs();
119
121
120 updateLFRCurrentMode();
122 updateLFRCurrentMode();
121
123
122 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
124 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
123
125
124 create_names(); // create all names
126 create_names(); // create all names
125
127
126 status = create_message_queues(); // create message queues
128 status = create_message_queues(); // create message queues
127 if (status != RTEMS_SUCCESSFUL)
129 if (status != RTEMS_SUCCESSFUL)
128 {
130 {
129 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
131 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
130 }
132 }
131
133
132 status = create_all_tasks(); // create all tasks
134 status = create_all_tasks(); // create all tasks
133 if (status != RTEMS_SUCCESSFUL)
135 if (status != RTEMS_SUCCESSFUL)
134 {
136 {
135 PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status)
137 PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status)
136 }
138 }
137
139
138 // **************************
140 // **************************
139 // <SPACEWIRE INITIALIZATION>
141 // <SPACEWIRE INITIALIZATION>
140 grspw_timecode_callback = &timecode_irq_handler;
142 grspw_timecode_callback = &timecode_irq_handler;
141
143
142 status_spw = spacewire_open_link(); // (1) open the link
144 status_spw = spacewire_open_link(); // (1) open the link
143 if ( status_spw != RTEMS_SUCCESSFUL )
145 if ( status_spw != RTEMS_SUCCESSFUL )
144 {
146 {
145 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
147 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
146 }
148 }
147
149
148 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
150 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
149 {
151 {
150 status_spw = spacewire_configure_link( fdSPW );
152 status_spw = spacewire_configure_link( fdSPW );
151 if ( status_spw != RTEMS_SUCCESSFUL )
153 if ( status_spw != RTEMS_SUCCESSFUL )
152 {
154 {
153 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
155 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
154 }
156 }
155 }
157 }
156
158
157 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
159 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
158 {
160 {
159 status_spw = spacewire_start_link( fdSPW );
161 status_spw = spacewire_start_link( fdSPW );
160 if ( status_spw != RTEMS_SUCCESSFUL )
162 if ( status_spw != RTEMS_SUCCESSFUL )
161 {
163 {
162 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
164 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
163 }
165 }
164 }
166 }
165 // </SPACEWIRE INITIALIZATION>
167 // </SPACEWIRE INITIALIZATION>
166 // ***************************
168 // ***************************
167
169
168 status = start_all_tasks(); // start all tasks
170 status = start_all_tasks(); // start all tasks
169 if (status != RTEMS_SUCCESSFUL)
171 if (status != RTEMS_SUCCESSFUL)
170 {
172 {
171 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
173 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
172 }
174 }
173
175
174 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
176 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
175 status = start_recv_send_tasks();
177 status = start_recv_send_tasks();
176 if ( status != RTEMS_SUCCESSFUL )
178 if ( status != RTEMS_SUCCESSFUL )
177 {
179 {
178 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
180 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
179 }
181 }
180
182
181 // suspend science tasks, they will be restarted later depending on the mode
183 // suspend science tasks, they will be restarted later depending on the mode
182 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
184 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
183 if (status != RTEMS_SUCCESSFUL)
185 if (status != RTEMS_SUCCESSFUL)
184 {
186 {
185 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
187 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
186 }
188 }
187
189
188 //******************************
190 //******************************
189 // <SPECTRAL MATRICES SIMULATOR>
191 // <SPECTRAL MATRICES SIMULATOR>
190 LEON_Mask_interrupt( IRQ_SM_SIMULATOR );
192 LEON_Mask_interrupt( IRQ_SM_SIMULATOR );
191 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
193 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
192 IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu );
194 IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu );
193 // </SPECTRAL MATRICES SIMULATOR>
195 // </SPECTRAL MATRICES SIMULATOR>
194 //*******************************
196 //*******************************
195
197
196 // configure IRQ handling for the waveform picker unit
198 // configure IRQ handling for the waveform picker unit
197 status = rtems_interrupt_catch( waveforms_isr,
199 status = rtems_interrupt_catch( waveforms_isr,
198 IRQ_SPARC_WAVEFORM_PICKER,
200 IRQ_SPARC_WAVEFORM_PICKER,
199 &old_isr_handler) ;
201 &old_isr_handler) ;
200 // configure IRQ handling for the spectral matrices unit
202 // configure IRQ handling for the spectral matrices unit
201 status = rtems_interrupt_catch( spectral_matrices_isr,
203 status = rtems_interrupt_catch( spectral_matrices_isr,
202 IRQ_SPARC_SPECTRAL_MATRIX,
204 IRQ_SPARC_SPECTRAL_MATRIX,
203 &old_isr_handler) ;
205 &old_isr_handler) ;
204
206
205 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
207 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
206 if ( status_spw != RTEMS_SUCCESSFUL )
208 if ( status_spw != RTEMS_SUCCESSFUL )
207 {
209 {
208 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
210 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
209 if ( status != RTEMS_SUCCESSFUL ) {
211 if ( status != RTEMS_SUCCESSFUL ) {
210 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
212 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
211 }
213 }
212 }
214 }
213
215
214 BOOT_PRINTF("delete INIT\n")
216 BOOT_PRINTF("delete INIT\n")
215
217
216 status = rtems_task_delete(RTEMS_SELF);
218 status = rtems_task_delete(RTEMS_SELF);
217
219
218 }
220 }
219
221
220 void init_local_mode_parameters( void )
222 void init_local_mode_parameters( void )
221 {
223 {
222 /** This function initialize the param_local global variable with default values.
224 /** This function initialize the param_local global variable with default values.
223 *
225 *
224 */
226 */
225
227
226 unsigned int i;
228 unsigned int i;
227
229
228 // LOCAL PARAMETERS
230 // LOCAL PARAMETERS
229
231
230 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
232 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
231 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
233 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
232 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
234 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
233
235
234 // init sequence counters
236 // init sequence counters
235
237
236 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
238 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
237 {
239 {
238 sequenceCounters_TC_EXE[i] = 0x00;
240 sequenceCounters_TC_EXE[i] = 0x00;
239 }
241 }
240 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
242 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
241 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
243 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
242 sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
244 sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
243 sequenceCounterParameterDump = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
245 sequenceCounterParameterDump = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
244 }
246 }
245
247
246 void reset_local_time( void )
248 void reset_local_time( void )
247 {
249 {
248 time_management_regs->ctrl = 0x02; // software reset, coarse time = 0x80000000
250 time_management_regs->ctrl = time_management_regs->ctrl | 0x02; // [0010] software reset, coarse time = 0x80000000
249 }
251 }
250
252
251 void create_names( void ) // create all names for tasks and queues
253 void create_names( void ) // create all names for tasks and queues
252 {
254 {
253 /** This function creates all RTEMS names used in the software for tasks and queues.
255 /** This function creates all RTEMS names used in the software for tasks and queues.
254 *
256 *
255 * @return RTEMS directive status codes:
257 * @return RTEMS directive status codes:
256 * - RTEMS_SUCCESSFUL - successful completion
258 * - RTEMS_SUCCESSFUL - successful completion
257 *
259 *
258 */
260 */
259
261
260 // task names
262 // task names
261 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
263 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
262 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
264 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
263 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
265 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
264 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
266 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
265 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
267 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
266 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
268 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
267 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
269 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
268 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
270 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
269 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
271 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
270 Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' );
272 Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' );
271 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
273 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
272 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
274 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
273 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
275 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
274 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
276 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
275 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
277 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
276 Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' );
278 Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' );
277 Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' );
279 Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' );
278 Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' );
280 Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' );
279 Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' );
281 Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' );
280
282
281 // rate monotonic period names
283 // rate monotonic period names
282 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
284 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
283
285
284 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
286 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
285 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
287 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
286 misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' );
288 misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' );
287 misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' );
289 misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' );
288 misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' );
290 misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' );
289 }
291 }
290
292
291 int create_all_tasks( void ) // create all tasks which run in the software
293 int create_all_tasks( void ) // create all tasks which run in the software
292 {
294 {
293 /** This function creates all RTEMS tasks used in the software.
295 /** This function creates all RTEMS tasks used in the software.
294 *
296 *
295 * @return RTEMS directive status codes:
297 * @return RTEMS directive status codes:
296 * - RTEMS_SUCCESSFUL - task created successfully
298 * - RTEMS_SUCCESSFUL - task created successfully
297 * - RTEMS_INVALID_ADDRESS - id is NULL
299 * - RTEMS_INVALID_ADDRESS - id is NULL
298 * - RTEMS_INVALID_NAME - invalid task name
300 * - RTEMS_INVALID_NAME - invalid task name
299 * - RTEMS_INVALID_PRIORITY - invalid task priority
301 * - RTEMS_INVALID_PRIORITY - invalid task priority
300 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
302 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
301 * - RTEMS_TOO_MANY - too many tasks created
303 * - RTEMS_TOO_MANY - too many tasks created
302 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
304 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
303 * - RTEMS_TOO_MANY - too many global objects
305 * - RTEMS_TOO_MANY - too many global objects
304 *
306 *
305 */
307 */
306
308
307 rtems_status_code status;
309 rtems_status_code status;
308
310
309 //**********
311 //**********
310 // SPACEWIRE
312 // SPACEWIRE
311 // RECV
313 // RECV
312 status = rtems_task_create(
314 status = rtems_task_create(
313 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
315 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
314 RTEMS_DEFAULT_MODES,
316 RTEMS_DEFAULT_MODES,
315 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
317 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
316 );
318 );
317 if (status == RTEMS_SUCCESSFUL) // SEND
319 if (status == RTEMS_SUCCESSFUL) // SEND
318 {
320 {
319 status = rtems_task_create(
321 status = rtems_task_create(
320 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
322 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
321 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
323 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
322 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
324 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
323 );
325 );
324 }
326 }
325 if (status == RTEMS_SUCCESSFUL) // WTDG
327 if (status == RTEMS_SUCCESSFUL) // WTDG
326 {
328 {
327 status = rtems_task_create(
329 status = rtems_task_create(
328 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
330 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
329 RTEMS_DEFAULT_MODES,
331 RTEMS_DEFAULT_MODES,
330 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
332 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
331 );
333 );
332 }
334 }
333 if (status == RTEMS_SUCCESSFUL) // ACTN
335 if (status == RTEMS_SUCCESSFUL) // ACTN
334 {
336 {
335 status = rtems_task_create(
337 status = rtems_task_create(
336 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
338 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
337 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
339 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
338 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
340 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
339 );
341 );
340 }
342 }
341 if (status == RTEMS_SUCCESSFUL) // SPIQ
343 if (status == RTEMS_SUCCESSFUL) // SPIQ
342 {
344 {
343 status = rtems_task_create(
345 status = rtems_task_create(
344 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
346 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
345 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
347 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
346 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
348 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
347 );
349 );
348 }
350 }
349
351
350 //******************
352 //******************
351 // SPECTRAL MATRICES
353 // SPECTRAL MATRICES
352 if (status == RTEMS_SUCCESSFUL) // AVF0
354 if (status == RTEMS_SUCCESSFUL) // AVF0
353 {
355 {
354 status = rtems_task_create(
356 status = rtems_task_create(
355 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
357 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
356 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
358 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
357 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
359 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
358 );
360 );
359 }
361 }
360 if (status == RTEMS_SUCCESSFUL) // PRC0
362 if (status == RTEMS_SUCCESSFUL) // PRC0
361 {
363 {
362 status = rtems_task_create(
364 status = rtems_task_create(
363 Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2,
365 Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2,
364 RTEMS_DEFAULT_MODES,
366 RTEMS_DEFAULT_MODES,
365 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0]
367 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0]
366 );
368 );
367 }
369 }
368 if (status == RTEMS_SUCCESSFUL) // AVF1
370 if (status == RTEMS_SUCCESSFUL) // AVF1
369 {
371 {
370 status = rtems_task_create(
372 status = rtems_task_create(
371 Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE,
373 Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE,
372 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
374 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
373 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1]
375 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1]
374 );
376 );
375 }
377 }
376 if (status == RTEMS_SUCCESSFUL) // PRC1
378 if (status == RTEMS_SUCCESSFUL) // PRC1
377 {
379 {
378 status = rtems_task_create(
380 status = rtems_task_create(
379 Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * 2,
381 Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * 2,
380 RTEMS_DEFAULT_MODES,
382 RTEMS_DEFAULT_MODES,
381 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1]
383 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1]
382 );
384 );
383 }
385 }
384 if (status == RTEMS_SUCCESSFUL) // AVF2
386 if (status == RTEMS_SUCCESSFUL) // AVF2
385 {
387 {
386 status = rtems_task_create(
388 status = rtems_task_create(
387 Task_name[TASKID_AVF2], TASK_PRIORITY_AVF2, RTEMS_MINIMUM_STACK_SIZE,
389 Task_name[TASKID_AVF2], TASK_PRIORITY_AVF2, RTEMS_MINIMUM_STACK_SIZE,
388 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
390 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
389 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF2]
391 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF2]
390 );
392 );
391 }
393 }
392 if (status == RTEMS_SUCCESSFUL) // PRC2
394 if (status == RTEMS_SUCCESSFUL) // PRC2
393 {
395 {
394 status = rtems_task_create(
396 status = rtems_task_create(
395 Task_name[TASKID_PRC2], TASK_PRIORITY_PRC2, RTEMS_MINIMUM_STACK_SIZE * 2,
397 Task_name[TASKID_PRC2], TASK_PRIORITY_PRC2, RTEMS_MINIMUM_STACK_SIZE * 2,
396 RTEMS_DEFAULT_MODES,
398 RTEMS_DEFAULT_MODES,
397 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC2]
399 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC2]
398 );
400 );
399 }
401 }
400
402
401 //****************
403 //****************
402 // WAVEFORM PICKER
404 // WAVEFORM PICKER
403 if (status == RTEMS_SUCCESSFUL) // WFRM
405 if (status == RTEMS_SUCCESSFUL) // WFRM
404 {
406 {
405 status = rtems_task_create(
407 status = rtems_task_create(
406 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
408 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
407 RTEMS_DEFAULT_MODES,
409 RTEMS_DEFAULT_MODES,
408 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
410 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
409 );
411 );
410 }
412 }
411 if (status == RTEMS_SUCCESSFUL) // CWF3
413 if (status == RTEMS_SUCCESSFUL) // CWF3
412 {
414 {
413 status = rtems_task_create(
415 status = rtems_task_create(
414 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
416 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
415 RTEMS_DEFAULT_MODES,
417 RTEMS_DEFAULT_MODES,
416 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3]
418 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3]
417 );
419 );
418 }
420 }
419 if (status == RTEMS_SUCCESSFUL) // CWF2
421 if (status == RTEMS_SUCCESSFUL) // CWF2
420 {
422 {
421 status = rtems_task_create(
423 status = rtems_task_create(
422 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
424 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
423 RTEMS_DEFAULT_MODES,
425 RTEMS_DEFAULT_MODES,
424 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2]
426 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2]
425 );
427 );
426 }
428 }
427 if (status == RTEMS_SUCCESSFUL) // CWF1
429 if (status == RTEMS_SUCCESSFUL) // CWF1
428 {
430 {
429 status = rtems_task_create(
431 status = rtems_task_create(
430 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
432 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
431 RTEMS_DEFAULT_MODES,
433 RTEMS_DEFAULT_MODES,
432 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1]
434 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1]
433 );
435 );
434 }
436 }
435 if (status == RTEMS_SUCCESSFUL) // SWBD
437 if (status == RTEMS_SUCCESSFUL) // SWBD
436 {
438 {
437 status = rtems_task_create(
439 status = rtems_task_create(
438 Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE,
440 Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE,
439 RTEMS_DEFAULT_MODES,
441 RTEMS_DEFAULT_MODES,
440 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD]
442 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD]
441 );
443 );
442 }
444 }
443
445
444 //*****
446 //*****
445 // MISC
447 // MISC
446 if (status == RTEMS_SUCCESSFUL) // STAT
448 if (status == RTEMS_SUCCESSFUL) // STAT
447 {
449 {
448 status = rtems_task_create(
450 status = rtems_task_create(
449 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
451 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
450 RTEMS_DEFAULT_MODES,
452 RTEMS_DEFAULT_MODES,
451 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
453 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
452 );
454 );
453 }
455 }
454 if (status == RTEMS_SUCCESSFUL) // DUMB
456 if (status == RTEMS_SUCCESSFUL) // DUMB
455 {
457 {
456 status = rtems_task_create(
458 status = rtems_task_create(
457 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
459 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
458 RTEMS_DEFAULT_MODES,
460 RTEMS_DEFAULT_MODES,
459 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
461 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
460 );
462 );
461 }
463 }
462 if (status == RTEMS_SUCCESSFUL) // HOUS
464 if (status == RTEMS_SUCCESSFUL) // HOUS
463 {
465 {
464 status = rtems_task_create(
466 status = rtems_task_create(
465 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
467 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
466 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
468 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
467 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
469 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_HOUS]
468 );
470 );
469 }
471 }
470
472
471 return status;
473 return status;
472 }
474 }
473
475
474 int start_recv_send_tasks( void )
476 int start_recv_send_tasks( void )
475 {
477 {
476 rtems_status_code status;
478 rtems_status_code status;
477
479
478 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
480 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
479 if (status!=RTEMS_SUCCESSFUL) {
481 if (status!=RTEMS_SUCCESSFUL) {
480 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
482 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
481 }
483 }
482
484
483 if (status == RTEMS_SUCCESSFUL) // SEND
485 if (status == RTEMS_SUCCESSFUL) // SEND
484 {
486 {
485 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
487 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
486 if (status!=RTEMS_SUCCESSFUL) {
488 if (status!=RTEMS_SUCCESSFUL) {
487 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
489 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
488 }
490 }
489 }
491 }
490
492
491 return status;
493 return status;
492 }
494 }
493
495
494 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
496 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
495 {
497 {
496 /** This function starts all RTEMS tasks used in the software.
498 /** This function starts all RTEMS tasks used in the software.
497 *
499 *
498 * @return RTEMS directive status codes:
500 * @return RTEMS directive status codes:
499 * - RTEMS_SUCCESSFUL - ask started successfully
501 * - RTEMS_SUCCESSFUL - ask started successfully
500 * - RTEMS_INVALID_ADDRESS - invalid task entry point
502 * - RTEMS_INVALID_ADDRESS - invalid task entry point
501 * - RTEMS_INVALID_ID - invalid task id
503 * - RTEMS_INVALID_ID - invalid task id
502 * - RTEMS_INCORRECT_STATE - task not in the dormant state
504 * - RTEMS_INCORRECT_STATE - task not in the dormant state
503 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
505 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
504 *
506 *
505 */
507 */
506 // starts all the tasks fot eh flight software
508 // starts all the tasks fot eh flight software
507
509
508 rtems_status_code status;
510 rtems_status_code status;
509
511
510 //**********
512 //**********
511 // SPACEWIRE
513 // SPACEWIRE
512 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
514 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
513 if (status!=RTEMS_SUCCESSFUL) {
515 if (status!=RTEMS_SUCCESSFUL) {
514 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
516 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
515 }
517 }
516
518
517 if (status == RTEMS_SUCCESSFUL) // WTDG
519 if (status == RTEMS_SUCCESSFUL) // WTDG
518 {
520 {
519 status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 );
521 status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 );
520 if (status!=RTEMS_SUCCESSFUL) {
522 if (status!=RTEMS_SUCCESSFUL) {
521 BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n")
523 BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n")
522 }
524 }
523 }
525 }
524
526
525 if (status == RTEMS_SUCCESSFUL) // ACTN
527 if (status == RTEMS_SUCCESSFUL) // ACTN
526 {
528 {
527 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
529 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
528 if (status!=RTEMS_SUCCESSFUL) {
530 if (status!=RTEMS_SUCCESSFUL) {
529 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
531 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
530 }
532 }
531 }
533 }
532
534
533 //******************
535 //******************
534 // SPECTRAL MATRICES
536 // SPECTRAL MATRICES
535 if (status == RTEMS_SUCCESSFUL) // AVF0
537 if (status == RTEMS_SUCCESSFUL) // AVF0
536 {
538 {
537 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, LFR_MODE_STANDBY );
539 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, LFR_MODE_STANDBY );
538 if (status!=RTEMS_SUCCESSFUL) {
540 if (status!=RTEMS_SUCCESSFUL) {
539 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
541 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
540 }
542 }
541 }
543 }
542 if (status == RTEMS_SUCCESSFUL) // PRC0
544 if (status == RTEMS_SUCCESSFUL) // PRC0
543 {
545 {
544 status = rtems_task_start( Task_id[TASKID_PRC0], prc0_task, LFR_MODE_STANDBY );
546 status = rtems_task_start( Task_id[TASKID_PRC0], prc0_task, LFR_MODE_STANDBY );
545 if (status!=RTEMS_SUCCESSFUL) {
547 if (status!=RTEMS_SUCCESSFUL) {
546 BOOT_PRINTF("in INIT *** Error starting TASK_PRC0\n")
548 BOOT_PRINTF("in INIT *** Error starting TASK_PRC0\n")
547 }
549 }
548 }
550 }
549 if (status == RTEMS_SUCCESSFUL) // AVF1
551 if (status == RTEMS_SUCCESSFUL) // AVF1
550 {
552 {
551 status = rtems_task_start( Task_id[TASKID_AVF1], avf1_task, LFR_MODE_STANDBY );
553 status = rtems_task_start( Task_id[TASKID_AVF1], avf1_task, LFR_MODE_STANDBY );
552 if (status!=RTEMS_SUCCESSFUL) {
554 if (status!=RTEMS_SUCCESSFUL) {
553 BOOT_PRINTF("in INIT *** Error starting TASK_AVF1\n")
555 BOOT_PRINTF("in INIT *** Error starting TASK_AVF1\n")
554 }
556 }
555 }
557 }
556 if (status == RTEMS_SUCCESSFUL) // PRC1
558 if (status == RTEMS_SUCCESSFUL) // PRC1
557 {
559 {
558 status = rtems_task_start( Task_id[TASKID_PRC1], prc1_task, LFR_MODE_STANDBY );
560 status = rtems_task_start( Task_id[TASKID_PRC1], prc1_task, LFR_MODE_STANDBY );
559 if (status!=RTEMS_SUCCESSFUL) {
561 if (status!=RTEMS_SUCCESSFUL) {
560 BOOT_PRINTF("in INIT *** Error starting TASK_PRC1\n")
562 BOOT_PRINTF("in INIT *** Error starting TASK_PRC1\n")
561 }
563 }
562 }
564 }
563 if (status == RTEMS_SUCCESSFUL) // AVF2
565 if (status == RTEMS_SUCCESSFUL) // AVF2
564 {
566 {
565 status = rtems_task_start( Task_id[TASKID_AVF2], avf2_task, 1 );
567 status = rtems_task_start( Task_id[TASKID_AVF2], avf2_task, 1 );
566 if (status!=RTEMS_SUCCESSFUL) {
568 if (status!=RTEMS_SUCCESSFUL) {
567 BOOT_PRINTF("in INIT *** Error starting TASK_AVF2\n")
569 BOOT_PRINTF("in INIT *** Error starting TASK_AVF2\n")
568 }
570 }
569 }
571 }
570 if (status == RTEMS_SUCCESSFUL) // PRC2
572 if (status == RTEMS_SUCCESSFUL) // PRC2
571 {
573 {
572 status = rtems_task_start( Task_id[TASKID_PRC2], prc2_task, 1 );
574 status = rtems_task_start( Task_id[TASKID_PRC2], prc2_task, 1 );
573 if (status!=RTEMS_SUCCESSFUL) {
575 if (status!=RTEMS_SUCCESSFUL) {
574 BOOT_PRINTF("in INIT *** Error starting TASK_PRC2\n")
576 BOOT_PRINTF("in INIT *** Error starting TASK_PRC2\n")
575 }
577 }
576 }
578 }
577
579
578 //****************
580 //****************
579 // WAVEFORM PICKER
581 // WAVEFORM PICKER
580 if (status == RTEMS_SUCCESSFUL) // WFRM
582 if (status == RTEMS_SUCCESSFUL) // WFRM
581 {
583 {
582 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
584 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
583 if (status!=RTEMS_SUCCESSFUL) {
585 if (status!=RTEMS_SUCCESSFUL) {
584 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
586 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
585 }
587 }
586 }
588 }
587 if (status == RTEMS_SUCCESSFUL) // CWF3
589 if (status == RTEMS_SUCCESSFUL) // CWF3
588 {
590 {
589 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
591 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
590 if (status!=RTEMS_SUCCESSFUL) {
592 if (status!=RTEMS_SUCCESSFUL) {
591 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
593 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
592 }
594 }
593 }
595 }
594 if (status == RTEMS_SUCCESSFUL) // CWF2
596 if (status == RTEMS_SUCCESSFUL) // CWF2
595 {
597 {
596 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
598 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
597 if (status!=RTEMS_SUCCESSFUL) {
599 if (status!=RTEMS_SUCCESSFUL) {
598 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
600 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
599 }
601 }
600 }
602 }
601 if (status == RTEMS_SUCCESSFUL) // CWF1
603 if (status == RTEMS_SUCCESSFUL) // CWF1
602 {
604 {
603 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
605 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
604 if (status!=RTEMS_SUCCESSFUL) {
606 if (status!=RTEMS_SUCCESSFUL) {
605 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
607 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
606 }
608 }
607 }
609 }
608 if (status == RTEMS_SUCCESSFUL) // SWBD
610 if (status == RTEMS_SUCCESSFUL) // SWBD
609 {
611 {
610 status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 );
612 status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 );
611 if (status!=RTEMS_SUCCESSFUL) {
613 if (status!=RTEMS_SUCCESSFUL) {
612 BOOT_PRINTF("in INIT *** Error starting TASK_SWBD\n")
614 BOOT_PRINTF("in INIT *** Error starting TASK_SWBD\n")
613 }
615 }
614 }
616 }
615
617
616 //*****
618 //*****
617 // MISC
619 // MISC
618 if (status == RTEMS_SUCCESSFUL) // HOUS
620 if (status == RTEMS_SUCCESSFUL) // HOUS
619 {
621 {
620 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
622 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
621 if (status!=RTEMS_SUCCESSFUL) {
623 if (status!=RTEMS_SUCCESSFUL) {
622 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
624 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
623 }
625 }
624 }
626 }
625 if (status == RTEMS_SUCCESSFUL) // DUMB
627 if (status == RTEMS_SUCCESSFUL) // DUMB
626 {
628 {
627 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
629 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
628 if (status!=RTEMS_SUCCESSFUL) {
630 if (status!=RTEMS_SUCCESSFUL) {
629 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
631 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
630 }
632 }
631 }
633 }
632 if (status == RTEMS_SUCCESSFUL) // STAT
634 if (status == RTEMS_SUCCESSFUL) // STAT
633 {
635 {
634 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
636 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
635 if (status!=RTEMS_SUCCESSFUL) {
637 if (status!=RTEMS_SUCCESSFUL) {
636 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
638 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
637 }
639 }
638 }
640 }
639
641
640 return status;
642 return status;
641 }
643 }
642
644
643 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
645 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
644 {
646 {
645 rtems_status_code status_recv;
647 rtems_status_code status_recv;
646 rtems_status_code status_send;
648 rtems_status_code status_send;
647 rtems_status_code status_q_p0;
649 rtems_status_code status_q_p0;
648 rtems_status_code status_q_p1;
650 rtems_status_code status_q_p1;
649 rtems_status_code status_q_p2;
651 rtems_status_code status_q_p2;
650 rtems_status_code ret;
652 rtems_status_code ret;
651 rtems_id queue_id;
653 rtems_id queue_id;
652
654
653 //****************************************
655 //****************************************
654 // create the queue for handling valid TCs
656 // create the queue for handling valid TCs
655 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
657 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
656 MSG_QUEUE_COUNT_RECV, CCSDS_TC_PKT_MAX_SIZE,
658 MSG_QUEUE_COUNT_RECV, CCSDS_TC_PKT_MAX_SIZE,
657 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
659 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
658 if ( status_recv != RTEMS_SUCCESSFUL ) {
660 if ( status_recv != RTEMS_SUCCESSFUL ) {
659 PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv)
661 PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv)
660 }
662 }
661
663
662 //************************************************
664 //************************************************
663 // create the queue for handling TM packet sending
665 // create the queue for handling TM packet sending
664 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
666 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
665 MSG_QUEUE_COUNT_SEND, MSG_QUEUE_SIZE_SEND,
667 MSG_QUEUE_COUNT_SEND, MSG_QUEUE_SIZE_SEND,
666 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
668 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
667 if ( status_send != RTEMS_SUCCESSFUL ) {
669 if ( status_send != RTEMS_SUCCESSFUL ) {
668 PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send)
670 PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send)
669 }
671 }
670
672
671 //*****************************************************************************
673 //*****************************************************************************
672 // create the queue for handling averaged spectral matrices for processing @ f0
674 // create the queue for handling averaged spectral matrices for processing @ f0
673 status_q_p0 = rtems_message_queue_create( misc_name[QUEUE_PRC0],
675 status_q_p0 = rtems_message_queue_create( misc_name[QUEUE_PRC0],
674 MSG_QUEUE_COUNT_PRC0, MSG_QUEUE_SIZE_PRC0,
676 MSG_QUEUE_COUNT_PRC0, MSG_QUEUE_SIZE_PRC0,
675 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
677 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
676 if ( status_q_p0 != RTEMS_SUCCESSFUL ) {
678 if ( status_q_p0 != RTEMS_SUCCESSFUL ) {
677 PRINTF1("in create_message_queues *** ERR creating Q_P0 queue, %d\n", status_q_p0)
679 PRINTF1("in create_message_queues *** ERR creating Q_P0 queue, %d\n", status_q_p0)
678 }
680 }
679
681
680 //*****************************************************************************
682 //*****************************************************************************
681 // create the queue for handling averaged spectral matrices for processing @ f1
683 // create the queue for handling averaged spectral matrices for processing @ f1
682 status_q_p1 = rtems_message_queue_create( misc_name[QUEUE_PRC1],
684 status_q_p1 = rtems_message_queue_create( misc_name[QUEUE_PRC1],
683 MSG_QUEUE_COUNT_PRC1, MSG_QUEUE_SIZE_PRC1,
685 MSG_QUEUE_COUNT_PRC1, MSG_QUEUE_SIZE_PRC1,
684 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
686 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
685 if ( status_q_p1 != RTEMS_SUCCESSFUL ) {
687 if ( status_q_p1 != RTEMS_SUCCESSFUL ) {
686 PRINTF1("in create_message_queues *** ERR creating Q_P1 queue, %d\n", status_q_p1)
688 PRINTF1("in create_message_queues *** ERR creating Q_P1 queue, %d\n", status_q_p1)
687 }
689 }
688
690
689 //*****************************************************************************
691 //*****************************************************************************
690 // create the queue for handling averaged spectral matrices for processing @ f2
692 // create the queue for handling averaged spectral matrices for processing @ f2
691 status_q_p2 = rtems_message_queue_create( misc_name[QUEUE_PRC2],
693 status_q_p2 = rtems_message_queue_create( misc_name[QUEUE_PRC2],
692 MSG_QUEUE_COUNT_PRC2, MSG_QUEUE_SIZE_PRC2,
694 MSG_QUEUE_COUNT_PRC2, MSG_QUEUE_SIZE_PRC2,
693 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
695 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
694 if ( status_q_p2 != RTEMS_SUCCESSFUL ) {
696 if ( status_q_p2 != RTEMS_SUCCESSFUL ) {
695 PRINTF1("in create_message_queues *** ERR creating Q_P2 queue, %d\n", status_q_p2)
697 PRINTF1("in create_message_queues *** ERR creating Q_P2 queue, %d\n", status_q_p2)
696 }
698 }
697
699
698 if ( status_recv != RTEMS_SUCCESSFUL )
700 if ( status_recv != RTEMS_SUCCESSFUL )
699 {
701 {
700 ret = status_recv;
702 ret = status_recv;
701 }
703 }
702 else if( status_send != RTEMS_SUCCESSFUL )
704 else if( status_send != RTEMS_SUCCESSFUL )
703 {
705 {
704 ret = status_send;
706 ret = status_send;
705 }
707 }
706 else if( status_q_p0 != RTEMS_SUCCESSFUL )
708 else if( status_q_p0 != RTEMS_SUCCESSFUL )
707 {
709 {
708 ret = status_q_p0;
710 ret = status_q_p0;
709 }
711 }
710 else if( status_q_p1 != RTEMS_SUCCESSFUL )
712 else if( status_q_p1 != RTEMS_SUCCESSFUL )
711 {
713 {
712 ret = status_q_p1;
714 ret = status_q_p1;
713 }
715 }
714 else
716 else
715 {
717 {
716 ret = status_q_p2;
718 ret = status_q_p2;
717 }
719 }
718
720
719 return ret;
721 return ret;
720 }
722 }
721
723
722 rtems_status_code get_message_queue_id_send( rtems_id *queue_id )
724 rtems_status_code get_message_queue_id_send( rtems_id *queue_id )
723 {
725 {
724 rtems_status_code status;
726 rtems_status_code status;
725 rtems_name queue_name;
727 rtems_name queue_name;
726
728
727 queue_name = rtems_build_name( 'Q', '_', 'S', 'D' );
729 queue_name = rtems_build_name( 'Q', '_', 'S', 'D' );
728
730
729 status = rtems_message_queue_ident( queue_name, 0, queue_id );
731 status = rtems_message_queue_ident( queue_name, 0, queue_id );
730
732
731 return status;
733 return status;
732 }
734 }
733
735
734 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id )
736 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id )
735 {
737 {
736 rtems_status_code status;
738 rtems_status_code status;
737 rtems_name queue_name;
739 rtems_name queue_name;
738
740
739 queue_name = rtems_build_name( 'Q', '_', 'R', 'V' );
741 queue_name = rtems_build_name( 'Q', '_', 'R', 'V' );
740
742
741 status = rtems_message_queue_ident( queue_name, 0, queue_id );
743 status = rtems_message_queue_ident( queue_name, 0, queue_id );
742
744
743 return status;
745 return status;
744 }
746 }
745
747
746 rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id )
748 rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id )
747 {
749 {
748 rtems_status_code status;
750 rtems_status_code status;
749 rtems_name queue_name;
751 rtems_name queue_name;
750
752
751 queue_name = rtems_build_name( 'Q', '_', 'P', '0' );
753 queue_name = rtems_build_name( 'Q', '_', 'P', '0' );
752
754
753 status = rtems_message_queue_ident( queue_name, 0, queue_id );
755 status = rtems_message_queue_ident( queue_name, 0, queue_id );
754
756
755 return status;
757 return status;
756 }
758 }
757
759
758 rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id )
760 rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id )
759 {
761 {
760 rtems_status_code status;
762 rtems_status_code status;
761 rtems_name queue_name;
763 rtems_name queue_name;
762
764
763 queue_name = rtems_build_name( 'Q', '_', 'P', '1' );
765 queue_name = rtems_build_name( 'Q', '_', 'P', '1' );
764
766
765 status = rtems_message_queue_ident( queue_name, 0, queue_id );
767 status = rtems_message_queue_ident( queue_name, 0, queue_id );
766
768
767 return status;
769 return status;
768 }
770 }
769
771
770 rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id )
772 rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id )
771 {
773 {
772 rtems_status_code status;
774 rtems_status_code status;
773 rtems_name queue_name;
775 rtems_name queue_name;
774
776
775 queue_name = rtems_build_name( 'Q', '_', 'P', '2' );
777 queue_name = rtems_build_name( 'Q', '_', 'P', '2' );
776
778
777 status = rtems_message_queue_ident( queue_name, 0, queue_id );
779 status = rtems_message_queue_ident( queue_name, 0, queue_id );
778
780
779 return status;
781 return status;
780 }
782 }
@@ -1,530 +1,635
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_status_code spare_status;
145 rtems_status_code spare_status;
146 rtems_id queue_id;
146 rtems_id queue_id;
147 rtems_rate_monotonic_period_status period_status;
147 rtems_rate_monotonic_period_status period_status;
148
148
149 status = get_message_queue_id_send( &queue_id );
149 status = get_message_queue_id_send( &queue_id );
150 if (status != RTEMS_SUCCESSFUL)
150 if (status != RTEMS_SUCCESSFUL)
151 {
151 {
152 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
152 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
153 }
153 }
154
154
155 BOOT_PRINTF("in HOUS ***\n")
155 BOOT_PRINTF("in HOUS ***\n")
156
156
157 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
157 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
158 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
158 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
159 if( status != RTEMS_SUCCESSFUL ) {
159 if( status != RTEMS_SUCCESSFUL ) {
160 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
160 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
161 }
161 }
162 }
162 }
163
163
164 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
164 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
165 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
165 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
166 housekeeping_packet.reserved = DEFAULT_RESERVED;
166 housekeeping_packet.reserved = DEFAULT_RESERVED;
167 housekeeping_packet.userApplication = CCSDS_USER_APP;
167 housekeeping_packet.userApplication = CCSDS_USER_APP;
168 housekeeping_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8);
168 housekeeping_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8);
169 housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK);
169 housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK);
170 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
170 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
171 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
171 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
172 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
172 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
173 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
173 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
174 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
174 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
175 housekeeping_packet.serviceType = TM_TYPE_HK;
175 housekeeping_packet.serviceType = TM_TYPE_HK;
176 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
176 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
177 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
177 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
178 housekeeping_packet.sid = SID_HK;
178 housekeeping_packet.sid = SID_HK;
179
179
180 status = rtems_rate_monotonic_cancel(HK_id);
180 status = rtems_rate_monotonic_cancel(HK_id);
181 if( status != RTEMS_SUCCESSFUL ) {
181 if( status != RTEMS_SUCCESSFUL ) {
182 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
182 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
183 }
183 }
184 else {
184 else {
185 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
185 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
186 }
186 }
187
187
188 // startup phase
188 // startup phase
189 status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks );
189 status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks );
190 status = rtems_rate_monotonic_get_status( HK_id, &period_status );
190 status = rtems_rate_monotonic_get_status( HK_id, &period_status );
191 DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state)
191 DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state)
192 while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway
192 while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway
193 {
193 {
194 if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization
194 if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization
195 {
195 {
196 break; // break if LFR is synchronized
196 break; // break if LFR is synchronized
197 }
197 }
198 else
198 else
199 {
199 {
200 status = rtems_rate_monotonic_get_status( HK_id, &period_status );
200 status = rtems_rate_monotonic_get_status( HK_id, &period_status );
201 // sched_yield();
201 // sched_yield();
202 status = rtems_task_wake_after( 10 ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 100 ms = 10 * 10 ms
202 status = rtems_task_wake_after( 10 ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 100 ms = 10 * 10 ms
203 }
203 }
204 }
204 }
205 status = rtems_rate_monotonic_cancel(HK_id);
205 status = rtems_rate_monotonic_cancel(HK_id);
206 DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state)
206 DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state)
207
207
208 while(1){ // launch the rate monotonic task
208 while(1){ // launch the rate monotonic task
209 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
209 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
210 if ( status != RTEMS_SUCCESSFUL ) {
210 if ( status != RTEMS_SUCCESSFUL ) {
211 PRINTF1( "in HOUS *** ERR period: %d\n", status);
211 PRINTF1( "in HOUS *** ERR period: %d\n", status);
212 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
212 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
213 }
213 }
214 else {
214 else {
215 housekeeping_packet.packetSequenceControl[0] = (unsigned char) (sequenceCounterHK >> 8);
215 housekeeping_packet.packetSequenceControl[0] = (unsigned char) (sequenceCounterHK >> 8);
216 housekeeping_packet.packetSequenceControl[1] = (unsigned char) (sequenceCounterHK );
216 housekeeping_packet.packetSequenceControl[1] = (unsigned char) (sequenceCounterHK );
217 increment_seq_counter( &sequenceCounterHK );
217 increment_seq_counter( &sequenceCounterHK );
218
218
219 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
219 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
220 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
220 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
221 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
221 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
222 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
222 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
223 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
223 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
224 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
224 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
225
225
226 spacewire_update_statistics();
226 spacewire_update_statistics();
227
227
228 get_v_e1_e2_f3( housekeeping_packet.hk_lfr_sc_v_f3 );
228 // get_v_e1_e2_f3_alt( housekeeping_packet.hk_lfr_sc_v_f3 );
229 get_cpu_load( (unsigned char *) &housekeeping_packet.hk_lfr_cpu_load );
229 get_cpu_load( (unsigned char *) &housekeeping_packet.hk_lfr_cpu_load );
230
230
231 // SEND PACKET
231 // SEND PACKET
232 status = rtems_message_queue_urgent( queue_id, &housekeeping_packet,
232 status = rtems_message_queue_urgent( queue_id, &housekeeping_packet,
233 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
233 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
234 if (status != RTEMS_SUCCESSFUL) {
234 if (status != RTEMS_SUCCESSFUL) {
235 PRINTF1("in HOUS *** ERR send: %d\n", status)
235 PRINTF1("in HOUS *** ERR send: %d\n", status)
236 }
236 }
237 }
237 }
238 }
238 }
239
239
240 PRINTF("in HOUS *** deleting task\n")
240 PRINTF("in HOUS *** deleting task\n")
241
241
242 status = rtems_task_delete( RTEMS_SELF ); // should not return
242 status = rtems_task_delete( RTEMS_SELF ); // should not return
243 printf( "rtems_task_delete returned with status of %d.\n", status );
243 printf( "rtems_task_delete returned with status of %d.\n", status );
244 return;
244 return;
245 }
245 }
246
246
247 rtems_task dumb_task( rtems_task_argument unused )
247 rtems_task dumb_task( rtems_task_argument unused )
248 {
248 {
249 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
249 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
250 *
250 *
251 * @param unused is the starting argument of the RTEMS task
251 * @param unused is the starting argument of the RTEMS task
252 *
252 *
253 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
253 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
254 *
254 *
255 */
255 */
256
256
257 unsigned int i;
257 unsigned int i;
258 unsigned int intEventOut;
258 unsigned int intEventOut;
259 unsigned int coarse_time = 0;
259 unsigned int coarse_time = 0;
260 unsigned int fine_time = 0;
260 unsigned int fine_time = 0;
261 rtems_event_set event_out;
261 rtems_event_set event_out;
262
262
263 char *DumbMessages[12] = {"in DUMB *** default", // RTEMS_EVENT_0
263 char *DumbMessages[12] = {"in DUMB *** default", // RTEMS_EVENT_0
264 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
264 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
265 "in DUMB *** f3 buffer changed", // RTEMS_EVENT_2
265 "in DUMB *** f3 buffer changed", // RTEMS_EVENT_2
266 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
266 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
267 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
267 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
268 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
268 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
269 "ERR HK", // RTEMS_EVENT_6
269 "ERR HK", // RTEMS_EVENT_6
270 "ready for dump", // RTEMS_EVENT_7
270 "ready for dump", // RTEMS_EVENT_7
271 "VHDL ERR *** spectral matrix", // RTEMS_EVENT_8
271 "VHDL ERR *** spectral matrix", // RTEMS_EVENT_8
272 "tick", // RTEMS_EVENT_9
272 "tick", // RTEMS_EVENT_9
273 "VHDL ERR *** waveform picker", // RTEMS_EVENT_10
273 "VHDL ERR *** waveform picker", // RTEMS_EVENT_10
274 "VHDL ERR *** unexpected ready matrix values" // RTEMS_EVENT_11
274 "VHDL ERR *** unexpected ready matrix values" // RTEMS_EVENT_11
275 };
275 };
276
276
277 BOOT_PRINTF("in DUMB *** \n")
277 BOOT_PRINTF("in DUMB *** \n")
278
278
279 while(1){
279 while(1){
280 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
280 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
281 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7
281 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7
282 | RTEMS_EVENT_8 | RTEMS_EVENT_9,
282 | RTEMS_EVENT_8 | RTEMS_EVENT_9,
283 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
283 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
284 intEventOut = (unsigned int) event_out;
284 intEventOut = (unsigned int) event_out;
285 for ( i=0; i<32; i++)
285 for ( i=0; i<32; i++)
286 {
286 {
287 if ( ((intEventOut >> i) & 0x0001) != 0)
287 if ( ((intEventOut >> i) & 0x0001) != 0)
288 {
288 {
289 coarse_time = time_management_regs->coarse_time;
289 coarse_time = time_management_regs->coarse_time;
290 fine_time = time_management_regs->fine_time;
290 fine_time = time_management_regs->fine_time;
291 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
291 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
292 if (i==8)
292 if (i==8)
293 {
293 {
294 }
294 }
295 if (i==10)
295 if (i==10)
296 {
296 {
297 }
297 }
298 }
298 }
299 }
299 }
300 }
300 }
301 }
301 }
302
302
303 //*****************************
303 //*****************************
304 // init housekeeping parameters
304 // init housekeeping parameters
305
305
306 void init_housekeeping_parameters( void )
306 void init_housekeeping_parameters( void )
307 {
307 {
308 /** This function initialize the housekeeping_packet global variable with default values.
308 /** This function initialize the housekeeping_packet global variable with default values.
309 *
309 *
310 */
310 */
311
311
312 unsigned int i = 0;
312 unsigned int i = 0;
313 unsigned char *parameters;
313 unsigned char *parameters;
314
314
315 parameters = (unsigned char*) &housekeeping_packet.lfr_status_word;
315 parameters = (unsigned char*) &housekeeping_packet.lfr_status_word;
316 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
316 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
317 {
317 {
318 parameters[i] = 0x00;
318 parameters[i] = 0x00;
319 }
319 }
320 // init status word
320 // init status word
321 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
321 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
322 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
322 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
323 // init software version
323 // init software version
324 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
324 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
325 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
325 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
326 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
326 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
327 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
327 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
328 // init fpga version
328 // init fpga version
329 parameters = (unsigned char *) (REGS_ADDR_VHDL_VERSION);
329 parameters = (unsigned char *) (REGS_ADDR_VHDL_VERSION);
330 housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1
330 housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1
331 housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2
331 housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2
332 housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3
332 housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3
333 }
333 }
334
334
335 void increment_seq_counter( unsigned short *packetSequenceControl )
335 void increment_seq_counter( unsigned short *packetSequenceControl )
336 {
336 {
337 /** This function increment the sequence counter psased in argument.
337 /** This function increment the sequence counter psased in argument.
338 *
338 *
339 * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0.
339 * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0.
340 *
340 *
341 */
341 */
342
342
343 unsigned short segmentation_grouping_flag;
343 unsigned short segmentation_grouping_flag;
344 unsigned short sequence_cnt;
344 unsigned short sequence_cnt;
345
345
346 segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; // keep bits 7 downto 6
346 segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; // keep bits 7 downto 6
347 sequence_cnt = (*packetSequenceControl) & 0x3fff; // [0011 1111 1111 1111]
347 sequence_cnt = (*packetSequenceControl) & 0x3fff; // [0011 1111 1111 1111]
348
348
349 if ( sequence_cnt < SEQ_CNT_MAX)
349 if ( sequence_cnt < SEQ_CNT_MAX)
350 {
350 {
351 sequence_cnt = sequence_cnt + 1;
351 sequence_cnt = sequence_cnt + 1;
352 }
352 }
353 else
353 else
354 {
354 {
355 sequence_cnt = 0;
355 sequence_cnt = 0;
356 }
356 }
357
357
358 *packetSequenceControl = segmentation_grouping_flag | sequence_cnt ;
358 *packetSequenceControl = segmentation_grouping_flag | sequence_cnt ;
359 }
359 }
360
360
361 void getTime( unsigned char *time)
361 void getTime( unsigned char *time)
362 {
362 {
363 /** This function write the current local time in the time buffer passed in argument.
363 /** This function write the current local time in the time buffer passed in argument.
364 *
364 *
365 */
365 */
366
366
367 time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
367 time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
368 time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
368 time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
369 time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
369 time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
370 time[3] = (unsigned char) (time_management_regs->coarse_time);
370 time[3] = (unsigned char) (time_management_regs->coarse_time);
371 time[4] = (unsigned char) (time_management_regs->fine_time>>8);
371 time[4] = (unsigned char) (time_management_regs->fine_time>>8);
372 time[5] = (unsigned char) (time_management_regs->fine_time);
372 time[5] = (unsigned char) (time_management_regs->fine_time);
373 }
373 }
374
374
375 unsigned long long int getTimeAsUnsignedLongLongInt( )
375 unsigned long long int getTimeAsUnsignedLongLongInt( )
376 {
376 {
377 /** This function write the current local time in the time buffer passed in argument.
377 /** This function write the current local time in the time buffer passed in argument.
378 *
378 *
379 */
379 */
380 unsigned long long int time;
380 unsigned long long int time;
381
381
382 time = ( (unsigned long long int) (time_management_regs->coarse_time & 0x7fffffff) << 16 )
382 time = ( (unsigned long long int) (time_management_regs->coarse_time & 0x7fffffff) << 16 )
383 + time_management_regs->fine_time;
383 + time_management_regs->fine_time;
384
384
385 return time;
385 return time;
386 }
386 }
387
387
388 void send_dumb_hk( void )
388 void send_dumb_hk( void )
389 {
389 {
390 Packet_TM_LFR_HK_t dummy_hk_packet;
390 Packet_TM_LFR_HK_t dummy_hk_packet;
391 unsigned char *parameters;
391 unsigned char *parameters;
392 unsigned int i;
392 unsigned int i;
393 rtems_id queue_id;
393 rtems_id queue_id;
394
394
395 dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
395 dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
396 dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
396 dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
397 dummy_hk_packet.reserved = DEFAULT_RESERVED;
397 dummy_hk_packet.reserved = DEFAULT_RESERVED;
398 dummy_hk_packet.userApplication = CCSDS_USER_APP;
398 dummy_hk_packet.userApplication = CCSDS_USER_APP;
399 dummy_hk_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8);
399 dummy_hk_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8);
400 dummy_hk_packet.packetID[1] = (unsigned char) (APID_TM_HK);
400 dummy_hk_packet.packetID[1] = (unsigned char) (APID_TM_HK);
401 dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
401 dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
402 dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
402 dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
403 dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
403 dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
404 dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
404 dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
405 dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
405 dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
406 dummy_hk_packet.serviceType = TM_TYPE_HK;
406 dummy_hk_packet.serviceType = TM_TYPE_HK;
407 dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK;
407 dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK;
408 dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND;
408 dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND;
409 dummy_hk_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
409 dummy_hk_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
410 dummy_hk_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
410 dummy_hk_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
411 dummy_hk_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
411 dummy_hk_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
412 dummy_hk_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
412 dummy_hk_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
413 dummy_hk_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
413 dummy_hk_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
414 dummy_hk_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
414 dummy_hk_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
415 dummy_hk_packet.sid = SID_HK;
415 dummy_hk_packet.sid = SID_HK;
416
416
417 // init status word
417 // init status word
418 dummy_hk_packet.lfr_status_word[0] = 0xff;
418 dummy_hk_packet.lfr_status_word[0] = 0xff;
419 dummy_hk_packet.lfr_status_word[1] = 0xff;
419 dummy_hk_packet.lfr_status_word[1] = 0xff;
420 // init software version
420 // init software version
421 dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1;
421 dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1;
422 dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2;
422 dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2;
423 dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3;
423 dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3;
424 dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4;
424 dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4;
425 // init fpga version
425 // init fpga version
426 parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0);
426 parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0);
427 dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1
427 dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1
428 dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2
428 dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2
429 dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3
429 dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3
430
430
431 parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load;
431 parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load;
432
432
433 for (i=0; i<100; i++)
433 for (i=0; i<100; i++)
434 {
434 {
435 parameters[i] = 0xff;
435 parameters[i] = 0xff;
436 }
436 }
437
437
438 get_message_queue_id_send( &queue_id );
438 get_message_queue_id_send( &queue_id );
439
439
440 rtems_message_queue_urgent( queue_id, &dummy_hk_packet,
440 rtems_message_queue_urgent( queue_id, &dummy_hk_packet,
441 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
441 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
442 }
442 }
443
443
444 void get_v_e1_e2_f3( unsigned char *spacecraft_potential )
444 void get_v_e1_e2_f3( unsigned char *spacecraft_potential )
445 {
445 {
446 unsigned int coarseTime;
446 unsigned int coarseTime;
447 unsigned int acquisitionTime;
447 unsigned int acquisitionTime;
448 unsigned int deltaT = 0;
448 unsigned int deltaT = 0;
449 unsigned char *bufferPtr;
449 unsigned char *bufferPtr;
450
450
451 unsigned int offset_in_samples;
451 unsigned int offset_in_samples;
452 unsigned int offset_in_bytes;
452 unsigned int offset_in_bytes;
453 unsigned char f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz
453 unsigned char f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz
454
454
455 bufferPtr = NULL;
455 bufferPtr = NULL;
456
456
457 if (lfrCurrentMode == LFR_MODE_STANDBY)
457 if (lfrCurrentMode == LFR_MODE_STANDBY)
458 {
458 {
459 spacecraft_potential[0] = 0x00;
459 spacecraft_potential[0] = 0x00;
460 spacecraft_potential[1] = 0x00;
460 spacecraft_potential[1] = 0x00;
461 spacecraft_potential[2] = 0x00;
461 spacecraft_potential[2] = 0x00;
462 spacecraft_potential[3] = 0x00;
462 spacecraft_potential[3] = 0x00;
463 spacecraft_potential[4] = 0x00;
463 spacecraft_potential[4] = 0x00;
464 spacecraft_potential[5] = 0x00;
464 spacecraft_potential[5] = 0x00;
465 }
465 }
466 else
466 else
467 {
467 {
468 coarseTime = time_management_regs->coarse_time & 0x7fffffff;
468 coarseTime = time_management_regs->coarse_time & 0x7fffffff;
469 bufferPtr = (unsigned char*) current_ring_node_f3->buffer_address;
469 bufferPtr = (unsigned char*) current_ring_node_f3->buffer_address;
470 acquisitionTime = (unsigned int) ( ( bufferPtr[0] & 0x7f ) << 24 )
470 acquisitionTime = (unsigned int) ( ( bufferPtr[0] & 0x7f ) << 24 )
471 + (unsigned int) ( bufferPtr[1] << 16 )
471 + (unsigned int) ( bufferPtr[1] << 16 )
472 + (unsigned int) ( bufferPtr[2] << 8 )
472 + (unsigned int) ( bufferPtr[2] << 8 )
473 + (unsigned int) ( bufferPtr[3] );
473 + (unsigned int) ( bufferPtr[3] );
474 if ( coarseTime > acquisitionTime )
474 if ( coarseTime > acquisitionTime )
475 {
475 {
476 deltaT = coarseTime - acquisitionTime;
476 deltaT = coarseTime - acquisitionTime;
477 offset_in_samples = (deltaT-1) * f3 ;
477 offset_in_samples = (deltaT-1) * f3 ;
478 }
478 }
479 else if( coarseTime == acquisitionTime )
479 else if( coarseTime == acquisitionTime )
480 {
480 {
481 bufferPtr = (unsigned char*) current_ring_node_f3->previous->buffer_address; // pick up v e1 and e2 in the previous f3 buffer
481 bufferPtr = (unsigned char*) current_ring_node_f3->previous->buffer_address; // pick up v e1 and e2 in the previous f3 buffer
482 offset_in_samples = NB_SAMPLES_PER_SNAPSHOT-1;
482 offset_in_samples = NB_SAMPLES_PER_SNAPSHOT-1;
483 }
483 }
484 else
484 else
485 {
485 {
486 offset_in_samples = 0;
486 offset_in_samples = 0;
487 PRINTF2("ERR *** in get_v_e1_e2_f3 *** coarseTime = %x, acquisitionTime = %x\n", coarseTime, acquisitionTime)
487 // PRINTF2("ERR *** in get_v_e1_e2_f3 *** coarseTime = %x, acquisitionTime = %x\n", coarseTime, acquisitionTime)
488 }
488 }
489
489
490 if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) )
490 if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) )
491 {
491 {
492 PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out of the buffer, counter = %d\n", offset_in_samples)
492 // PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out of the buffer, counter = %d\n", offset_in_samples)
493 offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1;
493 offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1;
494 }
494 }
495 offset_in_bytes = TIME_OFFSET_IN_BYTES + offset_in_samples * NB_WORDS_SWF_BLK * 4;
495 offset_in_bytes = TIME_OFFSET_IN_BYTES + offset_in_samples * NB_WORDS_SWF_BLK * 4;
496 spacecraft_potential[0] = bufferPtr[ offset_in_bytes + 0];
496 spacecraft_potential[0] = bufferPtr[ offset_in_bytes + 0];
497 spacecraft_potential[1] = bufferPtr[ offset_in_bytes + 1];
497 spacecraft_potential[1] = bufferPtr[ offset_in_bytes + 1];
498 spacecraft_potential[2] = bufferPtr[ offset_in_bytes + 2];
498 spacecraft_potential[2] = bufferPtr[ offset_in_bytes + 2];
499 spacecraft_potential[3] = bufferPtr[ offset_in_bytes + 3];
499 spacecraft_potential[3] = bufferPtr[ offset_in_bytes + 3];
500 spacecraft_potential[4] = bufferPtr[ offset_in_bytes + 4];
500 spacecraft_potential[4] = bufferPtr[ offset_in_bytes + 4];
501 spacecraft_potential[5] = bufferPtr[ offset_in_bytes + 5];
501 spacecraft_potential[5] = bufferPtr[ offset_in_bytes + 5];
502 }
502 }
503 }
503 }
504
504
505 void get_v_e1_e2_f3_alt( unsigned char *spacecraft_potential )
506 {
507 unsigned long long int localTime_asLong;
508 unsigned long long int f3_0_AcquisitionTime_asLong;
509 unsigned long long int f3_1_AcquisitionTime_asLong;
510 unsigned long long int deltaT;
511 unsigned long long int deltaT_f3_0;
512 unsigned long long int deltaT_f3_1;
513 unsigned char *bufferPtr;
514
515 unsigned int offset_in_samples;
516 unsigned int offset_in_bytes;
517 unsigned char f3;
518
519 bufferPtr = NULL;
520 deltaT = 0;
521 deltaT_f3_0 = 0xffffffff;
522 deltaT_f3_1 = 0xffffffff;
523 f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz
524
525 if (lfrCurrentMode == LFR_MODE_STANDBY)
526 {
527 spacecraft_potential[0] = 0x00;
528 spacecraft_potential[1] = 0x00;
529 spacecraft_potential[2] = 0x00;
530 spacecraft_potential[3] = 0x00;
531 spacecraft_potential[4] = 0x00;
532 spacecraft_potential[5] = 0x00;
533 }
534 else
535 {
536 localTime_asLong = get_acquisition_time( (unsigned char *) &time_management_regs->coarse_time );
537 f3_0_AcquisitionTime_asLong = get_acquisition_time( (unsigned char *) &waveform_picker_regs->f3_0_coarse_time );
538 f3_1_AcquisitionTime_asLong = get_acquisition_time( (unsigned char *) &waveform_picker_regs->f3_1_coarse_time );
539 printf("localTime 0x%llx, f3_0 0x%llx, f3_1 0x%llx\n",
540 localTime_asLong,
541 f3_0_AcquisitionTime_asLong,
542 f3_1_AcquisitionTime_asLong);
543
544 if ( localTime_asLong >= f3_0_AcquisitionTime_asLong )
545 {
546 deltaT_f3_0 = localTime_asLong - f3_0_AcquisitionTime_asLong;
547 }
548
549 if ( localTime_asLong > f3_1_AcquisitionTime_asLong )
550 {
551 deltaT_f3_1 = localTime_asLong - f3_1_AcquisitionTime_asLong;
552 }
553
554 if ( (deltaT_f3_0 != 0xffffffff) && (deltaT_f3_1 != 0xffffffff) )
555 {
556 if ( deltaT_f3_0 > deltaT_f3_1 )
557 {
558 deltaT = deltaT_f3_1;
559 bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3_1;
560 }
561 else
562 {
563 deltaT = deltaT_f3_0;
564 bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3_0;
565 }
566 }
567 else if ( (deltaT_f3_0 == 0xffffffff) && (deltaT_f3_1 != 0xffffffff) )
568 {
569 deltaT = deltaT_f3_1;
570 bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3_1;
571 }
572 else if ( (deltaT_f3_0 != 0xffffffff) && (deltaT_f3_1 == 0xffffffff) )
573 {
574 deltaT = deltaT_f3_0;
575 bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3_1;
576 }
577 else
578 {
579 deltaT = 0xffffffff;
580 }
581
582 if ( deltaT == 0xffffffff )
583 {
584 spacecraft_potential[0] = 0x00;
585 spacecraft_potential[1] = 0x00;
586 spacecraft_potential[2] = 0x00;
587 spacecraft_potential[3] = 0x00;
588 spacecraft_potential[4] = 0x00;
589 spacecraft_potential[5] = 0x00;
590 }
591 else
592 {
593 offset_in_samples = ( (double) deltaT ) / 65536. * f3;
594 if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) )
595 {
596 PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out of the buffer, counter = %d\n", offset_in_samples)
597 offset_in_samples = NB_SAMPLES_PER_SNAPSHOT - 1;
598 }
599 offset_in_bytes = offset_in_samples * NB_WORDS_SWF_BLK * 4;
600 spacecraft_potential[0] = bufferPtr[ offset_in_bytes + 0];
601 spacecraft_potential[1] = bufferPtr[ offset_in_bytes + 1];
602 spacecraft_potential[2] = bufferPtr[ offset_in_bytes + 2];
603 spacecraft_potential[3] = bufferPtr[ offset_in_bytes + 3];
604 spacecraft_potential[4] = bufferPtr[ offset_in_bytes + 4];
605 spacecraft_potential[5] = bufferPtr[ offset_in_bytes + 5];
606 }
607 }
608 }
609
505 void get_cpu_load( unsigned char *resource_statistics )
610 void get_cpu_load( unsigned char *resource_statistics )
506 {
611 {
507 unsigned char cpu_load;
612 unsigned char cpu_load;
508
613
509 cpu_load = lfr_rtems_cpu_usage_report();
614 cpu_load = lfr_rtems_cpu_usage_report();
510
615
511 // HK_LFR_CPU_LOAD
616 // HK_LFR_CPU_LOAD
512 resource_statistics[0] = cpu_load;
617 resource_statistics[0] = cpu_load;
513
618
514 // HK_LFR_CPU_LOAD_MAX
619 // HK_LFR_CPU_LOAD_MAX
515 if (cpu_load > resource_statistics[1])
620 if (cpu_load > resource_statistics[1])
516 {
621 {
517 resource_statistics[1] = cpu_load;
622 resource_statistics[1] = cpu_load;
518 }
623 }
519
624
520 // CPU_LOAD_AVE
625 // CPU_LOAD_AVE
521 resource_statistics[2] = 0;
626 resource_statistics[2] = 0;
522
627
523 #ifndef PRINT_TASK_STATISTICS
628 #ifndef PRINT_TASK_STATISTICS
524 rtems_cpu_usage_reset();
629 rtems_cpu_usage_reset();
525 #endif
630 #endif
526
631
527 }
632 }
528
633
529
634
530
635
@@ -1,624 +1,624
1 /** Functions related to the SpaceWire interface.
1 /** Functions related to the SpaceWire interface.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to handle SpaceWire transmissions:
6 * A group of functions to handle SpaceWire transmissions:
7 * - configuration of the SpaceWire link
7 * - configuration of the SpaceWire link
8 * - SpaceWire related interruption requests processing
8 * - SpaceWire related interruption requests processing
9 * - transmission of TeleMetry packets by a dedicated RTEMS task
9 * - transmission of TeleMetry packets by a dedicated RTEMS task
10 * - reception of TeleCommands by a dedicated RTEMS task
10 * - reception of TeleCommands by a dedicated RTEMS task
11 *
11 *
12 */
12 */
13
13
14 #include "fsw_spacewire.h"
14 #include "fsw_spacewire.h"
15
15
16 rtems_name semq_name;
16 rtems_name semq_name;
17 rtems_id semq_id;
17 rtems_id semq_id;
18
18
19 //***********
19 //***********
20 // RTEMS TASK
20 // RTEMS TASK
21 rtems_task spiq_task(rtems_task_argument unused)
21 rtems_task spiq_task(rtems_task_argument unused)
22 {
22 {
23 /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver.
23 /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver.
24 *
24 *
25 * @param unused is the starting argument of the RTEMS task
25 * @param unused is the starting argument of the RTEMS task
26 *
26 *
27 */
27 */
28
28
29 rtems_event_set event_out;
29 rtems_event_set event_out;
30 rtems_status_code status;
30 rtems_status_code status;
31 int linkStatus;
31 int linkStatus;
32
32
33 BOOT_PRINTF("in SPIQ *** \n")
33 BOOT_PRINTF("in SPIQ *** \n")
34
34
35 while(true){
35 while(true){
36 rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT
36 rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT
37 PRINTF("in SPIQ *** got SPW_LINKERR_EVENT\n")
37 PRINTF("in SPIQ *** got SPW_LINKERR_EVENT\n")
38
38
39 // [0] SUSPEND RECV AND SEND TASKS
39 // [0] SUSPEND RECV AND SEND TASKS
40 status = rtems_task_suspend( Task_id[ TASKID_RECV ] );
40 status = rtems_task_suspend( Task_id[ TASKID_RECV ] );
41 if ( status != RTEMS_SUCCESSFUL ) {
41 if ( status != RTEMS_SUCCESSFUL ) {
42 PRINTF("in SPIQ *** ERR suspending RECV Task\n")
42 PRINTF("in SPIQ *** ERR suspending RECV Task\n")
43 }
43 }
44 status = rtems_task_suspend( Task_id[ TASKID_SEND ] );
44 status = rtems_task_suspend( Task_id[ TASKID_SEND ] );
45 if ( status != RTEMS_SUCCESSFUL ) {
45 if ( status != RTEMS_SUCCESSFUL ) {
46 PRINTF("in SPIQ *** ERR suspending SEND Task\n")
46 PRINTF("in SPIQ *** ERR suspending SEND Task\n")
47 }
47 }
48
48
49 // [1] CHECK THE LINK
49 // [1] CHECK THE LINK
50 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1)
50 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1)
51 if ( linkStatus != 5) {
51 if ( linkStatus != 5) {
52 PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus)
52 PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus)
53 status = rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms
53 status = rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms
54 }
54 }
55
55
56 // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT
56 // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT
57 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2)
57 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2)
58 if ( linkStatus != 5 ) // [2.a] not in run state, reset the link
58 if ( linkStatus != 5 ) // [2.a] not in run state, reset the link
59 {
59 {
60 spacewire_compute_stats_offsets();
60 spacewire_compute_stats_offsets();
61 status = spacewire_reset_link( );
61 status = spacewire_reset_link( );
62 }
62 }
63 else // [2.b] in run state, start the link
63 else // [2.b] in run state, start the link
64 {
64 {
65 status = spacewire_stop_and_start_link( fdSPW ); // start the link
65 status = spacewire_stop_and_start_link( fdSPW ); // start the link
66 if ( status != RTEMS_SUCCESSFUL)
66 if ( status != RTEMS_SUCCESSFUL)
67 {
67 {
68 PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status)
68 PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status)
69 }
69 }
70 }
70 }
71
71
72 // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS
72 // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS
73 if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully
73 if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully
74 {
74 {
75 status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 );
75 status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 );
76 if ( status != RTEMS_SUCCESSFUL ) {
76 if ( status != RTEMS_SUCCESSFUL ) {
77 PRINTF("in SPIQ *** ERR resuming SEND Task\n")
77 PRINTF("in SPIQ *** ERR resuming SEND Task\n")
78 }
78 }
79 status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 );
79 status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 );
80 if ( status != RTEMS_SUCCESSFUL ) {
80 if ( status != RTEMS_SUCCESSFUL ) {
81 PRINTF("in SPIQ *** ERR resuming RECV Task\n")
81 PRINTF("in SPIQ *** ERR resuming RECV Task\n")
82 }
82 }
83 }
83 }
84 else // [3.b] the link is not in run state, go in STANDBY mode
84 else // [3.b] the link is not in run state, go in STANDBY mode
85 {
85 {
86 status = stop_current_mode();
86 status = stop_current_mode();
87 if ( status != RTEMS_SUCCESSFUL ) {
87 if ( status != RTEMS_SUCCESSFUL ) {
88 PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status)
88 PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status)
89 }
89 }
90 status = enter_mode( LFR_MODE_STANDBY, 0 );
90 status = enter_mode( LFR_MODE_STANDBY, 0 );
91 if ( status != RTEMS_SUCCESSFUL ) {
91 if ( status != RTEMS_SUCCESSFUL ) {
92 PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status)
92 PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status)
93 }
93 }
94 // wake the WTDG task up to wait for the link recovery
94 // wake the WTDG task up to wait for the link recovery
95 status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 );
95 status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 );
96 status = rtems_task_suspend( RTEMS_SELF );
96 status = rtems_task_suspend( RTEMS_SELF );
97 }
97 }
98 }
98 }
99 }
99 }
100
100
101 rtems_task recv_task( rtems_task_argument unused )
101 rtems_task recv_task( rtems_task_argument unused )
102 {
102 {
103 /** This RTEMS task is dedicated to the reception of incoming TeleCommands.
103 /** This RTEMS task is dedicated to the reception of incoming TeleCommands.
104 *
104 *
105 * @param unused is the starting argument of the RTEMS task
105 * @param unused is the starting argument of the RTEMS task
106 *
106 *
107 * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked:
107 * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked:
108 * 1. It reads the incoming data.
108 * 1. It reads the incoming data.
109 * 2. Launches the acceptance procedure.
109 * 2. Launches the acceptance procedure.
110 * 3. If the Telecommand is valid, sends it to a dedicated RTEMS message queue.
110 * 3. If the Telecommand is valid, sends it to a dedicated RTEMS message queue.
111 *
111 *
112 */
112 */
113
113
114 int len;
114 int len;
115 ccsdsTelecommandPacket_t currentTC;
115 ccsdsTelecommandPacket_t currentTC;
116 unsigned char computed_CRC[ 2 ];
116 unsigned char computed_CRC[ 2 ];
117 unsigned char currentTC_LEN_RCV[ 2 ];
117 unsigned char currentTC_LEN_RCV[ 2 ];
118 unsigned char destinationID;
118 unsigned char destinationID;
119 unsigned int estimatedPacketLength;
119 unsigned int estimatedPacketLength;
120 unsigned int parserCode;
120 unsigned int parserCode;
121 rtems_status_code status;
121 rtems_status_code status;
122 rtems_id queue_recv_id;
122 rtems_id queue_recv_id;
123 rtems_id queue_send_id;
123 rtems_id queue_send_id;
124
124
125 initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes
125 initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes
126
126
127 status = get_message_queue_id_recv( &queue_recv_id );
127 status = get_message_queue_id_recv( &queue_recv_id );
128 if (status != RTEMS_SUCCESSFUL)
128 if (status != RTEMS_SUCCESSFUL)
129 {
129 {
130 PRINTF1("in RECV *** ERR get_message_queue_id_recv %d\n", status)
130 PRINTF1("in RECV *** ERR get_message_queue_id_recv %d\n", status)
131 }
131 }
132
132
133 status = get_message_queue_id_send( &queue_send_id );
133 status = get_message_queue_id_send( &queue_send_id );
134 if (status != RTEMS_SUCCESSFUL)
134 if (status != RTEMS_SUCCESSFUL)
135 {
135 {
136 PRINTF1("in RECV *** ERR get_message_queue_id_send %d\n", status)
136 PRINTF1("in RECV *** ERR get_message_queue_id_send %d\n", status)
137 }
137 }
138
138
139 BOOT_PRINTF("in RECV *** \n")
139 BOOT_PRINTF("in RECV *** \n")
140
140
141 while(1)
141 while(1)
142 {
142 {
143 len = read( fdSPW, (char*) &currentTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking
143 len = read( fdSPW, (char*) &currentTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking
144 if (len == -1){ // error during the read call
144 if (len == -1){ // error during the read call
145 PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno)
145 PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno)
146 }
146 }
147 else {
147 else {
148 if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) {
148 if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) {
149 PRINTF("in RECV *** packet lenght too short\n")
149 PRINTF("in RECV *** packet lenght too short\n")
150 }
150 }
151 else {
151 else {
152 estimatedPacketLength = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes
152 estimatedPacketLength = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes
153 currentTC_LEN_RCV[ 0 ] = (unsigned char) (estimatedPacketLength >> 8);
153 currentTC_LEN_RCV[ 0 ] = (unsigned char) (estimatedPacketLength >> 8);
154 currentTC_LEN_RCV[ 1 ] = (unsigned char) (estimatedPacketLength );
154 currentTC_LEN_RCV[ 1 ] = (unsigned char) (estimatedPacketLength );
155 // CHECK THE TC
155 // CHECK THE TC
156 parserCode = tc_parser( &currentTC, estimatedPacketLength, computed_CRC ) ;
156 parserCode = tc_parser( &currentTC, estimatedPacketLength, computed_CRC ) ;
157 if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT)
157 if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT)
158 || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE)
158 || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE)
159 || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA)
159 || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA)
160 || (parserCode == WRONG_SRC_ID) )
160 || (parserCode == WRONG_SRC_ID) )
161 { // send TM_LFR_TC_EXE_CORRUPTED
161 { // send TM_LFR_TC_EXE_CORRUPTED
162 PRINTF1("TC corrupted received, with code: %d\n", parserCode)
162 PRINTF1("TC corrupted received, with code: %d\n", parserCode)
163 if ( !( (currentTC.serviceType==TC_TYPE_TIME) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_TIME) )
163 if ( !( (currentTC.serviceType==TC_TYPE_TIME) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_TIME) )
164 &&
164 &&
165 !( (currentTC.serviceType==TC_TYPE_GEN) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_INFO))
165 !( (currentTC.serviceType==TC_TYPE_GEN) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_INFO))
166 )
166 )
167 {
167 {
168 if ( parserCode == WRONG_SRC_ID )
168 if ( parserCode == WRONG_SRC_ID )
169 {
169 {
170 destinationID = SID_TC_GROUND;
170 destinationID = SID_TC_GROUND;
171 }
171 }
172 else
172 else
173 {
173 {
174 destinationID = currentTC.sourceID;
174 destinationID = currentTC.sourceID;
175 }
175 }
176 send_tm_lfr_tc_exe_corrupted( &currentTC, queue_send_id,
176 send_tm_lfr_tc_exe_corrupted( &currentTC, queue_send_id,
177 computed_CRC, currentTC_LEN_RCV,
177 computed_CRC, currentTC_LEN_RCV,
178 destinationID );
178 destinationID );
179 }
179 }
180 }
180 }
181 else
181 else
182 { // send valid TC to the action launcher
182 { // send valid TC to the action launcher
183 status = rtems_message_queue_send( queue_recv_id, &currentTC,
183 status = rtems_message_queue_send( queue_recv_id, &currentTC,
184 estimatedPacketLength + CCSDS_TC_TM_PACKET_OFFSET + 3);
184 estimatedPacketLength + CCSDS_TC_TM_PACKET_OFFSET + 3);
185 }
185 }
186 }
186 }
187 }
187 }
188 }
188 }
189 }
189 }
190
190
191 rtems_task send_task( rtems_task_argument argument)
191 rtems_task send_task( rtems_task_argument argument)
192 {
192 {
193 /** This RTEMS task is dedicated to the transmission of TeleMetry packets.
193 /** This RTEMS task is dedicated to the transmission of TeleMetry packets.
194 *
194 *
195 * @param unused is the starting argument of the RTEMS task
195 * @param unused is the starting argument of the RTEMS task
196 *
196 *
197 * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives:
197 * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives:
198 * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call.
198 * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call.
199 * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After
199 * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After
200 * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the
200 * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the
201 * data it contains.
201 * data it contains.
202 *
202 *
203 */
203 */
204
204
205 rtems_status_code status; // RTEMS status code
205 rtems_status_code status; // RTEMS status code
206 char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
206 char incomingData[MSG_QUEUE_SIZE_SEND]; // incoming data buffer
207 spw_ioctl_pkt_send *spw_ioctl_send;
207 spw_ioctl_pkt_send *spw_ioctl_send;
208 size_t size; // size of the incoming TC packet
208 size_t size; // size of the incoming TC packet
209 u_int32_t count;
209 u_int32_t count;
210 rtems_id queue_id;
210 rtems_id queue_id;
211
211
212 status = get_message_queue_id_send( &queue_id );
212 status = get_message_queue_id_send( &queue_id );
213 if (status != RTEMS_SUCCESSFUL)
213 if (status != RTEMS_SUCCESSFUL)
214 {
214 {
215 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
215 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
216 }
216 }
217
217
218 BOOT_PRINTF("in SEND *** \n")
218 BOOT_PRINTF("in SEND *** \n")
219
219
220 while(1)
220 while(1)
221 {
221 {
222 status = rtems_message_queue_receive( queue_id, incomingData, &size,
222 status = rtems_message_queue_receive( queue_id, incomingData, &size,
223 RTEMS_WAIT, RTEMS_NO_TIMEOUT );
223 RTEMS_WAIT, RTEMS_NO_TIMEOUT );
224
224
225 if (status!=RTEMS_SUCCESSFUL)
225 if (status!=RTEMS_SUCCESSFUL)
226 {
226 {
227 PRINTF1("in SEND *** (1) ERR = %d\n", status)
227 PRINTF1("in SEND *** (1) ERR = %d\n", status)
228 }
228 }
229 else
229 else
230 {
230 {
231 if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet
231 if ( incomingData[0] == CCSDS_DESTINATION_ID ) // the incoming message is a ccsds packet
232 {
232 {
233 status = write( fdSPW, incomingData, size );
233 status = write( fdSPW, incomingData, size );
234 if (status == -1){
234 if (status == -1){
235 PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size)
235 PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size)
236 }
236 }
237 }
237 }
238 else // the incoming message is a spw_ioctl_pkt_send structure
238 else // the incoming message is a spw_ioctl_pkt_send structure
239 {
239 {
240 spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData;
240 spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData;
241 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send );
241 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send );
242 if (status == -1){
242 if (status == -1){
243 PRINTF2("in SEND *** (2.b) ERRNO = %d, RTEMS = %d\n", errno, status)
243 PRINTF2("in SEND *** (2.b) ERRNO = %d, RTEMS = %d\n", errno, status)
244 }
244 }
245 }
245 }
246 }
246 }
247
247
248 status = rtems_message_queue_get_number_pending( queue_id, &count );
248 status = rtems_message_queue_get_number_pending( queue_id, &count );
249 if (status != RTEMS_SUCCESSFUL)
249 if (status != RTEMS_SUCCESSFUL)
250 {
250 {
251 PRINTF1("in SEND *** (3) ERR = %d\n", status)
251 PRINTF1("in SEND *** (3) ERR = %d\n", status)
252 }
252 }
253 else
253 else
254 {
254 {
255 if (count > maxCount)
255 if (count > maxCount)
256 {
256 {
257 maxCount = count;
257 maxCount = count;
258 }
258 }
259 }
259 }
260 }
260 }
261 }
261 }
262
262
263 rtems_task wtdg_task( rtems_task_argument argument )
263 rtems_task wtdg_task( rtems_task_argument argument )
264 {
264 {
265 rtems_event_set event_out;
265 rtems_event_set event_out;
266 rtems_status_code status;
266 rtems_status_code status;
267 int linkStatus;
267 int linkStatus;
268
268
269 BOOT_PRINTF("in WTDG ***\n")
269 BOOT_PRINTF("in WTDG ***\n")
270
270
271 while(1)
271 while(1)
272 {
272 {
273 // wait for an RTEMS_EVENT
273 // wait for an RTEMS_EVENT
274 rtems_event_receive( RTEMS_EVENT_0,
274 rtems_event_receive( RTEMS_EVENT_0,
275 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
275 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
276 PRINTF("in WTDG *** wait for the link\n")
276 PRINTF("in WTDG *** wait for the link\n")
277 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
277 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
278 while( linkStatus != 5) // wait for the link
278 while( linkStatus != 5) // wait for the link
279 {
279 {
280 rtems_task_wake_after( 10 );
280 rtems_task_wake_after( 10 );
281 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
281 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
282 }
282 }
283
283
284 status = spacewire_stop_and_start_link( fdSPW );
284 status = spacewire_stop_and_start_link( fdSPW );
285
285
286 if (status != RTEMS_SUCCESSFUL)
286 if (status != RTEMS_SUCCESSFUL)
287 {
287 {
288 PRINTF1("in WTDG *** ERR link not started %d\n", status)
288 PRINTF1("in WTDG *** ERR link not started %d\n", status)
289 }
289 }
290 else
290 else
291 {
291 {
292 PRINTF("in WTDG *** OK link started\n")
292 PRINTF("in WTDG *** OK link started\n")
293 }
293 }
294
294
295 // restart the SPIQ task
295 // restart the SPIQ task
296 status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 );
296 status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 );
297 if ( status != RTEMS_SUCCESSFUL ) {
297 if ( status != RTEMS_SUCCESSFUL ) {
298 PRINTF("in SPIQ *** ERR restarting SPIQ Task\n")
298 PRINTF("in SPIQ *** ERR restarting SPIQ Task\n")
299 }
299 }
300
300
301 // restart RECV and SEND
301 // restart RECV and SEND
302 status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 );
302 status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 );
303 if ( status != RTEMS_SUCCESSFUL ) {
303 if ( status != RTEMS_SUCCESSFUL ) {
304 PRINTF("in SPIQ *** ERR restarting SEND Task\n")
304 PRINTF("in SPIQ *** ERR restarting SEND Task\n")
305 }
305 }
306 status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 );
306 status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 );
307 if ( status != RTEMS_SUCCESSFUL ) {
307 if ( status != RTEMS_SUCCESSFUL ) {
308 PRINTF("in SPIQ *** ERR restarting RECV Task\n")
308 PRINTF("in SPIQ *** ERR restarting RECV Task\n")
309 }
309 }
310 }
310 }
311 }
311 }
312
312
313 //****************
313 //****************
314 // OTHER FUNCTIONS
314 // OTHER FUNCTIONS
315 int spacewire_open_link( void ) // by default, the driver resets the core: [SPW_CTRL_WRITE(pDev, SPW_CTRL_RESET);]
315 int spacewire_open_link( void ) // by default, the driver resets the core: [SPW_CTRL_WRITE(pDev, SPW_CTRL_RESET);]
316 {
316 {
317 /** This function opens the SpaceWire link.
317 /** This function opens the SpaceWire link.
318 *
318 *
319 * @return a valid file descriptor in case of success, -1 in case of a failure
319 * @return a valid file descriptor in case of success, -1 in case of a failure
320 *
320 *
321 */
321 */
322 rtems_status_code status;
322 rtems_status_code status;
323
323
324 fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware
324 fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware
325 if ( fdSPW < 0 ) {
325 if ( fdSPW < 0 ) {
326 PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno)
326 PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno)
327 }
327 }
328 else
328 else
329 {
329 {
330 status = RTEMS_SUCCESSFUL;
330 status = RTEMS_SUCCESSFUL;
331 }
331 }
332
332
333 return status;
333 return status;
334 }
334 }
335
335
336 int spacewire_start_link( int fd )
336 int spacewire_start_link( int fd )
337 {
337 {
338 rtems_status_code status;
338 rtems_status_code status;
339
339
340 status = ioctl( fd, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
340 status = ioctl( fd, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
341 // -1 default hardcoded driver timeout
341 // -1 default hardcoded driver timeout
342
342
343 return status;
343 return status;
344 }
344 }
345
345
346 int spacewire_stop_and_start_link( int fd )
346 int spacewire_stop_and_start_link( int fd )
347 {
347 {
348 rtems_status_code status;
348 rtems_status_code status;
349
349
350 status = ioctl( fd, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0
350 status = ioctl( fd, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0
351 status = ioctl( fd, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
351 status = ioctl( fd, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
352 // -1 default hardcoded driver timeout
352 // -1 default hardcoded driver timeout
353
353
354 return status;
354 return status;
355 }
355 }
356
356
357 int spacewire_configure_link( int fd )
357 int spacewire_configure_link( int fd )
358 {
358 {
359 /** This function configures the SpaceWire link.
359 /** This function configures the SpaceWire link.
360 *
360 *
361 * @return GR-RTEMS-DRIVER directive status codes:
361 * @return GR-RTEMS-DRIVER directive status codes:
362 * - 22 EINVAL - Null pointer or an out of range value was given as the argument.
362 * - 22 EINVAL - Null pointer or an out of range value was given as the argument.
363 * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode.
363 * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode.
364 * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used.
364 * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used.
365 * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up.
365 * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up.
366 * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers.
366 * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers.
367 * - 5 EIO - Error when writing to grswp hardware registers.
367 * - 5 EIO - Error when writing to grswp hardware registers.
368 * - 2 ENOENT - No such file or directory
368 * - 2 ENOENT - No such file or directory
369 */
369 */
370
370
371 rtems_status_code status;
371 rtems_status_code status;
372
372
373 spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force
373 spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force
374 spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration
374 spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration
375
375
376 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception
376 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception
377 if (status!=RTEMS_SUCCESSFUL) {
377 if (status!=RTEMS_SUCCESSFUL) {
378 PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n")
378 PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n")
379 }
379 }
380 //
380 //
381 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a
381 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a
382 if (status!=RTEMS_SUCCESSFUL) {
382 if (status!=RTEMS_SUCCESSFUL) {
383 PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs
383 PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs
384 }
384 }
385 //
385 //
386 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts
386 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts
387 if (status!=RTEMS_SUCCESSFUL) {
387 if (status!=RTEMS_SUCCESSFUL) {
388 PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n")
388 PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n")
389 }
389 }
390 //
390 //
391 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit
391 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit
392 if (status!=RTEMS_SUCCESSFUL) {
392 if (status!=RTEMS_SUCCESSFUL) {
393 PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
393 PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
394 }
394 }
395 //
395 //
396 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks
396 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks
397 if (status!=RTEMS_SUCCESSFUL) {
397 if (status!=RTEMS_SUCCESSFUL) {
398 PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n")
398 PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n")
399 }
399 }
400 //
400 //
401 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available
401 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available
402 if (status!=RTEMS_SUCCESSFUL) {
402 if (status!=RTEMS_SUCCESSFUL) {
403 PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n")
403 PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n")
404 }
404 }
405 //
405 //
406 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ]
406 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ]
407 if (status!=RTEMS_SUCCESSFUL) {
407 if (status!=RTEMS_SUCCESSFUL) {
408 PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n")
408 PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n")
409 }
409 }
410
410
411 return status;
411 return status;
412 }
412 }
413
413
414 int spacewire_reset_link( void )
414 int spacewire_reset_link( void )
415 {
415 {
416 /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver.
416 /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver.
417 *
417 *
418 * @return RTEMS directive status code:
418 * @return RTEMS directive status code:
419 * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s.
419 * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s.
420 * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout.
420 * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout.
421 *
421 *
422 */
422 */
423
423
424 rtems_status_code status_spw;
424 rtems_status_code status_spw;
425 int i;
425 int i;
426
426
427 for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ )
427 for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ )
428 {
428 {
429 PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i);
429 PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i);
430
430
431 // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM
431 // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM
432
432
433 status_spw = spacewire_stop_and_start_link( fdSPW );
433 status_spw = spacewire_stop_and_start_link( fdSPW );
434 if ( status_spw != RTEMS_SUCCESSFUL )
434 if ( status_spw != RTEMS_SUCCESSFUL )
435 {
435 {
436 PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw)
436 PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw)
437 }
437 }
438
438
439 if ( status_spw == RTEMS_SUCCESSFUL)
439 if ( status_spw == RTEMS_SUCCESSFUL)
440 {
440 {
441 break;
441 break;
442 }
442 }
443 }
443 }
444
444
445 return status_spw;
445 return status_spw;
446 }
446 }
447
447
448 void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force
448 void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force
449 {
449 {
450 /** This function sets the [N]o [P]ort force bit of the GRSPW control register.
450 /** This function sets the [N]o [P]ort force bit of the GRSPW control register.
451 *
451 *
452 * @param val is the value, 0 or 1, used to set the value of the NP bit.
452 * @param val is the value, 0 or 1, used to set the value of the NP bit.
453 * @param regAddr is the address of the GRSPW control register.
453 * @param regAddr is the address of the GRSPW control register.
454 *
454 *
455 * NP is the bit 20 of the GRSPW control register.
455 * NP is the bit 20 of the GRSPW control register.
456 *
456 *
457 */
457 */
458
458
459 unsigned int *spwptr = (unsigned int*) regAddr;
459 unsigned int *spwptr = (unsigned int*) regAddr;
460
460
461 if (val == 1) {
461 if (val == 1) {
462 *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit
462 *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit
463 }
463 }
464 if (val== 0) {
464 if (val== 0) {
465 *spwptr = *spwptr & 0xffdfffff;
465 *spwptr = *spwptr & 0xffdfffff;
466 }
466 }
467 }
467 }
468
468
469 void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable
469 void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable
470 {
470 {
471 /** This function sets the [R]MAP [E]nable bit of the GRSPW control register.
471 /** This function sets the [R]MAP [E]nable bit of the GRSPW control register.
472 *
472 *
473 * @param val is the value, 0 or 1, used to set the value of the RE bit.
473 * @param val is the value, 0 or 1, used to set the value of the RE bit.
474 * @param regAddr is the address of the GRSPW control register.
474 * @param regAddr is the address of the GRSPW control register.
475 *
475 *
476 * RE is the bit 16 of the GRSPW control register.
476 * RE is the bit 16 of the GRSPW control register.
477 *
477 *
478 */
478 */
479
479
480 unsigned int *spwptr = (unsigned int*) regAddr;
480 unsigned int *spwptr = (unsigned int*) regAddr;
481
481
482 if (val == 1)
482 if (val == 1)
483 {
483 {
484 *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit
484 *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit
485 }
485 }
486 if (val== 0)
486 if (val== 0)
487 {
487 {
488 *spwptr = *spwptr & 0xfffdffff;
488 *spwptr = *spwptr & 0xfffdffff;
489 }
489 }
490 }
490 }
491
491
492 void spacewire_compute_stats_offsets( void )
492 void spacewire_compute_stats_offsets( void )
493 {
493 {
494 /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising.
494 /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising.
495 *
495 *
496 * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics
496 * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics
497 * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it
497 * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it
498 * during the open systel call).
498 * during the open systel call).
499 *
499 *
500 */
500 */
501
501
502 spw_stats spacewire_stats_grspw;
502 spw_stats spacewire_stats_grspw;
503 rtems_status_code status;
503 rtems_status_code status;
504
504
505 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
505 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
506
506
507 spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received
507 spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received
508 + spacewire_stats.packets_received;
508 + spacewire_stats.packets_received;
509 spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent
509 spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent
510 + spacewire_stats.packets_sent;
510 + spacewire_stats.packets_sent;
511 spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err
511 spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err
512 + spacewire_stats.parity_err;
512 + spacewire_stats.parity_err;
513 spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err
513 spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err
514 + spacewire_stats.disconnect_err;
514 + spacewire_stats.disconnect_err;
515 spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err
515 spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err
516 + spacewire_stats.escape_err;
516 + spacewire_stats.escape_err;
517 spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err
517 spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err
518 + spacewire_stats.credit_err;
518 + spacewire_stats.credit_err;
519 spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err
519 spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err
520 + spacewire_stats.write_sync_err;
520 + spacewire_stats.write_sync_err;
521 spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err
521 spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err
522 + spacewire_stats.rx_rmap_header_crc_err;
522 + spacewire_stats.rx_rmap_header_crc_err;
523 spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err
523 spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err
524 + spacewire_stats.rx_rmap_data_crc_err;
524 + spacewire_stats.rx_rmap_data_crc_err;
525 spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep
525 spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep
526 + spacewire_stats.early_ep;
526 + spacewire_stats.early_ep;
527 spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address
527 spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address
528 + spacewire_stats.invalid_address;
528 + spacewire_stats.invalid_address;
529 spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err
529 spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err
530 + spacewire_stats.rx_eep_err;
530 + spacewire_stats.rx_eep_err;
531 spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated
531 spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated
532 + spacewire_stats.rx_truncated;
532 + spacewire_stats.rx_truncated;
533 }
533 }
534
534
535 void spacewire_update_statistics( void )
535 void spacewire_update_statistics( void )
536 {
536 {
537 rtems_status_code status;
537 rtems_status_code status;
538 spw_stats spacewire_stats_grspw;
538 spw_stats spacewire_stats_grspw;
539
539
540 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
540 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
541
541
542 spacewire_stats.packets_received = spacewire_stats_backup.packets_received
542 spacewire_stats.packets_received = spacewire_stats_backup.packets_received
543 + spacewire_stats_grspw.packets_received;
543 + spacewire_stats_grspw.packets_received;
544 spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent
544 spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent
545 + spacewire_stats_grspw.packets_sent;
545 + spacewire_stats_grspw.packets_sent;
546 spacewire_stats.parity_err = spacewire_stats_backup.parity_err
546 spacewire_stats.parity_err = spacewire_stats_backup.parity_err
547 + spacewire_stats_grspw.parity_err;
547 + spacewire_stats_grspw.parity_err;
548 spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err
548 spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err
549 + spacewire_stats_grspw.disconnect_err;
549 + spacewire_stats_grspw.disconnect_err;
550 spacewire_stats.escape_err = spacewire_stats_backup.escape_err
550 spacewire_stats.escape_err = spacewire_stats_backup.escape_err
551 + spacewire_stats_grspw.escape_err;
551 + spacewire_stats_grspw.escape_err;
552 spacewire_stats.credit_err = spacewire_stats_backup.credit_err
552 spacewire_stats.credit_err = spacewire_stats_backup.credit_err
553 + spacewire_stats_grspw.credit_err;
553 + spacewire_stats_grspw.credit_err;
554 spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err
554 spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err
555 + spacewire_stats_grspw.write_sync_err;
555 + spacewire_stats_grspw.write_sync_err;
556 spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err
556 spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err
557 + spacewire_stats_grspw.rx_rmap_header_crc_err;
557 + spacewire_stats_grspw.rx_rmap_header_crc_err;
558 spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err
558 spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err
559 + spacewire_stats_grspw.rx_rmap_data_crc_err;
559 + spacewire_stats_grspw.rx_rmap_data_crc_err;
560 spacewire_stats.early_ep = spacewire_stats_backup.early_ep
560 spacewire_stats.early_ep = spacewire_stats_backup.early_ep
561 + spacewire_stats_grspw.early_ep;
561 + spacewire_stats_grspw.early_ep;
562 spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address
562 spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address
563 + spacewire_stats_grspw.invalid_address;
563 + spacewire_stats_grspw.invalid_address;
564 spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err
564 spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err
565 + spacewire_stats_grspw.rx_eep_err;
565 + spacewire_stats_grspw.rx_eep_err;
566 spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated
566 spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated
567 + spacewire_stats_grspw.rx_truncated;
567 + spacewire_stats_grspw.rx_truncated;
568 //spacewire_stats.tx_link_err;
568 //spacewire_stats.tx_link_err;
569
569
570 //****************************
570 //****************************
571 // DPU_SPACEWIRE_IF_STATISTICS
571 // DPU_SPACEWIRE_IF_STATISTICS
572 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8);
572 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8);
573 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received);
573 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received);
574 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8);
574 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8);
575 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent);
575 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent);
576 //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt;
576 //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt;
577 //housekeeping_packet.hk_lfr_dpu_spw_last_timc;
577 //housekeeping_packet.hk_lfr_dpu_spw_last_timc;
578
578
579 //******************************************
579 //******************************************
580 // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY
580 // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY
581 housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err;
581 housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err;
582 housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err;
582 housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err;
583 housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err;
583 housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err;
584 housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err;
584 housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err;
585 housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err;
585 housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err;
586
586
587 //*********************************************
587 //*********************************************
588 // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY
588 // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY
589 housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep;
589 housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep;
590 housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address;
590 housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address;
591 housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err;
591 housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err;
592 housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated;
592 housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated;
593 }
593 }
594
594
595 void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc )
595 void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc )
596 {
596 {
597 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_9 );
597 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_9 );
598 struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO;
598 struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO;
599
599
600 grgpio_regs->io_port_direction_register =
600 grgpio_regs->io_port_direction_register =
601 grgpio_regs->io_port_direction_register | 0x04; // [0000 0100], 0 = output disabled, 1 = output enabled
601 grgpio_regs->io_port_direction_register | 0x04; // [0000 0100], 0 = output disabled, 1 = output enabled
602
602
603 if ( (grgpio_regs->io_port_output_register & 0x04) == 0x04 )
603 if ( (grgpio_regs->io_port_output_register & 0x04) == 0x04 )
604 {
604 {
605 grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfb; // [1111 1011]
605 grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfb; // [1111 1011]
606 }
606 }
607 else
607 else
608 {
608 {
609 grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register | 0x04; // [0000 0100]
609 grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register | 0x04; // [0000 0100]
610 }
610 }
611 }
611 }
612
612
613 rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data )
613 rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data )
614 {
614 {
615 int linkStatus;
615 int linkStatus;
616 rtems_status_code status;
616 rtems_status_code status;
617
617
618 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
618 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
619
619
620 if ( linkStatus == 5) {
620 if ( linkStatus == 5) {
621 PRINTF("in spacewire_reset_link *** link is running\n")
621 PRINTF("in spacewire_reset_link *** link is running\n")
622 status = RTEMS_SUCCESSFUL;
622 status = RTEMS_SUCCESSFUL;
623 }
623 }
624 }
624 }
@@ -1,698 +1,712
1 /** Functions related to data processing.
1 /** Functions related to data processing.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
7 *
7 *
8 */
8 */
9
9
10 #include "fsw_processing.h"
10 #include "fsw_processing.h"
11 #include "fsw_processing_globals.c"
11 #include "fsw_processing_globals.c"
12
12
13 unsigned int nb_sm_f0;
13 unsigned int nb_sm_f0;
14 unsigned int nb_sm_f0_aux_f1;
14 unsigned int nb_sm_f0_aux_f1;
15 unsigned int nb_sm_f1;
15 unsigned int nb_sm_f1;
16 unsigned int nb_sm_f0_aux_f2;
16 unsigned int nb_sm_f0_aux_f2;
17
17
18 //************************
18 //************************
19 // spectral matrices rings
19 // spectral matrices rings
20 ring_node_sm sm_ring_f0[ NB_RING_NODES_SM_F0 ];
20 ring_node_sm sm_ring_f0[ NB_RING_NODES_SM_F0 ];
21 ring_node_sm sm_ring_f1[ NB_RING_NODES_SM_F1 ];
21 ring_node_sm sm_ring_f1[ NB_RING_NODES_SM_F1 ];
22 ring_node_sm sm_ring_f2[ NB_RING_NODES_SM_F2 ];
22 ring_node_sm sm_ring_f2[ NB_RING_NODES_SM_F2 ];
23 ring_node_sm *current_ring_node_sm_f0;
23 ring_node_sm *current_ring_node_sm_f0;
24 ring_node_sm *current_ring_node_sm_f1;
24 ring_node_sm *current_ring_node_sm_f1;
25 ring_node_sm *current_ring_node_sm_f2;
25 ring_node_sm *current_ring_node_sm_f2;
26 ring_node_sm *ring_node_for_averaging_sm_f0;
26 ring_node_sm *ring_node_for_averaging_sm_f0;
27 ring_node_sm *ring_node_for_averaging_sm_f1;
27 ring_node_sm *ring_node_for_averaging_sm_f1;
28 ring_node_sm *ring_node_for_averaging_sm_f2;
28 ring_node_sm *ring_node_for_averaging_sm_f2;
29
29
30 //***********************************************************
30 //***********************************************************
31 // Interrupt Service Routine for spectral matrices processing
31 // Interrupt Service Routine for spectral matrices processing
32
32
33 void spectral_matrices_isr_f0( void )
33 void spectral_matrices_isr_f0( void )
34 {
34 {
35 unsigned char status;
35 unsigned char status;
36 unsigned long long int time_0;
36 unsigned long long int time_0;
37 unsigned long long int time_1;
37 unsigned long long int time_1;
38 unsigned long long int syncBit0;
38 unsigned long long int syncBit0;
39 unsigned long long int syncBit1;
39 unsigned long long int syncBit1;
40
40
41 status = spectral_matrix_regs->status & 0x03; // [0011] get the status_ready_matrix_f0_x bits
41 status = spectral_matrix_regs->status & 0x03; // [0011] get the status_ready_matrix_f0_x bits
42
42
43 time_0 = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f0_0_coarse_time );
43 time_0 = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f0_0_coarse_time );
44 time_1 = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f0_1_coarse_time );
44 time_1 = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f0_1_coarse_time );
45 syncBit0 = ( (unsigned long long int) (spectral_matrix_regs->f0_0_coarse_time & 0x80000000) ) << 16;
45 syncBit0 = ( (unsigned long long int) (spectral_matrix_regs->f0_0_coarse_time & 0x80000000) ) << 16;
46 syncBit1 = ( (unsigned long long int) (spectral_matrix_regs->f0_1_coarse_time & 0x80000000) ) << 16;
46 syncBit1 = ( (unsigned long long int) (spectral_matrix_regs->f0_1_coarse_time & 0x80000000) ) << 16;
47
47
48 switch(status)
48 switch(status)
49 {
49 {
50 case 0:
50 case 0:
51 break;
51 break;
52 case 3:
52 case 3:
53 if ( time_0 < time_1 )
53 if ( time_0 < time_1 )
54 {
54 {
55 close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0],
55 close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0],
56 ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0);
56 ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0);
57 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
57 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
58 spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address;
58 spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address;
59 close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0],
59 close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0],
60 ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1);
60 ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1);
61 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
61 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
62 spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address;
62 spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address;
63 }
63 }
64 else
64 else
65 {
65 {
66 close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0],
66 close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0],
67 ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1);
67 ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1);
68 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
68 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
69 spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address;
69 spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address;
70 close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0],
70 close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0],
71 ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0);
71 ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0);
72 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
72 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
73 spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address;
73 spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address;
74 }
74 }
75 spectral_matrix_regs->status = 0x03; // [0011]
75 spectral_matrix_regs->status = 0x03; // [0011]
76 break;
76 break;
77 case 1:
77 case 1:
78 close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0],
78 close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0],
79 ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0);
79 ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_0 | syncBit0);
80 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
80 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
81 spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address;
81 spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address;
82 spectral_matrix_regs->status = 0x01; // [0001]
82 spectral_matrix_regs->status = 0x01; // [0001]
83 break;
83 break;
84 case 2:
84 case 2:
85 close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0],
85 close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0],
86 ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1);
86 ring_node_for_averaging_sm_f0, current_ring_node_sm_f0, time_1 | syncBit1);
87 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
87 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
88 spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address;
88 spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address;
89 spectral_matrix_regs->status = 0x02; // [0010]
89 spectral_matrix_regs->status = 0x02; // [0010]
90 break;
90 break;
91 }
91 }
92 }
92 }
93
93
94 void spectral_matrices_isr_f1( void )
94 void spectral_matrices_isr_f1( void )
95 {
95 {
96 unsigned char status;
96 unsigned char status;
97 unsigned long long int time;
97 unsigned long long int time;
98 unsigned long long int syncBit;
98 unsigned long long int syncBit;
99 rtems_status_code status_code;
99 rtems_status_code status_code;
100
100
101 status = (spectral_matrix_regs->status & 0x0c) >> 2; // [1100] get the status_ready_matrix_f0_x bits
101 status = (spectral_matrix_regs->status & 0x0c) >> 2; // [1100] get the status_ready_matrix_f0_x bits
102
102
103 switch(status)
103 switch(status)
104 {
104 {
105 case 0:
105 case 0:
106 break;
106 break;
107 case 3:
107 case 3:
108 // UNEXPECTED VALUE
108 // UNEXPECTED VALUE
109 spectral_matrix_regs->status = 0xc0; // [1100]
109 spectral_matrix_regs->status = 0xc0; // [1100]
110 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 );
110 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 );
111 break;
111 break;
112 case 1:
112 case 1:
113 time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_0_coarse_time );
113 time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_0_coarse_time );
114 syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_0_coarse_time & 0x80000000) ) << 16;
114 syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_0_coarse_time & 0x80000000) ) << 16;
115 close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1],
115 close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1],
116 ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit);
116 ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit);
117 current_ring_node_sm_f1 = current_ring_node_sm_f1->next;
117 current_ring_node_sm_f1 = current_ring_node_sm_f1->next;
118 spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address;
118 spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address;
119 spectral_matrix_regs->status = 0x04; // [0100]
119 spectral_matrix_regs->status = 0x04; // [0100]
120 break;
120 break;
121 case 2:
121 case 2:
122 time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_1_coarse_time );
122 time = get_acquisition_time( (unsigned char *) &spectral_matrix_regs->f1_1_coarse_time );
123 syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_1_coarse_time & 0x80000000) ) << 16;
123 syncBit = ( (unsigned long long int) (spectral_matrix_regs->f1_1_coarse_time & 0x80000000) ) << 16;
124 close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1],
124 close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1],
125 ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit);
125 ring_node_for_averaging_sm_f1, current_ring_node_sm_f1, time | syncBit);
126 current_ring_node_sm_f1 = current_ring_node_sm_f1->next;
126 current_ring_node_sm_f1 = current_ring_node_sm_f1->next;
127 spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address;
127 spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address;
128 spectral_matrix_regs->status = 0x08; // [1000]
128 spectral_matrix_regs->status = 0x08; // [1000]
129 break;
129 break;
130 }
130 }
131 }
131 }
132
132
133 void spectral_matrices_isr_f2( void )
133 void spectral_matrices_isr_f2( void )
134 {
134 {
135 unsigned char status;
135 unsigned char status;
136 rtems_status_code status_code;
136 rtems_status_code status_code;
137
137
138 status = (spectral_matrix_regs->status & 0x30) >> 4; // [0011 0000] get the status_ready_matrix_f0_x bits
138 status = (spectral_matrix_regs->status & 0x30) >> 4; // [0011 0000] get the status_ready_matrix_f0_x bits
139
139
140 ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2;
140 ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2;
141
141
142 current_ring_node_sm_f2 = current_ring_node_sm_f2->next;
142 current_ring_node_sm_f2 = current_ring_node_sm_f2->next;
143
143
144 switch(status)
144 switch(status)
145 {
145 {
146 case 0:
146 case 0:
147 break;
147 break;
148 case 3:
148 case 3:
149 // UNEXPECTED VALUE
149 // UNEXPECTED VALUE
150 spectral_matrix_regs->status = 0x30; // [0011 0000]
150 spectral_matrix_regs->status = 0x30; // [0011 0000]
151 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 );
151 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_11 );
152 break;
152 break;
153 case 1:
153 case 1:
154 ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_0_coarse_time;
154 ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_0_coarse_time;
155 ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_0_fine_time;
155 ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_0_fine_time;
156 spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->buffer_address;
156 spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->buffer_address;
157 spectral_matrix_regs->status = 0x10; // [0001 0000]
157 spectral_matrix_regs->status = 0x10; // [0001 0000]
158 if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
158 if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
159 {
159 {
160 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
160 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
161 }
161 }
162 break;
162 break;
163 case 2:
163 case 2:
164 ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_1_coarse_time;
164 ring_node_for_averaging_sm_f2->coarseTime = spectral_matrix_regs->f2_1_coarse_time;
165 ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_1_fine_time;
165 ring_node_for_averaging_sm_f2->fineTime = spectral_matrix_regs->f2_1_fine_time;
166 spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address;
166 spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address;
167 spectral_matrix_regs->status = 0x20; // [0010 0000]
167 spectral_matrix_regs->status = 0x20; // [0010 0000]
168 if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
168 if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
169 {
169 {
170 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
170 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
171 }
171 }
172 break;
172 break;
173 }
173 }
174 }
174 }
175
175
176 void spectral_matrix_isr_error_handler( void )
176 void spectral_matrix_isr_error_handler( void )
177 {
177 {
178 rtems_status_code status_code;
178 rtems_status_code status_code;
179
179
180 if (spectral_matrix_regs->status & 0x7c0) // [0111 1100 0000]
180 if (spectral_matrix_regs->status & 0x7c0) // [0111 1100 0000]
181 {
181 {
182 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
182 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
183 }
183 }
184 }
184 }
185
185
186 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
186 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
187 {
187 {
188 // STATUS REGISTER
188 // STATUS REGISTER
189 // input_fifo_write(2) *** input_fifo_write(1) *** input_fifo_write(0)
189 // input_fifo_write(2) *** input_fifo_write(1) *** input_fifo_write(0)
190 // 10 9 8
190 // 10 9 8
191 // buffer_full ** bad_component_err ** f2_1 ** f2_0 ** f1_1 ** f1_0 ** f0_1 ** f0_0
191 // buffer_full ** bad_component_err ** f2_1 ** f2_0 ** f1_1 ** f1_0 ** f0_1 ** f0_0
192 // 7 6 5 4 3 2 1 0
192 // 7 6 5 4 3 2 1 0
193
193
194 spectral_matrices_isr_f0();
194 spectral_matrices_isr_f0();
195
195
196 spectral_matrices_isr_f1();
196 spectral_matrices_isr_f1();
197
197
198 spectral_matrices_isr_f2();
198 spectral_matrices_isr_f2();
199
199
200 // spectral_matrix_isr_error_handler();
200 // spectral_matrix_isr_error_handler();
201 }
201 }
202
202
203 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
203 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
204 {
204 {
205 rtems_status_code status_code;
205 rtems_status_code status_code;
206
206
207 //***
207 //***
208 // F0
208 // F0
209 nb_sm_f0 = nb_sm_f0 + 1;
209 nb_sm_f0 = nb_sm_f0 + 1;
210 if (nb_sm_f0 == NB_SM_BEFORE_AVF0 )
210 if (nb_sm_f0 == NB_SM_BEFORE_AVF0 )
211 {
211 {
212 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
212 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
213 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
213 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
214 {
214 {
215 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
215 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
216 }
216 }
217 nb_sm_f0 = 0;
217 nb_sm_f0 = 0;
218 }
218 }
219
219
220 //***
220 //***
221 // F1
221 // F1
222 nb_sm_f0_aux_f1 = nb_sm_f0_aux_f1 + 1;
222 nb_sm_f0_aux_f1 = nb_sm_f0_aux_f1 + 1;
223 if (nb_sm_f0_aux_f1 == 6)
223 if (nb_sm_f0_aux_f1 == 6)
224 {
224 {
225 nb_sm_f0_aux_f1 = 0;
225 nb_sm_f0_aux_f1 = 0;
226 nb_sm_f1 = nb_sm_f1 + 1;
226 nb_sm_f1 = nb_sm_f1 + 1;
227 }
227 }
228 if (nb_sm_f1 == NB_SM_BEFORE_AVF1 )
228 if (nb_sm_f1 == NB_SM_BEFORE_AVF1 )
229 {
229 {
230 ring_node_for_averaging_sm_f1 = current_ring_node_sm_f1;
230 ring_node_for_averaging_sm_f1 = current_ring_node_sm_f1;
231 if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
231 if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
232 {
232 {
233 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
233 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
234 }
234 }
235 nb_sm_f1 = 0;
235 nb_sm_f1 = 0;
236 }
236 }
237
237
238 //***
238 //***
239 // F2
239 // F2
240 nb_sm_f0_aux_f2 = nb_sm_f0_aux_f2 + 1;
240 nb_sm_f0_aux_f2 = nb_sm_f0_aux_f2 + 1;
241 if (nb_sm_f0_aux_f2 == 96)
241 if (nb_sm_f0_aux_f2 == 96)
242 {
242 {
243 nb_sm_f0_aux_f2 = 0;
243 nb_sm_f0_aux_f2 = 0;
244 ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2;
244 ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2;
245 if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
245 if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
246 {
246 {
247 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
247 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
248 }
248 }
249 }
249 }
250 }
250 }
251
251
252 //******************
252 //******************
253 // Spectral Matrices
253 // Spectral Matrices
254
254
255 void reset_nb_sm( void )
255 void reset_nb_sm( void )
256 {
256 {
257 nb_sm_f0 = 0;
257 nb_sm_f0 = 0;
258 nb_sm_f0_aux_f1 = 0;
258 nb_sm_f0_aux_f1 = 0;
259 nb_sm_f0_aux_f2 = 0;
259 nb_sm_f0_aux_f2 = 0;
260
260
261 nb_sm_f1 = 0;
261 nb_sm_f1 = 0;
262 }
262 }
263
263
264 void SM_init_rings( void )
264 void SM_init_rings( void )
265 {
265 {
266 unsigned char i;
266 unsigned char i;
267
267
268 // F0 RING
268 // F0 RING
269 sm_ring_f0[0].next = (ring_node_sm*) &sm_ring_f0[1];
269 sm_ring_f0[0].next = (ring_node_sm*) &sm_ring_f0[1];
270 sm_ring_f0[0].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-1];
270 sm_ring_f0[0].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-1];
271 sm_ring_f0[0].buffer_address =
271 sm_ring_f0[0].buffer_address =
272 (int) &sm_f0[ 0 ];
272 (int) &sm_f0[ 0 ];
273
273
274 sm_ring_f0[NB_RING_NODES_SM_F0-1].next = (ring_node_sm*) &sm_ring_f0[0];
274 sm_ring_f0[NB_RING_NODES_SM_F0-1].next = (ring_node_sm*) &sm_ring_f0[0];
275 sm_ring_f0[NB_RING_NODES_SM_F0-1].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-2];
275 sm_ring_f0[NB_RING_NODES_SM_F0-1].previous = (ring_node_sm*) &sm_ring_f0[NB_RING_NODES_SM_F0-2];
276 sm_ring_f0[NB_RING_NODES_SM_F0-1].buffer_address =
276 sm_ring_f0[NB_RING_NODES_SM_F0-1].buffer_address =
277 (int) &sm_f0[ (NB_RING_NODES_SM_F0-1) * TOTAL_SIZE_SM ];
277 (int) &sm_f0[ (NB_RING_NODES_SM_F0-1) * TOTAL_SIZE_SM ];
278
278
279 for(i=1; i<NB_RING_NODES_SM_F0-1; i++)
279 for(i=1; i<NB_RING_NODES_SM_F0-1; i++)
280 {
280 {
281 sm_ring_f0[i].next = (ring_node_sm*) &sm_ring_f0[i+1];
281 sm_ring_f0[i].next = (ring_node_sm*) &sm_ring_f0[i+1];
282 sm_ring_f0[i].previous = (ring_node_sm*) &sm_ring_f0[i-1];
282 sm_ring_f0[i].previous = (ring_node_sm*) &sm_ring_f0[i-1];
283 sm_ring_f0[i].buffer_address =
283 sm_ring_f0[i].buffer_address =
284 (int) &sm_f0[ i * TOTAL_SIZE_SM ];
284 (int) &sm_f0[ i * TOTAL_SIZE_SM ];
285 }
285 }
286
286
287 // F1 RING
287 // F1 RING
288 sm_ring_f1[0].next = (ring_node_sm*) &sm_ring_f1[1];
288 sm_ring_f1[0].next = (ring_node_sm*) &sm_ring_f1[1];
289 sm_ring_f1[0].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-1];
289 sm_ring_f1[0].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-1];
290 sm_ring_f1[0].buffer_address =
290 sm_ring_f1[0].buffer_address =
291 (int) &sm_f1[ 0 ];
291 (int) &sm_f1[ 0 ];
292
292
293 sm_ring_f1[NB_RING_NODES_SM_F1-1].next = (ring_node_sm*) &sm_ring_f1[0];
293 sm_ring_f1[NB_RING_NODES_SM_F1-1].next = (ring_node_sm*) &sm_ring_f1[0];
294 sm_ring_f1[NB_RING_NODES_SM_F1-1].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-2];
294 sm_ring_f1[NB_RING_NODES_SM_F1-1].previous = (ring_node_sm*) &sm_ring_f1[NB_RING_NODES_SM_F1-2];
295 sm_ring_f1[NB_RING_NODES_SM_F1-1].buffer_address =
295 sm_ring_f1[NB_RING_NODES_SM_F1-1].buffer_address =
296 (int) &sm_f1[ (NB_RING_NODES_SM_F1-1) * TOTAL_SIZE_SM ];
296 (int) &sm_f1[ (NB_RING_NODES_SM_F1-1) * TOTAL_SIZE_SM ];
297
297
298 for(i=1; i<NB_RING_NODES_SM_F1-1; i++)
298 for(i=1; i<NB_RING_NODES_SM_F1-1; i++)
299 {
299 {
300 sm_ring_f1[i].next = (ring_node_sm*) &sm_ring_f1[i+1];
300 sm_ring_f1[i].next = (ring_node_sm*) &sm_ring_f1[i+1];
301 sm_ring_f1[i].previous = (ring_node_sm*) &sm_ring_f1[i-1];
301 sm_ring_f1[i].previous = (ring_node_sm*) &sm_ring_f1[i-1];
302 sm_ring_f1[i].buffer_address =
302 sm_ring_f1[i].buffer_address =
303 (int) &sm_f1[ i * TOTAL_SIZE_SM ];
303 (int) &sm_f1[ i * TOTAL_SIZE_SM ];
304 }
304 }
305
305
306 // F2 RING
306 // F2 RING
307 sm_ring_f2[0].next = (ring_node_sm*) &sm_ring_f2[1];
307 sm_ring_f2[0].next = (ring_node_sm*) &sm_ring_f2[1];
308 sm_ring_f2[0].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-1];
308 sm_ring_f2[0].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-1];
309 sm_ring_f2[0].buffer_address =
309 sm_ring_f2[0].buffer_address =
310 (int) &sm_f2[ 0 ];
310 (int) &sm_f2[ 0 ];
311
311
312 sm_ring_f2[NB_RING_NODES_SM_F2-1].next = (ring_node_sm*) &sm_ring_f2[0];
312 sm_ring_f2[NB_RING_NODES_SM_F2-1].next = (ring_node_sm*) &sm_ring_f2[0];
313 sm_ring_f2[NB_RING_NODES_SM_F2-1].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-2];
313 sm_ring_f2[NB_RING_NODES_SM_F2-1].previous = (ring_node_sm*) &sm_ring_f2[NB_RING_NODES_SM_F2-2];
314 sm_ring_f2[NB_RING_NODES_SM_F2-1].buffer_address =
314 sm_ring_f2[NB_RING_NODES_SM_F2-1].buffer_address =
315 (int) &sm_f2[ (NB_RING_NODES_SM_F2-1) * TOTAL_SIZE_SM ];
315 (int) &sm_f2[ (NB_RING_NODES_SM_F2-1) * TOTAL_SIZE_SM ];
316
316
317 for(i=1; i<NB_RING_NODES_SM_F2-1; i++)
317 for(i=1; i<NB_RING_NODES_SM_F2-1; i++)
318 {
318 {
319 sm_ring_f2[i].next = (ring_node_sm*) &sm_ring_f2[i+1];
319 sm_ring_f2[i].next = (ring_node_sm*) &sm_ring_f2[i+1];
320 sm_ring_f2[i].previous = (ring_node_sm*) &sm_ring_f2[i-1];
320 sm_ring_f2[i].previous = (ring_node_sm*) &sm_ring_f2[i-1];
321 sm_ring_f2[i].buffer_address =
321 sm_ring_f2[i].buffer_address =
322 (int) &sm_f2[ i * TOTAL_SIZE_SM ];
322 (int) &sm_f2[ i * TOTAL_SIZE_SM ];
323 }
323 }
324
324
325 DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0)
325 DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0)
326 DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1)
326 DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1)
327 DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2)
327 DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2)
328
328
329 spectral_matrix_regs->f0_0_address = sm_ring_f0[0].buffer_address;
329 spectral_matrix_regs->f0_0_address = sm_ring_f0[0].buffer_address;
330 DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->f0_0_address)
330 DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->f0_0_address)
331 }
331 }
332
332
333 void SM_generic_init_ring( ring_node_sm *ring, unsigned char nbNodes, volatile int sm_f[] )
333 void SM_generic_init_ring( ring_node_sm *ring, unsigned char nbNodes, volatile int sm_f[] )
334 {
334 {
335 unsigned char i;
335 unsigned char i;
336
336
337 //***************
337 //***************
338 // BUFFER ADDRESS
338 // BUFFER ADDRESS
339 for(i=0; i<nbNodes; i++)
339 for(i=0; i<nbNodes; i++)
340 {
340 {
341 ring[ i ].buffer_address = (int) &sm_f[ i * TOTAL_SIZE_SM ];
341 ring[ i ].buffer_address = (int) &sm_f[ i * TOTAL_SIZE_SM ];
342 }
342 }
343
343
344 //*****
344 //*****
345 // NEXT
345 // NEXT
346 ring[ nbNodes - 1 ].next = (ring_node_sm*) &ring[ 0 ];
346 ring[ nbNodes - 1 ].next = (ring_node_sm*) &ring[ 0 ];
347 for(i=0; i<nbNodes-1; i++)
347 for(i=0; i<nbNodes-1; i++)
348 {
348 {
349 ring[ i ].next = (ring_node_sm*) &ring[ i + 1 ];
349 ring[ i ].next = (ring_node_sm*) &ring[ i + 1 ];
350 }
350 }
351
351
352 //*********
352 //*********
353 // PREVIOUS
353 // PREVIOUS
354 ring[ 0 ].previous = (ring_node_sm*) &ring[ nbNodes -1 ];
354 ring[ 0 ].previous = (ring_node_sm*) &ring[ nbNodes -1 ];
355 for(i=1; i<nbNodes; i++)
355 for(i=1; i<nbNodes; i++)
356 {
356 {
357 ring[ i ].previous = (ring_node_sm*) &ring[ i - 1 ];
357 ring[ i ].previous = (ring_node_sm*) &ring[ i - 1 ];
358 }
358 }
359 }
359 }
360
360
361 void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes )
361 void ASM_generic_init_ring( ring_node_asm *ring, unsigned char nbNodes )
362 {
362 {
363 unsigned char i;
363 unsigned char i;
364
364
365 ring[ nbNodes - 1 ].next
365 ring[ nbNodes - 1 ].next
366 = (ring_node_asm*) &ring[ 0 ];
366 = (ring_node_asm*) &ring[ 0 ];
367
367
368 for(i=0; i<nbNodes-1; i++)
368 for(i=0; i<nbNodes-1; i++)
369 {
369 {
370 ring[ i ].next = (ring_node_asm*) &ring[ i + 1 ];
370 ring[ i ].next = (ring_node_asm*) &ring[ i + 1 ];
371 }
371 }
372 }
372 }
373
373
374 void SM_reset_current_ring_nodes( void )
374 void SM_reset_current_ring_nodes( void )
375 {
375 {
376 current_ring_node_sm_f0 = sm_ring_f0[0].next;
376 current_ring_node_sm_f0 = sm_ring_f0[0].next;
377 current_ring_node_sm_f1 = sm_ring_f1[0].next;
377 current_ring_node_sm_f1 = sm_ring_f1[0].next;
378 current_ring_node_sm_f2 = sm_ring_f2[0].next;
378 current_ring_node_sm_f2 = sm_ring_f2[0].next;
379
379
380 ring_node_for_averaging_sm_f0 = sm_ring_f0;
380 ring_node_for_averaging_sm_f0 = sm_ring_f0;
381 ring_node_for_averaging_sm_f1 = sm_ring_f1;
381 ring_node_for_averaging_sm_f1 = sm_ring_f1;
382 ring_node_for_averaging_sm_f2 = sm_ring_f2;
382 ring_node_for_averaging_sm_f2 = sm_ring_f2;
383 }
383 }
384
384
385 void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header)
385 void ASM_init_header( Header_TM_LFR_SCIENCE_ASM_t *header)
386 {
386 {
387 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
387 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
388 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
388 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
389 header->reserved = 0x00;
389 header->reserved = 0x00;
390 header->userApplication = CCSDS_USER_APP;
390 header->userApplication = CCSDS_USER_APP;
391 header->packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
391 header->packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
392 header->packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
392 header->packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
393 header->packetSequenceControl[0] = 0xc0;
393 header->packetSequenceControl[0] = 0xc0;
394 header->packetSequenceControl[1] = 0x00;
394 header->packetSequenceControl[1] = 0x00;
395 header->packetLength[0] = 0x00;
395 header->packetLength[0] = 0x00;
396 header->packetLength[1] = 0x00;
396 header->packetLength[1] = 0x00;
397 // DATA FIELD HEADER
397 // DATA FIELD HEADER
398 header->spare1_pusVersion_spare2 = 0x10;
398 header->spare1_pusVersion_spare2 = 0x10;
399 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
399 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
400 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
400 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
401 header->destinationID = TM_DESTINATION_ID_GROUND;
401 header->destinationID = TM_DESTINATION_ID_GROUND;
402 // AUXILIARY DATA HEADER
402 // AUXILIARY DATA HEADER
403 header->sid = 0x00;
403 header->sid = 0x00;
404 header->biaStatusInfo = 0x00;
404 header->biaStatusInfo = 0x00;
405 header->pa_lfr_pkt_cnt_asm = 0x00;
405 header->pa_lfr_pkt_cnt_asm = 0x00;
406 header->pa_lfr_pkt_nr_asm = 0x00;
406 header->pa_lfr_pkt_nr_asm = 0x00;
407 header->time[0] = 0x00;
407 header->time[0] = 0x00;
408 header->time[0] = 0x00;
408 header->time[0] = 0x00;
409 header->time[0] = 0x00;
409 header->time[0] = 0x00;
410 header->time[0] = 0x00;
410 header->time[0] = 0x00;
411 header->time[0] = 0x00;
411 header->time[0] = 0x00;
412 header->time[0] = 0x00;
412 header->time[0] = 0x00;
413 header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB
413 header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB
414 header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB
414 header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB
415 }
415 }
416
416
417 void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
417 void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
418 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id)
418 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id)
419 {
419 {
420 unsigned int i;
420 unsigned int i;
421 unsigned int length = 0;
421 unsigned int length = 0;
422 rtems_status_code status;
422 rtems_status_code status;
423
423
424 for (i=0; i<2; i++)
424 for (i=0; i<2; i++)
425 {
425 {
426 // (1) BUILD THE DATA
426 // (1) BUILD THE DATA
427 switch(sid)
427 switch(sid)
428 {
428 {
429 case SID_NORM_ASM_F0:
429 case SID_NORM_ASM_F0:
430 spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; // 2 packets will be sent
430 spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; // 2 packets will be sent
431 spw_ioctl_send->data = &spectral_matrix[
431 spw_ioctl_send->data = &spectral_matrix[
432 ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2
432 ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2
433 ];
433 ];
434 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0;
434 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0;
435 header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB
435 header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB
436 header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB
436 header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB
437 break;
437 break;
438 case SID_NORM_ASM_F1:
438 case SID_NORM_ASM_F1:
439 spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F1_IN_BYTES / 2; // 2 packets will be sent
439 spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F1_IN_BYTES / 2; // 2 packets will be sent
440 spw_ioctl_send->data = &spectral_matrix[
440 spw_ioctl_send->data = &spectral_matrix[
441 ( (ASM_F1_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F1) ) * NB_VALUES_PER_SM ) * 2
441 ( (ASM_F1_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F1) ) * NB_VALUES_PER_SM ) * 2
442 ];
442 ];
443 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1;
443 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1;
444 header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F1) >> 8 ); // BLK_NR MSB
444 header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F1) >> 8 ); // BLK_NR MSB
445 header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F1); // BLK_NR LSB
445 header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F1); // BLK_NR LSB
446 break;
446 break;
447 case SID_NORM_ASM_F2:
447 case SID_NORM_ASM_F2:
448 spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F2_IN_BYTES / 2; // 2 packets will be sent
448 spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F2_IN_BYTES / 2; // 2 packets will be sent
449 spw_ioctl_send->data = &spectral_matrix[
449 spw_ioctl_send->data = &spectral_matrix[
450 ( (ASM_F2_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F2) ) * NB_VALUES_PER_SM ) * 2
450 ( (ASM_F2_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F2) ) * NB_VALUES_PER_SM ) * 2
451 ];
451 ];
452 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2;
452 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2;
453 header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F2) >> 8 ); // BLK_NR MSB
453 header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F2) >> 8 ); // BLK_NR MSB
454 header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F2); // BLK_NR LSB
454 header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F2); // BLK_NR LSB
455 break;
455 break;
456 default:
456 default:
457 PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid)
457 PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid)
458 break;
458 break;
459 }
459 }
460 spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES;
460 spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES;
461 spw_ioctl_send->hdr = (char *) header;
461 spw_ioctl_send->hdr = (char *) header;
462 spw_ioctl_send->options = 0;
462 spw_ioctl_send->options = 0;
463
463
464 // (2) BUILD THE HEADER
464 // (2) BUILD THE HEADER
465 increment_seq_counter_source_id( header->packetSequenceControl, sid );
465 increment_seq_counter_source_id( header->packetSequenceControl, sid );
466 header->packetLength[0] = (unsigned char) (length>>8);
466 header->packetLength[0] = (unsigned char) (length>>8);
467 header->packetLength[1] = (unsigned char) (length);
467 header->packetLength[1] = (unsigned char) (length);
468 header->sid = (unsigned char) sid; // SID
468 header->sid = (unsigned char) sid; // SID
469 header->pa_lfr_pkt_cnt_asm = 2;
469 header->pa_lfr_pkt_cnt_asm = 2;
470 header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1);
470 header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1);
471
471
472 // (3) SET PACKET TIME
472 // (3) SET PACKET TIME
473 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
473 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
474 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
474 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
475 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
475 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
476 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
476 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
477 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
477 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
478 header->time[5] = (unsigned char) (time_management_regs->fine_time);
478 header->time[5] = (unsigned char) (time_management_regs->fine_time);
479 //
479 //
480 header->acquisitionTime[0] = header->time[0];
480 header->acquisitionTime[0] = header->time[0];
481 header->acquisitionTime[1] = header->time[1];
481 header->acquisitionTime[1] = header->time[1];
482 header->acquisitionTime[2] = header->time[2];
482 header->acquisitionTime[2] = header->time[2];
483 header->acquisitionTime[3] = header->time[3];
483 header->acquisitionTime[3] = header->time[3];
484 header->acquisitionTime[4] = header->time[4];
484 header->acquisitionTime[4] = header->time[4];
485 header->acquisitionTime[5] = header->time[5];
485 header->acquisitionTime[5] = header->time[5];
486
486
487 // (4) SEND PACKET
487 // (4) SEND PACKET
488 status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
488 status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
489 if (status != RTEMS_SUCCESSFUL) {
489 if (status != RTEMS_SUCCESSFUL) {
490 printf("in ASM_send *** ERR %d\n", (int) status);
490 printf("in ASM_send *** ERR %d\n", (int) status);
491 }
491 }
492 }
492 }
493 }
493 }
494
494
495 //*****************
495 //*****************
496 // Basic Parameters
496 // Basic Parameters
497
497
498 void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header,
498 void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header,
499 unsigned int apid, unsigned char sid,
499 unsigned int apid, unsigned char sid,
500 unsigned int packetLength, unsigned char blkNr )
500 unsigned int packetLength, unsigned char blkNr )
501 {
501 {
502 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
502 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
503 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
503 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
504 header->reserved = 0x00;
504 header->reserved = 0x00;
505 header->userApplication = CCSDS_USER_APP;
505 header->userApplication = CCSDS_USER_APP;
506 header->packetID[0] = (unsigned char) (apid >> 8);
506 header->packetID[0] = (unsigned char) (apid >> 8);
507 header->packetID[1] = (unsigned char) (apid);
507 header->packetID[1] = (unsigned char) (apid);
508 header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
508 header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
509 header->packetSequenceControl[1] = 0x00;
509 header->packetSequenceControl[1] = 0x00;
510 header->packetLength[0] = (unsigned char) (packetLength >> 8);
510 header->packetLength[0] = (unsigned char) (packetLength >> 8);
511 header->packetLength[1] = (unsigned char) (packetLength);
511 header->packetLength[1] = (unsigned char) (packetLength);
512 // DATA FIELD HEADER
512 // DATA FIELD HEADER
513 header->spare1_pusVersion_spare2 = 0x10;
513 header->spare1_pusVersion_spare2 = 0x10;
514 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
514 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
515 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
515 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
516 header->destinationID = TM_DESTINATION_ID_GROUND;
516 header->destinationID = TM_DESTINATION_ID_GROUND;
517 // AUXILIARY DATA HEADER
517 // AUXILIARY DATA HEADER
518 header->sid = sid;
518 header->sid = sid;
519 header->biaStatusInfo = 0x00;
519 header->biaStatusInfo = 0x00;
520 header->time[0] = 0x00;
520 header->time[0] = 0x00;
521 header->time[0] = 0x00;
521 header->time[0] = 0x00;
522 header->time[0] = 0x00;
522 header->time[0] = 0x00;
523 header->time[0] = 0x00;
523 header->time[0] = 0x00;
524 header->time[0] = 0x00;
524 header->time[0] = 0x00;
525 header->time[0] = 0x00;
525 header->time[0] = 0x00;
526 header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB
526 header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB
527 header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB
527 header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB
528 }
528 }
529
529
530 void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header,
530 void BP_init_header_with_spare(Header_TM_LFR_SCIENCE_BP_with_spare_t *header,
531 unsigned int apid, unsigned char sid,
531 unsigned int apid, unsigned char sid,
532 unsigned int packetLength , unsigned char blkNr)
532 unsigned int packetLength , unsigned char blkNr)
533 {
533 {
534 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
534 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
535 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
535 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
536 header->reserved = 0x00;
536 header->reserved = 0x00;
537 header->userApplication = CCSDS_USER_APP;
537 header->userApplication = CCSDS_USER_APP;
538 header->packetID[0] = (unsigned char) (apid >> 8);
538 header->packetID[0] = (unsigned char) (apid >> 8);
539 header->packetID[1] = (unsigned char) (apid);
539 header->packetID[1] = (unsigned char) (apid);
540 header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
540 header->packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
541 header->packetSequenceControl[1] = 0x00;
541 header->packetSequenceControl[1] = 0x00;
542 header->packetLength[0] = (unsigned char) (packetLength >> 8);
542 header->packetLength[0] = (unsigned char) (packetLength >> 8);
543 header->packetLength[1] = (unsigned char) (packetLength);
543 header->packetLength[1] = (unsigned char) (packetLength);
544 // DATA FIELD HEADER
544 // DATA FIELD HEADER
545 header->spare1_pusVersion_spare2 = 0x10;
545 header->spare1_pusVersion_spare2 = 0x10;
546 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
546 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
547 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
547 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
548 header->destinationID = TM_DESTINATION_ID_GROUND;
548 header->destinationID = TM_DESTINATION_ID_GROUND;
549 // AUXILIARY DATA HEADER
549 // AUXILIARY DATA HEADER
550 header->sid = sid;
550 header->sid = sid;
551 header->biaStatusInfo = 0x00;
551 header->biaStatusInfo = 0x00;
552 header->time[0] = 0x00;
552 header->time[0] = 0x00;
553 header->time[0] = 0x00;
553 header->time[0] = 0x00;
554 header->time[0] = 0x00;
554 header->time[0] = 0x00;
555 header->time[0] = 0x00;
555 header->time[0] = 0x00;
556 header->time[0] = 0x00;
556 header->time[0] = 0x00;
557 header->time[0] = 0x00;
557 header->time[0] = 0x00;
558 header->source_data_spare = 0x00;
558 header->source_data_spare = 0x00;
559 header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB
559 header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB
560 header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB
560 header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB
561 }
561 }
562
562
563 void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend, unsigned int sid )
563 void BP_send(char *data, rtems_id queue_id, unsigned int nbBytesToSend, unsigned int sid )
564 {
564 {
565 rtems_status_code status;
565 rtems_status_code status;
566
566
567 // SET THE SEQUENCE_CNT PARAMETER
567 // SET THE SEQUENCE_CNT PARAMETER
568 increment_seq_counter_source_id( (unsigned char*) &data[ PACKET_POS_SEQUENCE_CNT ], sid );
568 increment_seq_counter_source_id( (unsigned char*) &data[ PACKET_POS_SEQUENCE_CNT ], sid );
569 // SEND PACKET
569 // SEND PACKET
570 status = rtems_message_queue_send( queue_id, data, nbBytesToSend);
570 status = rtems_message_queue_send( queue_id, data, nbBytesToSend);
571 if (status != RTEMS_SUCCESSFUL)
571 if (status != RTEMS_SUCCESSFUL)
572 {
572 {
573 printf("ERR *** in BP_send *** ERR %d\n", (int) status);
573 printf("ERR *** in BP_send *** ERR %d\n", (int) status);
574 }
574 }
575 }
575 }
576
576
577 //******************
577 //******************
578 // general functions
578 // general functions
579
579
580 void reset_sm_status( void )
581 {
582 // error
583 // 10 --------------- 9 ---------------- 8 ---------------- 7 ---------
584 // input_fif0_write_2 input_fifo_write_1 input_fifo_write_0 buffer_full
585 // ---------- 5 -- 4 -- 3 -- 2 -- 1 -- 0 --
586 // ready bits f2_1 f2_0 f1_1 f1_1 f0_1 f0_0
587
588 spectral_matrix_regs->status = 0x7ff; // [0111 1111 1111]
589 }
590
580 void reset_spectral_matrix_regs( void )
591 void reset_spectral_matrix_regs( void )
581 {
592 {
582 /** This function resets the spectral matrices module registers.
593 /** This function resets the spectral matrices module registers.
583 *
594 *
584 * The registers affected by this function are located at the following offset addresses:
595 * The registers affected by this function are located at the following offset addresses:
585 *
596 *
586 * - 0x00 config
597 * - 0x00 config
587 * - 0x04 status
598 * - 0x04 status
588 * - 0x08 matrixF0_Address0
599 * - 0x08 matrixF0_Address0
589 * - 0x10 matrixFO_Address1
600 * - 0x10 matrixFO_Address1
590 * - 0x14 matrixF1_Address
601 * - 0x14 matrixF1_Address
591 * - 0x18 matrixF2_Address
602 * - 0x18 matrixF2_Address
592 *
603 *
593 */
604 */
594
605
595 spectral_matrix_regs->config = 0x00;
606 set_sm_irq_onError( 0 );
596 spectral_matrix_regs->status = 0x00;
607
608 set_sm_irq_onNewMatrix( 0 );
609
610 reset_sm_status();
597
611
598 spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->previous->buffer_address;
612 spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->previous->buffer_address;
599 spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address;
613 spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address;
600 spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->previous->buffer_address;
614 spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->previous->buffer_address;
601 spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address;
615 spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address;
602 spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->previous->buffer_address;
616 spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->previous->buffer_address;
603 spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address;
617 spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address;
604
618
605 spectral_matrix_regs->matrix_length = 0xc8; // 25 * 128 / 16 = 200 = 0xc8
619 spectral_matrix_regs->matrix_length = 0xc8; // 25 * 128 / 16 = 200 = 0xc8
606 }
620 }
607
621
608 void set_time( unsigned char *time, unsigned char * timeInBuffer )
622 void set_time( unsigned char *time, unsigned char * timeInBuffer )
609 {
623 {
610 time[0] = timeInBuffer[0];
624 time[0] = timeInBuffer[0];
611 time[1] = timeInBuffer[1];
625 time[1] = timeInBuffer[1];
612 time[2] = timeInBuffer[2];
626 time[2] = timeInBuffer[2];
613 time[3] = timeInBuffer[3];
627 time[3] = timeInBuffer[3];
614 time[4] = timeInBuffer[6];
628 time[4] = timeInBuffer[6];
615 time[5] = timeInBuffer[7];
629 time[5] = timeInBuffer[7];
616 }
630 }
617
631
618 unsigned long long int get_acquisition_time( unsigned char *timePtr )
632 unsigned long long int get_acquisition_time( unsigned char *timePtr )
619 {
633 {
620 unsigned long long int acquisitionTimeAslong;
634 unsigned long long int acquisitionTimeAslong;
621 acquisitionTimeAslong = 0x00;
635 acquisitionTimeAslong = 0x00;
622 acquisitionTimeAslong = ( (unsigned long long int) (timePtr[0] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit
636 acquisitionTimeAslong = ( (unsigned long long int) (timePtr[0] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit
623 + ( (unsigned long long int) timePtr[1] << 32 )
637 + ( (unsigned long long int) timePtr[1] << 32 )
624 + ( (unsigned long long int) timePtr[2] << 24 )
638 + ( (unsigned long long int) timePtr[2] << 24 )
625 + ( (unsigned long long int) timePtr[3] << 16 )
639 + ( (unsigned long long int) timePtr[3] << 16 )
626 + ( (unsigned long long int) timePtr[6] << 8 )
640 + ( (unsigned long long int) timePtr[6] << 8 )
627 + ( (unsigned long long int) timePtr[7] );
641 + ( (unsigned long long int) timePtr[7] );
628 return acquisitionTimeAslong;
642 return acquisitionTimeAslong;
629 }
643 }
630
644
631 void close_matrix_actions(unsigned int *nb_sm, unsigned int nb_sm_before_avf, rtems_id avf_task_id,
645 void close_matrix_actions(unsigned int *nb_sm, unsigned int nb_sm_before_avf, rtems_id avf_task_id,
632 ring_node_sm *node_for_averaging, ring_node_sm *ringNode,
646 ring_node_sm *node_for_averaging, ring_node_sm *ringNode,
633 unsigned long long int time )
647 unsigned long long int time )
634 {
648 {
635 unsigned char *timePtr;
649 unsigned char *timePtr;
636 unsigned char *coarseTimePtr;
650 unsigned char *coarseTimePtr;
637 unsigned char *fineTimePtr;
651 unsigned char *fineTimePtr;
638 rtems_status_code status_code;
652 rtems_status_code status_code;
639
653
640 timePtr = (unsigned char *) &time;
654 timePtr = (unsigned char *) &time;
641 coarseTimePtr = (unsigned char *) &node_for_averaging->coarseTime;
655 coarseTimePtr = (unsigned char *) &node_for_averaging->coarseTime;
642 fineTimePtr = (unsigned char *) &node_for_averaging->fineTime;
656 fineTimePtr = (unsigned char *) &node_for_averaging->fineTime;
643
657
644 *nb_sm = *nb_sm + 1;
658 *nb_sm = *nb_sm + 1;
645 if (*nb_sm == nb_sm_before_avf)
659 if (*nb_sm == nb_sm_before_avf)
646 {
660 {
647 node_for_averaging = ringNode;
661 node_for_averaging = ringNode;
648 coarseTimePtr[0] = timePtr[2];
662 coarseTimePtr[0] = timePtr[2];
649 coarseTimePtr[1] = timePtr[3];
663 coarseTimePtr[1] = timePtr[3];
650 coarseTimePtr[2] = timePtr[4];
664 coarseTimePtr[2] = timePtr[4];
651 coarseTimePtr[3] = timePtr[5];
665 coarseTimePtr[3] = timePtr[5];
652 fineTimePtr[2] = timePtr[6];
666 fineTimePtr[2] = timePtr[6];
653 fineTimePtr[3] = timePtr[7];
667 fineTimePtr[3] = timePtr[7];
654 if (rtems_event_send( avf_task_id, RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
668 if (rtems_event_send( avf_task_id, RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
655 {
669 {
656 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
670 status_code = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
657 }
671 }
658 *nb_sm = 0;
672 *nb_sm = 0;
659 }
673 }
660 }
674 }
661
675
662 unsigned char getSID( rtems_event_set event )
676 unsigned char getSID( rtems_event_set event )
663 {
677 {
664 unsigned char sid;
678 unsigned char sid;
665
679
666 rtems_event_set eventSetBURST;
680 rtems_event_set eventSetBURST;
667 rtems_event_set eventSetSBM;
681 rtems_event_set eventSetSBM;
668
682
669 //******
683 //******
670 // BURST
684 // BURST
671 eventSetBURST = RTEMS_EVENT_BURST_BP1_F0
685 eventSetBURST = RTEMS_EVENT_BURST_BP1_F0
672 | RTEMS_EVENT_BURST_BP1_F1
686 | RTEMS_EVENT_BURST_BP1_F1
673 | RTEMS_EVENT_BURST_BP2_F0
687 | RTEMS_EVENT_BURST_BP2_F0
674 | RTEMS_EVENT_BURST_BP2_F1;
688 | RTEMS_EVENT_BURST_BP2_F1;
675
689
676 //****
690 //****
677 // SBM
691 // SBM
678 eventSetSBM = RTEMS_EVENT_SBM_BP1_F0
692 eventSetSBM = RTEMS_EVENT_SBM_BP1_F0
679 | RTEMS_EVENT_SBM_BP1_F1
693 | RTEMS_EVENT_SBM_BP1_F1
680 | RTEMS_EVENT_SBM_BP2_F0
694 | RTEMS_EVENT_SBM_BP2_F0
681 | RTEMS_EVENT_SBM_BP2_F1;
695 | RTEMS_EVENT_SBM_BP2_F1;
682
696
683 if (event & eventSetBURST)
697 if (event & eventSetBURST)
684 {
698 {
685 sid = SID_BURST_BP1_F0;
699 sid = SID_BURST_BP1_F0;
686 }
700 }
687 else if (event & eventSetSBM)
701 else if (event & eventSetSBM)
688 {
702 {
689 sid = SID_SBM1_BP1_F0;
703 sid = SID_SBM1_BP1_F0;
690 }
704 }
691 else
705 else
692 {
706 {
693 sid = 0;
707 sid = 0;
694 }
708 }
695
709
696 return sid;
710 return sid;
697 }
711 }
698
712
@@ -1,949 +1,971
1 /** Functions and tasks related to TeleCommand handling.
1 /** Functions and tasks related to TeleCommand handling.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to handle TeleCommands:\n
6 * A group of functions to handle TeleCommands:\n
7 * action launching\n
7 * action launching\n
8 * TC parsing\n
8 * TC parsing\n
9 * ...
9 * ...
10 *
10 *
11 */
11 */
12
12
13 #include "tc_handler.h"
13 #include "tc_handler.h"
14
14
15 //***********
15 //***********
16 // RTEMS TASK
16 // RTEMS TASK
17
17
18 rtems_task actn_task( rtems_task_argument unused )
18 rtems_task actn_task( rtems_task_argument unused )
19 {
19 {
20 /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands.
20 /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands.
21 *
21 *
22 * @param unused is the starting argument of the RTEMS task
22 * @param unused is the starting argument of the RTEMS task
23 *
23 *
24 * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending
24 * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending
25 * on the incoming TeleCommand.
25 * on the incoming TeleCommand.
26 *
26 *
27 */
27 */
28
28
29 int result;
29 int result;
30 rtems_status_code status; // RTEMS status code
30 rtems_status_code status; // RTEMS status code
31 ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task
31 ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task
32 size_t size; // size of the incoming TC packet
32 size_t size; // size of the incoming TC packet
33 unsigned char subtype; // subtype of the current TC packet
33 unsigned char subtype; // subtype of the current TC packet
34 unsigned char time[6];
34 unsigned char time[6];
35 rtems_id queue_rcv_id;
35 rtems_id queue_rcv_id;
36 rtems_id queue_snd_id;
36 rtems_id queue_snd_id;
37
37
38 status = get_message_queue_id_recv( &queue_rcv_id );
38 status = get_message_queue_id_recv( &queue_rcv_id );
39 if (status != RTEMS_SUCCESSFUL)
39 if (status != RTEMS_SUCCESSFUL)
40 {
40 {
41 PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status)
41 PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status)
42 }
42 }
43
43
44 status = get_message_queue_id_send( &queue_snd_id );
44 status = get_message_queue_id_send( &queue_snd_id );
45 if (status != RTEMS_SUCCESSFUL)
45 if (status != RTEMS_SUCCESSFUL)
46 {
46 {
47 PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status)
47 PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status)
48 }
48 }
49
49
50 result = LFR_SUCCESSFUL;
50 result = LFR_SUCCESSFUL;
51 subtype = 0; // subtype of the current TC packet
51 subtype = 0; // subtype of the current TC packet
52
52
53 BOOT_PRINTF("in ACTN *** \n")
53 BOOT_PRINTF("in ACTN *** \n")
54
54
55 while(1)
55 while(1)
56 {
56 {
57 status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
57 status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
58 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
58 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
59 getTime( time ); // set time to the current time
59 getTime( time ); // set time to the current time
60 if (status!=RTEMS_SUCCESSFUL)
60 if (status!=RTEMS_SUCCESSFUL)
61 {
61 {
62 PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
62 PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
63 }
63 }
64 else
64 else
65 {
65 {
66 subtype = TC.serviceSubType;
66 subtype = TC.serviceSubType;
67 switch(subtype)
67 switch(subtype)
68 {
68 {
69 case TC_SUBTYPE_RESET:
69 case TC_SUBTYPE_RESET:
70 result = action_reset( &TC, queue_snd_id, time );
70 result = action_reset( &TC, queue_snd_id, time );
71 close_action( &TC, result, queue_snd_id );
71 close_action( &TC, result, queue_snd_id );
72 break;
72 break;
73 //
73 //
74 case TC_SUBTYPE_LOAD_COMM:
74 case TC_SUBTYPE_LOAD_COMM:
75 result = action_load_common_par( &TC );
75 result = action_load_common_par( &TC );
76 close_action( &TC, result, queue_snd_id );
76 close_action( &TC, result, queue_snd_id );
77 break;
77 break;
78 //
78 //
79 case TC_SUBTYPE_LOAD_NORM:
79 case TC_SUBTYPE_LOAD_NORM:
80 result = action_load_normal_par( &TC, queue_snd_id, time );
80 result = action_load_normal_par( &TC, queue_snd_id, time );
81 close_action( &TC, result, queue_snd_id );
81 close_action( &TC, result, queue_snd_id );
82 break;
82 break;
83 //
83 //
84 case TC_SUBTYPE_LOAD_BURST:
84 case TC_SUBTYPE_LOAD_BURST:
85 result = action_load_burst_par( &TC, queue_snd_id, time );
85 result = action_load_burst_par( &TC, queue_snd_id, time );
86 close_action( &TC, result, queue_snd_id );
86 close_action( &TC, result, queue_snd_id );
87 break;
87 break;
88 //
88 //
89 case TC_SUBTYPE_LOAD_SBM1:
89 case TC_SUBTYPE_LOAD_SBM1:
90 result = action_load_sbm1_par( &TC, queue_snd_id, time );
90 result = action_load_sbm1_par( &TC, queue_snd_id, time );
91 close_action( &TC, result, queue_snd_id );
91 close_action( &TC, result, queue_snd_id );
92 break;
92 break;
93 //
93 //
94 case TC_SUBTYPE_LOAD_SBM2:
94 case TC_SUBTYPE_LOAD_SBM2:
95 result = action_load_sbm2_par( &TC, queue_snd_id, time );
95 result = action_load_sbm2_par( &TC, queue_snd_id, time );
96 close_action( &TC, result, queue_snd_id );
96 close_action( &TC, result, queue_snd_id );
97 break;
97 break;
98 //
98 //
99 case TC_SUBTYPE_DUMP:
99 case TC_SUBTYPE_DUMP:
100 result = action_dump_par( queue_snd_id );
100 result = action_dump_par( queue_snd_id );
101 close_action( &TC, result, queue_snd_id );
101 close_action( &TC, result, queue_snd_id );
102 break;
102 break;
103 //
103 //
104 case TC_SUBTYPE_ENTER:
104 case TC_SUBTYPE_ENTER:
105 result = action_enter_mode( &TC, queue_snd_id );
105 result = action_enter_mode( &TC, queue_snd_id );
106 close_action( &TC, result, queue_snd_id );
106 close_action( &TC, result, queue_snd_id );
107 break;
107 break;
108 //
108 //
109 case TC_SUBTYPE_UPDT_INFO:
109 case TC_SUBTYPE_UPDT_INFO:
110 result = action_update_info( &TC, queue_snd_id );
110 result = action_update_info( &TC, queue_snd_id );
111 close_action( &TC, result, queue_snd_id );
111 close_action( &TC, result, queue_snd_id );
112 break;
112 break;
113 //
113 //
114 case TC_SUBTYPE_EN_CAL:
114 case TC_SUBTYPE_EN_CAL:
115 result = action_enable_calibration( &TC, queue_snd_id, time );
115 result = action_enable_calibration( &TC, queue_snd_id, time );
116 close_action( &TC, result, queue_snd_id );
116 close_action( &TC, result, queue_snd_id );
117 break;
117 break;
118 //
118 //
119 case TC_SUBTYPE_DIS_CAL:
119 case TC_SUBTYPE_DIS_CAL:
120 result = action_disable_calibration( &TC, queue_snd_id, time );
120 result = action_disable_calibration( &TC, queue_snd_id, time );
121 close_action( &TC, result, queue_snd_id );
121 close_action( &TC, result, queue_snd_id );
122 break;
122 break;
123 //
123 //
124 case TC_SUBTYPE_UPDT_TIME:
124 case TC_SUBTYPE_UPDT_TIME:
125 result = action_update_time( &TC );
125 result = action_update_time( &TC );
126 close_action( &TC, result, queue_snd_id );
126 close_action( &TC, result, queue_snd_id );
127 break;
127 break;
128 //
128 //
129 default:
129 default:
130 break;
130 break;
131 }
131 }
132 }
132 }
133 }
133 }
134 }
134 }
135
135
136 //***********
136 //***********
137 // TC ACTIONS
137 // TC ACTIONS
138
138
139 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
139 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
140 {
140 {
141 /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
141 /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
142 *
142 *
143 * @param TC points to the TeleCommand packet that is being processed
143 * @param TC points to the TeleCommand packet that is being processed
144 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
144 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
145 *
145 *
146 */
146 */
147
147
148 printf("this is the end!!!\n");
148 printf("this is the end!!!\n");
149 exit(0);
149 exit(0);
150 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
150 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
151 return LFR_DEFAULT;
151 return LFR_DEFAULT;
152 }
152 }
153
153
154 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
154 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
155 {
155 {
156 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
156 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
157 *
157 *
158 * @param TC points to the TeleCommand packet that is being processed
158 * @param TC points to the TeleCommand packet that is being processed
159 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
159 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
160 *
160 *
161 */
161 */
162
162
163 rtems_status_code status;
163 rtems_status_code status;
164 unsigned char requestedMode;
164 unsigned char requestedMode;
165 unsigned int *transitionCoarseTime_ptr;
165 unsigned int *transitionCoarseTime_ptr;
166 unsigned int transitionCoarseTime;
166 unsigned int transitionCoarseTime;
167 unsigned char * bytePosPtr;
167 unsigned char * bytePosPtr;
168
168
169 bytePosPtr = (unsigned char *) &TC->packetID;
169 bytePosPtr = (unsigned char *) &TC->packetID;
170
170
171 requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ];
171 requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ];
172 transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] );
172 transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] );
173 transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff;
173 transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff;
174
174
175 status = check_mode_value( requestedMode );
175 status = check_mode_value( requestedMode );
176
176
177 if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent
177 if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent
178 {
178 {
179 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode );
179 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode );
180 }
180 }
181 else // the mode value is consistent, check the transition
181 else // the mode value is consistent, check the transition
182 {
182 {
183 status = check_mode_transition(requestedMode);
183 status = check_mode_transition(requestedMode);
184 if (status != LFR_SUCCESSFUL)
184 if (status != LFR_SUCCESSFUL)
185 {
185 {
186 PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n")
186 PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n")
187 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
187 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
188 }
188 }
189 }
189 }
190
190
191 if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode
191 if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode
192 {
192 {
193 status = check_transition_date( transitionCoarseTime );
193 status = check_transition_date( transitionCoarseTime );
194 if (status != LFR_SUCCESSFUL)
194 if (status != LFR_SUCCESSFUL)
195 {
195 {
196 PRINTF("ERR *** in action_enter_mode *** check_transition_date\n")
196 PRINTF("ERR *** in action_enter_mode *** check_transition_date\n")
197 send_tm_lfr_tc_exe_inconsistent( TC, queue_id,
197 send_tm_lfr_tc_exe_inconsistent( TC, queue_id,
198 BYTE_POS_CP_LFR_ENTER_MODE_TIME,
198 BYTE_POS_CP_LFR_ENTER_MODE_TIME,
199 bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] );
199 bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] );
200 }
200 }
201 }
201 }
202
202
203 if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode
203 if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode
204 {
204 {
205 PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode);
205 PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode);
206 status = enter_mode( requestedMode, transitionCoarseTime );
206 status = enter_mode( requestedMode, transitionCoarseTime );
207 }
207 }
208
208
209 return status;
209 return status;
210 }
210 }
211
211
212 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
212 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
213 {
213 {
214 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
214 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
215 *
215 *
216 * @param TC points to the TeleCommand packet that is being processed
216 * @param TC points to the TeleCommand packet that is being processed
217 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
217 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
218 *
218 *
219 * @return LFR directive status code:
219 * @return LFR directive status code:
220 * - LFR_DEFAULT
220 * - LFR_DEFAULT
221 * - LFR_SUCCESSFUL
221 * - LFR_SUCCESSFUL
222 *
222 *
223 */
223 */
224
224
225 unsigned int val;
225 unsigned int val;
226 int result;
226 int result;
227 unsigned int status;
227 unsigned int status;
228 unsigned char mode;
228 unsigned char mode;
229 unsigned char * bytePosPtr;
229 unsigned char * bytePosPtr;
230
230
231 bytePosPtr = (unsigned char *) &TC->packetID;
231 bytePosPtr = (unsigned char *) &TC->packetID;
232
232
233 // check LFR mode
233 // check LFR mode
234 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1;
234 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1;
235 status = check_update_info_hk_lfr_mode( mode );
235 status = check_update_info_hk_lfr_mode( mode );
236 if (status == LFR_SUCCESSFUL) // check TDS mode
236 if (status == LFR_SUCCESSFUL) // check TDS mode
237 {
237 {
238 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4;
238 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4;
239 status = check_update_info_hk_tds_mode( mode );
239 status = check_update_info_hk_tds_mode( mode );
240 }
240 }
241 if (status == LFR_SUCCESSFUL) // check THR mode
241 if (status == LFR_SUCCESSFUL) // check THR mode
242 {
242 {
243 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f);
243 mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f);
244 status = check_update_info_hk_thr_mode( mode );
244 status = check_update_info_hk_thr_mode( mode );
245 }
245 }
246 if (status == LFR_SUCCESSFUL) // if the parameter check is successful
246 if (status == LFR_SUCCESSFUL) // if the parameter check is successful
247 {
247 {
248 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
248 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
249 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
249 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
250 val++;
250 val++;
251 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
251 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
252 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
252 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
253 }
253 }
254
254
255 result = status;
255 result = status;
256
256
257 return result;
257 return result;
258 }
258 }
259
259
260 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
260 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
261 {
261 {
262 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
262 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
263 *
263 *
264 * @param TC points to the TeleCommand packet that is being processed
264 * @param TC points to the TeleCommand packet that is being processed
265 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
265 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
266 *
266 *
267 */
267 */
268
268
269 int result;
269 int result;
270 unsigned char lfrMode;
270 unsigned char lfrMode;
271
271
272 result = LFR_DEFAULT;
272 result = LFR_DEFAULT;
273 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
273 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
274
274
275 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
275 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
276 result = LFR_DEFAULT;
276 result = LFR_DEFAULT;
277
277
278 return result;
278 return result;
279 }
279 }
280
280
281 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
281 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
282 {
282 {
283 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
283 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
284 *
284 *
285 * @param TC points to the TeleCommand packet that is being processed
285 * @param TC points to the TeleCommand packet that is being processed
286 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
286 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
287 *
287 *
288 */
288 */
289
289
290 int result;
290 int result;
291 unsigned char lfrMode;
291 unsigned char lfrMode;
292
292
293 result = LFR_DEFAULT;
293 result = LFR_DEFAULT;
294 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
294 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
295
295
296 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
296 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
297 result = LFR_DEFAULT;
297 result = LFR_DEFAULT;
298
298
299 return result;
299 return result;
300 }
300 }
301
301
302 int action_update_time(ccsdsTelecommandPacket_t *TC)
302 int action_update_time(ccsdsTelecommandPacket_t *TC)
303 {
303 {
304 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
304 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
305 *
305 *
306 * @param TC points to the TeleCommand packet that is being processed
306 * @param TC points to the TeleCommand packet that is being processed
307 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
307 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
308 *
308 *
309 * @return LFR_SUCCESSFUL
309 * @return LFR_SUCCESSFUL
310 *
310 *
311 */
311 */
312
312
313 unsigned int val;
313 unsigned int val;
314
314
315 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
315 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
316 + (TC->dataAndCRC[1] << 16)
316 + (TC->dataAndCRC[1] << 16)
317 + (TC->dataAndCRC[2] << 8)
317 + (TC->dataAndCRC[2] << 8)
318 + TC->dataAndCRC[3];
318 + TC->dataAndCRC[3];
319
319
320 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
320 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
321 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
321 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
322 val++;
322 val++;
323 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
323 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
324 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
324 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
325
325
326 return LFR_SUCCESSFUL;
326 return LFR_SUCCESSFUL;
327 }
327 }
328
328
329 //*******************
329 //*******************
330 // ENTERING THE MODES
330 // ENTERING THE MODES
331 int check_mode_value( unsigned char requestedMode )
331 int check_mode_value( unsigned char requestedMode )
332 {
332 {
333 int status;
333 int status;
334
334
335 if ( (requestedMode != LFR_MODE_STANDBY)
335 if ( (requestedMode != LFR_MODE_STANDBY)
336 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
336 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
337 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
337 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
338 {
338 {
339 status = LFR_DEFAULT;
339 status = LFR_DEFAULT;
340 }
340 }
341 else
341 else
342 {
342 {
343 status = LFR_SUCCESSFUL;
343 status = LFR_SUCCESSFUL;
344 }
344 }
345
345
346 return status;
346 return status;
347 }
347 }
348
348
349 int check_mode_transition( unsigned char requestedMode )
349 int check_mode_transition( unsigned char requestedMode )
350 {
350 {
351 /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
351 /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
352 *
352 *
353 * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
353 * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
354 *
354 *
355 * @return LFR directive status codes:
355 * @return LFR directive status codes:
356 * - LFR_SUCCESSFUL - the transition is authorized
356 * - LFR_SUCCESSFUL - the transition is authorized
357 * - LFR_DEFAULT - the transition is not authorized
357 * - LFR_DEFAULT - the transition is not authorized
358 *
358 *
359 */
359 */
360
360
361 int status;
361 int status;
362
362
363 switch (requestedMode)
363 switch (requestedMode)
364 {
364 {
365 case LFR_MODE_STANDBY:
365 case LFR_MODE_STANDBY:
366 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
366 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
367 status = LFR_DEFAULT;
367 status = LFR_DEFAULT;
368 }
368 }
369 else
369 else
370 {
370 {
371 status = LFR_SUCCESSFUL;
371 status = LFR_SUCCESSFUL;
372 }
372 }
373 break;
373 break;
374 case LFR_MODE_NORMAL:
374 case LFR_MODE_NORMAL:
375 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
375 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
376 status = LFR_DEFAULT;
376 status = LFR_DEFAULT;
377 }
377 }
378 else {
378 else {
379 status = LFR_SUCCESSFUL;
379 status = LFR_SUCCESSFUL;
380 }
380 }
381 break;
381 break;
382 case LFR_MODE_BURST:
382 case LFR_MODE_BURST:
383 if ( lfrCurrentMode == LFR_MODE_BURST ) {
383 if ( lfrCurrentMode == LFR_MODE_BURST ) {
384 status = LFR_DEFAULT;
384 status = LFR_DEFAULT;
385 }
385 }
386 else {
386 else {
387 status = LFR_SUCCESSFUL;
387 status = LFR_SUCCESSFUL;
388 }
388 }
389 break;
389 break;
390 case LFR_MODE_SBM1:
390 case LFR_MODE_SBM1:
391 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
391 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
392 status = LFR_DEFAULT;
392 status = LFR_DEFAULT;
393 }
393 }
394 else {
394 else {
395 status = LFR_SUCCESSFUL;
395 status = LFR_SUCCESSFUL;
396 }
396 }
397 break;
397 break;
398 case LFR_MODE_SBM2:
398 case LFR_MODE_SBM2:
399 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
399 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
400 status = LFR_DEFAULT;
400 status = LFR_DEFAULT;
401 }
401 }
402 else {
402 else {
403 status = LFR_SUCCESSFUL;
403 status = LFR_SUCCESSFUL;
404 }
404 }
405 break;
405 break;
406 default:
406 default:
407 status = LFR_DEFAULT;
407 status = LFR_DEFAULT;
408 break;
408 break;
409 }
409 }
410
410
411 return status;
411 return status;
412 }
412 }
413
413
414 int check_transition_date( unsigned int transitionCoarseTime )
414 int check_transition_date( unsigned int transitionCoarseTime )
415 {
415 {
416 int status;
416 int status;
417 unsigned int localCoarseTime;
417 unsigned int localCoarseTime;
418 unsigned int deltaCoarseTime;
418 unsigned int deltaCoarseTime;
419
419
420 status = LFR_SUCCESSFUL;
420 status = LFR_SUCCESSFUL;
421
421
422 if (transitionCoarseTime == 0) // transition time = 0 means an instant transition
422 if (transitionCoarseTime == 0) // transition time = 0 means an instant transition
423 {
423 {
424 status = LFR_SUCCESSFUL;
424 status = LFR_SUCCESSFUL;
425 }
425 }
426 else
426 else
427 {
427 {
428 localCoarseTime = time_management_regs->coarse_time & 0x7fffffff;
428 localCoarseTime = time_management_regs->coarse_time & 0x7fffffff;
429
429
430 if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322
430 if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322
431 {
431 {
432 status = LFR_DEFAULT;
432 status = LFR_DEFAULT;
433 PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime)
433 PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime)
434 }
434 }
435
435
436 if (status == LFR_SUCCESSFUL)
436 if (status == LFR_SUCCESSFUL)
437 {
437 {
438 deltaCoarseTime = transitionCoarseTime - localCoarseTime;
438 deltaCoarseTime = transitionCoarseTime - localCoarseTime;
439 if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323
439 if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323
440 {
440 {
441 status = LFR_DEFAULT;
441 status = LFR_DEFAULT;
442 PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime)
442 PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime)
443 }
443 }
444 }
444 }
445 }
445 }
446
446
447 return status;
447 return status;
448 }
448 }
449
449
450 int stop_current_mode( void )
450 int stop_current_mode( void )
451 {
451 {
452 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
452 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
453 *
453 *
454 * @return RTEMS directive status codes:
454 * @return RTEMS directive status codes:
455 * - RTEMS_SUCCESSFUL - task restarted successfully
455 * - RTEMS_SUCCESSFUL - task restarted successfully
456 * - RTEMS_INVALID_ID - task id invalid
456 * - RTEMS_INVALID_ID - task id invalid
457 * - RTEMS_ALREADY_SUSPENDED - task already suspended
457 * - RTEMS_ALREADY_SUSPENDED - task already suspended
458 *
458 *
459 */
459 */
460
460
461 rtems_status_code status;
461 rtems_status_code status;
462
462
463 status = RTEMS_SUCCESSFUL;
463 status = RTEMS_SUCCESSFUL;
464
464
465 // (1) mask interruptions
465 // (1) mask interruptions
466 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
466 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
467 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
467 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
468
468
469 // (2) clear interruptions
469 // reset lfr VHDL module
470 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
470 reset_lfr();
471 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
472
471
473 // (3) reset waveform picker registers
472 // (2) reset waveform picker registers
474 reset_wfp_burst_enable(); // reset burst and enable bits
473 reset_wfp_burst_enable(); // reset burst and enable bits
475 reset_wfp_status(); // reset all the status bits
474 reset_wfp_status(); // reset all the status bits
476
475
477 // (4) reset spectral matrices registers
476 // (3) reset spectral matrices registers
478 set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices
477 set_sm_irq_onNewMatrix( 0 ); // stop the spectral matrices
479 set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0
478 reset_sm_status();
479
480 reset_extractSWF(); // reset the extractSWF flag to false
480 reset_extractSWF(); // reset the extractSWF flag to false
481
481
482 // (4) clear interruptions
483 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
484 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
485
482 // <Spectral Matrices simulator>
486 // <Spectral Matrices simulator>
483 LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator
487 LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator
484 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
488 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
485 LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator
489 LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator
486 // </Spectral Matrices simulator>
490 // </Spectral Matrices simulator>
487
491
488 // suspend several tasks
492 // suspend several tasks
489 if (lfrCurrentMode != LFR_MODE_STANDBY) {
493 if (lfrCurrentMode != LFR_MODE_STANDBY) {
490 status = suspend_science_tasks();
494 status = suspend_science_tasks();
491 }
495 }
492
496
493 if (status != RTEMS_SUCCESSFUL)
497 if (status != RTEMS_SUCCESSFUL)
494 {
498 {
495 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
499 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
496 }
500 }
497
501
498 return status;
502 return status;
499 }
503 }
500
504
501 int enter_mode( unsigned char mode, unsigned int transitionCoarseTime )
505 int enter_mode( unsigned char mode, unsigned int transitionCoarseTime )
502 {
506 {
503 /** This function is launched after a mode transition validation.
507 /** This function is launched after a mode transition validation.
504 *
508 *
505 * @param mode is the mode in which LFR will be put.
509 * @param mode is the mode in which LFR will be put.
506 *
510 *
507 * @return RTEMS directive status codes:
511 * @return RTEMS directive status codes:
508 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
512 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
509 * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully
513 * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully
510 *
514 *
511 */
515 */
512
516
513 rtems_status_code status;
517 rtems_status_code status;
514
518
515 //**********************
519 //**********************
516 // STOP THE CURRENT MODE
520 // STOP THE CURRENT MODE
517 status = stop_current_mode();
521 status = stop_current_mode();
518 if (status != RTEMS_SUCCESSFUL)
522 if (status != RTEMS_SUCCESSFUL)
519 {
523 {
520 PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode)
524 PRINTF1("ERR *** in enter_mode *** stop_current_mode with mode = %d\n", mode)
521 }
525 }
522
526
523 //*************************
527 //*************************
524 // ENTER THE REQUESTED MODE
528 // ENTER THE REQUESTED MODE
525 if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST)
529 if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST)
526 || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) )
530 || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) )
527 {
531 {
528 #ifdef PRINT_TASK_STATISTICS
532 #ifdef PRINT_TASK_STATISTICS
529 rtems_cpu_usage_reset();
533 rtems_cpu_usage_reset();
530 maxCount = 0;
534 maxCount = 0;
531 #endif
535 #endif
532 status = restart_science_tasks( mode );
536 status = restart_science_tasks( mode );
533 launch_spectral_matrix( );
537 launch_spectral_matrix( );
534 launch_waveform_picker( mode, transitionCoarseTime );
538 launch_waveform_picker( mode, transitionCoarseTime );
535 // launch_spectral_matrix_simu( );
539 // launch_spectral_matrix_simu( );
536 }
540 }
537 else if ( mode == LFR_MODE_STANDBY )
541 else if ( mode == LFR_MODE_STANDBY )
538 {
542 {
539 #ifdef PRINT_TASK_STATISTICS
543 #ifdef PRINT_TASK_STATISTICS
540 rtems_cpu_usage_report();
544 rtems_cpu_usage_report();
541 #endif
545 #endif
542
546
543 #ifdef PRINT_STACK_REPORT
547 #ifdef PRINT_STACK_REPORT
544 PRINTF("stack report selected\n")
548 PRINTF("stack report selected\n")
545 rtems_stack_checker_report_usage();
549 rtems_stack_checker_report_usage();
546 #endif
550 #endif
547 PRINTF1("maxCount = %d\n", maxCount)
551 PRINTF1("maxCount = %d\n", maxCount)
548 }
552 }
549 else
553 else
550 {
554 {
551 status = RTEMS_UNSATISFIED;
555 status = RTEMS_UNSATISFIED;
552 }
556 }
553
557
554 if (status != RTEMS_SUCCESSFUL)
558 if (status != RTEMS_SUCCESSFUL)
555 {
559 {
556 PRINTF1("ERR *** in enter_mode *** status = %d\n", status)
560 PRINTF1("ERR *** in enter_mode *** status = %d\n", status)
557 status = RTEMS_UNSATISFIED;
561 status = RTEMS_UNSATISFIED;
558 }
562 }
559
563
560 return status;
564 return status;
561 }
565 }
562
566
563 int restart_science_tasks(unsigned char lfrRequestedMode )
567 int restart_science_tasks(unsigned char lfrRequestedMode )
564 {
568 {
565 /** This function is used to restart all science tasks.
569 /** This function is used to restart all science tasks.
566 *
570 *
567 * @return RTEMS directive status codes:
571 * @return RTEMS directive status codes:
568 * - RTEMS_SUCCESSFUL - task restarted successfully
572 * - RTEMS_SUCCESSFUL - task restarted successfully
569 * - RTEMS_INVALID_ID - task id invalid
573 * - RTEMS_INVALID_ID - task id invalid
570 * - RTEMS_INCORRECT_STATE - task never started
574 * - RTEMS_INCORRECT_STATE - task never started
571 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
575 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
572 *
576 *
573 * Science tasks are AVF0, PRC0, WFRM, CWF3, CW2, CWF1
577 * Science tasks are AVF0, PRC0, WFRM, CWF3, CW2, CWF1
574 *
578 *
575 */
579 */
576
580
577 rtems_status_code status[10];
581 rtems_status_code status[10];
578 rtems_status_code ret;
582 rtems_status_code ret;
579
583
580 ret = RTEMS_SUCCESSFUL;
584 ret = RTEMS_SUCCESSFUL;
581
585
582 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode );
586 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], lfrRequestedMode );
583 if (status[0] != RTEMS_SUCCESSFUL)
587 if (status[0] != RTEMS_SUCCESSFUL)
584 {
588 {
585 PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[0])
589 PRINTF1("in restart_science_task *** AVF0 ERR %d\n", status[0])
586 }
590 }
587
591
588 status[1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode );
592 status[1] = rtems_task_restart( Task_id[TASKID_PRC0], lfrRequestedMode );
589 if (status[1] != RTEMS_SUCCESSFUL)
593 if (status[1] != RTEMS_SUCCESSFUL)
590 {
594 {
591 PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[1])
595 PRINTF1("in restart_science_task *** PRC0 ERR %d\n", status[1])
592 }
596 }
593
597
594 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
598 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
595 if (status[2] != RTEMS_SUCCESSFUL)
599 if (status[2] != RTEMS_SUCCESSFUL)
596 {
600 {
597 PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[2])
601 PRINTF1("in restart_science_task *** WFRM ERR %d\n", status[2])
598 }
602 }
599
603
600 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
604 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
601 if (status[3] != RTEMS_SUCCESSFUL)
605 if (status[3] != RTEMS_SUCCESSFUL)
602 {
606 {
603 PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[3])
607 PRINTF1("in restart_science_task *** CWF3 ERR %d\n", status[3])
604 }
608 }
605
609
606 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
610 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
607 if (status[4] != RTEMS_SUCCESSFUL)
611 if (status[4] != RTEMS_SUCCESSFUL)
608 {
612 {
609 PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[4])
613 PRINTF1("in restart_science_task *** CWF2 ERR %d\n", status[4])
610 }
614 }
611
615
612 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
616 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
613 if (status[5] != RTEMS_SUCCESSFUL)
617 if (status[5] != RTEMS_SUCCESSFUL)
614 {
618 {
615 PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[5])
619 PRINTF1("in restart_science_task *** CWF1 ERR %d\n", status[5])
616 }
620 }
617
621
618 status[6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode );
622 status[6] = rtems_task_restart( Task_id[TASKID_AVF1], lfrRequestedMode );
619 if (status[6] != RTEMS_SUCCESSFUL)
623 if (status[6] != RTEMS_SUCCESSFUL)
620 {
624 {
621 PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[6])
625 PRINTF1("in restart_science_task *** AVF1 ERR %d\n", status[6])
622 }
626 }
623
627
624 status[7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode );
628 status[7] = rtems_task_restart( Task_id[TASKID_PRC1],lfrRequestedMode );
625 if (status[7] != RTEMS_SUCCESSFUL)
629 if (status[7] != RTEMS_SUCCESSFUL)
626 {
630 {
627 PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7])
631 PRINTF1("in restart_science_task *** PRC1 ERR %d\n", status[7])
628 }
632 }
629
633
630 status[8] = rtems_task_restart( Task_id[TASKID_AVF2], 1 );
634 status[8] = rtems_task_restart( Task_id[TASKID_AVF2], 1 );
631 if (status[8] != RTEMS_SUCCESSFUL)
635 if (status[8] != RTEMS_SUCCESSFUL)
632 {
636 {
633 PRINTF1("in restart_science_task *** AVF2 ERR %d\n", status[8])
637 PRINTF1("in restart_science_task *** AVF2 ERR %d\n", status[8])
634 }
638 }
635
639
636 status[9] = rtems_task_restart( Task_id[TASKID_PRC2], 1 );
640 status[9] = rtems_task_restart( Task_id[TASKID_PRC2], 1 );
637 if (status[9] != RTEMS_SUCCESSFUL)
641 if (status[9] != RTEMS_SUCCESSFUL)
638 {
642 {
639 PRINTF1("in restart_science_task *** PRC2 ERR %d\n", status[9])
643 PRINTF1("in restart_science_task *** PRC2 ERR %d\n", status[9])
640 }
644 }
641
645
642 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) ||
646 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) ||
643 (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) ||
647 (status[2] != RTEMS_SUCCESSFUL) || (status[3] != RTEMS_SUCCESSFUL) ||
644 (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ||
648 (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ||
645 (status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) ||
649 (status[6] != RTEMS_SUCCESSFUL) || (status[7] != RTEMS_SUCCESSFUL) ||
646 (status[8] != RTEMS_SUCCESSFUL) || (status[9] != RTEMS_SUCCESSFUL) )
650 (status[8] != RTEMS_SUCCESSFUL) || (status[9] != RTEMS_SUCCESSFUL) )
647 {
651 {
648 ret = RTEMS_UNSATISFIED;
652 ret = RTEMS_UNSATISFIED;
649 }
653 }
650
654
651 return ret;
655 return ret;
652 }
656 }
653
657
654 int suspend_science_tasks()
658 int suspend_science_tasks()
655 {
659 {
656 /** This function suspends the science tasks.
660 /** This function suspends the science tasks.
657 *
661 *
658 * @return RTEMS directive status codes:
662 * @return RTEMS directive status codes:
659 * - RTEMS_SUCCESSFUL - task restarted successfully
663 * - RTEMS_SUCCESSFUL - task restarted successfully
660 * - RTEMS_INVALID_ID - task id invalid
664 * - RTEMS_INVALID_ID - task id invalid
661 * - RTEMS_ALREADY_SUSPENDED - task already suspended
665 * - RTEMS_ALREADY_SUSPENDED - task already suspended
662 *
666 *
663 */
667 */
664
668
665 rtems_status_code status;
669 rtems_status_code status;
666
670
667 status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0
671 status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0
668 if (status != RTEMS_SUCCESSFUL)
672 if (status != RTEMS_SUCCESSFUL)
669 {
673 {
670 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
674 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
671 }
675 }
672 if (status == RTEMS_SUCCESSFUL) // suspend PRC0
676 if (status == RTEMS_SUCCESSFUL) // suspend PRC0
673 {
677 {
674 status = rtems_task_suspend( Task_id[TASKID_PRC0] );
678 status = rtems_task_suspend( Task_id[TASKID_PRC0] );
675 if (status != RTEMS_SUCCESSFUL)
679 if (status != RTEMS_SUCCESSFUL)
676 {
680 {
677 PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status)
681 PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status)
678 }
682 }
679 }
683 }
680 if (status == RTEMS_SUCCESSFUL) // suspend AVF1
684 if (status == RTEMS_SUCCESSFUL) // suspend AVF1
681 {
685 {
682 status = rtems_task_suspend( Task_id[TASKID_AVF1] );
686 status = rtems_task_suspend( Task_id[TASKID_AVF1] );
683 if (status != RTEMS_SUCCESSFUL)
687 if (status != RTEMS_SUCCESSFUL)
684 {
688 {
685 PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status)
689 PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status)
686 }
690 }
687 }
691 }
688 if (status == RTEMS_SUCCESSFUL) // suspend PRC1
692 if (status == RTEMS_SUCCESSFUL) // suspend PRC1
689 {
693 {
690 status = rtems_task_suspend( Task_id[TASKID_PRC1] );
694 status = rtems_task_suspend( Task_id[TASKID_PRC1] );
691 if (status != RTEMS_SUCCESSFUL)
695 if (status != RTEMS_SUCCESSFUL)
692 {
696 {
693 PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status)
697 PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status)
694 }
698 }
695 }
699 }
696 if (status == RTEMS_SUCCESSFUL) // suspend AVF2
700 if (status == RTEMS_SUCCESSFUL) // suspend AVF2
697 {
701 {
698 status = rtems_task_suspend( Task_id[TASKID_AVF2] );
702 status = rtems_task_suspend( Task_id[TASKID_AVF2] );
699 if (status != RTEMS_SUCCESSFUL)
703 if (status != RTEMS_SUCCESSFUL)
700 {
704 {
701 PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status)
705 PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status)
702 }
706 }
703 }
707 }
704 if (status == RTEMS_SUCCESSFUL) // suspend PRC2
708 if (status == RTEMS_SUCCESSFUL) // suspend PRC2
705 {
709 {
706 status = rtems_task_suspend( Task_id[TASKID_PRC2] );
710 status = rtems_task_suspend( Task_id[TASKID_PRC2] );
707 if (status != RTEMS_SUCCESSFUL)
711 if (status != RTEMS_SUCCESSFUL)
708 {
712 {
709 PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status)
713 PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status)
710 }
714 }
711 }
715 }
712 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
716 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
713 {
717 {
714 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
718 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
715 if (status != RTEMS_SUCCESSFUL)
719 if (status != RTEMS_SUCCESSFUL)
716 {
720 {
717 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
721 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
718 }
722 }
719 }
723 }
720 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
724 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
721 {
725 {
722 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
726 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
723 if (status != RTEMS_SUCCESSFUL)
727 if (status != RTEMS_SUCCESSFUL)
724 {
728 {
725 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
729 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
726 }
730 }
727 }
731 }
728 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
732 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
729 {
733 {
730 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
734 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
731 if (status != RTEMS_SUCCESSFUL)
735 if (status != RTEMS_SUCCESSFUL)
732 {
736 {
733 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
737 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
734 }
738 }
735 }
739 }
736 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
740 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
737 {
741 {
738 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
742 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
739 if (status != RTEMS_SUCCESSFUL)
743 if (status != RTEMS_SUCCESSFUL)
740 {
744 {
741 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
745 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
742 }
746 }
743 }
747 }
744
748
745 return status;
749 return status;
746 }
750 }
747
751
748 void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime )
752 void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime )
749 {
753 {
750 WFP_reset_current_ring_nodes();
754 WFP_reset_current_ring_nodes();
755
751 reset_waveform_picker_regs();
756 reset_waveform_picker_regs();
757
752 set_wfp_burst_enable_register( mode );
758 set_wfp_burst_enable_register( mode );
753
759
754 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
760 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
755 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
761 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
756
762
757 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000]
758 if (transitionCoarseTime == 0)
763 if (transitionCoarseTime == 0)
759 {
764 {
760 waveform_picker_regs->start_date = time_management_regs->coarse_time;
765 waveform_picker_regs->start_date = time_management_regs->coarse_time;
761 }
766 }
762 else
767 else
763 {
768 {
764 waveform_picker_regs->start_date = transitionCoarseTime;
769 waveform_picker_regs->start_date = transitionCoarseTime;
765 }
770 }
766
771
767 PRINTF1("commutation coarse time = %d\n", transitionCoarseTime)
772 PRINTF1("commutation coarse time = %d\n", transitionCoarseTime)
768 }
773 }
769
774
770 void launch_spectral_matrix( void )
775 void launch_spectral_matrix( void )
771 {
776 {
772 SM_reset_current_ring_nodes();
777 SM_reset_current_ring_nodes();
778
773 reset_spectral_matrix_regs();
779 reset_spectral_matrix_regs();
780
774 reset_nb_sm();
781 reset_nb_sm();
775
782
776 struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO;
783 set_sm_irq_onNewMatrix( 1 );
777 grgpio_regs->io_port_direction_register =
784
778 grgpio_regs->io_port_direction_register | 0x01; // [0000 0001], 0 = output disabled, 1 = output enabled
779 grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfffffffe; // set the bit 0 to 0
780 set_irq_on_new_ready_matrix( 1 );
781 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX );
785 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX );
782 LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX );
786 LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX );
783 set_run_matrix_spectral( 1 );
787
784 }
788 }
785
789
786 void launch_spectral_matrix_simu( void )
790 void launch_spectral_matrix_simu( void )
787 {
791 {
788 SM_reset_current_ring_nodes();
792 SM_reset_current_ring_nodes();
789 reset_spectral_matrix_regs();
793 reset_spectral_matrix_regs();
790 reset_nb_sm();
794 reset_nb_sm();
791
795
792 // Spectral Matrices simulator
796 // Spectral Matrices simulator
793 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
797 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
794 LEON_Clear_interrupt( IRQ_SM_SIMULATOR );
798 LEON_Clear_interrupt( IRQ_SM_SIMULATOR );
795 LEON_Unmask_interrupt( IRQ_SM_SIMULATOR );
799 LEON_Unmask_interrupt( IRQ_SM_SIMULATOR );
796 }
800 }
797
801
798 void set_irq_on_new_ready_matrix( unsigned char value )
802 void set_sm_irq_onNewMatrix( unsigned char value )
799 {
803 {
800 if (value == 1)
804 if (value == 1)
801 {
805 {
802 spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01;
806 spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01;
803 }
807 }
804 else
808 else
805 {
809 {
806 spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110
810 spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110
807 }
811 }
808 }
812 }
809
813
810 void set_run_matrix_spectral( unsigned char value )
814 void set_sm_irq_onError( unsigned char value )
811 {
815 {
812 if (value == 1)
816 if (value == 1)
813 {
817 {
814 spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1
818 spectral_matrix_regs->config = spectral_matrix_regs->config | 0x02;
815 }
819 }
816 else
820 else
817 {
821 {
818 spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0
822 spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffd; // 1101
819 }
823 }
820 }
824 }
821
825
822 //****************
826 //****************
823 // CLOSING ACTIONS
827 // CLOSING ACTIONS
824 void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time )
828 void update_last_TC_exe( ccsdsTelecommandPacket_t *TC, unsigned char * time )
825 {
829 {
826 /** This function is used to update the HK packets statistics after a successful TC execution.
830 /** This function is used to update the HK packets statistics after a successful TC execution.
827 *
831 *
828 * @param TC points to the TC being processed
832 * @param TC points to the TC being processed
829 * @param time is the time used to date the TC execution
833 * @param time is the time used to date the TC execution
830 *
834 *
831 */
835 */
832
836
833 unsigned int val;
837 unsigned int val;
834
838
835 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
839 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
836 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
840 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
837 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
841 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
838 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
842 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
839 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
843 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
840 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
844 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
841 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
845 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
842 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
846 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
843 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
847 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
844 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
848 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
845 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
849 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
846 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
850 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
847
851
848 val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1];
852 val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1];
849 val++;
853 val++;
850 housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8);
854 housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8);
851 housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val);
855 housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val);
852 }
856 }
853
857
854 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time )
858 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char * time )
855 {
859 {
856 /** This function is used to update the HK packets statistics after a TC rejection.
860 /** This function is used to update the HK packets statistics after a TC rejection.
857 *
861 *
858 * @param TC points to the TC being processed
862 * @param TC points to the TC being processed
859 * @param time is the time used to date the TC rejection
863 * @param time is the time used to date the TC rejection
860 *
864 *
861 */
865 */
862
866
863 unsigned int val;
867 unsigned int val;
864
868
865 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
869 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
866 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
870 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
867 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
871 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
868 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
872 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
869 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
873 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
870 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
874 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
871 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
875 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
872 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
876 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
873 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
877 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
874 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
878 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
875 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
879 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
876 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
880 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
877
881
878 val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1];
882 val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1];
879 val++;
883 val++;
880 housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8);
884 housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8);
881 housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val);
885 housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val);
882 }
886 }
883
887
884 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id )
888 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id )
885 {
889 {
886 /** This function is the last step of the TC execution workflow.
890 /** This function is the last step of the TC execution workflow.
887 *
891 *
888 * @param TC points to the TC being processed
892 * @param TC points to the TC being processed
889 * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
893 * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
890 * @param queue_id is the id of the RTEMS message queue used to send TM packets
894 * @param queue_id is the id of the RTEMS message queue used to send TM packets
891 * @param time is the time used to date the TC execution
895 * @param time is the time used to date the TC execution
892 *
896 *
893 */
897 */
894
898
895 unsigned char requestedMode;
899 unsigned char requestedMode;
896
900
897 if (result == LFR_SUCCESSFUL)
901 if (result == LFR_SUCCESSFUL)
898 {
902 {
899 if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
903 if ( !( (TC->serviceType==TC_TYPE_TIME) & (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
900 &
904 &
901 !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
905 !( (TC->serviceType==TC_TYPE_GEN) & (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
902 )
906 )
903 {
907 {
904 send_tm_lfr_tc_exe_success( TC, queue_id );
908 send_tm_lfr_tc_exe_success( TC, queue_id );
905 }
909 }
906 if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) )
910 if ( (TC->serviceType == TC_TYPE_GEN) & (TC->serviceSubType == TC_SUBTYPE_ENTER) )
907 {
911 {
908 //**********************************
912 //**********************************
909 // UPDATE THE LFRMODE LOCAL VARIABLE
913 // UPDATE THE LFRMODE LOCAL VARIABLE
910 requestedMode = TC->dataAndCRC[1];
914 requestedMode = TC->dataAndCRC[1];
911 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d);
915 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((requestedMode << 4) + 0x0d);
912 updateLFRCurrentMode();
916 updateLFRCurrentMode();
913 }
917 }
914 }
918 }
915 else if (result == LFR_EXE_ERROR)
919 else if (result == LFR_EXE_ERROR)
916 {
920 {
917 send_tm_lfr_tc_exe_error( TC, queue_id );
921 send_tm_lfr_tc_exe_error( TC, queue_id );
918 }
922 }
919 }
923 }
920
924
921 //***************************
925 //***************************
922 // Interrupt Service Routines
926 // Interrupt Service Routines
923 rtems_isr commutation_isr1( rtems_vector_number vector )
927 rtems_isr commutation_isr1( rtems_vector_number vector )
924 {
928 {
925 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
929 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
926 printf("In commutation_isr1 *** Error sending event to DUMB\n");
930 printf("In commutation_isr1 *** Error sending event to DUMB\n");
927 }
931 }
928 }
932 }
929
933
930 rtems_isr commutation_isr2( rtems_vector_number vector )
934 rtems_isr commutation_isr2( rtems_vector_number vector )
931 {
935 {
932 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
936 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
933 printf("In commutation_isr2 *** Error sending event to DUMB\n");
937 printf("In commutation_isr2 *** Error sending event to DUMB\n");
934 }
938 }
935 }
939 }
936
940
937 //****************
941 //****************
938 // OTHER FUNCTIONS
942 // OTHER FUNCTIONS
939 void updateLFRCurrentMode()
943 void updateLFRCurrentMode()
940 {
944 {
941 /** This function updates the value of the global variable lfrCurrentMode.
945 /** This function updates the value of the global variable lfrCurrentMode.
942 *
946 *
943 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
947 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
944 *
948 *
945 */
949 */
946 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
950 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
947 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
951 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
948 }
952 }
949
953
954 void set_lfr_soft_reset( unsigned char value )
955 {
956 if (value == 1)
957 {
958 time_management_regs->ctrl = time_management_regs->ctrl | 0x00000004; // [0100]
959 }
960 else
961 {
962 time_management_regs->ctrl = time_management_regs->ctrl & 0xfffffffb; // [1011]
963 }
964 }
965
966 void reset_lfr( void )
967 {
968 set_lfr_soft_reset( 1 );
969
970 set_lfr_soft_reset( 0 );
971 }
This diff has been collapsed as it changes many lines, (540 lines changed) Show them Hide them
@@ -1,1489 +1,1643
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 rings
27 // F0
27 ring_node waveform_ring_f0[NB_RING_NODES_F0];
28 ring_node waveform_ring_f0[NB_RING_NODES_F0];
28 ring_node waveform_ring_f1[NB_RING_NODES_F1];
29 ring_node waveform_ring_f2[NB_RING_NODES_F2];
30 ring_node waveform_ring_f3[NB_RING_NODES_F3];
31 ring_node *current_ring_node_f0;
29 ring_node *current_ring_node_f0;
32 ring_node *ring_node_to_send_swf_f0;
30 ring_node *ring_node_to_send_swf_f0;
31 // F1
32 ring_node waveform_ring_f1[NB_RING_NODES_F1];
33 ring_node *current_ring_node_f1;
33 ring_node *current_ring_node_f1;
34 ring_node *ring_node_to_send_swf_f1;
34 ring_node *ring_node_to_send_swf_f1;
35 ring_node *ring_node_to_send_cwf_f1;
35 ring_node *ring_node_to_send_cwf_f1;
36 // F2
37 ring_node waveform_ring_f2[NB_RING_NODES_F2];
36 ring_node *current_ring_node_f2;
38 ring_node *current_ring_node_f2;
37 ring_node *ring_node_to_send_swf_f2;
39 ring_node *ring_node_to_send_swf_f2;
38 ring_node *ring_node_to_send_cwf_f2;
40 ring_node *ring_node_to_send_cwf_f2;
41 // F3
42 ring_node waveform_ring_f3[NB_RING_NODES_F3];
39 ring_node *current_ring_node_f3;
43 ring_node *current_ring_node_f3;
40 ring_node *ring_node_to_send_cwf_f3;
44 ring_node *ring_node_to_send_cwf_f3;
41
45
42 bool extractSWF = false;
46 bool extractSWF = false;
43 bool swf_f0_ready = false;
47 bool swf_f0_ready = false;
44 bool swf_f1_ready = false;
48 bool swf_f1_ready = false;
45 bool swf_f2_ready = false;
49 bool swf_f2_ready = false;
46
50
47 int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
51 int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) ];
52 ring_node ring_node_wf_snap_extracted;
48
53
49 //*********************
54 //*********************
50 // Interrupt SubRoutine
55 // Interrupt SubRoutine
51
56
52 void reset_extractSWF( void )
57 void reset_extractSWF( void )
53 {
58 {
54 extractSWF = false;
59 extractSWF = false;
55 swf_f0_ready = false;
60 swf_f0_ready = false;
56 swf_f1_ready = false;
61 swf_f1_ready = false;
57 swf_f2_ready = false;
62 swf_f2_ready = false;
58 }
63 }
59
64
60 void change_f0_buffer( void )
61 {
62 ring_node_to_send_swf_f0 = current_ring_node_f0;
63 current_ring_node_f0 = current_ring_node_f0->next;
64 if ( (waveform_picker_regs->status & 0x01) == 0x01)
65 {
66 ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_0_coarse_time;
67 ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_0_fine_time;
68 waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address;
69 }
70 else if ( (waveform_picker_regs->status & 0x02) == 0x02)
71 {
72 ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_1_coarse_time;
73 ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_1_fine_time;
74 waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address;
75 }
76 }
77
78 void change_f1_buffer( ring_node *ring_node_to_send )
79 {
80 ring_node_to_send = current_ring_node_f1;
81 current_ring_node_f1 = current_ring_node_f1->next;
82 if ( (waveform_picker_regs->status & 0x04) == 0x04)
83 {
84 ring_node_to_send->coarseTime = waveform_picker_regs->f1_0_coarse_time;
85 ring_node_to_send->fineTime = waveform_picker_regs->f1_0_fine_time;
86 waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address;
87 }
88 else if ( (waveform_picker_regs->status & 0x08) == 0x08)
89 {
90 ring_node_to_send->coarseTime = waveform_picker_regs->f1_1_coarse_time;
91 ring_node_to_send->fineTime = waveform_picker_regs->f1_1_fine_time;
92 waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address;
93 }
94 }
95
96 void change_f2_buffer( ring_node *ring_node_to_send )
97 {
98 ring_node_to_send = current_ring_node_f2;
99 current_ring_node_f2 = current_ring_node_f2->next;
100 if ( (waveform_picker_regs->status & 0x10) == 0x10)
101 {
102 ring_node_to_send->coarseTime = waveform_picker_regs->f2_0_coarse_time;
103 ring_node_to_send->fineTime = waveform_picker_regs->f2_0_fine_time;
104 waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address;
105 }
106 else if ( (waveform_picker_regs->status & 0x20) == 0x20)
107 {
108 ring_node_to_send->coarseTime = waveform_picker_regs->f2_1_coarse_time;
109 ring_node_to_send->fineTime = waveform_picker_regs->f2_1_fine_time;
110 waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address;
111 }
112 }
113
114 void waveforms_isr_f3( void )
65 void waveforms_isr_f3( void )
115 {
66 {
116 rtems_status_code spare_status;
67 rtems_status_code spare_status;
117
68
118 if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_BURST) // in BURST the data are used to place v, e1 and e2 in the HK packet
69 if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_BURST) // in BURST the data are used to place v, e1 and e2 in the HK packet
119 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
70 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
120 { // 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
121 if ((waveform_picker_regs->status & 0x40) == 0x40){ // [0100 0000] f3 buffer 0 is full
72 //***
122 // (1) change the receiving buffer for the waveform picker
73 // F3
123 ring_node_to_send_cwf_f3 = current_ring_node_f3;
74 if ( (waveform_picker_regs->status & 0xc0) != 0x00 ) { // [1100 0000] check the f3 full bits
124 current_ring_node_f3 = current_ring_node_f3->next;
75 ring_node_to_send_cwf_f3 = current_ring_node_f3->previous;
125 waveform_picker_regs->addr_data_f3_0 = current_ring_node_f3->buffer_address;
76 current_ring_node_f3 = current_ring_node_f3->next;
126 // (2) send an event for the waveforms transmission
77 if ((waveform_picker_regs->status & 0x40) == 0x40){ // [0100 0000] f3 buffer 0 is full
78 ring_node_to_send_cwf_f3->coarseTime = waveform_picker_regs->f3_0_coarse_time;
79 ring_node_to_send_cwf_f3->fineTime = waveform_picker_regs->f3_0_fine_time;
80 waveform_picker_regs->addr_data_f3_0 = current_ring_node_f3->buffer_address;
81 waveform_picker_regs->status = waveform_picker_regs->status & 0x00008840; // [1000 1000 0100 0000]
82 }
83 else if ((waveform_picker_regs->status & 0x80) == 0x80){ // [1000 0000] f3 buffer 1 is full
84 ring_node_to_send_cwf_f3->coarseTime = waveform_picker_regs->f3_1_coarse_time;
85 ring_node_to_send_cwf_f3->fineTime = waveform_picker_regs->f3_1_fine_time;
86 waveform_picker_regs->addr_data_f3_1 = current_ring_node_f3->buffer_address;
87 waveform_picker_regs->status = waveform_picker_regs->status & 0x00008880; // [1000 1000 1000 0000]
88 }
127 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
89 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
128 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
90 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 );
129 }
91 }
130 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2);
92 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2);
131 waveform_picker_regs->status = waveform_picker_regs->status & 0xffff77bf; // reset f3 bits to 0, [0111 0111 1011 1111]
132 }
133 else if ((waveform_picker_regs->status & 0x80) == 0x80){ // [1000 0000] f3 buffer 1 is full
134 // (1) change the receiving buffer for the waveform picker
135 ring_node_to_send_cwf_f3 = current_ring_node_f3;
136 current_ring_node_f3 = current_ring_node_f3->next;
137 waveform_picker_regs->addr_data_f3_1 = current_ring_node_f3->buffer_address;
138 // (2) send an event for the waveforms transmission
139 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
140 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
141 }
142 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2);
143 waveform_picker_regs->status = waveform_picker_regs->status & 0xffff777f; // reset f3 bits to 0, [0111 0111 0111 1111]
144 }
93 }
145 }
94 }
146 }
95 }
147
96
148 void waveforms_isr_normal( void )
97 void waveforms_isr_normal( void )
149 {
98 {
150 rtems_status_code status;
99 rtems_status_code status;
151
100
152 if ( ( (waveform_picker_regs->status & 0x30) != 0x00 ) // [0011 0000] check the f2 full bits
101 if ( ( (waveform_picker_regs->status & 0x30) != 0x00 ) // [0011 0000] check the f2 full bits
153 || ( (waveform_picker_regs->status & 0x0c) != 0x00 ) // [0000 1100] check the f1 full bits
102 && ( (waveform_picker_regs->status & 0x0c) != 0x00 ) // [0000 1100] check the f1 full bits
154 || ( (waveform_picker_regs->status & 0x03) != 0x00 )) // [0000 0011] check the f0 full bits
103 && ( (waveform_picker_regs->status & 0x03) != 0x00 )) // [0000 0011] check the f0 full bits
155 {
104 {
156 // change F0 ring node
105 //***
157 change_f0_buffer();
106 // F0
158 // change F1 ring node
107 ring_node_to_send_swf_f0 = current_ring_node_f0->previous;
159 change_f1_buffer( ring_node_to_send_swf_f1 );
108 current_ring_node_f0 = current_ring_node_f0->next;
160 // change F2 ring node
109 if ( (waveform_picker_regs->status & 0x01) == 0x01)
161 change_f2_buffer( ring_node_to_send_swf_f2 );
110 {
111
112 ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_0_coarse_time;
113 ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_0_fine_time;
114 waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address;
115 waveform_picker_regs->status = waveform_picker_regs->status & 0x00001101; // [0001 0001 0000 0001]
116 }
117 else if ( (waveform_picker_regs->status & 0x02) == 0x02)
118 {
119 ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_1_coarse_time;
120 ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_1_fine_time;
121 waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address;
122 waveform_picker_regs->status = waveform_picker_regs->status & 0x00001102; // [0001 0001 0000 0010]
123 }
124
125 //***
126 // F1
127 ring_node_to_send_swf_f1 = current_ring_node_f1->previous;
128 current_ring_node_f1 = current_ring_node_f1->next;
129 if ( (waveform_picker_regs->status & 0x04) == 0x04)
130 {
131 ring_node_to_send_swf_f1->coarseTime = waveform_picker_regs->f1_0_coarse_time;
132 ring_node_to_send_swf_f1->fineTime = waveform_picker_regs->f1_0_fine_time;
133 waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address;
134 waveform_picker_regs->status = waveform_picker_regs->status & 0x00002204; // [0010 0010 0000 0100] f1 bits = 0
135 }
136 else if ( (waveform_picker_regs->status & 0x08) == 0x08)
137 {
138 ring_node_to_send_swf_f1->coarseTime = waveform_picker_regs->f1_1_coarse_time;
139 ring_node_to_send_swf_f1->fineTime = waveform_picker_regs->f1_1_fine_time;
140 waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address;
141 waveform_picker_regs->status = waveform_picker_regs->status & 0x00002208; // [0010 0010 0000 1000] f1 bits = 0
142 }
143
144 //***
145 // F2
146 ring_node_to_send_swf_f2 = current_ring_node_f2->previous;
147 current_ring_node_f2 = current_ring_node_f2->next;
148 if ( (waveform_picker_regs->status & 0x10) == 0x10)
149 {
150 ring_node_to_send_swf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time;
151 ring_node_to_send_swf_f2->fineTime = waveform_picker_regs->f2_0_fine_time;
152 waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address;
153 waveform_picker_regs->status = waveform_picker_regs->status & 0x00004410; // [0100 0100 0001 0000]
154 }
155 else if ( (waveform_picker_regs->status & 0x20) == 0x20)
156 {
157 ring_node_to_send_swf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time;
158 ring_node_to_send_swf_f2->fineTime = waveform_picker_regs->f2_1_fine_time;
159 waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address;
160 waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000]
161 }
162 //
162 //
163 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL );
163 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL );
164 if ( status != RTEMS_SUCCESSFUL)
164 if ( status != RTEMS_SUCCESSFUL)
165 {
165 {
166 status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
166 status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 );
167 }
167 }
168 // update status bits except f3 bits
169 waveform_picker_regs->status = waveform_picker_regs->status & 0xffff00c0; // [1000 1000 1100 0000]
170 }
168 }
171 }
169 }
172
170
173 void waveforms_isr_burst( void )
171 void waveforms_isr_burst( void )
174 {
172 {
175 rtems_status_code spare_status;
173 rtems_status_code spare_status;
176
174
177 if ( (waveform_picker_regs->status & 0x30) != 0 ){ // [0100] check the f2 full bit
175 if ( (waveform_picker_regs->status & 0x30) != 0 ){ // [0100] check the f2 full bit
178 // (1) change the receiving buffer for the waveform picker
176 // (1) change the receiving buffer for the waveform picker
179 change_f2_buffer( ring_node_to_send_cwf_f2 );
177 ring_node_to_send_cwf_f2 = current_ring_node_f2->previous;
178 current_ring_node_f2 = current_ring_node_f2->next;
179 if ( (waveform_picker_regs->status & 0x10) == 0x10)
180 {
181 ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time;
182 ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_0_fine_time;
183 waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address;
184 waveform_picker_regs->status = waveform_picker_regs->status & 0x00004410; // [0100 0100 0001 0000]
185 }
186 else if ( (waveform_picker_regs->status & 0x20) == 0x20)
187 {
188 ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time;
189 ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_1_fine_time;
190 waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address;
191 waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000]
192 }
180 // (2) send an event for the waveforms transmission
193 // (2) send an event for the waveforms transmission
181 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
194 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
182 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
195 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 );
183 }
196 }
184 // update f2 status bits only
185 waveform_picker_regs->status = waveform_picker_regs->status & 0xffffbbcf; // [1011 1011 1100 1111] f2 bit = 0
186 }
197 }
187 }
198 }
188
199
189 void waveforms_isr_sbm1( void )
200 void waveforms_isr_sbm1( void )
190 {
201 {
191 rtems_status_code status;
202 rtems_status_code status;
192 rtems_status_code spare_status;
203 rtems_status_code spare_status;
193
204
194 //***
205 //***
195 // F1
206 // F1
196 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
207 if ( (waveform_picker_regs->status & 0x0c) != 0x00 ) { // [0000 1100] check the f1 full bits
197 // (1) change the receiving buffer for the waveform picker
208 // (1) change the receiving buffer for the waveform picker
198 change_f1_buffer( ring_node_to_send_cwf_f1 );
209 ring_node_to_send_cwf_f1 = current_ring_node_f1->previous;
210 current_ring_node_f1 = current_ring_node_f1->next;
211 if ( (waveform_picker_regs->status & 0x04) == 0x04)
212 {
213 ring_node_to_send_cwf_f1->coarseTime = waveform_picker_regs->f1_0_coarse_time;
214 ring_node_to_send_cwf_f1->fineTime = waveform_picker_regs->f1_0_fine_time;
215 waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address;
216 waveform_picker_regs->status = waveform_picker_regs->status & 0x00002204; // [0010 0010 0000 0100] f1 bits = 0
217 }
218 else if ( (waveform_picker_regs->status & 0x08) == 0x08)
219 {
220 ring_node_to_send_cwf_f1->coarseTime = waveform_picker_regs->f1_1_coarse_time;
221 ring_node_to_send_cwf_f1->fineTime = waveform_picker_regs->f1_1_fine_time;
222 waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address;
223 waveform_picker_regs->status = waveform_picker_regs->status & 0x00002208; // [0010 0010 0000 1000] f1 bits = 0
224 }
199 // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed)
225 // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed)
200 status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 );
226 status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 );
201 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0
202 }
227 }
203
228
204 //***
229 //***
205 // F0
230 // F0
206 if ( (waveform_picker_regs->status & 0x03) != 0x00 ) { // [0000 0011] one f0 buffer is full
231 if ( (waveform_picker_regs->status & 0x03) != 0x00 ) { // [0000 0011] check the f0 full bits
207 swf_f0_ready = true;
232 swf_f0_ready = true;
208 change_f0_buffer();
233 // change f0 buffer
234 ring_node_to_send_swf_f0 = current_ring_node_f0->previous;
235 current_ring_node_f0 = current_ring_node_f0->next;
236 if ( (waveform_picker_regs->status & 0x01) == 0x01)
237 {
238
239 ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_0_coarse_time;
240 ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_0_fine_time;
241 waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address;
242 waveform_picker_regs->status = waveform_picker_regs->status & 0x00001101; // [0001 0001 0000 0001]
243 }
244 else if ( (waveform_picker_regs->status & 0x02) == 0x02)
245 {
246 ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_1_coarse_time;
247 ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_1_fine_time;
248 waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address;
249 waveform_picker_regs->status = waveform_picker_regs->status & 0x00001102; // [0001 0001 0000 0010]
250 }
209 }
251 }
210
252
211 //***
253 //***
212 // F2
254 // F2
213 if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit
255 if ( (waveform_picker_regs->status & 0x30) != 0x00 ) { // [0011 0000] check the f2 full bits
214 swf_f2_ready = true;
256 swf_f2_ready = true;
215 change_f2_buffer( ring_node_to_send_swf_f2 );
257 // change f2 buffer
258 ring_node_to_send_swf_f2 = current_ring_node_f2->previous;
259 current_ring_node_f2 = current_ring_node_f2->next;
260 if ( (waveform_picker_regs->status & 0x10) == 0x10)
261 {
262 ring_node_to_send_swf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time;
263 ring_node_to_send_swf_f2->fineTime = waveform_picker_regs->f2_0_fine_time;
264 waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address;
265 waveform_picker_regs->status = waveform_picker_regs->status & 0x00004410; // [0100 0100 0001 0000]
266 }
267 else if ( (waveform_picker_regs->status & 0x20) == 0x20)
268 {
269 ring_node_to_send_swf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time;
270 ring_node_to_send_swf_f2->fineTime = waveform_picker_regs->f2_1_fine_time;
271 waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address;
272 waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000]
273 }
274 // start the snapshots transmission
216 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL)
275 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL)
217 {
276 {
218 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
277 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 );
219 }
278 }
220 }
279 }
221 }
280 }
222
281
223 void waveforms_isr_sbm2( void )
282 void waveforms_isr_sbm2( void )
224 {
283 {
225 rtems_status_code status;
284 rtems_status_code status;
226
285
227 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
286 //***
287 // F2
288 if ( (waveform_picker_regs->status & 0x30) != 0x00 ) { // [0011 0000] check the f2 full bit
228 // (1) change the receiving buffer for the waveform picker
289 // (1) change the receiving buffer for the waveform picker
229 change_f2_buffer( ring_node_to_send_cwf_f2 );
290 ring_node_to_send_cwf_f2 = current_ring_node_f2->previous;
291 current_ring_node_f2 = current_ring_node_f2->next;
292 if ( (waveform_picker_regs->status & 0x10) == 0x10)
293 {
294 ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time;
295 ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_0_fine_time;
296 waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address;
297 waveform_picker_regs->status = waveform_picker_regs->status & 0x00004410; // [0100 0100 0001 0000]
298 }
299 else if ( (waveform_picker_regs->status & 0x20) == 0x20)
300 {
301 ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time;
302 ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_1_fine_time;
303 waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address;
304 waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000]
305 }
230 // (2) send an event for the waveforms transmission
306 // (2) send an event for the waveforms transmission
231 status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 );
307 status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 );
232 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
233 }
308 }
234 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
309
310 //***
311 // F0
312 if ( (waveform_picker_regs->status & 0x03) != 0x00 ) { // [0000 0011] check the f0 full bit
235 swf_f0_ready = true;
313 swf_f0_ready = true;
236 change_f0_buffer();
314 // change f0 buffer
237 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0
315 ring_node_to_send_swf_f0 = current_ring_node_f0->previous;
316 current_ring_node_f0 = current_ring_node_f0->next;
317 if ( (waveform_picker_regs->status & 0x01) == 0x01)
318 {
319
320 ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_0_coarse_time;
321 ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_0_fine_time;
322 waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address;
323 waveform_picker_regs->status = waveform_picker_regs->status & 0x00001101; // [0001 0001 0000 0001]
324 }
325 else if ( (waveform_picker_regs->status & 0x02) == 0x02)
326 {
327 ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_1_coarse_time;
328 ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_1_fine_time;
329 waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address;
330 waveform_picker_regs->status = waveform_picker_regs->status & 0x00001102; // [0001 0001 0000 0010]
331 }
238 }
332 }
239 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
333
334 //***
335 // F1
336 if ( (waveform_picker_regs->status & 0x0c) != 0x00 ) { // [0000 1100] check the f1 full bit
240 swf_f1_ready = true;
337 swf_f1_ready = true;
241 change_f1_buffer( ring_node_to_send_swf_f1 );
338 ring_node_to_send_swf_f1 = current_ring_node_f1->previous;
242 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0
339 current_ring_node_f1 = current_ring_node_f1->next;
340 if ( (waveform_picker_regs->status & 0x04) == 0x04)
341 {
342 ring_node_to_send_swf_f1->coarseTime = waveform_picker_regs->f1_0_coarse_time;
343 ring_node_to_send_swf_f1->fineTime = waveform_picker_regs->f1_0_fine_time;
344 waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address;
345 waveform_picker_regs->status = waveform_picker_regs->status & 0x00002204; // [0010 0010 0000 0100] f1 bits = 0
346 }
347 else if ( (waveform_picker_regs->status & 0x08) == 0x08)
348 {
349 ring_node_to_send_swf_f1->coarseTime = waveform_picker_regs->f1_1_coarse_time;
350 ring_node_to_send_swf_f1->fineTime = waveform_picker_regs->f1_1_fine_time;
351 waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address;
352 waveform_picker_regs->status = waveform_picker_regs->status & 0x00002208; // [0010 0010 0000 1000] f1 bits = 0
353 }
243 }
354 }
244 }
355 }
245
356
246 rtems_isr waveforms_isr( rtems_vector_number vector )
357 rtems_isr waveforms_isr( rtems_vector_number vector )
247 {
358 {
248 /** This is the interrupt sub routine called by the waveform picker core.
359 /** This is the interrupt sub routine called by the waveform picker core.
249 *
360 *
250 * This ISR launch different actions depending mainly on two pieces of information:
361 * This ISR launch different actions depending mainly on two pieces of information:
251 * 1. the values read in the registers of the waveform picker.
362 * 1. the values read in the registers of the waveform picker.
252 * 2. the current LFR mode.
363 * 2. the current LFR mode.
253 *
364 *
254 */
365 */
255
366
256 // STATUS
367 // STATUS
257 // new error error buffer full
368 // new error error buffer full
258 // 15 14 13 12 11 10 9 8
369 // 15 14 13 12 11 10 9 8
259 // f3 f2 f1 f0 f3 f2 f1 f0
370 // f3 f2 f1 f0 f3 f2 f1 f0
260 //
371 //
261 // ready buffer
372 // ready buffer
262 // 7 6 5 4 3 2 1 0
373 // 7 6 5 4 3 2 1 0
263 // f3_1 f3_0 f2_1 f2_0 f1_1 f1_0 f0_1 f0_0
374 // f3_1 f3_0 f2_1 f2_0 f1_1 f1_0 f0_1 f0_0
264
375
265 rtems_status_code spare_status;
376 rtems_status_code spare_status;
266
377
267 waveforms_isr_f3();
378 waveforms_isr_f3();
268
379
269 if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits
380 if ( (waveform_picker_regs->status & 0xff00) != 0x00) // [1111 1111 0000 0000] check the error bits
270 {
381 {
271 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
382 spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_10 );
272 }
383 }
273
384
274 switch(lfrCurrentMode)
385 switch(lfrCurrentMode)
275 {
386 {
276 //********
387 //********
277 // STANDBY
388 // STANDBY
278 case(LFR_MODE_STANDBY):
389 case(LFR_MODE_STANDBY):
279 break;
390 break;
280
391
281 //******
392 //******
282 // NORMAL
393 // NORMAL
283 case(LFR_MODE_NORMAL):
394 case(LFR_MODE_NORMAL):
284 waveforms_isr_normal();
395 waveforms_isr_normal();
285 break;
396 break;
286
397
287 //******
398 //******
288 // BURST
399 // BURST
289 case(LFR_MODE_BURST):
400 case(LFR_MODE_BURST):
290 waveforms_isr_burst();
401 waveforms_isr_burst();
291 break;
402 break;
292
403
293 //*****
404 //*****
294 // SBM1
405 // SBM1
295 case(LFR_MODE_SBM1):
406 case(LFR_MODE_SBM1):
296 waveforms_isr_sbm1();
407 waveforms_isr_sbm1();
297 break;
408 break;
298
409
299 //*****
410 //*****
300 // SBM2
411 // SBM2
301 case(LFR_MODE_SBM2):
412 case(LFR_MODE_SBM2):
302 waveforms_isr_sbm2();
413 waveforms_isr_sbm2();
303 break;
414 break;
304
415
305 //********
416 //********
306 // DEFAULT
417 // DEFAULT
307 default:
418 default:
308 break;
419 break;
309 }
420 }
310 }
421 }
311
422
312 //************
423 //************
313 // RTEMS TASKS
424 // RTEMS TASKS
314
425
315 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
426 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
316 {
427 {
317 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
428 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
318 *
429 *
319 * @param unused is the starting argument of the RTEMS task
430 * @param unused is the starting argument of the RTEMS task
320 *
431 *
321 * The following data packets are sent by this task:
432 * The following data packets are sent by this task:
322 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
433 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
323 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
434 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
324 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
435 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
325 *
436 *
326 */
437 */
327
438
328 rtems_event_set event_out;
439 rtems_event_set event_out;
329 rtems_id queue_id;
440 rtems_id queue_id;
330 rtems_status_code status;
441 rtems_status_code status;
331 bool resynchronisationEngaged;
442 bool resynchronisationEngaged;
332
443
333 resynchronisationEngaged = false;
444 resynchronisationEngaged = false;
334
445
335 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
446 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
336 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
447 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
337 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
448 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
338
449
339 status = get_message_queue_id_send( &queue_id );
450 status = get_message_queue_id_send( &queue_id );
340 if (status != RTEMS_SUCCESSFUL)
451 if (status != RTEMS_SUCCESSFUL)
341 {
452 {
342 PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status)
453 PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status)
343 }
454 }
344
455
345 BOOT_PRINTF("in WFRM ***\n")
456 BOOT_PRINTF("in WFRM ***\n")
346
457
347 while(1){
458 while(1){
348 // wait for an RTEMS_EVENT
459 // wait for an RTEMS_EVENT
349 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
460 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
350 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
461 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
351 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
462 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
352 if(resynchronisationEngaged == false)
463 if(resynchronisationEngaged == false)
353 { // engage resynchronisation
464 { // engage resynchronisation
354 snapshot_resynchronization( (unsigned char *) ring_node_to_send_swf_f0->buffer_address);
465 snapshot_resynchronization( (unsigned char *) ring_node_to_send_swf_f0->buffer_address);
355 resynchronisationEngaged = true;
466 resynchronisationEngaged = true;
356 }
467 }
357 else
468 else
358 { // reset delta_snapshot to the nominal value
469 { // reset delta_snapshot to the nominal value
359 PRINTF("no resynchronisation, reset delta_snapshot to the nominal value\n")
470 PRINTF("no resynchronisation, reset delta_snapshot to the nominal value\n")
360 set_wfp_delta_snapshot();
471 set_wfp_delta_snapshot();
361 resynchronisationEngaged = false;
472 resynchronisationEngaged = false;
362 }
473 }
363 //
474 //
364
475
365 if (event_out == RTEMS_EVENT_MODE_NORMAL)
476 if (event_out == RTEMS_EVENT_MODE_NORMAL)
366 {
477 {
367 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n")
478 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n")
368 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
479 send_waveform_SWF( ring_node_to_send_swf_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
369 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
480 send_waveform_SWF( ring_node_to_send_swf_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
370 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
481 send_waveform_SWF( ring_node_to_send_swf_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
371 }
482 }
372 if (event_out == RTEMS_EVENT_MODE_SBM1)
483 if (event_out == RTEMS_EVENT_MODE_SBM1)
373 {
484 {
374 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n")
485 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n")
375 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
486 send_waveform_SWF( ring_node_to_send_swf_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
376 send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F1, headerSWF_F1, queue_id);
487 send_waveform_SWF( &ring_node_wf_snap_extracted, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
377 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
488 send_waveform_SWF( ring_node_to_send_swf_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
378 }
489 }
379 if (event_out == RTEMS_EVENT_MODE_SBM2)
490 if (event_out == RTEMS_EVENT_MODE_SBM2)
380 {
491 {
381 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n")
492 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n")
382 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
493 send_waveform_SWF( ring_node_to_send_swf_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
383 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
494 send_waveform_SWF( ring_node_to_send_swf_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
384 send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F2, headerSWF_F2, queue_id);
495 send_waveform_SWF( &ring_node_wf_snap_extracted, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
385 }
496 }
386 }
497 }
387 }
498 }
388
499
389 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
500 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
390 {
501 {
391 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
502 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
392 *
503 *
393 * @param unused is the starting argument of the RTEMS task
504 * @param unused is the starting argument of the RTEMS task
394 *
505 *
395 * The following data packet is sent by this task:
506 * The following data packet is sent by this task:
396 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
507 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
397 *
508 *
398 */
509 */
399
510
400 rtems_event_set event_out;
511 rtems_event_set event_out;
401 rtems_id queue_id;
512 rtems_id queue_id;
402 rtems_status_code status;
513 rtems_status_code status;
403
514
404 init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 );
515 init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 );
405 init_header_continuous_cwf3_light_table( headerCWF_F3_light );
516 init_header_continuous_cwf3_light_table( headerCWF_F3_light );
406
517
407 status = get_message_queue_id_send( &queue_id );
518 status = get_message_queue_id_send( &queue_id );
408 if (status != RTEMS_SUCCESSFUL)
519 if (status != RTEMS_SUCCESSFUL)
409 {
520 {
410 PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status)
521 PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status)
411 }
522 }
412
523
413 BOOT_PRINTF("in CWF3 ***\n")
524 BOOT_PRINTF("in CWF3 ***\n")
414
525
415 while(1){
526 while(1){
416 // wait for an RTEMS_EVENT
527 // wait for an RTEMS_EVENT
417 rtems_event_receive( RTEMS_EVENT_0,
528 rtems_event_receive( RTEMS_EVENT_0,
418 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
529 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
419 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
530 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
420 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode==LFR_MODE_SBM2) )
531 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode==LFR_MODE_SBM2) )
421 {
532 {
422 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
533 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
423 {
534 {
424 PRINTF("send CWF_LONG_F3\n")
535 PRINTF("send CWF_LONG_F3\n")
425 send_waveform_CWF(
536 send_waveform_CWF( ring_node_to_send_cwf_f3,
426 (volatile int*) ring_node_to_send_cwf_f3->buffer_address,
427 SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
537 SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
428 }
538 }
429 else
539 else
430 {
540 {
431 PRINTF("send CWF_F3 (light)\n")
541 PRINTF("send CWF_F3 (light)\n")
432 send_waveform_CWF3_light(
542 send_waveform_CWF3_light( ring_node_to_send_cwf_f3,
433 (volatile int*) ring_node_to_send_cwf_f3->buffer_address,
434 headerCWF_F3_light, queue_id );
543 headerCWF_F3_light, queue_id );
435 }
544 }
436
545
437 }
546 }
438 else
547 else
439 {
548 {
440 PRINTF1("in CWF3 *** lfrCurrentMode is %d, no data will be sent\n", lfrCurrentMode)
549 PRINTF1("in CWF3 *** lfrCurrentMode is %d, no data will be sent\n", lfrCurrentMode)
441 }
550 }
442 }
551 }
443 }
552 }
444
553
445 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
554 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
446 {
555 {
447 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
556 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
448 *
557 *
449 * @param unused is the starting argument of the RTEMS task
558 * @param unused is the starting argument of the RTEMS task
450 *
559 *
451 * The following data packet is sent by this function:
560 * The following data packet is sent by this function:
452 * - TM_LFR_SCIENCE_BURST_CWF_F2
561 * - TM_LFR_SCIENCE_BURST_CWF_F2
453 * - TM_LFR_SCIENCE_SBM2_CWF_F2
562 * - TM_LFR_SCIENCE_SBM2_CWF_F2
454 *
563 *
455 */
564 */
456
565
457 rtems_event_set event_out;
566 rtems_event_set event_out;
458 rtems_id queue_id;
567 rtems_id queue_id;
459 rtems_status_code status;
568 rtems_status_code status;
460
569
461 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
570 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
462 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
571 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
463
572
464 status = get_message_queue_id_send( &queue_id );
573 status = get_message_queue_id_send( &queue_id );
465 if (status != RTEMS_SUCCESSFUL)
574 if (status != RTEMS_SUCCESSFUL)
466 {
575 {
467 PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status)
576 PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status)
468 }
577 }
469
578
470 BOOT_PRINTF("in CWF2 ***\n")
579 BOOT_PRINTF("in CWF2 ***\n")
471
580
472 while(1){
581 while(1){
473 // wait for an RTEMS_EVENT
582 // wait for an RTEMS_EVENT
474 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
583 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
475 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
584 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
476 if (event_out == RTEMS_EVENT_MODE_BURST)
585 if (event_out == RTEMS_EVENT_MODE_BURST)
477 {
586 {
478 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
587 send_waveform_CWF( ring_node_to_send_cwf_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
479 }
588 }
480 if (event_out == RTEMS_EVENT_MODE_SBM2)
589 if (event_out == RTEMS_EVENT_MODE_SBM2)
481 {
590 {
482 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
591 send_waveform_CWF( ring_node_to_send_cwf_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
483 // launch snapshot extraction if needed
592 // launch snapshot extraction if needed
484 if (extractSWF == true)
593 if (extractSWF == true)
485 {
594 {
486 ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2;
595 ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2;
487 // extract the snapshot
596 // extract the snapshot
488 build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 );
597 build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 );
489 // send the snapshot when built
598 // send the snapshot when built
490 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 );
599 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 );
491 extractSWF = false;
600 extractSWF = false;
492 }
601 }
493 if (swf_f0_ready && swf_f1_ready)
602 if (swf_f0_ready && swf_f1_ready)
494 {
603 {
495 extractSWF = true;
604 extractSWF = true;
496 swf_f0_ready = false;
605 swf_f0_ready = false;
497 swf_f1_ready = false;
606 swf_f1_ready = false;
498 }
607 }
499 }
608 }
500 }
609 }
501 }
610 }
502
611
503 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
612 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
504 {
613 {
505 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
614 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
506 *
615 *
507 * @param unused is the starting argument of the RTEMS task
616 * @param unused is the starting argument of the RTEMS task
508 *
617 *
509 * The following data packet is sent by this function:
618 * The following data packet is sent by this function:
510 * - TM_LFR_SCIENCE_SBM1_CWF_F1
619 * - TM_LFR_SCIENCE_SBM1_CWF_F1
511 *
620 *
512 */
621 */
513
622
514 rtems_event_set event_out;
623 rtems_event_set event_out;
515 rtems_id queue_id;
624 rtems_id queue_id;
516 rtems_status_code status;
625 rtems_status_code status;
517
626
518 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
627 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
519
628
520 status = get_message_queue_id_send( &queue_id );
629 status = get_message_queue_id_send( &queue_id );
521 if (status != RTEMS_SUCCESSFUL)
630 if (status != RTEMS_SUCCESSFUL)
522 {
631 {
523 PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status)
632 PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status)
524 }
633 }
525
634
526 BOOT_PRINTF("in CWF1 ***\n")
635 BOOT_PRINTF("in CWF1 ***\n")
527
636
528 while(1){
637 while(1){
529 // wait for an RTEMS_EVENT
638 // wait for an RTEMS_EVENT
530 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
639 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
531 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
640 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
532 send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
641 send_waveform_CWF( ring_node_to_send_cwf_f1, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
533 // launch snapshot extraction if needed
642 // launch snapshot extraction if needed
534 if (extractSWF == true)
643 if (extractSWF == true)
535 {
644 {
536 ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1;
645 ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1;
537 // launch the snapshot extraction
646 // launch the snapshot extraction
538 status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 );
647 status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 );
539 extractSWF = false;
648 extractSWF = false;
540 }
649 }
541 if (swf_f0_ready == true)
650 if (swf_f0_ready == true)
542 {
651 {
543 extractSWF = true;
652 extractSWF = true;
544 swf_f0_ready = false; // this step shall be executed only one time
653 swf_f0_ready = false; // this step shall be executed only one time
545 }
654 }
546 if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction
655 if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction
547 {
656 {
548 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 );
657 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 );
549 swf_f1_ready = false;
658 swf_f1_ready = false;
550 swf_f2_ready = false;
659 swf_f2_ready = false;
551 }
660 }
552 }
661 }
553 }
662 }
554
663
555 rtems_task swbd_task(rtems_task_argument argument)
664 rtems_task swbd_task(rtems_task_argument argument)
556 {
665 {
557 /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers.
666 /** This RTEMS task is dedicated to the building of snapshots from different continuous waveforms buffers.
558 *
667 *
559 * @param unused is the starting argument of the RTEMS task
668 * @param unused is the starting argument of the RTEMS task
560 *
669 *
561 */
670 */
562
671
563 rtems_event_set event_out;
672 rtems_event_set event_out;
564
673
565 BOOT_PRINTF("in SWBD ***\n")
674 BOOT_PRINTF("in SWBD ***\n")
566
675
567 while(1){
676 while(1){
568 // wait for an RTEMS_EVENT
677 // wait for an RTEMS_EVENT
569 rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2,
678 rtems_event_receive( RTEMS_EVENT_MODE_SBM1 | RTEMS_EVENT_MODE_SBM2,
570 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
679 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
571 if (event_out == RTEMS_EVENT_MODE_SBM1)
680 if (event_out == RTEMS_EVENT_MODE_SBM1)
572 {
681 {
573 build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 );
682 build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 );
574 swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent
683 swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent
575 }
684 }
576 else
685 else
577 {
686 {
578 PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out)
687 PRINTF1("in SWBD *** unexpected rtems event received %x\n", (int) event_out)
579 }
688 }
580 }
689 }
581 }
690 }
582
691
583 //******************
692 //******************
584 // general functions
693 // general functions
585
694
586 void WFP_init_rings( void )
695 void WFP_init_rings( void )
587 {
696 {
588 // F0 RING
697 // F0 RING
589 init_waveform_ring( waveform_ring_f0, NB_RING_NODES_F0, wf_snap_f0 );
698 init_waveform_ring( waveform_ring_f0, NB_RING_NODES_F0, wf_snap_f0 );
590 // F1 RING
699 // F1 RING
591 init_waveform_ring( waveform_ring_f1, NB_RING_NODES_F1, wf_snap_f1 );
700 init_waveform_ring( waveform_ring_f1, NB_RING_NODES_F1, wf_snap_f1 );
592 // F2 RING
701 // F2 RING
593 init_waveform_ring( waveform_ring_f2, NB_RING_NODES_F2, wf_snap_f2 );
702 init_waveform_ring( waveform_ring_f2, NB_RING_NODES_F2, wf_snap_f2 );
594 // F3 RING
703 // F3 RING
595 init_waveform_ring( waveform_ring_f3, NB_RING_NODES_F3, wf_cont_f3 );
704 init_waveform_ring( waveform_ring_f3, NB_RING_NODES_F3, wf_cont_f3 );
596
705
706 ring_node_wf_snap_extracted.buffer_address = (int) wf_snap_extracted;
707
597 DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0)
708 DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0)
598 DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1)
709 DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1)
599 DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2)
710 DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2)
600 DEBUG_PRINTF1("waveform_ring_f3 @%x\n", (unsigned int) waveform_ring_f3)
711 DEBUG_PRINTF1("waveform_ring_f3 @%x\n", (unsigned int) waveform_ring_f3)
601 }
712 }
602
713
603 void init_waveform_ring(ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] )
714 void init_waveform_ring(ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] )
604 {
715 {
605 unsigned char i;
716 unsigned char i;
606
717
607 waveform_ring[0].next = (ring_node*) &waveform_ring[ 1 ];
718 waveform_ring[0].next = (ring_node*) &waveform_ring[ 1 ];
608 waveform_ring[0].previous = (ring_node*) &waveform_ring[ nbNodes - 1 ];
719 waveform_ring[0].previous = (ring_node*) &waveform_ring[ nbNodes - 1 ];
609 waveform_ring[0].buffer_address = (int) &wfrm[0];
720 waveform_ring[0].buffer_address = (int) &wfrm[0];
610
721
611 waveform_ring[nbNodes-1].next = (ring_node*) &waveform_ring[ 0 ];
722 waveform_ring[nbNodes-1].next = (ring_node*) &waveform_ring[ 0 ];
612 waveform_ring[nbNodes-1].previous = (ring_node*) &waveform_ring[ nbNodes - 2 ];
723 waveform_ring[nbNodes-1].previous = (ring_node*) &waveform_ring[ nbNodes - 2 ];
613 waveform_ring[nbNodes-1].buffer_address = (int) &wfrm[ (nbNodes-1) * WFRM_BUFFER ];
724 waveform_ring[nbNodes-1].buffer_address = (int) &wfrm[ (nbNodes-1) * WFRM_BUFFER ];
614
725
615 for(i=1; i<nbNodes-1; i++)
726 for(i=1; i<nbNodes-1; i++)
616 {
727 {
617 waveform_ring[i].next = (ring_node*) &waveform_ring[ i + 1 ];
728 waveform_ring[i].next = (ring_node*) &waveform_ring[ i + 1 ];
618 waveform_ring[i].previous = (ring_node*) &waveform_ring[ i - 1 ];
729 waveform_ring[i].previous = (ring_node*) &waveform_ring[ i - 1 ];
619 waveform_ring[i].buffer_address = (int) &wfrm[ i * WFRM_BUFFER ];
730 waveform_ring[i].buffer_address = (int) &wfrm[ i * WFRM_BUFFER ];
620 }
731 }
621 }
732 }
622
733
623 void WFP_reset_current_ring_nodes( void )
734 void WFP_reset_current_ring_nodes( void )
624 {
735 {
625 current_ring_node_f0 = waveform_ring_f0;
736 current_ring_node_f0 = waveform_ring_f0;
626 ring_node_to_send_swf_f0 = waveform_ring_f0;
737 ring_node_to_send_swf_f0 = waveform_ring_f0;
627
738
628 current_ring_node_f1 = waveform_ring_f1;
739 current_ring_node_f1 = waveform_ring_f1;
629 ring_node_to_send_cwf_f1 = waveform_ring_f1;
740 ring_node_to_send_cwf_f1 = waveform_ring_f1;
630 ring_node_to_send_swf_f1 = waveform_ring_f1;
741 ring_node_to_send_swf_f1 = waveform_ring_f1;
631
742
632 current_ring_node_f2 = waveform_ring_f2;
743 current_ring_node_f2 = waveform_ring_f2;
633 ring_node_to_send_cwf_f2 = waveform_ring_f2;
744 ring_node_to_send_cwf_f2 = waveform_ring_f2;
634 ring_node_to_send_swf_f2 = waveform_ring_f2;
745 ring_node_to_send_swf_f2 = waveform_ring_f2;
635
746
636 current_ring_node_f3 = waveform_ring_f3;
747 current_ring_node_f3 = waveform_ring_f3;
637 ring_node_to_send_cwf_f3 = waveform_ring_f3;
748 ring_node_to_send_cwf_f3 = waveform_ring_f3;
638 }
749 }
639
750
640 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
751 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
641 {
752 {
642 unsigned char i;
753 unsigned char i;
643 int return_value;
754 int return_value;
644
755
645 return_value = LFR_SUCCESSFUL;
756 return_value = LFR_SUCCESSFUL;
646
757
647 for (i=0; i<7; i++)
758 for (i=0; i<7; i++)
648 {
759 {
649 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
760 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
650 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
761 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
651 headerSWF[ i ].reserved = DEFAULT_RESERVED;
762 headerSWF[ i ].reserved = DEFAULT_RESERVED;
652 headerSWF[ i ].userApplication = CCSDS_USER_APP;
763 headerSWF[ i ].userApplication = CCSDS_USER_APP;
653 headerSWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
764 headerSWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
654 headerSWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
765 headerSWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
655 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
766 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
656 if (i == 6)
767 if (i == 6)
657 {
768 {
658 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8);
769 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8);
659 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 );
770 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 );
660 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8);
771 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8);
661 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 );
772 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 );
662 }
773 }
663 else
774 else
664 {
775 {
665 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8);
776 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8);
666 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 );
777 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 );
667 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8);
778 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8);
668 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 );
779 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 );
669 }
780 }
670 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
781 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
671 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
782 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
672 headerSWF[ i ].pktNr = i+1; // PKT_NR
783 headerSWF[ i ].pktNr = i+1; // PKT_NR
673 // DATA FIELD HEADER
784 // DATA FIELD HEADER
674 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
785 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
675 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
786 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
676 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
787 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
677 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
788 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
678 // AUXILIARY DATA HEADER
789 // AUXILIARY DATA HEADER
679 headerSWF[ i ].time[0] = 0x00;
790 headerSWF[ i ].time[0] = 0x00;
680 headerSWF[ i ].time[0] = 0x00;
791 headerSWF[ i ].time[0] = 0x00;
681 headerSWF[ i ].time[0] = 0x00;
792 headerSWF[ i ].time[0] = 0x00;
682 headerSWF[ i ].time[0] = 0x00;
793 headerSWF[ i ].time[0] = 0x00;
683 headerSWF[ i ].time[0] = 0x00;
794 headerSWF[ i ].time[0] = 0x00;
684 headerSWF[ i ].time[0] = 0x00;
795 headerSWF[ i ].time[0] = 0x00;
685 headerSWF[ i ].sid = sid;
796 headerSWF[ i ].sid = sid;
686 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
797 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
687 }
798 }
688
799
689 return return_value;
800 return return_value;
690 }
801 }
691
802
692 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
803 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
693 {
804 {
694 unsigned int i;
805 unsigned int i;
695 int return_value;
806 int return_value;
696
807
697 return_value = LFR_SUCCESSFUL;
808 return_value = LFR_SUCCESSFUL;
698
809
699 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++)
810 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++)
700 {
811 {
701 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
812 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
702 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
813 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
703 headerCWF[ i ].reserved = DEFAULT_RESERVED;
814 headerCWF[ i ].reserved = DEFAULT_RESERVED;
704 headerCWF[ i ].userApplication = CCSDS_USER_APP;
815 headerCWF[ i ].userApplication = CCSDS_USER_APP;
705 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
816 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
706 {
817 {
707 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2 >> 8);
818 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2 >> 8);
708 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2);
819 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_SBM1_SBM2);
709 }
820 }
710 else
821 else
711 {
822 {
712 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
823 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
713 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
824 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
714 }
825 }
715 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
826 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
716 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8);
827 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8);
717 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 );
828 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 );
718 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8);
829 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8);
719 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF );
830 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF );
720 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
831 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
721 // DATA FIELD HEADER
832 // DATA FIELD HEADER
722 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
833 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
723 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
834 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
724 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
835 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
725 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
836 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
726 // AUXILIARY DATA HEADER
837 // AUXILIARY DATA HEADER
727 headerCWF[ i ].sid = sid;
838 headerCWF[ i ].sid = sid;
728 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
839 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
729 headerCWF[ i ].time[0] = 0x00;
840 headerCWF[ i ].time[0] = 0x00;
730 headerCWF[ i ].time[0] = 0x00;
841 headerCWF[ i ].time[0] = 0x00;
731 headerCWF[ i ].time[0] = 0x00;
842 headerCWF[ i ].time[0] = 0x00;
732 headerCWF[ i ].time[0] = 0x00;
843 headerCWF[ i ].time[0] = 0x00;
733 headerCWF[ i ].time[0] = 0x00;
844 headerCWF[ i ].time[0] = 0x00;
734 headerCWF[ i ].time[0] = 0x00;
845 headerCWF[ i ].time[0] = 0x00;
735 }
846 }
736
847
737 return return_value;
848 return return_value;
738 }
849 }
739
850
740 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
851 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
741 {
852 {
742 unsigned int i;
853 unsigned int i;
743 int return_value;
854 int return_value;
744
855
745 return_value = LFR_SUCCESSFUL;
856 return_value = LFR_SUCCESSFUL;
746
857
747 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++)
858 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++)
748 {
859 {
749 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
860 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
750 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
861 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
751 headerCWF[ i ].reserved = DEFAULT_RESERVED;
862 headerCWF[ i ].reserved = DEFAULT_RESERVED;
752 headerCWF[ i ].userApplication = CCSDS_USER_APP;
863 headerCWF[ i ].userApplication = CCSDS_USER_APP;
753
864
754 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
865 headerCWF[ i ].packetID[0] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST >> 8);
755 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
866 headerCWF[ i ].packetID[1] = (unsigned char) (APID_TM_SCIENCE_NORMAL_BURST);
756
867
757 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
868 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
758 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8);
869 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8);
759 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 );
870 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 );
760 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8);
871 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8);
761 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 );
872 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 );
762
873
763 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
874 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
764 // DATA FIELD HEADER
875 // DATA FIELD HEADER
765 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
876 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
766 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
877 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
767 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
878 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
768 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
879 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
769 // AUXILIARY DATA HEADER
880 // AUXILIARY DATA HEADER
770 headerCWF[ i ].sid = SID_NORM_CWF_F3;
881 headerCWF[ i ].sid = SID_NORM_CWF_F3;
771 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
882 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
772 headerCWF[ i ].time[0] = 0x00;
883 headerCWF[ i ].time[0] = 0x00;
773 headerCWF[ i ].time[0] = 0x00;
884 headerCWF[ i ].time[0] = 0x00;
774 headerCWF[ i ].time[0] = 0x00;
885 headerCWF[ i ].time[0] = 0x00;
775 headerCWF[ i ].time[0] = 0x00;
886 headerCWF[ i ].time[0] = 0x00;
776 headerCWF[ i ].time[0] = 0x00;
887 headerCWF[ i ].time[0] = 0x00;
777 headerCWF[ i ].time[0] = 0x00;
888 headerCWF[ i ].time[0] = 0x00;
778 }
889 }
779
890
780 return return_value;
891 return return_value;
781 }
892 }
782
893
783 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
894 int send_waveform_SWF( ring_node *ring_node_to_send, unsigned int sid,
784 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
895 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
785 {
896 {
786 /** This function sends SWF CCSDS packets (F2, F1 or F0).
897 /** This function sends SWF CCSDS packets (F2, F1 or F0).
787 *
898 *
788 * @param waveform points to the buffer containing the data that will be send.
899 * @param waveform points to the buffer containing the data that will be send.
789 * @param sid is the source identifier of the data that will be sent.
900 * @param sid is the source identifier of the data that will be sent.
790 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
901 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
791 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
902 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
792 * contain information to setup the transmission of the data packets.
903 * contain information to setup the transmission of the data packets.
793 *
904 *
794 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
905 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
795 *
906 *
796 */
907 */
797
908
798 unsigned int i;
909 unsigned int i;
799 int ret;
910 int ret;
800 unsigned int coarseTime;
911 unsigned int coarseTime;
801 unsigned int fineTime;
912 unsigned int fineTime;
802 rtems_status_code status;
913 rtems_status_code status;
803 spw_ioctl_pkt_send spw_ioctl_send_SWF;
914 spw_ioctl_pkt_send spw_ioctl_send_SWF;
915 int *dataPtr;
804
916
805 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
917 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
806 spw_ioctl_send_SWF.options = 0;
918 spw_ioctl_send_SWF.options = 0;
807
919
808 ret = LFR_DEFAULT;
920 ret = LFR_DEFAULT;
809
921
810 coarseTime = waveform[0];
922 coarseTime = ring_node_to_send->coarseTime;
811 fineTime = waveform[1];
923 fineTime = ring_node_to_send->fineTime;
924 dataPtr = (int*) ring_node_to_send->buffer_address;
812
925
813 for (i=0; i<7; i++) // send waveform
926 for (i=0; i<7; i++) // send waveform
814 {
927 {
815 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET];
928 spw_ioctl_send_SWF.data = (char*) &dataPtr[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) ];
816 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
929 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
817 // BUILD THE DATA
930 // BUILD THE DATA
818 if (i==6) {
931 if (i==6) {
819 spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK;
932 spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK;
820 }
933 }
821 else {
934 else {
822 spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK;
935 spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK;
823 }
936 }
824 // SET PACKET SEQUENCE COUNTER
937 // SET PACKET SEQUENCE COUNTER
825 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
938 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
826 // SET PACKET TIME
939 // SET PACKET TIME
827 compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime );
940 compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime );
828 //
941 //
829 headerSWF[ i ].time[0] = headerSWF[ i ].acquisitionTime[0];
942 headerSWF[ i ].time[0] = headerSWF[ i ].acquisitionTime[0];
830 headerSWF[ i ].time[1] = headerSWF[ i ].acquisitionTime[1];
943 headerSWF[ i ].time[1] = headerSWF[ i ].acquisitionTime[1];
831 headerSWF[ i ].time[2] = headerSWF[ i ].acquisitionTime[2];
944 headerSWF[ i ].time[2] = headerSWF[ i ].acquisitionTime[2];
832 headerSWF[ i ].time[3] = headerSWF[ i ].acquisitionTime[3];
945 headerSWF[ i ].time[3] = headerSWF[ i ].acquisitionTime[3];
833 headerSWF[ i ].time[4] = headerSWF[ i ].acquisitionTime[4];
946 headerSWF[ i ].time[4] = headerSWF[ i ].acquisitionTime[4];
834 headerSWF[ i ].time[5] = headerSWF[ i ].acquisitionTime[5];
947 headerSWF[ i ].time[5] = headerSWF[ i ].acquisitionTime[5];
835 // SEND PACKET
948 // SEND PACKET
836 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
949 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
837 if (status != RTEMS_SUCCESSFUL) {
950 if (status != RTEMS_SUCCESSFUL) {
838 printf("%d-%d, ERR %d\n", sid, i, (int) status);
951 printf("%d-%d, ERR %d\n", sid, i, (int) status);
839 ret = LFR_DEFAULT;
952 ret = LFR_DEFAULT;
840 }
953 }
841 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
954 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
842 }
955 }
843
956
844 return ret;
957 return ret;
845 }
958 }
846
959
847 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
960 int send_waveform_CWF(ring_node *ring_node_to_send, unsigned int sid,
848 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
961 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
849 {
962 {
850 /** This function sends CWF CCSDS packets (F2, F1 or F0).
963 /** This function sends CWF CCSDS packets (F2, F1 or F0).
851 *
964 *
852 * @param waveform points to the buffer containing the data that will be send.
965 * @param waveform points to the buffer containing the data that will be send.
853 * @param sid is the source identifier of the data that will be sent.
966 * @param sid is the source identifier of the data that will be sent.
854 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
967 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
855 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
968 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
856 * contain information to setup the transmission of the data packets.
969 * contain information to setup the transmission of the data packets.
857 *
970 *
858 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
971 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
859 *
972 *
860 */
973 */
861
974
862 unsigned int i;
975 unsigned int i;
863 int ret;
976 int ret;
864 unsigned int coarseTime;
977 unsigned int coarseTime;
865 unsigned int fineTime;
978 unsigned int fineTime;
866 rtems_status_code status;
979 rtems_status_code status;
867 spw_ioctl_pkt_send spw_ioctl_send_CWF;
980 spw_ioctl_pkt_send spw_ioctl_send_CWF;
981 int *dataPtr;
868
982
869 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
983 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
870 spw_ioctl_send_CWF.options = 0;
984 spw_ioctl_send_CWF.options = 0;
871
985
872 ret = LFR_DEFAULT;
986 ret = LFR_DEFAULT;
873
987
874 coarseTime = waveform[0];
988 coarseTime = ring_node_to_send->coarseTime;
875 fineTime = waveform[1];
989 fineTime = ring_node_to_send->fineTime;
990 dataPtr = (int*) ring_node_to_send->buffer_address;
876
991
877 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform
992 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform
878 {
993 {
879 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET];
994 spw_ioctl_send_CWF.data = (char*) &dataPtr[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) ];
880 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
995 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
881 // BUILD THE DATA
996 // BUILD THE DATA
882 spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK;
997 spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK;
883 // SET PACKET SEQUENCE COUNTER
998 // SET PACKET SEQUENCE COUNTER
884 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
999 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
885 // SET PACKET TIME
1000 // SET PACKET TIME
886 compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime);
1001 compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime);
887 //
1002 //
888 headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0];
1003 headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0];
889 headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1];
1004 headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1];
890 headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2];
1005 headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2];
891 headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3];
1006 headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3];
892 headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4];
1007 headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4];
893 headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5];
1008 headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5];
894 // SEND PACKET
1009 // SEND PACKET
895 if (sid == SID_NORM_CWF_LONG_F3)
1010 if (sid == SID_NORM_CWF_LONG_F3)
896 {
1011 {
897 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
1012 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
898 if (status != RTEMS_SUCCESSFUL) {
1013 if (status != RTEMS_SUCCESSFUL) {
899 printf("%d-%d, ERR %d\n", sid, i, (int) status);
1014 printf("%d-%d, ERR %d\n", sid, i, (int) status);
900 ret = LFR_DEFAULT;
1015 ret = LFR_DEFAULT;
901 }
1016 }
902 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
1017 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
903 }
1018 }
904 else
1019 else
905 {
1020 {
906 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
1021 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
907 if (status != RTEMS_SUCCESSFUL) {
1022 if (status != RTEMS_SUCCESSFUL) {
908 printf("%d-%d, ERR %d\n", sid, i, (int) status);
1023 printf("%d-%d, ERR %d\n", sid, i, (int) status);
909 ret = LFR_DEFAULT;
1024 ret = LFR_DEFAULT;
910 }
1025 }
911 }
1026 }
912 }
1027 }
913
1028
914 return ret;
1029 return ret;
915 }
1030 }
916
1031
917 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
1032 int send_waveform_CWF3_light( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id )
918 {
1033 {
919 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
1034 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
920 *
1035 *
921 * @param waveform points to the buffer containing the data that will be send.
1036 * @param waveform points to the buffer containing the data that will be send.
922 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
1037 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
923 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
1038 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
924 * contain information to setup the transmission of the data packets.
1039 * contain information to setup the transmission of the data packets.
925 *
1040 *
926 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
1041 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
927 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
1042 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
928 *
1043 *
929 */
1044 */
930
1045
931 unsigned int i;
1046 unsigned int i;
932 int ret;
1047 int ret;
933 unsigned int coarseTime;
1048 unsigned int coarseTime;
934 unsigned int fineTime;
1049 unsigned int fineTime;
935 rtems_status_code status;
1050 rtems_status_code status;
936 spw_ioctl_pkt_send spw_ioctl_send_CWF;
1051 spw_ioctl_pkt_send spw_ioctl_send_CWF;
937 char *sample;
1052 char *sample;
1053 int *dataPtr;
938
1054
939 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
1055 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
940 spw_ioctl_send_CWF.options = 0;
1056 spw_ioctl_send_CWF.options = 0;
941
1057
942 ret = LFR_DEFAULT;
1058 ret = LFR_DEFAULT;
943
1059
1060 coarseTime = ring_node_to_send->coarseTime;
1061 fineTime = ring_node_to_send->fineTime;
1062 dataPtr = (int*) ring_node_to_send->buffer_address;
1063
944 //**********************
1064 //**********************
945 // BUILD CWF3_light DATA
1065 // BUILD CWF3_light DATA
946 for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
1066 for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
947 {
1067 {
948 sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
1068 sample = (char*) &dataPtr[ (i * NB_WORDS_SWF_BLK) ];
949 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ];
1069 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ];
950 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ];
1070 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ];
951 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ];
1071 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ];
952 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ];
1072 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ];
953 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ];
1073 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ];
954 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ];
1074 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ];
955 }
1075 }
956
1076
957 coarseTime = waveform[0];
958 fineTime = waveform[1];
959
960 //*********************
1077 //*********************
961 // SEND CWF3_light DATA
1078 // SEND CWF3_light DATA
962 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform
1079 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform
963 {
1080 {
964 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];
1081 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK) ];
965 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
1082 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
966 // BUILD THE DATA
1083 // BUILD THE DATA
967 spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK;
1084 spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK;
968 // SET PACKET SEQUENCE COUNTER
1085 // SET PACKET SEQUENCE COUNTER
969 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
1086 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
970 // SET PACKET TIME
1087 // SET PACKET TIME
971 compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime );
1088 compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime );
972 //
1089 //
973 headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0];
1090 headerCWF[ i ].time[0] = headerCWF[ i ].acquisitionTime[0];
974 headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1];
1091 headerCWF[ i ].time[1] = headerCWF[ i ].acquisitionTime[1];
975 headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2];
1092 headerCWF[ i ].time[2] = headerCWF[ i ].acquisitionTime[2];
976 headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3];
1093 headerCWF[ i ].time[3] = headerCWF[ i ].acquisitionTime[3];
977 headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4];
1094 headerCWF[ i ].time[4] = headerCWF[ i ].acquisitionTime[4];
978 headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5];
1095 headerCWF[ i ].time[5] = headerCWF[ i ].acquisitionTime[5];
979 // SEND PACKET
1096 // SEND PACKET
980 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
1097 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
981 if (status != RTEMS_SUCCESSFUL) {
1098 if (status != RTEMS_SUCCESSFUL) {
982 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
1099 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
983 ret = LFR_DEFAULT;
1100 ret = LFR_DEFAULT;
984 }
1101 }
985 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
1102 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
986 }
1103 }
987
1104
988 return ret;
1105 return ret;
989 }
1106 }
990
1107
1108 int send_ring_node_CWF( ring_node *ring_node_to_send )
1109 {
1110 int status;
1111
1112 status = LFR_SUCCESSFUL;
1113 // status = rtems_message_queue_send( queue_id, ring_node_to_send, 4 );
1114
1115 return status;
1116 }
1117
991 void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime,
1118 void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime,
992 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime )
1119 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime )
993 {
1120 {
994 unsigned long long int acquisitionTimeAsLong;
1121 unsigned long long int acquisitionTimeAsLong;
995 unsigned char localAcquisitionTime[6];
1122 unsigned char localAcquisitionTime[6];
996 double deltaT;
1123 double deltaT;
997
1124
998 deltaT = 0.;
1125 deltaT = 0.;
999
1126
1000 localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 24 );
1127 localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 24 );
1001 localAcquisitionTime[1] = (unsigned char) ( coarseTime >> 16 );
1128 localAcquisitionTime[1] = (unsigned char) ( coarseTime >> 16 );
1002 localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 8 );
1129 localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 8 );
1003 localAcquisitionTime[3] = (unsigned char) ( coarseTime );
1130 localAcquisitionTime[3] = (unsigned char) ( coarseTime );
1004 localAcquisitionTime[4] = (unsigned char) ( fineTime >> 8 );
1131 localAcquisitionTime[4] = (unsigned char) ( fineTime >> 8 );
1005 localAcquisitionTime[5] = (unsigned char) ( fineTime );
1132 localAcquisitionTime[5] = (unsigned char) ( fineTime );
1006
1133
1007 acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 )
1134 acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 )
1008 + ( (unsigned long long int) localAcquisitionTime[1] << 32 )
1135 + ( (unsigned long long int) localAcquisitionTime[1] << 32 )
1009 + ( (unsigned long long int) localAcquisitionTime[2] << 24 )
1136 + ( (unsigned long long int) localAcquisitionTime[2] << 24 )
1010 + ( (unsigned long long int) localAcquisitionTime[3] << 16 )
1137 + ( (unsigned long long int) localAcquisitionTime[3] << 16 )
1011 + ( (unsigned long long int) localAcquisitionTime[4] << 8 )
1138 + ( (unsigned long long int) localAcquisitionTime[4] << 8 )
1012 + ( (unsigned long long int) localAcquisitionTime[5] );
1139 + ( (unsigned long long int) localAcquisitionTime[5] );
1013
1140
1014 switch( sid )
1141 switch( sid )
1015 {
1142 {
1016 case SID_NORM_SWF_F0:
1143 case SID_NORM_SWF_F0:
1017 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ;
1144 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ;
1018 break;
1145 break;
1019
1146
1020 case SID_NORM_SWF_F1:
1147 case SID_NORM_SWF_F1:
1021 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ;
1148 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ;
1022 break;
1149 break;
1023
1150
1024 case SID_NORM_SWF_F2:
1151 case SID_NORM_SWF_F2:
1025 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ;
1152 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ;
1026 break;
1153 break;
1027
1154
1028 case SID_SBM1_CWF_F1:
1155 case SID_SBM1_CWF_F1:
1029 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ;
1156 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ;
1030 break;
1157 break;
1031
1158
1032 case SID_SBM2_CWF_F2:
1159 case SID_SBM2_CWF_F2:
1033 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
1160 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
1034 break;
1161 break;
1035
1162
1036 case SID_BURST_CWF_F2:
1163 case SID_BURST_CWF_F2:
1037 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
1164 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
1038 break;
1165 break;
1039
1166
1040 case SID_NORM_CWF_F3:
1167 case SID_NORM_CWF_F3:
1041 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ;
1168 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ;
1042 break;
1169 break;
1043
1170
1044 case SID_NORM_CWF_LONG_F3:
1171 case SID_NORM_CWF_LONG_F3:
1045 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ;
1172 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ;
1046 break;
1173 break;
1047
1174
1048 default:
1175 default:
1049 PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid)
1176 PRINTF1("in compute_acquisition_time *** ERR unexpected sid %d", sid)
1050 deltaT = 0.;
1177 deltaT = 0.;
1051 break;
1178 break;
1052 }
1179 }
1053
1180
1054 acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT;
1181 acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT;
1055 //
1182 //
1056 acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40);
1183 acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40);
1057 acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32);
1184 acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32);
1058 acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24);
1185 acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24);
1059 acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16);
1186 acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16);
1060 acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 );
1187 acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 );
1061 acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong );
1188 acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong );
1062
1189
1063 }
1190 }
1064
1191
1065 void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel )
1192 void build_snapshot_from_ring( ring_node *ring_node_to_send, unsigned char frequencyChannel )
1066 {
1193 {
1067 unsigned int i;
1194 unsigned int i;
1068 unsigned long long int centerTime_asLong;
1195 unsigned long long int centerTime_asLong;
1069 unsigned long long int acquisitionTimeF0_asLong;
1196 unsigned long long int acquisitionTimeF0_asLong;
1070 unsigned long long int acquisitionTime_asLong;
1197 unsigned long long int acquisitionTime_asLong;
1071 unsigned long long int bufferAcquisitionTime_asLong;
1198 unsigned long long int bufferAcquisitionTime_asLong;
1072 unsigned char *ptr1;
1199 unsigned char *ptr1;
1073 unsigned char *ptr2;
1200 unsigned char *ptr2;
1074 unsigned char *timeCharPtr;
1201 unsigned char *timeCharPtr;
1075 unsigned char nb_ring_nodes;
1202 unsigned char nb_ring_nodes;
1076 unsigned long long int frequency_asLong;
1203 unsigned long long int frequency_asLong;
1077 unsigned long long int nbTicksPerSample_asLong;
1204 unsigned long long int nbTicksPerSample_asLong;
1078 unsigned long long int nbSamplesPart1_asLong;
1205 unsigned long long int nbSamplesPart1_asLong;
1079 unsigned long long int sampleOffset_asLong;
1206 unsigned long long int sampleOffset_asLong;
1080
1207
1081 unsigned int deltaT_F0;
1208 unsigned int deltaT_F0;
1082 unsigned int deltaT_F1;
1209 unsigned int deltaT_F1;
1083 unsigned long long int deltaT_F2;
1210 unsigned long long int deltaT_F2;
1084
1211
1085 deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667;
1212 deltaT_F0 = 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667;
1086 deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384;
1213 deltaT_F1 = 16384; // (2048. / 4096. / 2.) * 65536. = 16384;
1087 deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144;
1214 deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144;
1088 sampleOffset_asLong = 0x00;
1215 sampleOffset_asLong = 0x00;
1089
1216
1090 // (1) get the f0 acquisition time
1217 // (1) get the f0 acquisition time
1091 acquisitionTimeF0_asLong = get_acquisition_time( (unsigned char *) current_ring_node_f0->buffer_address );
1218 acquisitionTimeF0_asLong = get_acquisition_time( (unsigned char *) &ring_node_to_send->coarseTime );
1092
1219
1093 // (2) compute the central reference time
1220 // (2) compute the central reference time
1094 centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0;
1221 centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0;
1095
1222
1096 // (3) compute the acquisition time of the current snapshot
1223 // (3) compute the acquisition time of the current snapshot
1097 switch(frequencyChannel)
1224 switch(frequencyChannel)
1098 {
1225 {
1099 case 1: // 1 is for F1 = 4096 Hz
1226 case 1: // 1 is for F1 = 4096 Hz
1100 acquisitionTime_asLong = centerTime_asLong - deltaT_F1;
1227 acquisitionTime_asLong = centerTime_asLong - deltaT_F1;
1101 nb_ring_nodes = NB_RING_NODES_F1;
1228 nb_ring_nodes = NB_RING_NODES_F1;
1102 frequency_asLong = 4096;
1229 frequency_asLong = 4096;
1103 nbTicksPerSample_asLong = 16; // 65536 / 4096;
1230 nbTicksPerSample_asLong = 16; // 65536 / 4096;
1104 break;
1231 break;
1105 case 2: // 2 is for F2 = 256 Hz
1232 case 2: // 2 is for F2 = 256 Hz
1106 acquisitionTime_asLong = centerTime_asLong - deltaT_F2;
1233 acquisitionTime_asLong = centerTime_asLong - deltaT_F2;
1107 nb_ring_nodes = NB_RING_NODES_F2;
1234 nb_ring_nodes = NB_RING_NODES_F2;
1108 frequency_asLong = 256;
1235 frequency_asLong = 256;
1109 nbTicksPerSample_asLong = 256; // 65536 / 256;
1236 nbTicksPerSample_asLong = 256; // 65536 / 256;
1110 break;
1237 break;
1111 default:
1238 default:
1112 acquisitionTime_asLong = centerTime_asLong;
1239 acquisitionTime_asLong = centerTime_asLong;
1113 frequency_asLong = 256;
1240 frequency_asLong = 256;
1114 nbTicksPerSample_asLong = 256;
1241 nbTicksPerSample_asLong = 256;
1115 break;
1242 break;
1116 }
1243 }
1117
1244
1118 //****************************************************************************
1245 //****************************************************************************
1119 // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong
1246 // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong
1120 for (i=0; i<nb_ring_nodes; i++)
1247 for (i=0; i<nb_ring_nodes; i++)
1121 {
1248 {
1122 PRINTF1("%d ... ", i)
1249 PRINTF1("%d ... ", i)
1123 bufferAcquisitionTime_asLong = get_acquisition_time( (unsigned char *) ring_node_to_send->buffer_address );
1250 bufferAcquisitionTime_asLong = get_acquisition_time( (unsigned char *) ring_node_to_send->coarseTime );
1124 if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong)
1251 if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong)
1125 {
1252 {
1126 PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong)
1253 PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong)
1127 break;
1254 break;
1128 }
1255 }
1129 ring_node_to_send = ring_node_to_send->previous;
1256 ring_node_to_send = ring_node_to_send->previous;
1130 }
1257 }
1131
1258
1132 // (5) compute the number of samples to take in the current buffer
1259 // (5) compute the number of samples to take in the current buffer
1133 sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16;
1260 sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16;
1134 nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong;
1261 nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong;
1135 PRINTF2("sampleOffset_asLong = %llx, nbSamplesPart1_asLong = %llx\n", sampleOffset_asLong, nbSamplesPart1_asLong)
1262 PRINTF2("sampleOffset_asLong = %llx, nbSamplesPart1_asLong = %llx\n", sampleOffset_asLong, nbSamplesPart1_asLong)
1136
1263
1137 // (6) compute the final acquisition time
1264 // (6) compute the final acquisition time
1138 acquisitionTime_asLong = bufferAcquisitionTime_asLong +
1265 acquisitionTime_asLong = bufferAcquisitionTime_asLong +
1139 sampleOffset_asLong * nbTicksPerSample_asLong;
1266 sampleOffset_asLong * nbTicksPerSample_asLong;
1140
1267
1141 // (7) copy the acquisition time at the beginning of the extrated snapshot
1268 // (7) copy the acquisition time at the beginning of the extrated snapshot
1142 ptr1 = (unsigned char*) &acquisitionTime_asLong;
1269 ptr1 = (unsigned char*) &acquisitionTime_asLong;
1143 ptr2 = (unsigned char*) wf_snap_extracted;
1270 // fine time
1271 ptr2 = (unsigned char*) &ring_node_wf_snap_extracted.fineTime;
1272 ptr2[2] = ptr1[ 4 + 2 ];
1273 ptr2[3] = ptr1[ 5 + 2 ];
1274 // coarse time
1275 ptr2 = (unsigned char*) &ring_node_wf_snap_extracted.coarseTime;
1144 ptr2[0] = ptr1[ 0 + 2 ];
1276 ptr2[0] = ptr1[ 0 + 2 ];
1145 ptr2[1] = ptr1[ 1 + 2 ];
1277 ptr2[1] = ptr1[ 1 + 2 ];
1146 ptr2[2] = ptr1[ 2 + 2 ];
1278 ptr2[2] = ptr1[ 2 + 2 ];
1147 ptr2[3] = ptr1[ 3 + 2 ];
1279 ptr2[3] = ptr1[ 3 + 2 ];
1148 ptr2[6] = ptr1[ 4 + 2 ];
1149 ptr2[7] = ptr1[ 5 + 2 ];
1150
1280
1151 // re set the synchronization bit
1281 // re set the synchronization bit
1152 timeCharPtr = (unsigned char*) ring_node_to_send->buffer_address;
1282 timeCharPtr = (unsigned char*) &ring_node_to_send->coarseTime;
1153 ptr2[0] = ptr2[0] | (timeCharPtr[0] & 0x80); // [1000 0000]
1283 ptr2[0] = ptr2[0] | (timeCharPtr[0] & 0x80); // [1000 0000]
1154
1284
1155 if ( (nbSamplesPart1_asLong >= NB_SAMPLES_PER_SNAPSHOT) | (nbSamplesPart1_asLong < 0) )
1285 if ( (nbSamplesPart1_asLong >= NB_SAMPLES_PER_SNAPSHOT) | (nbSamplesPart1_asLong < 0) )
1156 {
1286 {
1157 nbSamplesPart1_asLong = 0;
1287 nbSamplesPart1_asLong = 0;
1158 }
1288 }
1159 // copy the part 1 of the snapshot in the extracted buffer
1289 // copy the part 1 of the snapshot in the extracted buffer
1160 for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ )
1290 for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ )
1161 {
1291 {
1162 wf_snap_extracted[i + TIME_OFFSET] =
1292 wf_snap_extracted[i] =
1163 ((int*) ring_node_to_send->buffer_address)[i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) + TIME_OFFSET];
1293 ((int*) ring_node_to_send->buffer_address)[ i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) ];
1164 }
1294 }
1165 // copy the part 2 of the snapshot in the extracted buffer
1295 // copy the part 2 of the snapshot in the extracted buffer
1166 ring_node_to_send = ring_node_to_send->next;
1296 ring_node_to_send = ring_node_to_send->next;
1167 for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ )
1297 for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ )
1168 {
1298 {
1169 wf_snap_extracted[i + TIME_OFFSET] =
1299 wf_snap_extracted[i] =
1170 ((int*) ring_node_to_send->buffer_address)[(i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) + TIME_OFFSET];
1300 ((int*) ring_node_to_send->buffer_address)[ (i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) ];
1171 }
1301 }
1172 }
1302 }
1173
1303
1174 void snapshot_resynchronization( unsigned char *timePtr )
1304 void snapshot_resynchronization( unsigned char *timePtr )
1175 {
1305 {
1176 unsigned long long int acquisitionTime;
1306 unsigned long long int acquisitionTime;
1177 unsigned long long int centerTime;
1307 unsigned long long int centerTime;
1178 unsigned long long int previousTick;
1308 unsigned long long int previousTick;
1179 unsigned long long int nextTick;
1309 unsigned long long int nextTick;
1180 unsigned long long int deltaPreviousTick;
1310 unsigned long long int deltaPreviousTick;
1181 unsigned long long int deltaNextTick;
1311 unsigned long long int deltaNextTick;
1182 unsigned int deltaTickInF2;
1312 unsigned int deltaTickInF2;
1183 double deltaPrevious;
1313 double deltaPrevious;
1184 double deltaNext;
1314 double deltaNext;
1185
1315
1186 acquisitionTime = get_acquisition_time( timePtr );
1316 acquisitionTime = get_acquisition_time( timePtr );
1187
1317
1188 // compute center time
1318 // compute center time
1189 centerTime = acquisitionTime + 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667;
1319 centerTime = acquisitionTime + 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667;
1190 previousTick = centerTime - (centerTime & 0xffff);
1320 previousTick = centerTime - (centerTime & 0xffff);
1191 nextTick = previousTick + 65536;
1321 nextTick = previousTick + 65536;
1192
1322
1193 deltaPreviousTick = centerTime - previousTick;
1323 deltaPreviousTick = centerTime - previousTick;
1194 deltaNextTick = nextTick - centerTime;
1324 deltaNextTick = nextTick - centerTime;
1195
1325
1196 deltaPrevious = ((double) deltaPreviousTick) / 65536. * 1000.;
1326 deltaPrevious = ((double) deltaPreviousTick) / 65536. * 1000.;
1197 deltaNext = ((double) deltaNextTick) / 65536. * 1000.;
1327 deltaNext = ((double) deltaNextTick) / 65536. * 1000.;
1198
1328
1199 printf("delta previous = %f ms, delta next = %f ms\n", deltaPrevious, deltaNext);
1329 printf("delta previous = %f ms, delta next = %f ms\n", deltaPrevious, deltaNext);
1200 printf("delta previous = %llu, delta next = %llu\n", deltaPreviousTick, deltaNextTick);
1330 printf("delta previous = %llu, delta next = %llu\n", deltaPreviousTick, deltaNextTick);
1201
1331
1202 // which tick is the closest
1332 // which tick is the closest
1203 if (deltaPreviousTick > deltaNextTick)
1333 if (deltaPreviousTick > deltaNextTick)
1204 {
1334 {
1205 deltaTickInF2 = floor( (deltaNext * 256. / 1000.) ); // the division by 2 is important here
1335 deltaTickInF2 = floor( (deltaNext * 256. / 1000.) ); // the division by 2 is important here
1206 waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot + deltaTickInF2;
1336 waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot + deltaTickInF2;
1207 printf("correction of = + %u\n", deltaTickInF2);
1337 printf("correction of = + %u\n", deltaTickInF2);
1208 }
1338 }
1209 else
1339 else
1210 {
1340 {
1211 deltaTickInF2 = floor( (deltaPrevious * 256. / 1000.) ); // the division by 2 is important here
1341 deltaTickInF2 = floor( (deltaPrevious * 256. / 1000.) ); // the division by 2 is important here
1212 waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot - deltaTickInF2;
1342 waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot - deltaTickInF2;
1213 printf("correction of = - %u\n", deltaTickInF2);
1343 printf("correction of = - %u\n", deltaTickInF2);
1214 }
1344 }
1215 }
1345 }
1216
1346
1217 //**************
1347 //**************
1218 // wfp registers
1348 // wfp registers
1219 void reset_wfp_burst_enable(void)
1349 void reset_wfp_burst_enable( void )
1220 {
1350 {
1221 /** This function resets the waveform picker burst_enable register.
1351 /** This function resets the waveform picker burst_enable register.
1222 *
1352 *
1223 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
1353 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
1224 *
1354 *
1225 */
1355 */
1226
1356
1227 waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1357 // [1000 000] burst f2, f1, f0 enable f3, f2, f1, f0
1358 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable & 0x80;
1228 }
1359 }
1229
1360
1230 void reset_wfp_status( void )
1361 void reset_wfp_status( void )
1231 {
1362 {
1232 /** This function resets the waveform picker status register.
1363 /** This function resets the waveform picker status register.
1233 *
1364 *
1234 * All status bits are set to 0 [new_err full_err full].
1365 * All status bits are set to 0 [new_err full_err full].
1235 *
1366 *
1236 */
1367 */
1237
1368
1238 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1369 waveform_picker_regs->status = 0xffff;
1239 }
1370 }
1240
1371
1241 void reset_waveform_picker_regs(void)
1372 void reset_wfp_buffer_addresses( void )
1373 {
1374 // F0
1375 waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address; // 0x08
1376 current_ring_node_f0 = current_ring_node_f0->next;
1377 waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address; // 0x0c
1378 // F1
1379 waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address; // 0x10
1380 current_ring_node_f1 = current_ring_node_f1->next;
1381 waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address; // 0x14
1382 // F2
1383 waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address; // 0x18
1384 current_ring_node_f2 = current_ring_node_f2->next;
1385 waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address; // 0x1c
1386 // F3
1387 waveform_picker_regs->addr_data_f3_0 = current_ring_node_f3->buffer_address; // 0x20
1388 current_ring_node_f3 = current_ring_node_f3->next;
1389 waveform_picker_regs->addr_data_f3_1 = current_ring_node_f3->buffer_address; // 0x24
1390 }
1391
1392 void reset_waveform_picker_regs( void )
1242 {
1393 {
1243 /** This function resets the waveform picker module registers.
1394 /** This function resets the waveform picker module registers.
1244 *
1395 *
1245 * The registers affected by this function are located at the following offset addresses:
1396 * The registers affected by this function are located at the following offset addresses:
1246 * - 0x00 data_shaping
1397 * - 0x00 data_shaping
1247 * - 0x04 run_burst_enable
1398 * - 0x04 run_burst_enable
1248 * - 0x08 addr_data_f0
1399 * - 0x08 addr_data_f0
1249 * - 0x0C addr_data_f1
1400 * - 0x0C addr_data_f1
1250 * - 0x10 addr_data_f2
1401 * - 0x10 addr_data_f2
1251 * - 0x14 addr_data_f3
1402 * - 0x14 addr_data_f3
1252 * - 0x18 status
1403 * - 0x18 status
1253 * - 0x1C delta_snapshot
1404 * - 0x1C delta_snapshot
1254 * - 0x20 delta_f0
1405 * - 0x20 delta_f0
1255 * - 0x24 delta_f0_2
1406 * - 0x24 delta_f0_2
1256 * - 0x28 delta_f1
1407 * - 0x28 delta_f1
1257 * - 0x2c delta_f2
1408 * - 0x2c delta_f2
1258 * - 0x30 nb_data_by_buffer
1409 * - 0x30 nb_data_by_buffer
1259 * - 0x34 nb_snapshot_param
1410 * - 0x34 nb_snapshot_param
1260 * - 0x38 start_date
1411 * - 0x38 start_date
1261 * - 0x3c nb_word_in_buffer
1412 * - 0x3c nb_word_in_buffer
1262 *
1413 *
1263 */
1414 */
1264
1415
1265 set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW
1416 set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW
1417
1266 reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1418 reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1267 waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address; // 0x08
1419
1268 waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address; // 0x0c
1420 reset_wfp_buffer_addresses();
1269 waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address; // 0x10
1421
1270 waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address; // 0x14
1271 waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address; // 0x18
1272 waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address; // 0x1c
1273 waveform_picker_regs->addr_data_f3_0 = current_ring_node_f3->buffer_address; // 0x20
1274 waveform_picker_regs->addr_data_f3_1 = current_ring_node_f3->buffer_address; // 0x24
1275 reset_wfp_status(); // 0x18
1422 reset_wfp_status(); // 0x18
1276 //
1423
1277 set_wfp_delta_snapshot(); // 0x1c
1424 set_wfp_delta_snapshot(); // 0x1c *** 300 s => 0x12bff
1425
1278 set_wfp_delta_f0_f0_2(); // 0x20, 0x24
1426 set_wfp_delta_f0_f0_2(); // 0x20, 0x24
1427
1279 set_wfp_delta_f1(); // 0x28
1428 set_wfp_delta_f1(); // 0x28
1429
1280 set_wfp_delta_f2(); // 0x2c
1430 set_wfp_delta_f2(); // 0x2c
1281 DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot)
1431
1282 DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0)
1432 DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot)
1283 DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2)
1433 DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0)
1284 DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1)
1434 DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2)
1285 DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2)
1435 DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1)
1436 DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2)
1286 // 2688 = 8 * 336
1437 // 2688 = 8 * 336
1287 waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1
1438 waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1
1288 waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples
1439 waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples
1289 waveform_picker_regs->start_date = 0x00; // 0x38
1440 waveform_picker_regs->start_date = 0x7fffffff; // 0x38
1290 waveform_picker_regs->buffer_length = 0x1f8; // buffer length in burst = 3 * 2688 / 16 = 504 = 0x1f8
1441 //
1442 // coarse time and fine time registers are not initialized, they are volatile
1443 //
1444 waveform_picker_regs->buffer_length = 0x1f8;// buffer length in burst = 3 * 2688 / 16 = 504 = 0x1f8
1291 }
1445 }
1292
1446
1293 void set_wfp_data_shaping( void )
1447 void set_wfp_data_shaping( void )
1294 {
1448 {
1295 /** This function sets the data_shaping register of the waveform picker module.
1449 /** This function sets the data_shaping register of the waveform picker module.
1296 *
1450 *
1297 * The value is read from one field of the parameter_dump_packet structure:\n
1451 * The value is read from one field of the parameter_dump_packet structure:\n
1298 * bw_sp0_sp1_r0_r1
1452 * bw_sp0_sp1_r0_r1
1299 *
1453 *
1300 */
1454 */
1301
1455
1302 unsigned char data_shaping;
1456 unsigned char data_shaping;
1303
1457
1304 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
1458 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
1305 // waveform picker : [R1 R0 SP1 SP0 BW]
1459 // waveform picker : [R1 R0 SP1 SP0 BW]
1306
1460
1307 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
1461 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
1308
1462
1309 waveform_picker_regs->data_shaping =
1463 waveform_picker_regs->data_shaping =
1310 ( (data_shaping & 0x10) >> 4 ) // BW
1464 ( (data_shaping & 0x10) >> 4 ) // BW
1311 + ( (data_shaping & 0x08) >> 2 ) // SP0
1465 + ( (data_shaping & 0x08) >> 2 ) // SP0
1312 + ( (data_shaping & 0x04) ) // SP1
1466 + ( (data_shaping & 0x04) ) // SP1
1313 + ( (data_shaping & 0x02) << 2 ) // R0
1467 + ( (data_shaping & 0x02) << 2 ) // R0
1314 + ( (data_shaping & 0x01) << 4 ); // R1
1468 + ( (data_shaping & 0x01) << 4 ); // R1
1315 }
1469 }
1316
1470
1317 void set_wfp_burst_enable_register( unsigned char mode )
1471 void set_wfp_burst_enable_register( unsigned char mode )
1318 {
1472 {
1319 /** This function sets the waveform picker burst_enable register depending on the mode.
1473 /** This function sets the waveform picker burst_enable register depending on the mode.
1320 *
1474 *
1321 * @param mode is the LFR mode to launch.
1475 * @param mode is the LFR mode to launch.
1322 *
1476 *
1323 * The burst bits shall be before the enable bits.
1477 * The burst bits shall be before the enable bits.
1324 *
1478 *
1325 */
1479 */
1326
1480
1327 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1481 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1328 // the burst bits shall be set first, before the enable bits
1482 // the burst bits shall be set first, before the enable bits
1329 switch(mode) {
1483 switch(mode) {
1330 case(LFR_MODE_NORMAL):
1484 case(LFR_MODE_NORMAL):
1331 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable
1485 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable
1332 waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1486 waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1333 break;
1487 break;
1334 case(LFR_MODE_BURST):
1488 case(LFR_MODE_BURST):
1335 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1489 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1336 // waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2
1490 // waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2
1337 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1100] enable f3 AND f2
1491 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1100] enable f3 AND f2
1338 break;
1492 break;
1339 case(LFR_MODE_SBM1):
1493 case(LFR_MODE_SBM1):
1340 waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled
1494 waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled
1341 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1495 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1342 break;
1496 break;
1343 case(LFR_MODE_SBM2):
1497 case(LFR_MODE_SBM2):
1344 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1498 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1345 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1499 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1346 break;
1500 break;
1347 default:
1501 default:
1348 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1502 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1349 break;
1503 break;
1350 }
1504 }
1351 }
1505 }
1352
1506
1353 void set_wfp_delta_snapshot( void )
1507 void set_wfp_delta_snapshot( void )
1354 {
1508 {
1355 /** This function sets the delta_snapshot register of the waveform picker module.
1509 /** This function sets the delta_snapshot register of the waveform picker module.
1356 *
1510 *
1357 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
1511 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
1358 * - sy_lfr_n_swf_p[0]
1512 * - sy_lfr_n_swf_p[0]
1359 * - sy_lfr_n_swf_p[1]
1513 * - sy_lfr_n_swf_p[1]
1360 *
1514 *
1361 */
1515 */
1362
1516
1363 unsigned int delta_snapshot;
1517 unsigned int delta_snapshot;
1364 unsigned int delta_snapshot_in_T2;
1518 unsigned int delta_snapshot_in_T2;
1365
1519
1366 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
1520 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
1367 + parameter_dump_packet.sy_lfr_n_swf_p[1];
1521 + parameter_dump_packet.sy_lfr_n_swf_p[1];
1368
1522
1369 delta_snapshot_in_T2 = delta_snapshot * 256;
1523 delta_snapshot_in_T2 = delta_snapshot * 256;
1370 waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2 - 1; // max 4 bytes
1524 waveform_picker_regs->delta_snapshot = delta_snapshot_in_T2 - 1; // max 4 bytes
1371 }
1525 }
1372
1526
1373 void set_wfp_delta_f0_f0_2( void )
1527 void set_wfp_delta_f0_f0_2( void )
1374 {
1528 {
1375 unsigned int delta_snapshot;
1529 unsigned int delta_snapshot;
1376 unsigned int nb_samples_per_snapshot;
1530 unsigned int nb_samples_per_snapshot;
1377 float delta_f0_in_float;
1531 float delta_f0_in_float;
1378
1532
1379 delta_snapshot = waveform_picker_regs->delta_snapshot;
1533 delta_snapshot = waveform_picker_regs->delta_snapshot;
1380 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1534 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1381 delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.;
1535 delta_f0_in_float =nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 24576.) * 256.;
1382
1536
1383 waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float );
1537 waveform_picker_regs->delta_f0 = delta_snapshot - floor( delta_f0_in_float );
1384 waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits
1538 waveform_picker_regs->delta_f0_2 = 0x7; // max 7 bits
1385 }
1539 }
1386
1540
1387 void set_wfp_delta_f1( void )
1541 void set_wfp_delta_f1( void )
1388 {
1542 {
1389 unsigned int delta_snapshot;
1543 unsigned int delta_snapshot;
1390 unsigned int nb_samples_per_snapshot;
1544 unsigned int nb_samples_per_snapshot;
1391 float delta_f1_in_float;
1545 float delta_f1_in_float;
1392
1546
1393 delta_snapshot = waveform_picker_regs->delta_snapshot;
1547 delta_snapshot = waveform_picker_regs->delta_snapshot;
1394 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1548 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1395 delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.;
1549 delta_f1_in_float = nb_samples_per_snapshot / 2. * ( 1. / 256. - 1. / 4096.) * 256.;
1396
1550
1397 waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float );
1551 waveform_picker_regs->delta_f1 = delta_snapshot - floor( delta_f1_in_float );
1398 }
1552 }
1399
1553
1400 void set_wfp_delta_f2()
1554 void set_wfp_delta_f2()
1401 {
1555 {
1402 unsigned int delta_snapshot;
1556 unsigned int delta_snapshot;
1403 unsigned int nb_samples_per_snapshot;
1557 unsigned int nb_samples_per_snapshot;
1404
1558
1405 delta_snapshot = waveform_picker_regs->delta_snapshot;
1559 delta_snapshot = waveform_picker_regs->delta_snapshot;
1406 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1560 nb_samples_per_snapshot = parameter_dump_packet.sy_lfr_n_swf_l[0] * 256 + parameter_dump_packet.sy_lfr_n_swf_l[1];
1407
1561
1408 waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2;
1562 waveform_picker_regs->delta_f2 = delta_snapshot - nb_samples_per_snapshot / 2;
1409 }
1563 }
1410
1564
1411 //*****************
1565 //*****************
1412 // local parameters
1566 // local parameters
1413
1567
1414 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1568 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1415 {
1569 {
1416 /** This function increments the parameter "sequence_cnt" depending on the sid passed in argument.
1570 /** This function increments the parameter "sequence_cnt" depending on the sid passed in argument.
1417 *
1571 *
1418 * @param packet_sequence_control is a pointer toward the parameter sequence_cnt to update.
1572 * @param packet_sequence_control is a pointer toward the parameter sequence_cnt to update.
1419 * @param sid is the source identifier of the packet being updated.
1573 * @param sid is the source identifier of the packet being updated.
1420 *
1574 *
1421 * REQ-LFR-SRS-5240 / SSS-CP-FS-590
1575 * REQ-LFR-SRS-5240 / SSS-CP-FS-590
1422 * The sequence counters shall wrap around from 2^14 to zero.
1576 * The sequence counters shall wrap around from 2^14 to zero.
1423 * The sequence counter shall start at zero at startup.
1577 * The sequence counter shall start at zero at startup.
1424 *
1578 *
1425 * REQ-LFR-SRS-5239 / SSS-CP-FS-580
1579 * REQ-LFR-SRS-5239 / SSS-CP-FS-580
1426 * All TM_LFR_SCIENCE_ packets are sent to ground, i.e. destination id = 0
1580 * All TM_LFR_SCIENCE_ packets are sent to ground, i.e. destination id = 0
1427 *
1581 *
1428 */
1582 */
1429
1583
1430 unsigned short *sequence_cnt;
1584 unsigned short *sequence_cnt;
1431 unsigned short segmentation_grouping_flag;
1585 unsigned short segmentation_grouping_flag;
1432 unsigned short new_packet_sequence_control;
1586 unsigned short new_packet_sequence_control;
1433 rtems_mode initial_mode_set;
1587 rtems_mode initial_mode_set;
1434 rtems_mode current_mode_set;
1588 rtems_mode current_mode_set;
1435 rtems_status_code status;
1589 rtems_status_code status;
1436
1590
1437 //******************************************
1591 //******************************************
1438 // CHANGE THE MODE OF THE CALLING RTEMS TASK
1592 // CHANGE THE MODE OF THE CALLING RTEMS TASK
1439 status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &initial_mode_set );
1593 status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &initial_mode_set );
1440
1594
1441 if ( (sid == SID_NORM_SWF_F0) || (sid == SID_NORM_SWF_F1) || (sid == SID_NORM_SWF_F2)
1595 if ( (sid == SID_NORM_SWF_F0) || (sid == SID_NORM_SWF_F1) || (sid == SID_NORM_SWF_F2)
1442 || (sid == SID_NORM_CWF_F3) || (sid == SID_NORM_CWF_LONG_F3)
1596 || (sid == SID_NORM_CWF_F3) || (sid == SID_NORM_CWF_LONG_F3)
1443 || (sid == SID_BURST_CWF_F2)
1597 || (sid == SID_BURST_CWF_F2)
1444 || (sid == SID_NORM_ASM_F0) || (sid == SID_NORM_ASM_F1) || (sid == SID_NORM_ASM_F2)
1598 || (sid == SID_NORM_ASM_F0) || (sid == SID_NORM_ASM_F1) || (sid == SID_NORM_ASM_F2)
1445 || (sid == SID_NORM_BP1_F0) || (sid == SID_NORM_BP1_F1) || (sid == SID_NORM_BP1_F2)
1599 || (sid == SID_NORM_BP1_F0) || (sid == SID_NORM_BP1_F1) || (sid == SID_NORM_BP1_F2)
1446 || (sid == SID_NORM_BP2_F0) || (sid == SID_NORM_BP2_F1) || (sid == SID_NORM_BP2_F2)
1600 || (sid == SID_NORM_BP2_F0) || (sid == SID_NORM_BP2_F1) || (sid == SID_NORM_BP2_F2)
1447 || (sid == SID_BURST_BP1_F0) || (sid == SID_BURST_BP2_F0)
1601 || (sid == SID_BURST_BP1_F0) || (sid == SID_BURST_BP2_F0)
1448 || (sid == SID_BURST_BP1_F1) || (sid == SID_BURST_BP2_F1) )
1602 || (sid == SID_BURST_BP1_F1) || (sid == SID_BURST_BP2_F1) )
1449 {
1603 {
1450 sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_NORMAL_BURST;
1604 sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_NORMAL_BURST;
1451 }
1605 }
1452 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2)
1606 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2)
1453 || (sid == SID_SBM1_BP1_F0) || (sid == SID_SBM1_BP2_F0)
1607 || (sid == SID_SBM1_BP1_F0) || (sid == SID_SBM1_BP2_F0)
1454 || (sid == SID_SBM2_BP1_F0) || (sid == SID_SBM2_BP2_F0)
1608 || (sid == SID_SBM2_BP1_F0) || (sid == SID_SBM2_BP2_F0)
1455 || (sid == SID_SBM2_BP1_F1) || (sid == SID_SBM2_BP2_F1) )
1609 || (sid == SID_SBM2_BP1_F1) || (sid == SID_SBM2_BP2_F1) )
1456 {
1610 {
1457 sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_SBM1_SBM2;
1611 sequence_cnt = (unsigned short *) &sequenceCounters_SCIENCE_SBM1_SBM2;
1458 }
1612 }
1459 else
1613 else
1460 {
1614 {
1461 sequence_cnt = (unsigned short *) NULL;
1615 sequence_cnt = (unsigned short *) NULL;
1462 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1616 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1463 }
1617 }
1464
1618
1465 if (sequence_cnt != NULL)
1619 if (sequence_cnt != NULL)
1466 {
1620 {
1467 segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
1621 segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
1468 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1622 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1469
1623
1470 new_packet_sequence_control = segmentation_grouping_flag | (*sequence_cnt) ;
1624 new_packet_sequence_control = segmentation_grouping_flag | (*sequence_cnt) ;
1471
1625
1472 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1626 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1473 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1627 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1474
1628
1475 // increment the sequence counter
1629 // increment the sequence counter
1476 if ( *sequence_cnt < SEQ_CNT_MAX)
1630 if ( *sequence_cnt < SEQ_CNT_MAX)
1477 {
1631 {
1478 *sequence_cnt = *sequence_cnt + 1;
1632 *sequence_cnt = *sequence_cnt + 1;
1479 }
1633 }
1480 else
1634 else
1481 {
1635 {
1482 *sequence_cnt = 0;
1636 *sequence_cnt = 0;
1483 }
1637 }
1484 }
1638 }
1485
1639
1486 //***********************************
1640 //***********************************
1487 // RESET THE MODE OF THE CALLING TASK
1641 // RESET THE MODE OF THE CALLING TASK
1488 status = rtems_task_mode( initial_mode_set, RTEMS_PREEMPT_MASK, &current_mode_set );
1642 status = rtems_task_mode( initial_mode_set, RTEMS_PREEMPT_MASK, &current_mode_set );
1489 }
1643 }
@@ -1,267 +1,267
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 3.2.0, 2014-09-25T16:02:40. -->
3 <!-- Written by QtCreator 3.2.1, 2014-10-24T14:21:58. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>EnvironmentId</variable>
6 <variable>EnvironmentId</variable>
7 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
7 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
8 </data>
8 </data>
9 <data>
9 <data>
10 <variable>ProjectExplorer.Project.ActiveTarget</variable>
10 <variable>ProjectExplorer.Project.ActiveTarget</variable>
11 <value type="int">0</value>
11 <value type="int">0</value>
12 </data>
12 </data>
13 <data>
13 <data>
14 <variable>ProjectExplorer.Project.EditorSettings</variable>
14 <variable>ProjectExplorer.Project.EditorSettings</variable>
15 <valuemap type="QVariantMap">
15 <valuemap type="QVariantMap">
16 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
16 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
17 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
17 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
18 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
18 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
19 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
19 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
20 <value type="QString" key="language">Cpp</value>
20 <value type="QString" key="language">Cpp</value>
21 <valuemap type="QVariantMap" key="value">
21 <valuemap type="QVariantMap" key="value">
22 <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
22 <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
23 </valuemap>
23 </valuemap>
24 </valuemap>
24 </valuemap>
25 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
25 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
26 <value type="QString" key="language">QmlJS</value>
26 <value type="QString" key="language">QmlJS</value>
27 <valuemap type="QVariantMap" key="value">
27 <valuemap type="QVariantMap" key="value">
28 <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
28 <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
29 </valuemap>
29 </valuemap>
30 </valuemap>
30 </valuemap>
31 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
31 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
32 <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
32 <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
33 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
33 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
34 <value type="int" key="EditorConfiguration.IndentSize">4</value>
34 <value type="int" key="EditorConfiguration.IndentSize">4</value>
35 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
35 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
36 <value type="int" key="EditorConfiguration.MarginColumn">80</value>
36 <value type="int" key="EditorConfiguration.MarginColumn">80</value>
37 <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
37 <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
38 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
38 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
39 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
39 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
40 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
40 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
41 <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
41 <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
42 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
42 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
43 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
43 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
44 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
44 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
45 <value type="int" key="EditorConfiguration.TabSize">8</value>
45 <value type="int" key="EditorConfiguration.TabSize">8</value>
46 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
46 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
47 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
47 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
48 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
48 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
49 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
49 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
50 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
50 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
51 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
51 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
52 </valuemap>
52 </valuemap>
53 </data>
53 </data>
54 <data>
54 <data>
55 <variable>ProjectExplorer.Project.PluginSettings</variable>
55 <variable>ProjectExplorer.Project.PluginSettings</variable>
56 <valuemap type="QVariantMap"/>
56 <valuemap type="QVariantMap"/>
57 </data>
57 </data>
58 <data>
58 <data>
59 <variable>ProjectExplorer.Project.Target.0</variable>
59 <variable>ProjectExplorer.Project.Target.0</variable>
60 <valuemap type="QVariantMap">
60 <valuemap type="QVariantMap">
61 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
61 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
62 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
62 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
63 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
63 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
64 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
64 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
65 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
65 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
66 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
66 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
67 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
67 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
68 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/opt/DEV_PLE/timegen-qt</value>
68 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/opt/DEV_PLE/timegen-qt</value>
69 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
69 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
70 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
70 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
71 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
71 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
72 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
72 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
73 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
73 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
74 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
74 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
75 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
75 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
76 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
76 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
77 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
77 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
78 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
78 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
79 </valuemap>
79 </valuemap>
80 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
80 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
81 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
81 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
82 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
82 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
83 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
83 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
84 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
84 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
85 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
85 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
86 <value type="QString">-w</value>
86 <value type="QString">-w</value>
87 <value type="QString">-r</value>
87 <value type="QString">-r</value>
88 </valuelist>
88 </valuelist>
89 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
89 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
90 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
90 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
91 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
91 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
92 </valuemap>
92 </valuemap>
93 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
93 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
96 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
96 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
97 </valuemap>
97 </valuemap>
98 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
98 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
99 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
99 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
100 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
100 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
101 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
101 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
102 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
102 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
103 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
103 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
104 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
104 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
105 <value type="QString">-w</value>
105 <value type="QString">-w</value>
106 <value type="QString">-r</value>
106 <value type="QString">-r</value>
107 </valuelist>
107 </valuelist>
108 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
108 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
109 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
109 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
110 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
110 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
111 </valuemap>
111 </valuemap>
112 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
112 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
115 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
115 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
116 </valuemap>
116 </valuemap>
117 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
117 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
118 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
118 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
119 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
119 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
120 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
120 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
121 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
121 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
122 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
122 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
123 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
123 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
124 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
124 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
125 </valuemap>
125 </valuemap>
126 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
126 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
127 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/opt/DEV_PLE/build-timegen-qt-Desktop_Qt_4_8_2_in_PATH_System-Release</value>
127 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/opt/DEV_PLE/build-timegen-qt-Desktop_Qt_4_8_2_in_PATH_System-Release</value>
128 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
128 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
129 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
129 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
130 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
130 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
131 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
131 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
132 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
132 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
133 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
133 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
134 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
134 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
135 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
135 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
136 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
136 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
137 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
137 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
138 </valuemap>
138 </valuemap>
139 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
139 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
140 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
140 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
141 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
141 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
142 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
142 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
143 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
143 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
144 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
144 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
145 <value type="QString">-w</value>
145 <value type="QString">-w</value>
146 <value type="QString">-r</value>
146 <value type="QString">-r</value>
147 </valuelist>
147 </valuelist>
148 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
148 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
149 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
149 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
150 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
150 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
151 </valuemap>
151 </valuemap>
152 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
152 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
153 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
153 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
154 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
154 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
155 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
155 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
156 </valuemap>
156 </valuemap>
157 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
157 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
158 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
158 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
159 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
159 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
160 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
160 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
161 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
161 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
162 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
162 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
163 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
163 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
164 <value type="QString">-w</value>
164 <value type="QString">-w</value>
165 <value type="QString">-r</value>
165 <value type="QString">-r</value>
166 </valuelist>
166 </valuelist>
167 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
167 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
168 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
168 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
169 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
169 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
170 </valuemap>
170 </valuemap>
171 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
171 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
174 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
174 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
175 </valuemap>
175 </valuemap>
176 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
176 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
177 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
177 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
178 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
178 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
179 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
179 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
180 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
180 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
181 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
181 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
182 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
182 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
183 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
183 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
184 </valuemap>
184 </valuemap>
185 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
185 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
186 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
186 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
187 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
187 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
188 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
188 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
189 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
189 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
190 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
190 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
191 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
191 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
192 </valuemap>
192 </valuemap>
193 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
193 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
194 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
194 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
195 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
195 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
196 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
196 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
197 </valuemap>
197 </valuemap>
198 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
198 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
199 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
199 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
200 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
200 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
201 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
201 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
202 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
202 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
203 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
203 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
204 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
204 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
205 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
205 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
206 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
206 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
207 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
207 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
208 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
208 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
209 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
209 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
210 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
210 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
211 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
211 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
212 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
212 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
213 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
213 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
214 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
214 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
215 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
215 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
216 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
216 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
217 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
217 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
218 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
218 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
219 <value type="int">0</value>
219 <value type="int">0</value>
220 <value type="int">1</value>
220 <value type="int">1</value>
221 <value type="int">2</value>
221 <value type="int">2</value>
222 <value type="int">3</value>
222 <value type="int">3</value>
223 <value type="int">4</value>
223 <value type="int">4</value>
224 <value type="int">5</value>
224 <value type="int">5</value>
225 <value type="int">6</value>
225 <value type="int">6</value>
226 <value type="int">7</value>
226 <value type="int">7</value>
227 <value type="int">8</value>
227 <value type="int">8</value>
228 <value type="int">9</value>
228 <value type="int">9</value>
229 <value type="int">10</value>
229 <value type="int">10</value>
230 <value type="int">11</value>
230 <value type="int">11</value>
231 <value type="int">12</value>
231 <value type="int">12</value>
232 <value type="int">13</value>
232 <value type="int">13</value>
233 <value type="int">14</value>
233 <value type="int">14</value>
234 </valuelist>
234 </valuelist>
235 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
235 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
236 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
236 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
237 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">timegen-qt</value>
237 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">timegen-qt</value>
238 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
238 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
239 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/timegen-qt/timegen-qt.pro</value>
239 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/timegen-qt/timegen-qt.pro</value>
240 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
240 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
241 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">timegen-qt.pro</value>
241 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">timegen-qt.pro</value>
242 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
242 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
243 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
243 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
244 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
244 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
245 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
245 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
246 <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
246 <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
247 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
247 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
248 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
248 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
249 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
249 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
250 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
250 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
251 </valuemap>
251 </valuemap>
252 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
252 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
253 </valuemap>
253 </valuemap>
254 </data>
254 </data>
255 <data>
255 <data>
256 <variable>ProjectExplorer.Project.TargetCount</variable>
256 <variable>ProjectExplorer.Project.TargetCount</variable>
257 <value type="int">1</value>
257 <value type="int">1</value>
258 </data>
258 </data>
259 <data>
259 <data>
260 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
260 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
261 <value type="int">16</value>
261 <value type="int">16</value>
262 </data>
262 </data>
263 <data>
263 <data>
264 <variable>Version</variable>
264 <variable>Version</variable>
265 <value type="int">16</value>
265 <value type="int">16</value>
266 </data>
266 </data>
267 </qtcreator>
267 </qtcreator>
General Comments 0
You need to be logged in to leave comments. Login now