##// END OF EJS Templates
fsw-1-0...
paul -
r82:4237b1096e59 VHDLib206
parent child
Show More
@@ -1,248 +1,248
1 #############################################################################
1 #############################################################################
2 # Makefile for building: bin/fsw
2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Fri Nov 15 17:09:56 2013
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Nov 19 10:04:58 2013
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=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=1 -DSW_VERSION_N4=0 -DPRINT_MESSAGES_ON_CONSOLE
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=0 -DPRINT_MESSAGES_ON_CONSOLE
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header
17 LINK = sparc-rtems-g++
17 LINK = sparc-rtems-g++
18 LFLAGS =
18 LFLAGS =
19 LIBS = $(SUBLIBS)
19 LIBS = $(SUBLIBS)
20 AR = sparc-rtems-ar rcs
20 AR = sparc-rtems-ar rcs
21 RANLIB =
21 RANLIB =
22 QMAKE = /usr/bin/qmake-qt4
22 QMAKE = /usr/bin/qmake-qt4
23 TAR = tar -cf
23 TAR = tar -cf
24 COMPRESS = gzip -9f
24 COMPRESS = gzip -9f
25 COPY = cp -f
25 COPY = cp -f
26 SED = sed
26 SED = sed
27 COPY_FILE = $(COPY)
27 COPY_FILE = $(COPY)
28 COPY_DIR = $(COPY) -r
28 COPY_DIR = $(COPY) -r
29 STRIP = sparc-rtems-strip
29 STRIP = sparc-rtems-strip
30 INSTALL_FILE = install -m 644 -p
30 INSTALL_FILE = install -m 644 -p
31 INSTALL_DIR = $(COPY_DIR)
31 INSTALL_DIR = $(COPY_DIR)
32 INSTALL_PROGRAM = install -m 755 -p
32 INSTALL_PROGRAM = install -m 755 -p
33 DEL_FILE = rm -f
33 DEL_FILE = rm -f
34 SYMLINK = ln -f -s
34 SYMLINK = ln -f -s
35 DEL_DIR = rmdir
35 DEL_DIR = rmdir
36 MOVE = mv -f
36 MOVE = mv -f
37 CHK_DIR_EXISTS= test -d
37 CHK_DIR_EXISTS= test -d
38 MKDIR = mkdir -p
38 MKDIR = mkdir -p
39
39
40 ####### Output directory
40 ####### Output directory
41
41
42 OBJECTS_DIR = obj/
42 OBJECTS_DIR = obj/
43
43
44 ####### Files
44 ####### Files
45
45
46 SOURCES = ../src/wf_handler.c \
46 SOURCES = ../src/wf_handler.c \
47 ../src/tc_handler.c \
47 ../src/tc_handler.c \
48 ../src/fsw_processing.c \
48 ../src/fsw_processing.c \
49 ../src/fsw_misc.c \
49 ../src/fsw_misc.c \
50 ../src/fsw_init.c \
50 ../src/fsw_init.c \
51 ../src/fsw_globals.c \
51 ../src/fsw_globals.c \
52 ../src/fsw_spacewire.c \
52 ../src/fsw_spacewire.c \
53 ../src/tc_load_dump_parameters.c \
53 ../src/tc_load_dump_parameters.c \
54 ../src/tm_lfr_tc_exe.c \
54 ../src/tm_lfr_tc_exe.c \
55 ../src/tc_acceptance.c
55 ../src/tc_acceptance.c
56 OBJECTS = obj/wf_handler.o \
56 OBJECTS = obj/wf_handler.o \
57 obj/tc_handler.o \
57 obj/tc_handler.o \
58 obj/fsw_processing.o \
58 obj/fsw_processing.o \
59 obj/fsw_misc.o \
59 obj/fsw_misc.o \
60 obj/fsw_init.o \
60 obj/fsw_init.o \
61 obj/fsw_globals.o \
61 obj/fsw_globals.o \
62 obj/fsw_spacewire.o \
62 obj/fsw_spacewire.o \
63 obj/tc_load_dump_parameters.o \
63 obj/tc_load_dump_parameters.o \
64 obj/tm_lfr_tc_exe.o \
64 obj/tm_lfr_tc_exe.o \
65 obj/tc_acceptance.o
65 obj/tc_acceptance.o
66 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
66 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
67 /usr/lib64/qt4/mkspecs/common/linux.conf \
67 /usr/lib64/qt4/mkspecs/common/linux.conf \
68 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
68 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
69 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
69 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
70 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
70 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
71 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
71 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
72 /usr/lib64/qt4/mkspecs/qconfig.pri \
72 /usr/lib64/qt4/mkspecs/qconfig.pri \
73 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
73 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
74 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
74 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
75 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
75 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
76 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
76 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
77 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
77 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
78 sparc.pri \
78 sparc.pri \
79 /usr/lib64/qt4/mkspecs/features/release.prf \
79 /usr/lib64/qt4/mkspecs/features/release.prf \
80 /usr/lib64/qt4/mkspecs/features/default_post.prf \
80 /usr/lib64/qt4/mkspecs/features/default_post.prf \
81 /usr/lib64/qt4/mkspecs/features/shared.prf \
81 /usr/lib64/qt4/mkspecs/features/shared.prf \
82 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
82 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
83 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
83 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
84 /usr/lib64/qt4/mkspecs/features/resources.prf \
84 /usr/lib64/qt4/mkspecs/features/resources.prf \
85 /usr/lib64/qt4/mkspecs/features/uic.prf \
85 /usr/lib64/qt4/mkspecs/features/uic.prf \
86 /usr/lib64/qt4/mkspecs/features/yacc.prf \
86 /usr/lib64/qt4/mkspecs/features/yacc.prf \
87 /usr/lib64/qt4/mkspecs/features/lex.prf \
87 /usr/lib64/qt4/mkspecs/features/lex.prf \
88 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
88 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
89 fsw-qt.pro
89 fsw-qt.pro
90 QMAKE_TARGET = fsw
90 QMAKE_TARGET = fsw
91 DESTDIR = bin/
91 DESTDIR = bin/
92 TARGET = bin/fsw
92 TARGET = bin/fsw
93
93
94 first: all
94 first: all
95 ####### Implicit rules
95 ####### Implicit rules
96
96
97 .SUFFIXES: .o .c .cpp .cc .cxx .C
97 .SUFFIXES: .o .c .cpp .cc .cxx .C
98
98
99 .cpp.o:
99 .cpp.o:
100 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
100 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
101
101
102 .cc.o:
102 .cc.o:
103 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
103 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
104
104
105 .cxx.o:
105 .cxx.o:
106 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
106 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
107
107
108 .C.o:
108 .C.o:
109 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
109 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
110
110
111 .c.o:
111 .c.o:
112 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
112 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
113
113
114 ####### Build rules
114 ####### Build rules
115
115
116 all: Makefile $(TARGET)
116 all: Makefile $(TARGET)
117
117
118 $(TARGET): $(OBJECTS)
118 $(TARGET): $(OBJECTS)
119 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
119 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
120 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
120 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
121
121
122 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
122 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
123 /usr/lib64/qt4/mkspecs/common/linux.conf \
123 /usr/lib64/qt4/mkspecs/common/linux.conf \
124 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
124 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
125 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
125 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
126 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
126 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
127 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
127 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
128 /usr/lib64/qt4/mkspecs/qconfig.pri \
128 /usr/lib64/qt4/mkspecs/qconfig.pri \
129 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
129 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
130 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
130 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
131 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
131 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
132 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
132 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
133 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
133 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
134 sparc.pri \
134 sparc.pri \
135 /usr/lib64/qt4/mkspecs/features/release.prf \
135 /usr/lib64/qt4/mkspecs/features/release.prf \
136 /usr/lib64/qt4/mkspecs/features/default_post.prf \
136 /usr/lib64/qt4/mkspecs/features/default_post.prf \
137 /usr/lib64/qt4/mkspecs/features/shared.prf \
137 /usr/lib64/qt4/mkspecs/features/shared.prf \
138 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
138 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
139 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
139 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
140 /usr/lib64/qt4/mkspecs/features/resources.prf \
140 /usr/lib64/qt4/mkspecs/features/resources.prf \
141 /usr/lib64/qt4/mkspecs/features/uic.prf \
141 /usr/lib64/qt4/mkspecs/features/uic.prf \
142 /usr/lib64/qt4/mkspecs/features/yacc.prf \
142 /usr/lib64/qt4/mkspecs/features/yacc.prf \
143 /usr/lib64/qt4/mkspecs/features/lex.prf \
143 /usr/lib64/qt4/mkspecs/features/lex.prf \
144 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
144 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
145 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
145 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
146 /usr/lib64/qt4/mkspecs/common/unix.conf:
146 /usr/lib64/qt4/mkspecs/common/unix.conf:
147 /usr/lib64/qt4/mkspecs/common/linux.conf:
147 /usr/lib64/qt4/mkspecs/common/linux.conf:
148 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
148 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
149 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
149 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
150 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
150 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
151 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
151 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
152 /usr/lib64/qt4/mkspecs/qconfig.pri:
152 /usr/lib64/qt4/mkspecs/qconfig.pri:
153 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
153 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
154 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
154 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
155 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
155 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
156 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
156 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
157 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
157 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
158 sparc.pri:
158 sparc.pri:
159 /usr/lib64/qt4/mkspecs/features/release.prf:
159 /usr/lib64/qt4/mkspecs/features/release.prf:
160 /usr/lib64/qt4/mkspecs/features/default_post.prf:
160 /usr/lib64/qt4/mkspecs/features/default_post.prf:
161 /usr/lib64/qt4/mkspecs/features/shared.prf:
161 /usr/lib64/qt4/mkspecs/features/shared.prf:
162 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
162 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
163 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
163 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
164 /usr/lib64/qt4/mkspecs/features/resources.prf:
164 /usr/lib64/qt4/mkspecs/features/resources.prf:
165 /usr/lib64/qt4/mkspecs/features/uic.prf:
165 /usr/lib64/qt4/mkspecs/features/uic.prf:
166 /usr/lib64/qt4/mkspecs/features/yacc.prf:
166 /usr/lib64/qt4/mkspecs/features/yacc.prf:
167 /usr/lib64/qt4/mkspecs/features/lex.prf:
167 /usr/lib64/qt4/mkspecs/features/lex.prf:
168 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
168 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
169 qmake: FORCE
169 qmake: FORCE
170 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
170 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
171
171
172 dist:
172 dist:
173 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
173 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
174 $(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
174 $(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
175
175
176
176
177 clean:compiler_clean
177 clean:compiler_clean
178 -$(DEL_FILE) $(OBJECTS)
178 -$(DEL_FILE) $(OBJECTS)
179 -$(DEL_FILE) *~ core *.core
179 -$(DEL_FILE) *~ core *.core
180
180
181
181
182 ####### Sub-libraries
182 ####### Sub-libraries
183
183
184 distclean: clean
184 distclean: clean
185 -$(DEL_FILE) $(TARGET)
185 -$(DEL_FILE) $(TARGET)
186 -$(DEL_FILE) Makefile
186 -$(DEL_FILE) Makefile
187
187
188
188
189 grmon:
189 grmon:
190 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
190 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
191
191
192 check: first
192 check: first
193
193
194 compiler_rcc_make_all:
194 compiler_rcc_make_all:
195 compiler_rcc_clean:
195 compiler_rcc_clean:
196 compiler_uic_make_all:
196 compiler_uic_make_all:
197 compiler_uic_clean:
197 compiler_uic_clean:
198 compiler_image_collection_make_all: qmake_image_collection.cpp
198 compiler_image_collection_make_all: qmake_image_collection.cpp
199 compiler_image_collection_clean:
199 compiler_image_collection_clean:
200 -$(DEL_FILE) qmake_image_collection.cpp
200 -$(DEL_FILE) qmake_image_collection.cpp
201 compiler_yacc_decl_make_all:
201 compiler_yacc_decl_make_all:
202 compiler_yacc_decl_clean:
202 compiler_yacc_decl_clean:
203 compiler_yacc_impl_make_all:
203 compiler_yacc_impl_make_all:
204 compiler_yacc_impl_clean:
204 compiler_yacc_impl_clean:
205 compiler_lex_make_all:
205 compiler_lex_make_all:
206 compiler_lex_clean:
206 compiler_lex_clean:
207 compiler_clean:
207 compiler_clean:
208
208
209 ####### Compile
209 ####### Compile
210
210
211 obj/wf_handler.o: ../src/wf_handler.c
211 obj/wf_handler.o: ../src/wf_handler.c
212 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
212 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
213
213
214 obj/tc_handler.o: ../src/tc_handler.c
214 obj/tc_handler.o: ../src/tc_handler.c
215 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
215 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
216
216
217 obj/fsw_processing.o: ../src/fsw_processing.c ../src/fsw_processing_globals.c
217 obj/fsw_processing.o: ../src/fsw_processing.c ../src/fsw_processing_globals.c
218 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c
218 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c
219
219
220 obj/fsw_misc.o: ../src/fsw_misc.c
220 obj/fsw_misc.o: ../src/fsw_misc.c
221 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
221 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
222
222
223 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
223 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
224 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
224 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
225
225
226 obj/fsw_globals.o: ../src/fsw_globals.c
226 obj/fsw_globals.o: ../src/fsw_globals.c
227 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
227 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
228
228
229 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
229 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
230 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
230 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
231
231
232 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
232 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
233 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
233 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
234
234
235 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
235 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
236 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
236 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
237
237
238 obj/tc_acceptance.o: ../src/tc_acceptance.c
238 obj/tc_acceptance.o: ../src/tc_acceptance.c
239 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
239 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
240
240
241 ####### Install
241 ####### Install
242
242
243 install: FORCE
243 install: FORCE
244
244
245 uninstall: FORCE
245 uninstall: FORCE
246
246
247 FORCE:
247 FORCE:
248
248
@@ -1,20 +1,20
1 SREC_PREFIX = RpwLfrApp
1 SREC_PREFIX = RpwLfrApp
2 SREC_COUNTER = 0001
2 SREC_COUNTER = 0002
3 SREC_FSW_REF = fsw-0-7
3 SREC_FSW_REF = fsw-1-0
4 SREC_SUFFIX = .srec
4 SREC_SUFFIX = .srec
5 SREC_TEXT = $(SREC_PREFIX)_$(SREC_COUNTER)_text_$(SREC_FSW_REF)$(SREC_SUFFIX)
5 SREC_TEXT = $(SREC_PREFIX)_$(SREC_COUNTER)_text_$(SREC_FSW_REF)$(SREC_SUFFIX)
6 SREC_DATA = $(SREC_PREFIX)_$(SREC_COUNTER)_data_$(SREC_FSW_REF)$(SREC_SUFFIX)
6 SREC_DATA = $(SREC_PREFIX)_$(SREC_COUNTER)_data_$(SREC_FSW_REF)$(SREC_SUFFIX)
7 OBJCOPY = sparc-rtems-objcopy
7 OBJCOPY = sparc-rtems-objcopy
8 OBJCOPY_OPT = -g -v
8 OBJCOPY_OPT = -g -v
9
9
10 all: text data
10 all: text data
11
11
12 text: fsw
12 text: fsw
13 $(OBJCOPY) $(OBJCOPY_OPT) fsw $(SREC_TEXT) -O srec -j .text
13 $(OBJCOPY) $(OBJCOPY_OPT) fsw $(SREC_TEXT) -O srec -j .text
14
14
15 data: fsw
15 data: fsw
16 $(OBJCOPY) $(OBJCOPY_OPT) fsw $(SREC_DATA) -O srec -j .data
16 $(OBJCOPY) $(OBJCOPY_OPT) fsw $(SREC_DATA) -O srec -j .data
17
17
18 clean:
18 clean:
19 rm *.srec
19 rm *.srec
20
20
@@ -1,79 +1,79
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 *** gsa
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** gsa
4 CONFIG += console verbose
4 CONFIG += console verbose
5 CONFIG -= qt
5 CONFIG -= qt
6
6
7 include(./sparc.pri)
7 include(./sparc.pri)
8
8
9 # flight software version
9 # flight software version
10 SWVERSION=-1-0
10 SWVERSION=-1-0
11 DEFINES += SW_VERSION_N1=0
11 DEFINES += SW_VERSION_N1=1 # major
12 DEFINES += SW_VERSION_N2=0
12 DEFINES += SW_VERSION_N2=0 # minor
13 DEFINES += SW_VERSION_N3=1
13 DEFINES += SW_VERSION_N3=0 # patch
14 DEFINES += SW_VERSION_N4=0
14 DEFINES += SW_VERSION_N4=0 # internal
15
15
16 contains( CONFIG, verbose ) {
16 contains( CONFIG, verbose ) {
17 DEFINES += PRINT_MESSAGES_ON_CONSOLE
17 DEFINES += PRINT_MESSAGES_ON_CONSOLE
18 }
18 }
19
19
20 contains( CONFIG, debug_messages ) {
20 contains( CONFIG, debug_messages ) {
21 DEFINES += DEBUG_MESSAGES
21 DEFINES += DEBUG_MESSAGES
22 }
22 }
23
23
24 contains( CONFIG, cpu_usage_report ) {
24 contains( CONFIG, cpu_usage_report ) {
25 DEFINES += PRINT_TASK_STATISTICS
25 DEFINES += PRINT_TASK_STATISTICS
26 }
26 }
27
27
28 contains( CONFIG, stack_report ) {
28 contains( CONFIG, stack_report ) {
29 DEFINES += PRINT_STACK_REPORT
29 DEFINES += PRINT_STACK_REPORT
30 }
30 }
31
31
32 contains( CONFIG, boot_messages ) {
32 contains( CONFIG, boot_messages ) {
33 DEFINES += BOOT_MESSAGES
33 DEFINES += BOOT_MESSAGES
34 }
34 }
35
35
36 #doxygen.target = doxygen
36 #doxygen.target = doxygen
37 #doxygen.commands = doxygen ../doc/Doxyfile
37 #doxygen.commands = doxygen ../doc/Doxyfile
38 #QMAKE_EXTRA_TARGETS += doxygen
38 #QMAKE_EXTRA_TARGETS += doxygen
39
39
40 TARGET = fsw
40 TARGET = fsw
41 contains( CONFIG, gsa ) {
41 contains( CONFIG, gsa ) {
42 DEFINES += GSA
42 DEFINES += GSA
43 TARGET = fsw-gsa
43 TARGET = fsw-gsa
44 }
44 }
45
45
46 INCLUDEPATH += \
46 INCLUDEPATH += \
47 ../src \
47 ../src \
48 ../header
48 ../header
49
49
50 SOURCES += \
50 SOURCES += \
51 ../src/wf_handler.c \
51 ../src/wf_handler.c \
52 ../src/tc_handler.c \
52 ../src/tc_handler.c \
53 ../src/fsw_processing.c \
53 ../src/fsw_processing.c \
54 ../src/fsw_misc.c \
54 ../src/fsw_misc.c \
55 ../src/fsw_init.c \
55 ../src/fsw_init.c \
56 ../src/fsw_globals.c \
56 ../src/fsw_globals.c \
57 ../src/fsw_spacewire.c \
57 ../src/fsw_spacewire.c \
58 ../src/tc_load_dump_parameters.c \
58 ../src/tc_load_dump_parameters.c \
59 ../src/tm_lfr_tc_exe.c \
59 ../src/tm_lfr_tc_exe.c \
60 ../src/tc_acceptance.c
60 ../src/tc_acceptance.c
61
61
62
62
63 HEADERS += \
63 HEADERS += \
64 ../header/wf_handler.h \
64 ../header/wf_handler.h \
65 ../header/tc_handler.h \
65 ../header/tc_handler.h \
66 ../header/grlib_regs.h \
66 ../header/grlib_regs.h \
67 ../header/fsw_processing.h \
67 ../header/fsw_processing.h \
68 ../header/fsw_params.h \
68 ../header/fsw_params.h \
69 ../header/fsw_misc.h \
69 ../header/fsw_misc.h \
70 ../header/fsw_init.h \
70 ../header/fsw_init.h \
71 ../header/ccsds_types.h \
71 ../header/ccsds_types.h \
72 ../header/fsw_params_processing.h \
72 ../header/fsw_params_processing.h \
73 ../header/fsw_spacewire.h \
73 ../header/fsw_spacewire.h \
74 ../header/tm_byte_positions.h \
74 ../header/tm_byte_positions.h \
75 ../header/tc_load_dump_parameters.h \
75 ../header/tc_load_dump_parameters.h \
76 ../header/tm_lfr_tc_exe.h \
76 ../header/tm_lfr_tc_exe.h \
77 ../header/tc_acceptance.h \
77 ../header/tc_acceptance.h \
78 ../header/fsw_params_nb_bytes.h
78 ../header/fsw_params_nb_bytes.h
79
79
@@ -1,439 +1,439
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 2.8.1, 2013-11-15T17:08:10. -->
3 <!-- Written by QtCreator 2.8.1, 2013-11-19T10:04:48. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
7 <value type="int">0</value>
7 <value type="int">0</value>
8 </data>
8 </data>
9 <data>
9 <data>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
11 <valuemap type="QVariantMap">
11 <valuemap type="QVariantMap">
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
16 <value type="QString" key="language">Cpp</value>
16 <value type="QString" key="language">Cpp</value>
17 <valuemap type="QVariantMap" key="value">
17 <valuemap type="QVariantMap" key="value">
18 <value type="QString" key="CurrentPreferences">CppGlobal</value>
18 <value type="QString" key="CurrentPreferences">CppGlobal</value>
19 </valuemap>
19 </valuemap>
20 </valuemap>
20 </valuemap>
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
22 <value type="QString" key="language">QmlJS</value>
22 <value type="QString" key="language">QmlJS</value>
23 <valuemap type="QVariantMap" key="value">
23 <valuemap type="QVariantMap" key="value">
24 <value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
24 <value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
25 </valuemap>
25 </valuemap>
26 </valuemap>
26 </valuemap>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
28 <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
28 <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
32 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
32 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
33 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
33 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
34 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
34 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
35 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
35 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
36 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
36 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
37 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
37 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
38 <value type="int" key="EditorConfiguration.TabSize">8</value>
38 <value type="int" key="EditorConfiguration.TabSize">8</value>
39 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
39 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
40 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
40 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
41 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
41 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
42 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
42 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
43 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
43 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
44 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
44 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
45 </valuemap>
45 </valuemap>
46 </data>
46 </data>
47 <data>
47 <data>
48 <variable>ProjectExplorer.Project.PluginSettings</variable>
48 <variable>ProjectExplorer.Project.PluginSettings</variable>
49 <valuemap type="QVariantMap"/>
49 <valuemap type="QVariantMap"/>
50 </data>
50 </data>
51 <data>
51 <data>
52 <variable>ProjectExplorer.Project.Target.0</variable>
52 <variable>ProjectExplorer.Project.Target.0</variable>
53 <valuemap type="QVariantMap">
53 <valuemap type="QVariantMap">
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
61 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
61 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
63 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
63 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
64 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
64 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
67 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
67 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
69 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
69 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
70 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
70 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
71 </valuemap>
71 </valuemap>
72 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
72 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
73 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
73 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
74 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
74 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
77 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
77 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
78 <value type="QString">-w</value>
78 <value type="QString">-w</value>
79 <value type="QString">-r</value>
79 <value type="QString">-r</value>
80 </valuelist>
80 </valuelist>
81 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
81 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
82 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
82 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
84 </valuemap>
84 </valuemap>
85 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
85 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
86 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
86 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
89 </valuemap>
89 </valuemap>
90 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
90 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
92 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
92 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
93 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
93 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
96 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
96 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
97 <value type="QString">-w</value>
97 <value type="QString">-w</value>
98 <value type="QString">-r</value>
98 <value type="QString">-r</value>
99 </valuelist>
99 </valuelist>
100 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
100 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
101 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
101 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
103 </valuemap>
103 </valuemap>
104 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
104 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
105 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
105 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
108 </valuemap>
108 </valuemap>
109 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
109 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
110 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
110 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
111 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
111 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
112 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
112 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
115 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
115 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
116 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
116 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
118 </valuemap>
118 </valuemap>
119 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
119 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
120 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
120 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
122 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
122 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
126 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
126 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
127 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
127 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
128 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
128 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
129 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
129 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
130 </valuemap>
130 </valuemap>
131 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
131 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
132 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
132 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
133 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
133 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
134 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
134 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
136 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
136 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
137 <value type="QString">-w</value>
137 <value type="QString">-w</value>
138 <value type="QString">-r</value>
138 <value type="QString">-r</value>
139 </valuelist>
139 </valuelist>
140 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
140 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
141 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
141 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
142 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
142 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
143 </valuemap>
143 </valuemap>
144 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
144 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
145 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
145 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
146 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
146 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
147 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
147 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
148 </valuemap>
148 </valuemap>
149 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
149 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
150 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
150 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
151 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
151 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
152 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
152 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
153 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
153 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
154 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
154 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
155 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
155 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
156 <value type="QString">-w</value>
156 <value type="QString">-w</value>
157 <value type="QString">-r</value>
157 <value type="QString">-r</value>
158 </valuelist>
158 </valuelist>
159 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
159 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
160 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
160 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
161 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
161 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
162 </valuemap>
162 </valuemap>
163 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
163 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
164 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
164 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
165 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
165 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
166 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
166 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
167 </valuemap>
167 </valuemap>
168 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
168 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
169 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
169 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
170 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
170 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
171 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release2</value>
171 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release2</value>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
174 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
174 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
175 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
175 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
176 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
176 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
177 </valuemap>
177 </valuemap>
178 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
178 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
179 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
179 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
180 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
180 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
181 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
181 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
182 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
182 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
183 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
183 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
184 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
184 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
185 </valuemap>
185 </valuemap>
186 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
186 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
187 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
187 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
188 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
188 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
189 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
189 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
190 </valuemap>
190 </valuemap>
191 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
191 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
192 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
192 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
193 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
193 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
194 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
194 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
195 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
195 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
196 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
196 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
197 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
197 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
198 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
198 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
199 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
199 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
200 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
200 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
201 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
201 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
202 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
202 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
203 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
203 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
204 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
204 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
205 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
205 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
206 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
206 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
207 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
207 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
208 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
208 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
209 <value type="int">0</value>
209 <value type="int">0</value>
210 <value type="int">1</value>
210 <value type="int">1</value>
211 <value type="int">2</value>
211 <value type="int">2</value>
212 <value type="int">3</value>
212 <value type="int">3</value>
213 <value type="int">4</value>
213 <value type="int">4</value>
214 <value type="int">5</value>
214 <value type="int">5</value>
215 <value type="int">6</value>
215 <value type="int">6</value>
216 <value type="int">7</value>
216 <value type="int">7</value>
217 <value type="int">8</value>
217 <value type="int">8</value>
218 <value type="int">9</value>
218 <value type="int">9</value>
219 <value type="int">10</value>
219 <value type="int">10</value>
220 <value type="int">11</value>
220 <value type="int">11</value>
221 <value type="int">12</value>
221 <value type="int">12</value>
222 <value type="int">13</value>
222 <value type="int">13</value>
223 <value type="int">14</value>
223 <value type="int">14</value>
224 </valuelist>
224 </valuelist>
225 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
225 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
226 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
226 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
227 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
227 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
228 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
228 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
229 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
229 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
230 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
230 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
231 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
231 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
232 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
232 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
233 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
233 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
234 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
234 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
235 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
235 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
236 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
236 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
237 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
237 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
238 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
238 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
239 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
239 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
240 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
240 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
241 </valuemap>
241 </valuemap>
242 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
242 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
243 </valuemap>
243 </valuemap>
244 </data>
244 </data>
245 <data>
245 <data>
246 <variable>ProjectExplorer.Project.Target.1</variable>
246 <variable>ProjectExplorer.Project.Target.1</variable>
247 <valuemap type="QVariantMap">
247 <valuemap type="QVariantMap">
248 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop2</value>
248 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop2</value>
249 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop2</value>
249 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop2</value>
250 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{e96c4de1-323d-4095-8746-d006ca3bd573}</value>
250 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{e96c4de1-323d-4095-8746-d006ca3bd573}</value>
251 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
251 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
252 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
252 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
253 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
253 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
254 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
254 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
255 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
255 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
256 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
256 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
257 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
257 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
258 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
258 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
259 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
259 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
260 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
260 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
261 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
261 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
262 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
262 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
263 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
263 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
264 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
264 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
265 </valuemap>
265 </valuemap>
266 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
266 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
267 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
267 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
268 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
268 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
269 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
269 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
270 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
270 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
271 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
271 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
272 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
272 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
273 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
273 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
274 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
274 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
275 </valuemap>
275 </valuemap>
276 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
276 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
277 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
277 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
278 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
278 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
279 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
279 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
280 </valuemap>
280 </valuemap>
281 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
281 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
282 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
282 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
283 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
283 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
284 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
284 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
285 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
285 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
286 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
286 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
287 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
287 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
288 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
288 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
289 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
289 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
290 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
290 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
291 </valuemap>
291 </valuemap>
292 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
292 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
293 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
293 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
294 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
294 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
295 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
295 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
296 </valuemap>
296 </valuemap>
297 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
297 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
298 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
298 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
299 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
299 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
300 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
300 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
301 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
301 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
302 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
302 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
303 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
303 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
304 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
304 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
305 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
305 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
306 </valuemap>
306 </valuemap>
307 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
307 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
308 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
308 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
309 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
309 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
310 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
310 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
311 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
311 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
312 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
312 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
313 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
313 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
314 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
314 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
315 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
315 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
316 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
316 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
317 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
317 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
318 </valuemap>
318 </valuemap>
319 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
319 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
320 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
320 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
321 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
321 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
322 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
322 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
323 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
323 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
324 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
324 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
325 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
325 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
326 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
326 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
327 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
327 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
328 </valuemap>
328 </valuemap>
329 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
329 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
330 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
330 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
331 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
331 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
332 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
332 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
333 </valuemap>
333 </valuemap>
334 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
334 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
335 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
335 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
336 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
336 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
337 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
337 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
338 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
338 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
339 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
339 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
340 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
340 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
341 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
341 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
342 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
342 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
343 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
343 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
344 </valuemap>
344 </valuemap>
345 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
345 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
346 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
346 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
347 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
347 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
348 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
348 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
349 </valuemap>
349 </valuemap>
350 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
350 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
351 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
351 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
352 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
352 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
353 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release2</value>
353 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release2</value>
354 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
354 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
355 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
355 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
356 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
356 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
357 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
357 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
358 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
358 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
359 </valuemap>
359 </valuemap>
360 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
360 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
361 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
361 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
362 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
362 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
363 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
363 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
364 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
364 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
365 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
365 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
366 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
366 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
367 </valuemap>
367 </valuemap>
368 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
368 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
369 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
369 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
370 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
370 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
371 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
371 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
372 </valuemap>
372 </valuemap>
373 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
373 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
374 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
374 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
375 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
375 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
376 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
376 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
377 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
377 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
378 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
378 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
379 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
379 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
380 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
380 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
381 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
381 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
382 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
382 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
383 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
383 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
384 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
384 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
385 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
385 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
386 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
386 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
387 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
387 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
388 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
388 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
389 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
389 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
390 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
390 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
391 <value type="int">0</value>
391 <value type="int">0</value>
392 <value type="int">1</value>
392 <value type="int">1</value>
393 <value type="int">2</value>
393 <value type="int">2</value>
394 <value type="int">3</value>
394 <value type="int">3</value>
395 <value type="int">4</value>
395 <value type="int">4</value>
396 <value type="int">5</value>
396 <value type="int">5</value>
397 <value type="int">6</value>
397 <value type="int">6</value>
398 <value type="int">7</value>
398 <value type="int">7</value>
399 <value type="int">8</value>
399 <value type="int">8</value>
400 <value type="int">9</value>
400 <value type="int">9</value>
401 <value type="int">10</value>
401 <value type="int">10</value>
402 <value type="int">11</value>
402 <value type="int">11</value>
403 <value type="int">12</value>
403 <value type="int">12</value>
404 <value type="int">13</value>
404 <value type="int">13</value>
405 <value type="int">14</value>
405 <value type="int">14</value>
406 </valuelist>
406 </valuelist>
407 <value type="int" key="PE.EnvironmentAspect.Base">-1</value>
407 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
408 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
408 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
409 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
409 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
410 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
410 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
411 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
411 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
412 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
412 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
413 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
413 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
414 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
414 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
415 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
415 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
416 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
416 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
417 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
417 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
418 <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
418 <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
419 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
419 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
420 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
420 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
421 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
421 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
422 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
422 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
423 </valuemap>
423 </valuemap>
424 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
424 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
425 </valuemap>
425 </valuemap>
426 </data>
426 </data>
427 <data>
427 <data>
428 <variable>ProjectExplorer.Project.TargetCount</variable>
428 <variable>ProjectExplorer.Project.TargetCount</variable>
429 <value type="int">2</value>
429 <value type="int">2</value>
430 </data>
430 </data>
431 <data>
431 <data>
432 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
432 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
433 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
433 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
434 </data>
434 </data>
435 <data>
435 <data>
436 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
436 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
437 <value type="int">14</value>
437 <value type="int">14</value>
438 </data>
438 </data>
439 </qtcreator>
439 </qtcreator>
@@ -1,35 +1,40
1 #ifndef FSW_INIT_H_INCLUDED
1 #ifndef FSW_INIT_H_INCLUDED
2 #define FSW_INIT_H_INCLUDED
2 #define FSW_INIT_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <leon.h>
5 #include <leon.h>
6
6
7 #include "fsw_params.h"
7 #include "fsw_params.h"
8 #include "fsw_misc.h"
8 #include "fsw_misc.h"
9 #include "fsw_processing.h"
9 #include "fsw_processing.h"
10 #include "tc_handler.h"
10 #include "tc_handler.h"
11 #include "wf_handler.h"
11 #include "wf_handler.h"
12
12
13 #include "fsw_spacewire.h"
13 #include "fsw_spacewire.h"
14
14
15 extern rtems_name Task_name[20]; /* array of task names */
16 extern rtems_id Task_id[20]; /* array of task ids */
17
15 // RTEMS TASKS
18 // RTEMS TASKS
16 rtems_task Init( rtems_task_argument argument);
19 rtems_task Init( rtems_task_argument argument);
17
20
18 // OTHER functions
21 // OTHER functions
19 void create_names( void );
22 void create_names( void );
20 int create_all_tasks( void );
23 int create_all_tasks( void );
21 int start_all_tasks( void );
24 int start_all_tasks( void );
22 //
25 //
23 rtems_status_code create_message_queues( void );
26 rtems_status_code create_message_queues( void );
27 rtems_status_code get_message_queue_id_send( rtems_id *queue_id );
28 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id );
24 //
29 //
25 int start_recv_send_tasks( void );
30 int start_recv_send_tasks( void );
26 //
31 //
27 void init_local_mode_parameters( void );
32 void init_local_mode_parameters( void );
28
33
29 extern int rtems_cpu_usage_report( void );
34 extern int rtems_cpu_usage_report( void );
30 extern int rtems_cpu_usage_reset( void );
35 extern int rtems_cpu_usage_reset( void );
31 extern void rtems_stack_checker_report_usage( void );
36 extern void rtems_stack_checker_report_usage( void );
32
37
33 extern int sched_yield( void );
38 extern int sched_yield( void );
34
39
35 #endif // FSW_INIT_H_INCLUDED
40 #endif // FSW_INIT_H_INCLUDED
@@ -1,54 +1,57
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
11
12 // MODE PARAMETERS
12 // MODE PARAMETERS
13 extern unsigned int maxCount;
13 extern unsigned int maxCount;
14
14
15 //****
15 //****
16 // ISR
16 // ISR
17 rtems_isr commutation_isr1( rtems_vector_number vector );
17 rtems_isr commutation_isr1( rtems_vector_number vector );
18 rtems_isr commutation_isr2( rtems_vector_number vector );
18 rtems_isr commutation_isr2( rtems_vector_number vector );
19
19
20 //***********
20 //***********
21 // RTEMS TASK
21 // RTEMS TASK
22 rtems_task actn_task( rtems_task_argument unused );
22 rtems_task actn_task( rtems_task_argument unused );
23
23
24 //***********
24 //***********
25 // TC ACTIONS
25 // TC ACTIONS
26 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
26 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
27 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
27 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
28 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
28 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
29 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
29 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
30 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
30 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
31 int action_update_time(ccsdsTelecommandPacket_t *TC);
31 int action_update_time(ccsdsTelecommandPacket_t *TC);
32
32
33 // mode transition
33 // mode transition
34 int transition_validation(unsigned char requestedMode);
34 int transition_validation(unsigned char requestedMode);
35 int stop_current_mode();
35 int stop_current_mode();
36 int enter_mode(unsigned char mode);
36 int enter_mode(unsigned char mode);
37 int enter_standby_mode();
37 int enter_standby_mode();
38 int enter_normal_mode();
38 int enter_normal_mode();
39 int enter_burst_mode();
39 int enter_burst_mode();
40 int enter_sbm1_mode();
40 int enter_sbm1_mode();
41 int enter_sbm2_mode();
41 int enter_sbm2_mode();
42 int restart_science_tasks();
42 int restart_science_tasks();
43 int suspend_science_tasks();
43 int suspend_science_tasks();
44
44
45 // other functions
45 // other functions
46 void updateLFRCurrentMode();
46 void updateLFRCurrentMode();
47 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time);
47 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time);
48 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time);
48 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time);
49 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time);
49 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time);
50
50
51 extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id );
52 extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id );
53
51 #endif // TC_HANDLER_H_INCLUDED
54 #endif // TC_HANDLER_H_INCLUDED
52
55
53
56
54
57
@@ -1,87 +1,85
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
12
13 #define pi 3.1415
13 #define pi 3.1415
14
14
15 extern int fdSPW;
15 extern int fdSPW;
16 extern volatile int wf_snap_f0[ ];
16 extern volatile int wf_snap_f0[ ];
17 //
17 //
18 extern volatile int wf_snap_f1[ ];
18 extern volatile int wf_snap_f1[ ];
19 extern volatile int wf_snap_f1_bis[ ];
19 extern volatile int wf_snap_f1_bis[ ];
20 extern volatile int wf_snap_f1_norm[ ];
20 extern volatile int wf_snap_f1_norm[ ];
21 //
21 //
22 extern volatile int wf_snap_f2[ ];
22 extern volatile int wf_snap_f2[ ];
23 extern volatile int wf_snap_f2_bis[ ];
23 extern volatile int wf_snap_f2_bis[ ];
24 extern volatile int wf_snap_f2_norm[ ];
24 extern volatile int wf_snap_f2_norm[ ];
25 //
25 //
26 extern volatile int wf_cont_f3[ ];
26 extern volatile int wf_cont_f3[ ];
27 extern volatile int wf_cont_f3_bis[ ];
27 extern volatile int wf_cont_f3_bis[ ];
28 extern char wf_cont_f3_light[ ];
28 extern char wf_cont_f3_light[ ];
29 extern waveform_picker_regs_t *waveform_picker_regs;
29 extern waveform_picker_regs_t *waveform_picker_regs;
30 extern time_management_regs_t *time_management_regs;
30 extern time_management_regs_t *time_management_regs;
31 extern Packet_TM_LFR_HK_t housekeeping_packet;
31 extern Packet_TM_LFR_HK_t housekeeping_packet;
32 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
32 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
33 extern struct param_local_str param_local;
33 extern struct param_local_str param_local;
34
34
35 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
35 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
36 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
36 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
37
37
38 extern rtems_name misc_name[5];
39 extern rtems_name Task_name[20]; /* array of task ids */
40 extern rtems_id Task_id[20]; /* array of task ids */
38 extern rtems_id Task_id[20]; /* array of task ids */
41
39
42 extern unsigned char lfrCurrentMode;
40 extern unsigned char lfrCurrentMode;
43
41
44 rtems_isr waveforms_isr( rtems_vector_number vector );
42 rtems_isr waveforms_isr( rtems_vector_number vector );
45 rtems_isr waveforms_simulator_isr( rtems_vector_number vector );
43 rtems_isr waveforms_simulator_isr( rtems_vector_number vector );
46 rtems_task wfrm_task( rtems_task_argument argument );
44 rtems_task wfrm_task( rtems_task_argument argument );
47 rtems_task cwf3_task( rtems_task_argument argument );
45 rtems_task cwf3_task( rtems_task_argument argument );
48 rtems_task cwf2_task( rtems_task_argument argument );
46 rtems_task cwf2_task( rtems_task_argument argument );
49 rtems_task cwf1_task( rtems_task_argument argument );
47 rtems_task cwf1_task( rtems_task_argument argument );
50
48
51 //******************
49 //******************
52 // general functions
50 // general functions
53 void init_waveforms( void );
51 void init_waveforms( void );
54 //
52 //
55 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
53 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
56 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
54 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
57 int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
55 int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
58 //
56 //
59 void reset_waveforms( void );
57 void reset_waveforms( void );
60 //
58 //
61 int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
59 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_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
60 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_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
61 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( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
62 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
65 //
63 //
66 rtems_id get_pkts_queue_id( void );
64 rtems_id get_pkts_queue_id( void );
67
65
68 //**************
66 //**************
69 // wfp registers
67 // wfp registers
70 void set_wfp_data_shaping();
68 void set_wfp_data_shaping();
71 char set_wfp_delta_snapshot();
69 char set_wfp_delta_snapshot();
72 void set_wfp_burst_enable_register( unsigned char mode);
70 void set_wfp_burst_enable_register( unsigned char mode);
73 void reset_wfp_burst_enable();
71 void reset_wfp_burst_enable();
74 void reset_wfp_status();
72 void reset_wfp_status();
75 void reset_waveform_picker_regs();
73 void reset_waveform_picker_regs();
76
74
77 //*****************
75 //*****************
78 // local parameters
76 // local parameters
79 void set_local_sbm1_nb_cwf_max( void );
77 void set_local_sbm1_nb_cwf_max( void );
80 void set_local_sbm2_nb_cwf_max( void );
78 void set_local_sbm2_nb_cwf_max( void );
81 void set_local_nb_interrupt_f0_MAX( void );
79 void set_local_nb_interrupt_f0_MAX( void );
82 void reset_local_sbm1_nb_cwf_sent( void );
80 void reset_local_sbm1_nb_cwf_sent( void );
83 void reset_local_sbm2_nb_cwf_sent( void );
81 void reset_local_sbm2_nb_cwf_sent( void );
84
82
85 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid );
83 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid );
86
84
87 #endif // WF_HANDLER_H_INCLUDED
85 #endif // WF_HANDLER_H_INCLUDED
@@ -1,586 +1,610
1 /** This is the RTEMS initialization module.
1 /** This is the RTEMS initialization module.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * This module contains two very different information:
6 * This module contains two very different information:
7 * - specific instructions to configure the compilation of the RTEMS executive
7 * - specific instructions to configure the compilation of the RTEMS executive
8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
9 *
9 *
10 */
10 */
11
11
12 //*************************
12 //*************************
13 // GPL reminder to be added
13 // GPL reminder to be added
14 //*************************
14 //*************************
15
15
16 #include <rtems.h>
16 #include <rtems.h>
17
17
18 /* configuration information */
18 /* configuration information */
19
19
20 #define CONFIGURE_INIT
20 #define CONFIGURE_INIT
21
21
22 #include <bsp.h> /* for device driver prototypes */
22 #include <bsp.h> /* for device driver prototypes */
23
23
24 /* configuration information */
24 /* configuration information */
25
25
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
28
28
29 #define CONFIGURE_MAXIMUM_TASKS 20
29 #define CONFIGURE_MAXIMUM_TASKS 20
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
35 #define CONFIGURE_MAXIMUM_DRIVERS 16
35 #define CONFIGURE_MAXIMUM_DRIVERS 16
36 #define CONFIGURE_MAXIMUM_PERIODS 5
36 #define CONFIGURE_MAXIMUM_PERIODS 5
37 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
37 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
38 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2
38 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2
39 #ifdef PRINT_STACK_REPORT
39 #ifdef PRINT_STACK_REPORT
40 #define CONFIGURE_STACK_CHECKER_ENABLED
40 #define CONFIGURE_STACK_CHECKER_ENABLED
41 #endif
41 #endif
42
42
43 #include <rtems/confdefs.h>
43 #include <rtems/confdefs.h>
44
44
45 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
45 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
46 #ifdef RTEMS_DRVMGR_STARTUP
46 #ifdef RTEMS_DRVMGR_STARTUP
47 #ifdef LEON3
47 #ifdef LEON3
48 /* Add Timer and UART Driver */
48 /* Add Timer and UART Driver */
49 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
49 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
50 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
50 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
51 #endif
51 #endif
52 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
52 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
53 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
53 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
54 #endif
54 #endif
55 #endif
55 #endif
56 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
56 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
57 #include <drvmgr/drvmgr_confdefs.h>
57 #include <drvmgr/drvmgr_confdefs.h>
58 #endif
58 #endif
59
59
60 #include "fsw_init.h"
60 #include "fsw_init.h"
61 #include "fsw_config.c"
61 #include "fsw_config.c"
62
62
63 rtems_task Init( rtems_task_argument ignored )
63 rtems_task Init( rtems_task_argument ignored )
64 {
64 {
65 /** This is the RTEMS INIT taks, it the first task launched by the system.
65 /** This is the RTEMS INIT taks, it the first task launched by the system.
66 *
66 *
67 * @param unused is the starting argument of the RTEMS task
67 * @param unused is the starting argument of the RTEMS task
68 *
68 *
69 * The INIT task create and run all other RTEMS tasks.
69 * The INIT task create and run all other RTEMS tasks.
70 *
70 *
71 */
71 */
72
72
73
73
74 rtems_status_code status;
74 rtems_status_code status;
75 rtems_status_code status_spw;
75 rtems_status_code status_spw;
76 rtems_isr_entry old_isr_handler;
76 rtems_isr_entry old_isr_handler;
77
77
78 BOOT_PRINTF("\n\n\n\n\n")
78 BOOT_PRINTF("\n\n\n\n\n")
79 BOOT_PRINTF("***************************\n")
79 BOOT_PRINTF("***************************\n")
80 BOOT_PRINTF("** START Flight Software **\n")
80 BOOT_PRINTF("** START Flight Software **\n")
81 BOOT_PRINTF("***************************\n")
81 BOOT_PRINTF("***************************\n")
82 BOOT_PRINTF("\n\n")
82 BOOT_PRINTF("\n\n")
83
83
84 //send_console_outputs_on_apbuart_port();
84 //send_console_outputs_on_apbuart_port();
85 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
85 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
86
86
87 reset_wfp_burst_enable(); // stop the waveform picker if it was running
87 reset_wfp_burst_enable(); // stop the waveform picker if it was running
88
88
89 init_parameter_dump();
89 init_parameter_dump();
90 init_local_mode_parameters();
90 init_local_mode_parameters();
91 init_housekeeping_parameters();
91 init_housekeeping_parameters();
92
92
93 updateLFRCurrentMode();
93 updateLFRCurrentMode();
94
94
95 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
95 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
96
96
97 create_names(); // create all names
97 create_names(); // create all names
98
98
99 status = create_message_queues(); // create message queues
99 status = create_message_queues(); // create message queues
100 if (status != RTEMS_SUCCESSFUL)
100 if (status != RTEMS_SUCCESSFUL)
101 {
101 {
102 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
102 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
103 }
103 }
104
104
105 status = create_all_tasks(); // create all tasks
105 status = create_all_tasks(); // create all tasks
106 if (status != RTEMS_SUCCESSFUL)
106 if (status != RTEMS_SUCCESSFUL)
107 {
107 {
108 PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status)
108 PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status)
109 }
109 }
110
110
111 // **************************
111 // **************************
112 // <SPACEWIRE INITIALIZATION>
112 // <SPACEWIRE INITIALIZATION>
113 grspw_timecode_callback = &timecode_irq_handler;
113 grspw_timecode_callback = &timecode_irq_handler;
114
114
115 status_spw = spacewire_open_link(); // (1) open the link
115 status_spw = spacewire_open_link(); // (1) open the link
116 if ( status_spw != RTEMS_SUCCESSFUL )
116 if ( status_spw != RTEMS_SUCCESSFUL )
117 {
117 {
118 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
118 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
119 }
119 }
120
120
121 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
121 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
122 {
122 {
123 status_spw = spacewire_configure_link( fdSPW );
123 status_spw = spacewire_configure_link( fdSPW );
124 if ( status_spw != RTEMS_SUCCESSFUL )
124 if ( status_spw != RTEMS_SUCCESSFUL )
125 {
125 {
126 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
126 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
127 }
127 }
128 }
128 }
129
129
130 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
130 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
131 {
131 {
132 status_spw = spacewire_start_link( fdSPW );
132 status_spw = spacewire_start_link( fdSPW );
133 if ( status_spw != RTEMS_SUCCESSFUL )
133 if ( status_spw != RTEMS_SUCCESSFUL )
134 {
134 {
135 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
135 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
136 }
136 }
137 }
137 }
138 // </SPACEWIRE INITIALIZATION>
138 // </SPACEWIRE INITIALIZATION>
139 // ***************************
139 // ***************************
140
140
141 status = start_all_tasks(); // start all tasks
141 status = start_all_tasks(); // start all tasks
142 if (status != RTEMS_SUCCESSFUL)
142 if (status != RTEMS_SUCCESSFUL)
143 {
143 {
144 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
144 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
145 }
145 }
146
146
147 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
147 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
148 status = start_recv_send_tasks();
148 status = start_recv_send_tasks();
149 if ( status != RTEMS_SUCCESSFUL )
149 if ( status != RTEMS_SUCCESSFUL )
150 {
150 {
151 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
151 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
152 }
152 }
153
153
154 // suspend science tasks. they will be restarted later depending on the mode
154 // suspend science tasks. they will be restarted later depending on the mode
155 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
155 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
156 if (status != RTEMS_SUCCESSFUL)
156 if (status != RTEMS_SUCCESSFUL)
157 {
157 {
158 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
158 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
159 }
159 }
160
160
161 #ifdef GSA
161 #ifdef GSA
162 // mask IRQ lines
162 // mask IRQ lines
163 LEON_Mask_interrupt( IRQ_SM );
163 LEON_Mask_interrupt( IRQ_SM );
164 LEON_Mask_interrupt( IRQ_WF );
164 LEON_Mask_interrupt( IRQ_WF );
165 // Spectral Matrices simulator
165 // Spectral Matrices simulator
166 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
166 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
167 IRQ_SPARC_SM, spectral_matrices_isr );
167 IRQ_SPARC_SM, spectral_matrices_isr );
168 // WaveForms
168 // WaveForms
169 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR,
169 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR,
170 IRQ_SPARC_WF, waveforms_simulator_isr );
170 IRQ_SPARC_WF, waveforms_simulator_isr );
171 #else
171 #else
172 // configure IRQ handling for the waveform picker unit
172 // configure IRQ handling for the waveform picker unit
173 status = rtems_interrupt_catch( waveforms_isr,
173 status = rtems_interrupt_catch( waveforms_isr,
174 IRQ_SPARC_WAVEFORM_PICKER,
174 IRQ_SPARC_WAVEFORM_PICKER,
175 &old_isr_handler) ;
175 &old_isr_handler) ;
176 #endif
176 #endif
177
177
178 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
178 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
179 if ( status_spw != RTEMS_SUCCESSFUL )
179 if ( status_spw != RTEMS_SUCCESSFUL )
180 {
180 {
181 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
181 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
182 if ( status != RTEMS_SUCCESSFUL ) {
182 if ( status != RTEMS_SUCCESSFUL ) {
183 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
183 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
184 }
184 }
185 }
185 }
186
186
187 BOOT_PRINTF("delete INIT\n")
187 BOOT_PRINTF("delete INIT\n")
188
188
189 status = rtems_task_delete(RTEMS_SELF);
189 status = rtems_task_delete(RTEMS_SELF);
190
190
191 }
191 }
192
192
193 void init_local_mode_parameters( void )
193 void init_local_mode_parameters( void )
194 {
194 {
195 /** This function initialize the param_local global variable with default values.
195 /** This function initialize the param_local global variable with default values.
196 *
196 *
197 */
197 */
198
198
199 unsigned int i;
199 unsigned int i;
200
200
201 // LOCAL PARAMETERS
201 // LOCAL PARAMETERS
202 set_local_sbm1_nb_cwf_max();
202 set_local_sbm1_nb_cwf_max();
203 set_local_sbm2_nb_cwf_max();
203 set_local_sbm2_nb_cwf_max();
204 set_local_nb_interrupt_f0_MAX();
204 set_local_nb_interrupt_f0_MAX();
205
205
206 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
206 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
207 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
207 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
208 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
208 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
209
209
210 reset_local_sbm1_nb_cwf_sent();
210 reset_local_sbm1_nb_cwf_sent();
211 reset_local_sbm2_nb_cwf_sent();
211 reset_local_sbm2_nb_cwf_sent();
212
212
213 // init sequence counters
213 // init sequence counters
214
214
215 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
215 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
216 {
216 {
217 sequenceCounters_TC_EXE[i] = 0x00;
217 sequenceCounters_TC_EXE[i] = 0x00;
218 }
218 }
219 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
219 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
220 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
220 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
221 }
221 }
222
222
223 void create_names( void ) // create all names for tasks and queues
223 void create_names( void ) // create all names for tasks and queues
224 {
224 {
225 /** This function creates all RTEMS names used in the software for tasks and queues.
225 /** This function creates all RTEMS names used in the software for tasks and queues.
226 *
226 *
227 * @return RTEMS directive status codes:
227 * @return RTEMS directive status codes:
228 * - RTEMS_SUCCESSFUL - successful completion
228 * - RTEMS_SUCCESSFUL - successful completion
229 *
229 *
230 */
230 */
231
231
232 // task names
232 // task names
233 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
233 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
234 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
234 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
235 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
235 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
236 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
236 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
237 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
237 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
238 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
238 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
239 Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' );
239 Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' );
240 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
240 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
241 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
241 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
242 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
242 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
243 Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' );
243 Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' );
244 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
244 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
245 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
245 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
246 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
246 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
247 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
247 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
248 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
248 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
249
249
250 // rate monotonic period names
250 // rate monotonic period names
251 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
251 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
252
252
253 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
253 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
254 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
254 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
255 }
255 }
256
256
257 int create_all_tasks( void ) // create all tasks which run in the software
257 int create_all_tasks( void ) // create all tasks which run in the software
258 {
258 {
259 /** This function creates all RTEMS tasks used in the software.
259 /** This function creates all RTEMS tasks used in the software.
260 *
260 *
261 * @return RTEMS directive status codes:
261 * @return RTEMS directive status codes:
262 * - RTEMS_SUCCESSFUL - task created successfully
262 * - RTEMS_SUCCESSFUL - task created successfully
263 * - RTEMS_INVALID_ADDRESS - id is NULL
263 * - RTEMS_INVALID_ADDRESS - id is NULL
264 * - RTEMS_INVALID_NAME - invalid task name
264 * - RTEMS_INVALID_NAME - invalid task name
265 * - RTEMS_INVALID_PRIORITY - invalid task priority
265 * - RTEMS_INVALID_PRIORITY - invalid task priority
266 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
266 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
267 * - RTEMS_TOO_MANY - too many tasks created
267 * - RTEMS_TOO_MANY - too many tasks created
268 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
268 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
269 * - RTEMS_TOO_MANY - too many global objects
269 * - RTEMS_TOO_MANY - too many global objects
270 *
270 *
271 */
271 */
272
272
273 rtems_status_code status;
273 rtems_status_code status;
274
274
275 // RECV
275 // RECV
276 status = rtems_task_create(
276 status = rtems_task_create(
277 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
277 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
278 RTEMS_DEFAULT_MODES,
278 RTEMS_DEFAULT_MODES,
279 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
279 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
280 );
280 );
281
281
282 if (status == RTEMS_SUCCESSFUL) // ACTN
282 if (status == RTEMS_SUCCESSFUL) // ACTN
283 {
283 {
284 status = rtems_task_create(
284 status = rtems_task_create(
285 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
285 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
286 RTEMS_DEFAULT_MODES,
286 RTEMS_DEFAULT_MODES,
287 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
287 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
288 );
288 );
289 }
289 }
290 if (status == RTEMS_SUCCESSFUL) // SPIQ
290 if (status == RTEMS_SUCCESSFUL) // SPIQ
291 {
291 {
292 status = rtems_task_create(
292 status = rtems_task_create(
293 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
293 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
294 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
294 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
295 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
295 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
296 );
296 );
297 }
297 }
298 if (status == RTEMS_SUCCESSFUL) // SMIQ
298 if (status == RTEMS_SUCCESSFUL) // SMIQ
299 {
299 {
300 status = rtems_task_create(
300 status = rtems_task_create(
301 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE,
301 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE,
302 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
302 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
303 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
303 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
304 );
304 );
305 }
305 }
306 if (status == RTEMS_SUCCESSFUL) // STAT
306 if (status == RTEMS_SUCCESSFUL) // STAT
307 {
307 {
308 status = rtems_task_create(
308 status = rtems_task_create(
309 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
309 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
310 RTEMS_DEFAULT_MODES,
310 RTEMS_DEFAULT_MODES,
311 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
311 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
312 );
312 );
313 }
313 }
314 if (status == RTEMS_SUCCESSFUL) // AVF0
314 if (status == RTEMS_SUCCESSFUL) // AVF0
315 {
315 {
316 status = rtems_task_create(
316 status = rtems_task_create(
317 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
317 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
318 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
318 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
319 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
319 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
320 );
320 );
321 }
321 }
322 if (status == RTEMS_SUCCESSFUL) // BPF0
322 if (status == RTEMS_SUCCESSFUL) // BPF0
323 {
323 {
324 status = rtems_task_create(
324 status = rtems_task_create(
325 Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE,
325 Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE,
326 RTEMS_DEFAULT_MODES,
326 RTEMS_DEFAULT_MODES,
327 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0]
327 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0]
328 );
328 );
329 }
329 }
330 if (status == RTEMS_SUCCESSFUL) // WFRM
330 if (status == RTEMS_SUCCESSFUL) // WFRM
331 {
331 {
332 status = rtems_task_create(
332 status = rtems_task_create(
333 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
333 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
334 RTEMS_DEFAULT_MODES,
334 RTEMS_DEFAULT_MODES,
335 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
335 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
336 );
336 );
337 }
337 }
338 if (status == RTEMS_SUCCESSFUL) // DUMB
338 if (status == RTEMS_SUCCESSFUL) // DUMB
339 {
339 {
340 status = rtems_task_create(
340 status = rtems_task_create(
341 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
341 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
342 RTEMS_DEFAULT_MODES,
342 RTEMS_DEFAULT_MODES,
343 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
343 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
344 );
344 );
345 }
345 }
346 if (status == RTEMS_SUCCESSFUL) // HOUS
346 if (status == RTEMS_SUCCESSFUL) // HOUS
347 {
347 {
348 status = rtems_task_create(
348 status = rtems_task_create(
349 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
349 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
350 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
350 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
351 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
351 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
352 );
352 );
353 }
353 }
354 if (status == RTEMS_SUCCESSFUL) // MATR
354 if (status == RTEMS_SUCCESSFUL) // MATR
355 {
355 {
356 status = rtems_task_create(
356 status = rtems_task_create(
357 Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE,
357 Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE,
358 RTEMS_DEFAULT_MODES,
358 RTEMS_DEFAULT_MODES,
359 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR]
359 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR]
360 );
360 );
361 }
361 }
362 if (status == RTEMS_SUCCESSFUL) // CWF3
362 if (status == RTEMS_SUCCESSFUL) // CWF3
363 {
363 {
364 status = rtems_task_create(
364 status = rtems_task_create(
365 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
365 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
366 RTEMS_DEFAULT_MODES,
366 RTEMS_DEFAULT_MODES,
367 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3]
367 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3]
368 );
368 );
369 }
369 }
370 if (status == RTEMS_SUCCESSFUL) // CWF2
370 if (status == RTEMS_SUCCESSFUL) // CWF2
371 {
371 {
372 status = rtems_task_create(
372 status = rtems_task_create(
373 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
373 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
374 RTEMS_DEFAULT_MODES,
374 RTEMS_DEFAULT_MODES,
375 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2]
375 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2]
376 );
376 );
377 }
377 }
378 if (status == RTEMS_SUCCESSFUL) // CWF1
378 if (status == RTEMS_SUCCESSFUL) // CWF1
379 {
379 {
380 status = rtems_task_create(
380 status = rtems_task_create(
381 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
381 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
382 RTEMS_DEFAULT_MODES,
382 RTEMS_DEFAULT_MODES,
383 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1]
383 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1]
384 );
384 );
385 }
385 }
386 if (status == RTEMS_SUCCESSFUL) // SEND
386 if (status == RTEMS_SUCCESSFUL) // SEND
387 {
387 {
388 status = rtems_task_create(
388 status = rtems_task_create(
389 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
389 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
390 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
390 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
391 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
391 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
392 );
392 );
393 }
393 }
394 if (status == RTEMS_SUCCESSFUL) // WTDG
394 if (status == RTEMS_SUCCESSFUL) // WTDG
395 {
395 {
396 status = rtems_task_create(
396 status = rtems_task_create(
397 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
397 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
398 RTEMS_DEFAULT_MODES,
398 RTEMS_DEFAULT_MODES,
399 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
399 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
400 );
400 );
401 }
401 }
402
402
403 return status;
403 return status;
404 }
404 }
405
405
406 int start_recv_send_tasks( void )
406 int start_recv_send_tasks( void )
407 {
407 {
408 rtems_status_code status;
408 rtems_status_code status;
409
409
410 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
410 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
411 if (status!=RTEMS_SUCCESSFUL) {
411 if (status!=RTEMS_SUCCESSFUL) {
412 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
412 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
413 }
413 }
414
414
415 if (status == RTEMS_SUCCESSFUL) // SEND
415 if (status == RTEMS_SUCCESSFUL) // SEND
416 {
416 {
417 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
417 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
418 if (status!=RTEMS_SUCCESSFUL) {
418 if (status!=RTEMS_SUCCESSFUL) {
419 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
419 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
420 }
420 }
421 }
421 }
422
422
423 return status;
423 return status;
424 }
424 }
425
425
426 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
426 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
427 {
427 {
428 /** This function starts all RTEMS tasks used in the software.
428 /** This function starts all RTEMS tasks used in the software.
429 *
429 *
430 * @return RTEMS directive status codes:
430 * @return RTEMS directive status codes:
431 * - RTEMS_SUCCESSFUL - ask started successfully
431 * - RTEMS_SUCCESSFUL - ask started successfully
432 * - RTEMS_INVALID_ADDRESS - invalid task entry point
432 * - RTEMS_INVALID_ADDRESS - invalid task entry point
433 * - RTEMS_INVALID_ID - invalid task id
433 * - RTEMS_INVALID_ID - invalid task id
434 * - RTEMS_INCORRECT_STATE - task not in the dormant state
434 * - RTEMS_INCORRECT_STATE - task not in the dormant state
435 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
435 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
436 *
436 *
437 */
437 */
438 // starts all the tasks fot eh flight software
438 // starts all the tasks fot eh flight software
439
439
440 rtems_status_code status;
440 rtems_status_code status;
441
441
442 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
442 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
443 if (status!=RTEMS_SUCCESSFUL) {
443 if (status!=RTEMS_SUCCESSFUL) {
444 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
444 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
445 }
445 }
446
446
447 if (status == RTEMS_SUCCESSFUL) // WTDG
447 if (status == RTEMS_SUCCESSFUL) // WTDG
448 {
448 {
449 status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 );
449 status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 );
450 if (status!=RTEMS_SUCCESSFUL) {
450 if (status!=RTEMS_SUCCESSFUL) {
451 BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n")
451 BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n")
452 }
452 }
453 }
453 }
454
454
455 if (status == RTEMS_SUCCESSFUL) // SMIQ
455 if (status == RTEMS_SUCCESSFUL) // SMIQ
456 {
456 {
457 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
457 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
458 if (status!=RTEMS_SUCCESSFUL) {
458 if (status!=RTEMS_SUCCESSFUL) {
459 BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n")
459 BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n")
460 }
460 }
461 }
461 }
462
462
463 if (status == RTEMS_SUCCESSFUL) // ACTN
463 if (status == RTEMS_SUCCESSFUL) // ACTN
464 {
464 {
465 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
465 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
466 if (status!=RTEMS_SUCCESSFUL) {
466 if (status!=RTEMS_SUCCESSFUL) {
467 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
467 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
468 }
468 }
469 }
469 }
470
470
471 if (status == RTEMS_SUCCESSFUL) // STAT
471 if (status == RTEMS_SUCCESSFUL) // STAT
472 {
472 {
473 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
473 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
474 if (status!=RTEMS_SUCCESSFUL) {
474 if (status!=RTEMS_SUCCESSFUL) {
475 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
475 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
476 }
476 }
477 }
477 }
478
478
479 if (status == RTEMS_SUCCESSFUL) // AVF0
479 if (status == RTEMS_SUCCESSFUL) // AVF0
480 {
480 {
481 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
481 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
482 if (status!=RTEMS_SUCCESSFUL) {
482 if (status!=RTEMS_SUCCESSFUL) {
483 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
483 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
484 }
484 }
485 }
485 }
486
486
487 if (status == RTEMS_SUCCESSFUL) // BPF0
487 if (status == RTEMS_SUCCESSFUL) // BPF0
488 {
488 {
489 status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 );
489 status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 );
490 if (status!=RTEMS_SUCCESSFUL) {
490 if (status!=RTEMS_SUCCESSFUL) {
491 BOOT_PRINTF("in INIT *** Error starting TASK_BPF0\n")
491 BOOT_PRINTF("in INIT *** Error starting TASK_BPF0\n")
492 }
492 }
493 }
493 }
494
494
495 if (status == RTEMS_SUCCESSFUL) // WFRM
495 if (status == RTEMS_SUCCESSFUL) // WFRM
496 {
496 {
497 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
497 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
498 if (status!=RTEMS_SUCCESSFUL) {
498 if (status!=RTEMS_SUCCESSFUL) {
499 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
499 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
500 }
500 }
501 }
501 }
502
502
503 if (status == RTEMS_SUCCESSFUL) // DUMB
503 if (status == RTEMS_SUCCESSFUL) // DUMB
504 {
504 {
505 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
505 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
506 if (status!=RTEMS_SUCCESSFUL) {
506 if (status!=RTEMS_SUCCESSFUL) {
507 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
507 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
508 }
508 }
509 }
509 }
510
510
511 if (status == RTEMS_SUCCESSFUL) // HOUS
511 if (status == RTEMS_SUCCESSFUL) // HOUS
512 {
512 {
513 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
513 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
514 if (status!=RTEMS_SUCCESSFUL) {
514 if (status!=RTEMS_SUCCESSFUL) {
515 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
515 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
516 }
516 }
517 }
517 }
518
518
519 if (status == RTEMS_SUCCESSFUL) // MATR
519 if (status == RTEMS_SUCCESSFUL) // MATR
520 {
520 {
521 status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 );
521 status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 );
522 if (status!=RTEMS_SUCCESSFUL) {
522 if (status!=RTEMS_SUCCESSFUL) {
523 BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n")
523 BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n")
524 }
524 }
525 }
525 }
526
526
527 if (status == RTEMS_SUCCESSFUL) // CWF3
527 if (status == RTEMS_SUCCESSFUL) // CWF3
528 {
528 {
529 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
529 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
530 if (status!=RTEMS_SUCCESSFUL) {
530 if (status!=RTEMS_SUCCESSFUL) {
531 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
531 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
532 }
532 }
533 }
533 }
534
534
535 if (status == RTEMS_SUCCESSFUL) // CWF2
535 if (status == RTEMS_SUCCESSFUL) // CWF2
536 {
536 {
537 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
537 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
538 if (status!=RTEMS_SUCCESSFUL) {
538 if (status!=RTEMS_SUCCESSFUL) {
539 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
539 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
540 }
540 }
541 }
541 }
542
542
543 if (status == RTEMS_SUCCESSFUL) // CWF1
543 if (status == RTEMS_SUCCESSFUL) // CWF1
544 {
544 {
545 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
545 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
546 if (status!=RTEMS_SUCCESSFUL) {
546 if (status!=RTEMS_SUCCESSFUL) {
547 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
547 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
548 }
548 }
549 }
549 }
550 return status;
550 return status;
551 }
551 }
552
552
553 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
553 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
554 {
554 {
555 rtems_status_code status_recv;
555 rtems_status_code status_recv;
556 rtems_status_code status_send;
556 rtems_status_code status_send;
557 rtems_status_code ret;
557 rtems_status_code ret;
558 rtems_id queue_id;
558 rtems_id queue_id;
559
559
560 // create the queue for handling valid TCs
560 // create the queue for handling valid TCs
561 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
561 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
562 ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE,
562 ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE,
563 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
563 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
564 if ( status_recv != RTEMS_SUCCESSFUL ) {
564 if ( status_recv != RTEMS_SUCCESSFUL ) {
565 PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv)
565 PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv)
566 }
566 }
567
567
568 // create the queue for handling TM packet sending
568 // create the queue for handling TM packet sending
569 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
569 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
570 ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE,
570 ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE,
571 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
571 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
572 if ( status_send != RTEMS_SUCCESSFUL ) {
572 if ( status_send != RTEMS_SUCCESSFUL ) {
573 PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send)
573 PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send)
574 }
574 }
575
575
576 if ( status_recv != RTEMS_SUCCESSFUL )
576 if ( status_recv != RTEMS_SUCCESSFUL )
577 {
577 {
578 ret = status_recv;
578 ret = status_recv;
579 }
579 }
580 else
580 else
581 {
581 {
582 ret = status_send;
582 ret = status_send;
583 }
583 }
584
584
585 return ret;
585 return ret;
586 }
586 }
587
588 rtems_status_code get_message_queue_id_send( rtems_id *queue_id )
589 {
590 rtems_status_code status;
591 rtems_name queue_name;
592
593 queue_name = rtems_build_name( 'Q', '_', 'S', 'D' );
594
595 status = rtems_message_queue_ident( queue_name, 0, queue_id );
596
597 return status;
598 }
599
600 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id )
601 {
602 rtems_status_code status;
603 rtems_name queue_name;
604
605 queue_name = rtems_build_name( 'Q', '_', 'R', 'V' );
606
607 status = rtems_message_queue_ident( queue_name, 0, queue_id );
608
609 return status;
610 }
@@ -1,336 +1,336
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 //char *DumbMessages[7] = {"in DUMB *** default", // RTEMS_EVENT_0
10 //char *DumbMessages[7] = {"in DUMB *** default", // RTEMS_EVENT_0
11 // "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
11 // "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
12 // "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
12 // "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
13 // "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
13 // "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
14 // "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
14 // "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
15 // "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
15 // "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
16 // "ERR HK" // RTEMS_EVENT_6
16 // "ERR HK" // RTEMS_EVENT_6
17 //};
17 //};
18
18
19 void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
19 void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
20 unsigned char interrupt_level, rtems_isr (*timer_isr)() )
20 unsigned char interrupt_level, rtems_isr (*timer_isr)() )
21 {
21 {
22 /** This function configures a GPTIMER timer instantiated in the VHDL design.
22 /** This function configures a GPTIMER timer instantiated in the VHDL design.
23 *
23 *
24 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
24 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
25 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
25 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
26 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
26 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
27 * @param interrupt_level is the interrupt level that the timer drives.
27 * @param interrupt_level is the interrupt level that the timer drives.
28 * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer.
28 * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer.
29 *
29 *
30 * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76
30 * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76
31 *
31 *
32 */
32 */
33
33
34 rtems_status_code status;
34 rtems_status_code status;
35 rtems_isr_entry old_isr_handler;
35 rtems_isr_entry old_isr_handler;
36
36
37 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
37 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
38 if (status!=RTEMS_SUCCESSFUL)
38 if (status!=RTEMS_SUCCESSFUL)
39 {
39 {
40 PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n")
40 PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n")
41 }
41 }
42
42
43 timer_set_clock_divider( gptimer_regs, timer, clock_divider);
43 timer_set_clock_divider( gptimer_regs, timer, clock_divider);
44 }
44 }
45
45
46 void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer)
46 void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer)
47 {
47 {
48 /** This function starts a GPTIMER timer.
48 /** This function starts a GPTIMER timer.
49 *
49 *
50 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
50 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
51 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
51 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
52 *
52 *
53 */
53 */
54
54
55 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
55 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
56 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register
56 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register
57 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer
57 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer
58 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart
58 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart
59 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable
59 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable
60 }
60 }
61
61
62 void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer)
62 void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer)
63 {
63 {
64 /** This function stops a GPTIMER timer.
64 /** This function stops a GPTIMER timer.
65 *
65 *
66 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
66 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
67 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
67 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
68 *
68 *
69 */
69 */
70
70
71 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer
71 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer
72 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable
72 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable
73 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
73 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
74 }
74 }
75
75
76 void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider)
76 void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider)
77 {
77 {
78 /** This function sets the clock divider of a GPTIMER timer.
78 /** This function sets the clock divider of a GPTIMER timer.
79 *
79 *
80 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
80 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
81 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
81 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
82 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
82 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
83 *
83 *
84 */
84 */
85
85
86 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
86 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
87 }
87 }
88
88
89 int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port
89 int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port
90 {
90 {
91 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
91 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
92
92
93 apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB;
93 apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB;
94 PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
94 PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
95
95
96 return 0;
96 return 0;
97 }
97 }
98
98
99 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
99 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
100 {
100 {
101 /** This function sets the scaler reload register of the apbuart module
101 /** This function sets the scaler reload register of the apbuart module
102 *
102 *
103 * @param regs is the address of the apbuart registers in memory
103 * @param regs is the address of the apbuart registers in memory
104 * @param value is the value that will be stored in the scaler register
104 * @param value is the value that will be stored in the scaler register
105 *
105 *
106 * The value shall be set by the software to get data on the serial interface.
106 * The value shall be set by the software to get data on the serial interface.
107 *
107 *
108 */
108 */
109
109
110 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
110 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
111
111
112 apbuart_regs->scaler = value;
112 apbuart_regs->scaler = value;
113 BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value)
113 BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value)
114 }
114 }
115
115
116 //************
116 //************
117 // RTEMS TASKS
117 // RTEMS TASKS
118
118
119 rtems_task stat_task(rtems_task_argument argument)
119 rtems_task stat_task(rtems_task_argument argument)
120 {
120 {
121 int i;
121 int i;
122 int j;
122 int j;
123 i = 0;
123 i = 0;
124 j = 0;
124 j = 0;
125 BOOT_PRINTF("in STAT *** \n")
125 BOOT_PRINTF("in STAT *** \n")
126 while(1){
126 while(1){
127 rtems_task_wake_after(1000);
127 rtems_task_wake_after(1000);
128 PRINTF1("%d\n", j)
128 PRINTF1("%d\n", j)
129 if (i == CPU_USAGE_REPORT_PERIOD) {
129 if (i == CPU_USAGE_REPORT_PERIOD) {
130 // #ifdef PRINT_TASK_STATISTICS
130 // #ifdef PRINT_TASK_STATISTICS
131 // rtems_cpu_usage_report();
131 // rtems_cpu_usage_report();
132 // rtems_cpu_usage_reset();
132 // rtems_cpu_usage_reset();
133 // #endif
133 // #endif
134 i = 0;
134 i = 0;
135 }
135 }
136 else i++;
136 else i++;
137 j++;
137 j++;
138 }
138 }
139 }
139 }
140
140
141 rtems_task hous_task(rtems_task_argument argument)
141 rtems_task hous_task(rtems_task_argument argument)
142 {
142 {
143 rtems_status_code status;
143 rtems_status_code status;
144 rtems_id queue_id;
144 rtems_id queue_id;
145
145
146 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id );
146 status = get_message_queue_id_send( &queue_id );
147 if (status != RTEMS_SUCCESSFUL)
147 if (status != RTEMS_SUCCESSFUL)
148 {
148 {
149 PRINTF1("in HOUS *** ERR %d\n", status)
149 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
150 }
150 }
151
151
152 BOOT_PRINTF("in HOUS ***\n")
152 BOOT_PRINTF("in HOUS ***\n")
153
153
154 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
154 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
155 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
155 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
156 if( status != RTEMS_SUCCESSFUL ) {
156 if( status != RTEMS_SUCCESSFUL ) {
157 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
157 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
158 }
158 }
159 }
159 }
160
160
161 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
161 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
162 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
162 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
163 housekeeping_packet.reserved = DEFAULT_RESERVED;
163 housekeeping_packet.reserved = DEFAULT_RESERVED;
164 housekeeping_packet.userApplication = CCSDS_USER_APP;
164 housekeeping_packet.userApplication = CCSDS_USER_APP;
165 housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8);
165 housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8);
166 housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK);
166 housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK);
167 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
167 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
168 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
168 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
169 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
169 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
170 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
170 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
171 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
171 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
172 housekeeping_packet.serviceType = TM_TYPE_HK;
172 housekeeping_packet.serviceType = TM_TYPE_HK;
173 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
173 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
174 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
174 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
175 housekeeping_packet.sid = SID_HK;
175
176
176 status = rtems_rate_monotonic_cancel(HK_id);
177 status = rtems_rate_monotonic_cancel(HK_id);
177 if( status != RTEMS_SUCCESSFUL ) {
178 if( status != RTEMS_SUCCESSFUL ) {
178 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
179 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
179 }
180 }
180 else {
181 else {
181 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
182 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
182 }
183 }
183
184
184 while(1){ // launch the rate monotonic task
185 while(1){ // launch the rate monotonic task
185 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
186 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
186 if ( status != RTEMS_SUCCESSFUL ) {
187 if ( status != RTEMS_SUCCESSFUL ) {
187 PRINTF1( "in HOUS *** ERR period: %d\n", status);
188 PRINTF1( "in HOUS *** ERR period: %d\n", status);
188 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
189 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
189 }
190 }
190 else {
191 else {
191 increment_seq_counter( housekeeping_packet.packetSequenceControl );
192 increment_seq_counter( housekeeping_packet.packetSequenceControl );
192 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
193 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
193 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
194 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
194 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
195 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
195 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
196 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
196 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
197 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
197 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
198 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
198 housekeeping_packet.sid = SID_HK;
199
199
200 spacewire_update_statistics();
200 spacewire_update_statistics();
201
201
202 // SEND PACKET
202 // SEND PACKET
203 status = rtems_message_queue_send( queue_id, &housekeeping_packet,
203 status = rtems_message_queue_send( queue_id, &housekeeping_packet,
204 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
204 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
205 if (status != RTEMS_SUCCESSFUL) {
205 if (status != RTEMS_SUCCESSFUL) {
206 PRINTF1("in HOUS *** ERR send: %d\n", status)
206 PRINTF1("in HOUS *** ERR send: %d\n", status)
207 }
207 }
208 }
208 }
209 }
209 }
210
210
211 PRINTF("in HOUS *** deleting task\n")
211 PRINTF("in HOUS *** deleting task\n")
212
212
213 status = rtems_task_delete( RTEMS_SELF ); // should not return
213 status = rtems_task_delete( RTEMS_SELF ); // should not return
214 printf( "rtems_task_delete returned with status of %d.\n", status );
214 printf( "rtems_task_delete returned with status of %d.\n", status );
215 return;
215 return;
216 }
216 }
217
217
218 rtems_task dumb_task( rtems_task_argument unused )
218 rtems_task dumb_task( rtems_task_argument unused )
219 {
219 {
220 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
220 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
221 *
221 *
222 * @param unused is the starting argument of the RTEMS task
222 * @param unused is the starting argument of the RTEMS task
223 *
223 *
224 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
224 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
225 *
225 *
226 */
226 */
227
227
228 unsigned int i;
228 unsigned int i;
229 unsigned int intEventOut;
229 unsigned int intEventOut;
230 unsigned int coarse_time = 0;
230 unsigned int coarse_time = 0;
231 unsigned int fine_time = 0;
231 unsigned int fine_time = 0;
232 rtems_event_set event_out;
232 rtems_event_set event_out;
233
233
234 char *DumbMessages[7] = {"in DUMB *** default", // RTEMS_EVENT_0
234 char *DumbMessages[7] = {"in DUMB *** default", // RTEMS_EVENT_0
235 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
235 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
236 "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
236 "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
237 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
237 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
238 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
238 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
239 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
239 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
240 "ERR HK" // RTEMS_EVENT_6
240 "ERR HK" // RTEMS_EVENT_6
241 };
241 };
242
242
243 BOOT_PRINTF("in DUMB *** \n")
243 BOOT_PRINTF("in DUMB *** \n")
244
244
245 while(1){
245 while(1){
246 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
246 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
247 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6,
247 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6,
248 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
248 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
249 intEventOut = (unsigned int) event_out;
249 intEventOut = (unsigned int) event_out;
250 for ( i=0; i<32; i++)
250 for ( i=0; i<32; i++)
251 {
251 {
252 if ( ((intEventOut >> i) & 0x0001) != 0)
252 if ( ((intEventOut >> i) & 0x0001) != 0)
253 {
253 {
254 coarse_time = time_management_regs->coarse_time;
254 coarse_time = time_management_regs->coarse_time;
255 fine_time = time_management_regs->fine_time;
255 fine_time = time_management_regs->fine_time;
256 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
256 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
257 }
257 }
258 }
258 }
259 }
259 }
260 }
260 }
261
261
262 //*****************************
262 //*****************************
263 // init housekeeping parameters
263 // init housekeeping parameters
264
264
265 void init_housekeeping_parameters( void )
265 void init_housekeeping_parameters( void )
266 {
266 {
267 /** This function initialize the housekeeping_packet global variable with default values.
267 /** This function initialize the housekeeping_packet global variable with default values.
268 *
268 *
269 */
269 */
270
270
271 unsigned int i = 0;
271 unsigned int i = 0;
272 char *parameters;
272 char *parameters;
273
273
274 parameters = (char*) &housekeeping_packet.lfr_status_word;
274 parameters = (char*) &housekeeping_packet.lfr_status_word;
275 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
275 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
276 {
276 {
277 parameters[i] = 0x00;
277 parameters[i] = 0x00;
278 }
278 }
279 // init status word
279 // init status word
280 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
280 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
281 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
281 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
282 // init software version
282 // init software version
283 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
283 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
284 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
284 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
285 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
285 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
286 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
286 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
287
287
288 }
288 }
289
289
290 void increment_seq_counter( unsigned char *packet_sequence_control)
290 void increment_seq_counter( unsigned char *packet_sequence_control)
291 {
291 {
292 /** This function increment the sequence counter psased in argument.
292 /** This function increment the sequence counter psased in argument.
293 *
293 *
294 * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0.
294 * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0.
295 *
295 *
296 */
296 */
297
297
298 unsigned short sequence_cnt;
298 unsigned short sequence_cnt;
299 unsigned short segmentation_grouping_flag;
299 unsigned short segmentation_grouping_flag;
300 unsigned short new_packet_sequence_control;
300 unsigned short new_packet_sequence_control;
301
301
302 segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6
302 segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6
303 sequence_cnt = (unsigned short) (
303 sequence_cnt = (unsigned short) (
304 ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0
304 ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0
305 + packet_sequence_control[1]
305 + packet_sequence_control[1]
306 );
306 );
307
307
308 if ( sequence_cnt < SEQ_CNT_MAX)
308 if ( sequence_cnt < SEQ_CNT_MAX)
309 {
309 {
310 sequence_cnt = sequence_cnt + 1;
310 sequence_cnt = sequence_cnt + 1;
311 }
311 }
312 else
312 else
313 {
313 {
314 sequence_cnt = 0;
314 sequence_cnt = 0;
315 }
315 }
316
316
317 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
317 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
318
318
319 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
319 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
320 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
320 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
321 }
321 }
322
322
323 void getTime( unsigned char *time)
323 void getTime( unsigned char *time)
324 {
324 {
325 /** This function write the current local time in the time buffer passed in argument.
325 /** This function write the current local time in the time buffer passed in argument.
326 *
326 *
327 */
327 */
328
328
329 time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
329 time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
330 time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
330 time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
331 time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
331 time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
332 time[3] = (unsigned char) (time_management_regs->coarse_time);
332 time[3] = (unsigned char) (time_management_regs->coarse_time);
333 time[4] = (unsigned char) (time_management_regs->fine_time>>8);
333 time[4] = (unsigned char) (time_management_regs->fine_time>>8);
334 time[5] = (unsigned char) (time_management_regs->fine_time);
334 time[5] = (unsigned char) (time_management_regs->fine_time);
335 }
335 }
336
336
@@ -1,656 +1,656
1 /** Functions related to data processing.
1 /** Functions related to data processing.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
7 *
7 *
8 */
8 */
9
9
10 #include <fsw_processing.h>
10 #include <fsw_processing.h>
11
11
12 #include "fsw_processing_globals.c"
12 #include "fsw_processing_globals.c"
13
13
14 BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ];
14 BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ];
15 float averaged_spec_mat_f0[ TOTAL_SIZE_SM ];
15 float averaged_spec_mat_f0[ TOTAL_SIZE_SM ];
16 char averaged_spec_mat_f0_char[ TOTAL_SIZE_SM * 2 ];
16 char averaged_spec_mat_f0_char[ TOTAL_SIZE_SM * 2 ];
17 float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
17 float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
18
18
19 //***********************************************************
19 //***********************************************************
20 // Interrupt Service Routine for spectral matrices processing
20 // Interrupt Service Routine for spectral matrices processing
21 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
21 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
22 {
22 {
23 unsigned char status;
23 unsigned char status;
24 unsigned char i;
24 unsigned char i;
25
25
26 status = spectral_matrix_regs->status; //[f2 f1 f0_1 f0_0]
26 status = spectral_matrix_regs->status; //[f2 f1 f0_1 f0_0]
27 for (i=0; i<4; i++)
27 for (i=0; i<4; i++)
28 {
28 {
29 if ( ( (status >> i) & 0x01) == 1) // (1) buffer rotation
29 if ( ( (status >> i) & 0x01) == 1) // (1) buffer rotation
30 {
30 {
31 switch(i)
31 switch(i)
32 {
32 {
33 case 0:
33 case 0:
34 if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0)
34 if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0)
35 {
35 {
36 spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0_bis;
36 spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0_bis;
37 }
37 }
38 else
38 else
39 {
39 {
40 spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0;
40 spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0;
41 }
41 }
42 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe;
42 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe;
43 break;
43 break;
44 case 1:
44 case 1:
45 if (spectral_matrix_regs->matrixFO_Address1 == (int) spec_mat_f0_1)
45 if (spectral_matrix_regs->matrixFO_Address1 == (int) spec_mat_f0_1)
46 {
46 {
47 spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1_bis;
47 spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1_bis;
48 }
48 }
49 else
49 else
50 {
50 {
51 spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1;
51 spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1;
52 }
52 }
53 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd;
53 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd;
54 break;
54 break;
55 case 2:
55 case 2:
56 if (spectral_matrix_regs->matrixF1_Address == (int) spec_mat_f1)
56 if (spectral_matrix_regs->matrixF1_Address == (int) spec_mat_f1)
57 {
57 {
58 spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1_bis;
58 spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1_bis;
59 }
59 }
60 else
60 else
61 {
61 {
62 spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1;
62 spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1;
63 }
63 }
64 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffb;
64 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffb;
65 break;
65 break;
66 case 3:
66 case 3:
67 if (spectral_matrix_regs->matrixF2_Address == (int) spec_mat_f2)
67 if (spectral_matrix_regs->matrixF2_Address == (int) spec_mat_f2)
68 {
68 {
69 spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2_bis;
69 spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2_bis;
70 }
70 }
71 else
71 else
72 {
72 {
73 spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2;
73 spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2;
74 }
74 }
75 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff7;
75 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff7;
76 break;
76 break;
77 default:
77 default:
78 break;
78 break;
79 }
79 }
80 }
80 }
81 }
81 }
82
82
83 // reset error codes to 0
83 // reset error codes to 0
84 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // [1100 1111]
84 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // [1100 1111]
85
85
86 if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
86 if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
87 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 );
87 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 );
88 }
88 }
89 }
89 }
90
90
91 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
91 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
92 {
92 {
93 if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
93 if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
94 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 );
94 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 );
95 }
95 }
96 }
96 }
97
97
98 //************
98 //************
99 // RTEMS TASKS
99 // RTEMS TASKS
100
100
101 rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ
101 rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ
102 {
102 {
103 rtems_event_set event_out;
103 rtems_event_set event_out;
104 unsigned int nb_interrupt_f0 = 0;
104 unsigned int nb_interrupt_f0 = 0;
105
105
106 BOOT_PRINTF("in SMIQ *** \n")
106 BOOT_PRINTF("in SMIQ *** \n")
107
107
108 while(1){
108 while(1){
109 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
109 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
110 nb_interrupt_f0 = nb_interrupt_f0 + 1;
110 nb_interrupt_f0 = nb_interrupt_f0 + 1;
111 if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){
111 if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){
112 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
112 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
113 {
113 {
114 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
114 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
115 }
115 }
116 nb_interrupt_f0 = 0;
116 nb_interrupt_f0 = 0;
117 }
117 }
118 }
118 }
119 }
119 }
120
120
121 rtems_task spw_bppr_task(rtems_task_argument argument)
121 rtems_task spw_bppr_task(rtems_task_argument argument)
122 {
122 {
123 rtems_status_code status;
123 rtems_status_code status;
124 rtems_event_set event_out;
124 rtems_event_set event_out;
125
125
126 BOOT_PRINTF("in BPPR ***\n");
126 BOOT_PRINTF("in BPPR ***\n");
127
127
128 while( true ){ // wait for an event to begin with the processing
128 while( true ){ // wait for an event to begin with the processing
129 status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out);
129 status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out);
130 }
130 }
131 }
131 }
132
132
133 rtems_task avf0_task(rtems_task_argument argument)
133 rtems_task avf0_task(rtems_task_argument argument)
134 {
134 {
135 int i;
135 int i;
136 static int nb_average;
136 static int nb_average;
137 rtems_event_set event_out;
137 rtems_event_set event_out;
138 rtems_status_code status;
138 rtems_status_code status;
139
139
140 nb_average = 0;
140 nb_average = 0;
141
141
142 BOOT_PRINTF("in AVFO *** \n")
142 BOOT_PRINTF("in AVFO *** \n")
143
143
144 while(1){
144 while(1){
145 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
145 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
146 for(i=0; i<TOTAL_SIZE_SM; i++){
146 for(i=0; i<TOTAL_SIZE_SM; i++){
147 averaged_spec_mat_f0[i] = averaged_spec_mat_f0[i] + spec_mat_f0_a[i]
147 averaged_spec_mat_f0[i] = averaged_spec_mat_f0[i] + spec_mat_f0_a[i]
148 + spec_mat_f0_b[i]
148 + spec_mat_f0_b[i]
149 + spec_mat_f0_c[i]
149 + spec_mat_f0_c[i]
150 + spec_mat_f0_d[i]
150 + spec_mat_f0_d[i]
151 + spec_mat_f0_e[i]
151 + spec_mat_f0_e[i]
152 + spec_mat_f0_f[i]
152 + spec_mat_f0_f[i]
153 + spec_mat_f0_g[i]
153 + spec_mat_f0_g[i]
154 + spec_mat_f0_h[i];
154 + spec_mat_f0_h[i];
155 }
155 }
156 nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0;
156 nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0;
157 if (nb_average == NB_AVERAGE_NORMAL_f0) {
157 if (nb_average == NB_AVERAGE_NORMAL_f0) {
158 nb_average = 0;
158 nb_average = 0;
159 status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0
159 status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0
160 if (status != RTEMS_SUCCESSFUL) {
160 if (status != RTEMS_SUCCESSFUL) {
161 printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status);
161 printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status);
162 }
162 }
163 }
163 }
164 }
164 }
165 }
165 }
166
166
167 rtems_task bpf0_task(rtems_task_argument argument)
167 rtems_task bpf0_task(rtems_task_argument argument)
168 {
168 {
169 rtems_event_set event_out;
169 rtems_event_set event_out;
170 static unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_SM_F0 * 9 ];
170 static unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_SM_F0 * 9 ];
171
171
172 BOOT_PRINTF("in BPFO *** \n")
172 BOOT_PRINTF("in BPFO *** \n")
173
173
174 while(1){
174 while(1){
175 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
175 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
176 matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0);
176 matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0);
177 BP1_set(compressed_spec_mat_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0);
177 BP1_set(compressed_spec_mat_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0);
178 }
178 }
179 }
179 }
180
180
181 rtems_task matr_task(rtems_task_argument argument)
181 rtems_task matr_task(rtems_task_argument argument)
182 {
182 {
183 spw_ioctl_pkt_send spw_ioctl_send_ASM;
183 spw_ioctl_pkt_send spw_ioctl_send_ASM;
184 rtems_event_set event_out;
184 rtems_event_set event_out;
185 rtems_status_code status;
185 rtems_status_code status;
186 rtems_id queue_id;
186 rtems_id queue_id;
187 Header_TM_LFR_SCIENCE_ASM_t headerASM;
187 Header_TM_LFR_SCIENCE_ASM_t headerASM;
188
188
189 init_header_asm( &headerASM );
189 init_header_asm( &headerASM );
190
190
191 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id );
191 status = get_message_queue_id_send( &queue_id );
192 if (status != RTEMS_SUCCESSFUL)
192 if (status != RTEMS_SUCCESSFUL)
193 {
193 {
194 PRINTF1("in MATR *** ERR getting queue id, %d\n", status)
194 PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status)
195 }
195 }
196
196
197 BOOT_PRINTF("in MATR *** \n")
197 BOOT_PRINTF("in MATR *** \n")
198
198
199 fill_averaged_spectral_matrix( );
199 fill_averaged_spectral_matrix( );
200
200
201 while(1){
201 while(1){
202 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
202 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
203
203
204 #ifdef GSA
204 #ifdef GSA
205 #else
205 #else
206 fill_averaged_spectral_matrix( );
206 fill_averaged_spectral_matrix( );
207 #endif
207 #endif
208 convert_averaged_spectral_matrix( averaged_spec_mat_f0, averaged_spec_mat_f0_char);
208 convert_averaged_spectral_matrix( averaged_spec_mat_f0, averaged_spec_mat_f0_char);
209
209
210 send_spectral_matrix( &headerASM, averaged_spec_mat_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
210 send_spectral_matrix( &headerASM, averaged_spec_mat_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
211 }
211 }
212 }
212 }
213
213
214 //*****************************
214 //*****************************
215 // Spectral matrices processing
215 // Spectral matrices processing
216
216
217 void matrix_reset(volatile float *averaged_spec_mat)
217 void matrix_reset(volatile float *averaged_spec_mat)
218 {
218 {
219 int i;
219 int i;
220 for(i=0; i<TOTAL_SIZE_SM; i++){
220 for(i=0; i<TOTAL_SIZE_SM; i++){
221 averaged_spec_mat[i] = 0;
221 averaged_spec_mat[i] = 0;
222 }
222 }
223 }
223 }
224
224
225 void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat)
225 void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat)
226 {
226 {
227 int i;
227 int i;
228 int j;
228 int j;
229 switch (fChannel){
229 switch (fChannel){
230 case 0:
230 case 0:
231 for(i=0;i<NB_BINS_COMPRESSED_SM_F0;i++){
231 for(i=0;i<NB_BINS_COMPRESSED_SM_F0;i++){
232 j = 17 + (i * 8);
232 j = 17 + (i * 8);
233 compressed_spec_mat[i] = (averaged_spec_mat[j]
233 compressed_spec_mat[i] = (averaged_spec_mat[j]
234 + averaged_spec_mat[j+1]
234 + averaged_spec_mat[j+1]
235 + averaged_spec_mat[j+2]
235 + averaged_spec_mat[j+2]
236 + averaged_spec_mat[j+3]
236 + averaged_spec_mat[j+3]
237 + averaged_spec_mat[j+4]
237 + averaged_spec_mat[j+4]
238 + averaged_spec_mat[j+5]
238 + averaged_spec_mat[j+5]
239 + averaged_spec_mat[j+6]
239 + averaged_spec_mat[j+6]
240 + averaged_spec_mat[j+7])/(8*NB_AVERAGE_NORMAL_f0);
240 + averaged_spec_mat[j+7])/(8*NB_AVERAGE_NORMAL_f0);
241 }
241 }
242 break;
242 break;
243 case 1:
243 case 1:
244 // case fChannel = f1 to be completed later
244 // case fChannel = f1 to be completed later
245 break;
245 break;
246 case 2:
246 case 2:
247 // case fChannel = f1 to be completed later
247 // case fChannel = f1 to be completed later
248 break;
248 break;
249 default:
249 default:
250 break;
250 break;
251 }
251 }
252 }
252 }
253
253
254 void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){
254 void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){
255 int i;
255 int i;
256 int j;
256 int j;
257 unsigned char tmp_u_char;
257 unsigned char tmp_u_char;
258 unsigned char * pt_char = NULL;
258 unsigned char * pt_char = NULL;
259 float PSDB, PSDE;
259 float PSDB, PSDE;
260 float NVEC_V0;
260 float NVEC_V0;
261 float NVEC_V1;
261 float NVEC_V1;
262 float NVEC_V2;
262 float NVEC_V2;
263 //float significand;
263 //float significand;
264 //int exponent;
264 //int exponent;
265 float aux;
265 float aux;
266 float tr_SB_SB;
266 float tr_SB_SB;
267 float tmp;
267 float tmp;
268 float sx_re;
268 float sx_re;
269 float sx_im;
269 float sx_im;
270 float nebx_re = 0;
270 float nebx_re = 0;
271 float nebx_im = 0;
271 float nebx_im = 0;
272 float ny = 0;
272 float ny = 0;
273 float nz = 0;
273 float nz = 0;
274 float bx_bx_star = 0;
274 float bx_bx_star = 0;
275 for(i=0; i<nb_bins_compressed_spec_mat; i++){
275 for(i=0; i<nb_bins_compressed_spec_mat; i++){
276 //==============================================
276 //==============================================
277 // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits
277 // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits
278 PSDB = compressed_spec_mat[i*30] // S11
278 PSDB = compressed_spec_mat[i*30] // S11
279 + compressed_spec_mat[(i*30) + 10] // S22
279 + compressed_spec_mat[(i*30) + 10] // S22
280 + compressed_spec_mat[(i*30) + 18]; // S33
280 + compressed_spec_mat[(i*30) + 18]; // S33
281 //significand = frexp(PSDB, &exponent);
281 //significand = frexp(PSDB, &exponent);
282 pt_char = (unsigned char*) &PSDB;
282 pt_char = (unsigned char*) &PSDB;
283 LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float
283 LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float
284 LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float
284 LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float
285 //==============================================
285 //==============================================
286 // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits
286 // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits
287 PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44
287 PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44
288 + compressed_spec_mat[(i*30) + 28] * K55_pe // S55
288 + compressed_spec_mat[(i*30) + 28] * K55_pe // S55
289 + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45
289 + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45
290 - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45
290 - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45
291 pt_char = (unsigned char*) &PSDE;
291 pt_char = (unsigned char*) &PSDE;
292 LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float
292 LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float
293 LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float
293 LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float
294 //==============================================================================
294 //==============================================================================
295 // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits
295 // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits
296 // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits
296 // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits
297 // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits
297 // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits
298 tmp = sqrt(
298 tmp = sqrt(
299 compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12
299 compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12
300 +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13
300 +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13
301 +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23
301 +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23
302 );
302 );
303 NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23
303 NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23
304 NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13
304 NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13
305 NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12
305 NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12
306 LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127);
306 LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127);
307 LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127);
307 LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127);
308 pt_char = (unsigned char*) &NVEC_V2;
308 pt_char = (unsigned char*) &NVEC_V2;
309 LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2
309 LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2
310 //=======================================================
310 //=======================================================
311 // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits
311 // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits
312 aux = 2*tmp / PSDB; // compute the ellipticity
312 aux = 2*tmp / PSDB; // compute the ellipticity
313 tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity
313 tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity
314 LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char
314 LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char
315 //==============================================================
315 //==============================================================
316 // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits
316 // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits
317 for(j = 0; j<NB_VALUES_PER_SM;j++){
317 for(j = 0; j<NB_VALUES_PER_SM;j++){
318 tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30]
318 tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30]
319 + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10]
319 + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10]
320 + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18]
320 + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18]
321 + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2]
321 + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2]
322 + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3]
322 + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3]
323 + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4]
323 + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4]
324 + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5]
324 + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5]
325 + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12]
325 + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12]
326 + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13];
326 + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13];
327 }
327 }
328 aux = PSDB*PSDB;
328 aux = PSDB*PSDB;
329 tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) );
329 tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) );
330 tmp_u_char = (unsigned char) (NVEC_V0*(8-1));
330 tmp_u_char = (unsigned char) (NVEC_V0*(8-1));
331 LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char
331 LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char
332 //=======================================================================================
332 //=======================================================================================
333 // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1)
333 // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1)
334 sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re
334 sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re
335 + compressed_spec_mat[(i*30) + 6] * K14_sx_re
335 + compressed_spec_mat[(i*30) + 6] * K14_sx_re
336 + compressed_spec_mat[(i*30) + 8] * K15_sx_re
336 + compressed_spec_mat[(i*30) + 8] * K15_sx_re
337 + compressed_spec_mat[(i*30) + 14] * K24_sx_re
337 + compressed_spec_mat[(i*30) + 14] * K24_sx_re
338 + compressed_spec_mat[(i*30) + 16] * K25_sx_re
338 + compressed_spec_mat[(i*30) + 16] * K25_sx_re
339 + compressed_spec_mat[(i*30) + 22] * K35_sx_re;
339 + compressed_spec_mat[(i*30) + 22] * K35_sx_re;
340 sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im
340 sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im
341 + compressed_spec_mat[(i*30) + 7] * K14_sx_im
341 + compressed_spec_mat[(i*30) + 7] * K14_sx_im
342 + compressed_spec_mat[(i*30) + 9] * K15_sx_im
342 + compressed_spec_mat[(i*30) + 9] * K15_sx_im
343 + compressed_spec_mat[(i*30) + 15] * K24_sx_im
343 + compressed_spec_mat[(i*30) + 15] * K24_sx_im
344 + compressed_spec_mat[(i*30) + 17] * K25_sx_im
344 + compressed_spec_mat[(i*30) + 17] * K25_sx_im
345 + compressed_spec_mat[(i*30) + 23] * K35_sx_im;
345 + compressed_spec_mat[(i*30) + 23] * K35_sx_im;
346 LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression
346 LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression
347 if ( abs(sx_re) > abs(sx_im) ) {
347 if ( abs(sx_re) > abs(sx_im) ) {
348 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx
348 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx
349 }
349 }
350 else {
350 else {
351 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx
351 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx
352 }
352 }
353 //======================================================================
353 //======================================================================
354 // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1)
354 // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1)
355 ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2;
355 ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2;
356 nz = NVEC_V0;
356 nz = NVEC_V0;
357 bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22
357 bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22
358 + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33
358 + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33
359 - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23
359 - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23
360 nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re
360 nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re
361 +compressed_spec_mat[(i*30) + 16] * K25_ny_re
361 +compressed_spec_mat[(i*30) + 16] * K25_ny_re
362 +compressed_spec_mat[(i*30) + 20] * K34_ny_re
362 +compressed_spec_mat[(i*30) + 20] * K34_ny_re
363 +compressed_spec_mat[(i*30) + 22] * K35_ny_re)
363 +compressed_spec_mat[(i*30) + 22] * K35_ny_re)
364 + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re
364 + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re
365 +compressed_spec_mat[(i*30) + 16] * K25_nz_re
365 +compressed_spec_mat[(i*30) + 16] * K25_nz_re
366 +compressed_spec_mat[(i*30) + 20] * K34_nz_re
366 +compressed_spec_mat[(i*30) + 20] * K34_nz_re
367 +compressed_spec_mat[(i*30) + 22] * K35_nz_re);
367 +compressed_spec_mat[(i*30) + 22] * K35_nz_re);
368 nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re
368 nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re
369 +compressed_spec_mat[(i*30) + 17] * K25_ny_re
369 +compressed_spec_mat[(i*30) + 17] * K25_ny_re
370 +compressed_spec_mat[(i*30) + 21] * K34_ny_re
370 +compressed_spec_mat[(i*30) + 21] * K34_ny_re
371 +compressed_spec_mat[(i*30) + 23] * K35_ny_re)
371 +compressed_spec_mat[(i*30) + 23] * K35_ny_re)
372 + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im
372 + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im
373 +compressed_spec_mat[(i*30) + 17] * K25_nz_im
373 +compressed_spec_mat[(i*30) + 17] * K25_nz_im
374 +compressed_spec_mat[(i*30) + 21] * K34_nz_im
374 +compressed_spec_mat[(i*30) + 21] * K34_nz_im
375 +compressed_spec_mat[(i*30) + 23] * K35_nz_im);
375 +compressed_spec_mat[(i*30) + 23] * K35_nz_im);
376 tmp = nebx_re / bx_bx_star;
376 tmp = nebx_re / bx_bx_star;
377 LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression
377 LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression
378 if ( abs(nebx_re) > abs(nebx_im) ) {
378 if ( abs(nebx_re) > abs(nebx_im) ) {
379 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx
379 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx
380 }
380 }
381 else {
381 else {
382 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx
382 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx
383 }
383 }
384 }
384 }
385
385
386 }
386 }
387
387
388 void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){
388 void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){
389 // BP2 autocorrelation
389 // BP2 autocorrelation
390 int i;
390 int i;
391 int aux = 0;
391 int aux = 0;
392
392
393 for(i = 0; i<nb_bins_compressed_spec_mat; i++){
393 for(i = 0; i<nb_bins_compressed_spec_mat; i++){
394 // S12
394 // S12
395 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]);
395 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]);
396 compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux;
396 compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux;
397 compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux;
397 compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux;
398 // S13
398 // S13
399 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]);
399 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]);
400 compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux;
400 compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux;
401 compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux;
401 compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux;
402 // S23
402 // S23
403 aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]);
403 aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]);
404 compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux;
404 compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux;
405 compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux;
405 compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux;
406 // S45
406 // S45
407 aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]);
407 aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]);
408 compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux;
408 compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux;
409 compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux;
409 compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux;
410 // S14
410 // S14
411 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]);
411 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]);
412 compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux;
412 compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux;
413 compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux;
413 compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux;
414 // S15
414 // S15
415 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]);
415 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]);
416 compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux;
416 compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux;
417 compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux;
417 compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux;
418 // S24
418 // S24
419 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]);
419 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]);
420 compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux;
420 compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux;
421 compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux;
421 compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux;
422 // S25
422 // S25
423 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]);
423 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]);
424 compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux;
424 compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux;
425 compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux;
425 compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux;
426 // S34
426 // S34
427 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]);
427 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]);
428 compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux;
428 compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux;
429 compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux;
429 compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux;
430 // S35
430 // S35
431 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]);
431 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]);
432 compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux;
432 compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux;
433 compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux;
433 compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux;
434 }
434 }
435 }
435 }
436
436
437 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header)
437 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header)
438 {
438 {
439 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
439 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
440 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
440 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
441 header->reserved = 0x00;
441 header->reserved = 0x00;
442 header->userApplication = CCSDS_USER_APP;
442 header->userApplication = CCSDS_USER_APP;
443 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
443 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
444 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
444 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
445 header->packetSequenceControl[0] = 0xc0;
445 header->packetSequenceControl[0] = 0xc0;
446 header->packetSequenceControl[1] = 0x00;
446 header->packetSequenceControl[1] = 0x00;
447 header->packetLength[0] = 0x00;
447 header->packetLength[0] = 0x00;
448 header->packetLength[1] = 0x00;
448 header->packetLength[1] = 0x00;
449 // DATA FIELD HEADER
449 // DATA FIELD HEADER
450 header->spare1_pusVersion_spare2 = 0x10;
450 header->spare1_pusVersion_spare2 = 0x10;
451 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
451 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
452 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
452 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
453 header->destinationID = TM_DESTINATION_ID_GROUND;
453 header->destinationID = TM_DESTINATION_ID_GROUND;
454 // AUXILIARY DATA HEADER
454 // AUXILIARY DATA HEADER
455 header->sid = 0x00;
455 header->sid = 0x00;
456 header->biaStatusInfo = 0x00;
456 header->biaStatusInfo = 0x00;
457 header->cntASM = 0x00;
457 header->cntASM = 0x00;
458 header->nrASM = 0x00;
458 header->nrASM = 0x00;
459 header->time[0] = 0x00;
459 header->time[0] = 0x00;
460 header->time[0] = 0x00;
460 header->time[0] = 0x00;
461 header->time[0] = 0x00;
461 header->time[0] = 0x00;
462 header->time[0] = 0x00;
462 header->time[0] = 0x00;
463 header->time[0] = 0x00;
463 header->time[0] = 0x00;
464 header->time[0] = 0x00;
464 header->time[0] = 0x00;
465 header->blkNr[0] = 0x00; // BLK_NR MSB
465 header->blkNr[0] = 0x00; // BLK_NR MSB
466 header->blkNr[1] = 0x00; // BLK_NR LSB
466 header->blkNr[1] = 0x00; // BLK_NR LSB
467 }
467 }
468
468
469 void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
469 void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
470 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id)
470 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id)
471 {
471 {
472 unsigned int i;
472 unsigned int i;
473 unsigned int length = 0;
473 unsigned int length = 0;
474 rtems_status_code status;
474 rtems_status_code status;
475
475
476 header->sid = (unsigned char) sid;
476 header->sid = (unsigned char) sid;
477
477
478 for (i=0; i<2; i++)
478 for (i=0; i<2; i++)
479 {
479 {
480 // BUILD THE DATA
480 // BUILD THE DATA
481 spw_ioctl_send->dlen = TOTAL_SIZE_SM;
481 spw_ioctl_send->dlen = TOTAL_SIZE_SM;
482 spw_ioctl_send->data = &spectral_matrix[ i * TOTAL_SIZE_SM];
482 spw_ioctl_send->data = &spectral_matrix[ i * TOTAL_SIZE_SM];
483 spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES;
483 spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES;
484 spw_ioctl_send->hdr = (char *) header;
484 spw_ioctl_send->hdr = (char *) header;
485 spw_ioctl_send->options = 0;
485 spw_ioctl_send->options = 0;
486
486
487 // BUILD THE HEADER
487 // BUILD THE HEADER
488 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM;
488 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM;
489 header->packetLength[0] = (unsigned char) (length>>8);
489 header->packetLength[0] = (unsigned char) (length>>8);
490 header->packetLength[1] = (unsigned char) (length);
490 header->packetLength[1] = (unsigned char) (length);
491 header->sid = (unsigned char) sid; // SID
491 header->sid = (unsigned char) sid; // SID
492 header->cntASM = 2;
492 header->cntASM = 2;
493 header->nrASM = (unsigned char) (i+1);
493 header->nrASM = (unsigned char) (i+1);
494 header->blkNr[0] =(unsigned char) ( (NB_BINS_PER_SM/2) >> 8 ); // BLK_NR MSB
494 header->blkNr[0] =(unsigned char) ( (NB_BINS_PER_SM/2) >> 8 ); // BLK_NR MSB
495 header->blkNr[1] = (unsigned char) (NB_BINS_PER_SM/2); // BLK_NR LSB
495 header->blkNr[1] = (unsigned char) (NB_BINS_PER_SM/2); // BLK_NR LSB
496 // SET PACKET TIME
496 // SET PACKET TIME
497 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
497 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
498 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
498 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
499 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
499 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
500 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
500 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
501 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
501 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
502 header->time[5] = (unsigned char) (time_management_regs->fine_time);
502 header->time[5] = (unsigned char) (time_management_regs->fine_time);
503 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
503 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
504 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
504 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
505 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
505 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
506 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
506 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
507 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
507 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
508 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
508 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
509 // SEND PACKET
509 // SEND PACKET
510 status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
510 status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
511 if (status != RTEMS_SUCCESSFUL) {
511 if (status != RTEMS_SUCCESSFUL) {
512 printf("in send_spectral_matrix *** ERR %d\n", (int) status);
512 printf("in send_spectral_matrix *** ERR %d\n", (int) status);
513 }
513 }
514 }
514 }
515 }
515 }
516
516
517 void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix)
517 void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix)
518 {
518 {
519 unsigned int i;
519 unsigned int i;
520 unsigned int j;
520 unsigned int j;
521 char * pt_char_input;
521 char * pt_char_input;
522 char * pt_char_output;
522 char * pt_char_output;
523
523
524 pt_char_input = NULL;
524 pt_char_input = NULL;
525 pt_char_output = NULL;
525 pt_char_output = NULL;
526
526
527 for( i=0; i<NB_BINS_PER_SM; i++)
527 for( i=0; i<NB_BINS_PER_SM; i++)
528 {
528 {
529 for ( j=0; j<NB_VALUES_PER_SM; j++)
529 for ( j=0; j<NB_VALUES_PER_SM; j++)
530 {
530 {
531 pt_char_input = (char*) &input_matrix[ (i*NB_VALUES_PER_SM) + j ];
531 pt_char_input = (char*) &input_matrix[ (i*NB_VALUES_PER_SM) + j ];
532 pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ];
532 pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ];
533 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
533 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
534 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
534 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
535 }
535 }
536 }
536 }
537 }
537 }
538
538
539 void fill_averaged_spectral_matrix(void)
539 void fill_averaged_spectral_matrix(void)
540 {
540 {
541 /** This function fills spectral matrices related buffers with arbitrary data.
541 /** This function fills spectral matrices related buffers with arbitrary data.
542 *
542 *
543 * This function is for testing purpose only.
543 * This function is for testing purpose only.
544 *
544 *
545 */
545 */
546
546
547 #ifdef GSA
547 #ifdef GSA
548 float offset = 10.;
548 float offset = 10.;
549 float coeff = 100000.;
549 float coeff = 100000.;
550
550
551 averaged_spec_mat_f0[ 0 + 25 * 0 ] = 0. + offset;
551 averaged_spec_mat_f0[ 0 + 25 * 0 ] = 0. + offset;
552 averaged_spec_mat_f0[ 0 + 25 * 1 ] = 1. + offset;
552 averaged_spec_mat_f0[ 0 + 25 * 1 ] = 1. + offset;
553 averaged_spec_mat_f0[ 0 + 25 * 2 ] = 2. + offset;
553 averaged_spec_mat_f0[ 0 + 25 * 2 ] = 2. + offset;
554 averaged_spec_mat_f0[ 0 + 25 * 3 ] = 3. + offset;
554 averaged_spec_mat_f0[ 0 + 25 * 3 ] = 3. + offset;
555 averaged_spec_mat_f0[ 0 + 25 * 4 ] = 4. + offset;
555 averaged_spec_mat_f0[ 0 + 25 * 4 ] = 4. + offset;
556 averaged_spec_mat_f0[ 0 + 25 * 5 ] = 5. + offset;
556 averaged_spec_mat_f0[ 0 + 25 * 5 ] = 5. + offset;
557 averaged_spec_mat_f0[ 0 + 25 * 6 ] = 6. + offset;
557 averaged_spec_mat_f0[ 0 + 25 * 6 ] = 6. + offset;
558 averaged_spec_mat_f0[ 0 + 25 * 7 ] = 7. + offset;
558 averaged_spec_mat_f0[ 0 + 25 * 7 ] = 7. + offset;
559 averaged_spec_mat_f0[ 0 + 25 * 8 ] = 8. + offset;
559 averaged_spec_mat_f0[ 0 + 25 * 8 ] = 8. + offset;
560 averaged_spec_mat_f0[ 0 + 25 * 9 ] = 9. + offset;
560 averaged_spec_mat_f0[ 0 + 25 * 9 ] = 9. + offset;
561 averaged_spec_mat_f0[ 0 + 25 * 10 ] = 10. + offset;
561 averaged_spec_mat_f0[ 0 + 25 * 10 ] = 10. + offset;
562 averaged_spec_mat_f0[ 0 + 25 * 11 ] = 11. + offset;
562 averaged_spec_mat_f0[ 0 + 25 * 11 ] = 11. + offset;
563 averaged_spec_mat_f0[ 0 + 25 * 12 ] = 12. + offset;
563 averaged_spec_mat_f0[ 0 + 25 * 12 ] = 12. + offset;
564 averaged_spec_mat_f0[ 0 + 25 * 13 ] = 13. + offset;
564 averaged_spec_mat_f0[ 0 + 25 * 13 ] = 13. + offset;
565 averaged_spec_mat_f0[ 0 + 25 * 14 ] = 14. + offset;
565 averaged_spec_mat_f0[ 0 + 25 * 14 ] = 14. + offset;
566 averaged_spec_mat_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff;
566 averaged_spec_mat_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff;
567 averaged_spec_mat_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff;
567 averaged_spec_mat_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff;
568 averaged_spec_mat_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff;
568 averaged_spec_mat_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff;
569 averaged_spec_mat_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff;
569 averaged_spec_mat_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff;
570 averaged_spec_mat_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff;
570 averaged_spec_mat_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff;
571 averaged_spec_mat_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff;
571 averaged_spec_mat_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff;
572 averaged_spec_mat_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff;
572 averaged_spec_mat_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff;
573 averaged_spec_mat_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff;
573 averaged_spec_mat_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff;
574 averaged_spec_mat_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff;
574 averaged_spec_mat_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff;
575 averaged_spec_mat_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff;
575 averaged_spec_mat_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff;
576 averaged_spec_mat_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff;
576 averaged_spec_mat_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff;
577 averaged_spec_mat_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff;
577 averaged_spec_mat_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff;
578 averaged_spec_mat_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff;
578 averaged_spec_mat_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff;
579 averaged_spec_mat_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff;
579 averaged_spec_mat_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff;
580 averaged_spec_mat_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff;
580 averaged_spec_mat_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff;
581 offset = 10000000;
581 offset = 10000000;
582 averaged_spec_mat_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff;
582 averaged_spec_mat_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff;
583 averaged_spec_mat_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff;
583 averaged_spec_mat_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff;
584 averaged_spec_mat_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff;
584 averaged_spec_mat_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff;
585 averaged_spec_mat_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff;
585 averaged_spec_mat_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff;
586 averaged_spec_mat_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff;
586 averaged_spec_mat_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff;
587 averaged_spec_mat_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff;
587 averaged_spec_mat_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff;
588 averaged_spec_mat_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff;
588 averaged_spec_mat_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff;
589 averaged_spec_mat_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff;
589 averaged_spec_mat_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff;
590 averaged_spec_mat_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff;
590 averaged_spec_mat_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff;
591 averaged_spec_mat_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff;
591 averaged_spec_mat_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff;
592 averaged_spec_mat_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff;
592 averaged_spec_mat_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff;
593 averaged_spec_mat_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff;
593 averaged_spec_mat_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff;
594 averaged_spec_mat_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff;
594 averaged_spec_mat_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff;
595 averaged_spec_mat_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff;
595 averaged_spec_mat_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff;
596 averaged_spec_mat_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff;
596 averaged_spec_mat_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff;
597
597
598 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_spec_mat_f0[ 0 ];
598 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_spec_mat_f0[ 0 ];
599 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_spec_mat_f0[ 1 ];
599 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_spec_mat_f0[ 1 ];
600 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_spec_mat_f0[ 2 ];
600 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_spec_mat_f0[ 2 ];
601 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_spec_mat_f0[ 3 ];
601 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_spec_mat_f0[ 3 ];
602 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_spec_mat_f0[ 4 ];
602 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_spec_mat_f0[ 4 ];
603 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_spec_mat_f0[ 5 ];
603 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_spec_mat_f0[ 5 ];
604 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_spec_mat_f0[ 6 ];
604 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_spec_mat_f0[ 6 ];
605 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_spec_mat_f0[ 7 ];
605 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_spec_mat_f0[ 7 ];
606 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_spec_mat_f0[ 8 ];
606 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_spec_mat_f0[ 8 ];
607 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_spec_mat_f0[ 9 ];
607 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_spec_mat_f0[ 9 ];
608 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_spec_mat_f0[ 10 ];
608 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_spec_mat_f0[ 10 ];
609 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_spec_mat_f0[ 11 ];
609 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_spec_mat_f0[ 11 ];
610 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_spec_mat_f0[ 12 ];
610 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_spec_mat_f0[ 12 ];
611 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_spec_mat_f0[ 13 ];
611 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_spec_mat_f0[ 13 ];
612 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_spec_mat_f0[ 14 ];
612 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_spec_mat_f0[ 14 ];
613 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_spec_mat_f0[ 15 ];
613 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_spec_mat_f0[ 15 ];
614 #else
614 #else
615 unsigned int i;
615 unsigned int i;
616
616
617 for(i=0; i<TOTAL_SIZE_SM; i++)
617 for(i=0; i<TOTAL_SIZE_SM; i++)
618 {
618 {
619 if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0)
619 if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0)
620 averaged_spec_mat_f0[i] = (float) spec_mat_f0_0_bis[ SM_HEADER + i ];
620 averaged_spec_mat_f0[i] = (float) spec_mat_f0_0_bis[ SM_HEADER + i ];
621 else
621 else
622 averaged_spec_mat_f0[i] = (float) spec_mat_f0_0[ SM_HEADER + i ];
622 averaged_spec_mat_f0[i] = (float) spec_mat_f0_0[ SM_HEADER + i ];
623 }
623 }
624 #endif
624 #endif
625 }
625 }
626
626
627 void reset_spectral_matrix_regs()
627 void reset_spectral_matrix_regs()
628 {
628 {
629 /** This function resets the spectral matrices module registers.
629 /** This function resets the spectral matrices module registers.
630 *
630 *
631 * The registers affected by this function are located at the following offset addresses:
631 * The registers affected by this function are located at the following offset addresses:
632 *
632 *
633 * - 0x00 config
633 * - 0x00 config
634 * - 0x04 status
634 * - 0x04 status
635 * - 0x08 matrixF0_Address0
635 * - 0x08 matrixF0_Address0
636 * - 0x10 matrixFO_Address1
636 * - 0x10 matrixFO_Address1
637 * - 0x14 matrixF1_Address
637 * - 0x14 matrixF1_Address
638 * - 0x18 matrixF2_Address
638 * - 0x18 matrixF2_Address
639 *
639 *
640 */
640 */
641
641
642 #ifdef GSA
642 #ifdef GSA
643 #else
643 #else
644 spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0;
644 spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0;
645 spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1;
645 spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1;
646 spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1;
646 spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1;
647 spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2;
647 spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2;
648 #endif
648 #endif
649 }
649 }
650
650
651 //******************
651 //******************
652 // general functions
652 // general functions
653
653
654
654
655
655
656
656
@@ -1,624 +1,606
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_start_link( fdSPW ); // start the link
65 status = spacewire_stop_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_standby_mode();
90 status = enter_standby_mode();
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 currentTC_LEN_RCV_AsUnsignedInt;
119 unsigned int currentTC_LEN_RCV_AsUnsignedInt;
120 unsigned int parserCode;
120 unsigned int parserCode;
121 unsigned char time[6];
121 unsigned char time[6];
122 rtems_status_code status;
122 rtems_status_code status;
123 rtems_id queue_recv_id;
123 rtems_id queue_recv_id;
124 rtems_id queue_send_id;
124 rtems_id queue_send_id;
125
125
126 initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes
126 initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes
127
127
128 status = rtems_message_queue_ident( misc_name[QUEUE_RECV], 0, &queue_recv_id );
128 status = get_message_queue_id_recv( &queue_recv_id );
129 if (status != RTEMS_SUCCESSFUL)
129 if (status != RTEMS_SUCCESSFUL)
130 {
130 {
131 PRINTF1("in RECV *** ERR getting QUEUE_RECV id, %d\n", status)
131 PRINTF1("in RECV *** ERR get_message_queue_id_recv %d\n", status)
132 }
132 }
133
133
134 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_send_id );
134 status = get_message_queue_id_send( &queue_send_id );
135 if (status != RTEMS_SUCCESSFUL)
135 if (status != RTEMS_SUCCESSFUL)
136 {
136 {
137 PRINTF1("in RECV *** ERR getting QUEUE_SEND id, %d\n", status)
137 PRINTF1("in RECV *** ERR get_message_queue_id_send %d\n", status)
138 }
138 }
139
139
140 BOOT_PRINTF("in RECV *** \n")
140 BOOT_PRINTF("in RECV *** \n")
141
141
142 while(1)
142 while(1)
143 {
143 {
144 len = read( fdSPW, (char*) &currentTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking
144 len = read( fdSPW, (char*) &currentTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking
145 if (len == -1){ // error during the read call
145 if (len == -1){ // error during the read call
146 PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno)
146 PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno)
147 }
147 }
148 else {
148 else {
149 if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) {
149 if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) {
150 PRINTF("in RECV *** packet lenght too short\n")
150 PRINTF("in RECV *** packet lenght too short\n")
151 }
151 }
152 else {
152 else {
153 currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes
153 currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes
154 currentTC_LEN_RCV[ 0 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt >> 8);
154 currentTC_LEN_RCV[ 0 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt >> 8);
155 currentTC_LEN_RCV[ 1 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt );
155 currentTC_LEN_RCV[ 1 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt );
156 // CHECK THE TC
156 // CHECK THE TC
157 parserCode = tc_parser( &currentTC, currentTC_LEN_RCV_AsUnsignedInt, computed_CRC ) ;
157 parserCode = tc_parser( &currentTC, currentTC_LEN_RCV_AsUnsignedInt, computed_CRC ) ;
158 if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT)
158 if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT)
159 || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE)
159 || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE)
160 || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA)
160 || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA)
161 || (parserCode == WRONG_SRC_ID) )
161 || (parserCode == WRONG_SRC_ID) )
162 { // send TM_LFR_TC_EXE_CORRUPTED
162 { // send TM_LFR_TC_EXE_CORRUPTED
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 getTime( time );
176 getTime( time );
177 close_action( &currentTC, LFR_DEFAULT, queue_send_id, time);
177 close_action( &currentTC, LFR_DEFAULT, queue_send_id, time);
178 send_tm_lfr_tc_exe_corrupted( &currentTC, queue_send_id,
178 send_tm_lfr_tc_exe_corrupted( &currentTC, queue_send_id,
179 computed_CRC, currentTC_LEN_RCV,
179 computed_CRC, currentTC_LEN_RCV,
180 destinationID, time );
180 destinationID, time );
181 }
181 }
182 }
182 }
183 else
183 else
184 { // send valid TC to the action launcher
184 { // send valid TC to the action launcher
185 status = rtems_message_queue_send( queue_recv_id, &currentTC,
185 status = rtems_message_queue_send( queue_recv_id, &currentTC,
186 currentTC_LEN_RCV_AsUnsignedInt + CCSDS_TC_TM_PACKET_OFFSET + 3);
186 currentTC_LEN_RCV_AsUnsignedInt + CCSDS_TC_TM_PACKET_OFFSET + 3);
187 }
187 }
188 }
188 }
189 }
189 }
190 }
190 }
191 }
191 }
192
192
193 rtems_task send_task( rtems_task_argument argument)
193 rtems_task send_task( rtems_task_argument argument)
194 {
194 {
195 /** This RTEMS task is dedicated to the transmission of TeleMetry packets.
195 /** This RTEMS task is dedicated to the transmission of TeleMetry packets.
196 *
196 *
197 * @param unused is the starting argument of the RTEMS task
197 * @param unused is the starting argument of the RTEMS task
198 *
198 *
199 * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives:
199 * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives:
200 * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call.
200 * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call.
201 * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After
201 * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After
202 * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the
202 * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the
203 * data it contains.
203 * data it contains.
204 *
204 *
205 */
205 */
206
206
207 rtems_status_code status; // RTEMS status code
207 rtems_status_code status; // RTEMS status code
208 char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer
208 char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer
209 spw_ioctl_pkt_send *spw_ioctl_send;
209 spw_ioctl_pkt_send *spw_ioctl_send;
210 size_t size; // size of the incoming TC packet
210 size_t size; // size of the incoming TC packet
211 u_int32_t count;
211 u_int32_t count;
212 rtems_id queue_id;
212 rtems_id queue_id;
213
213
214 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id );
214 status = get_message_queue_id_send( &queue_id );
215 if (status != RTEMS_SUCCESSFUL)
215 if (status != RTEMS_SUCCESSFUL)
216 {
216 {
217 PRINTF1("in SEND *** ERR getting queue id, %d\n", status)
217 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
218 }
218 }
219
219
220 BOOT_PRINTF("in SEND *** \n")
220 BOOT_PRINTF("in SEND *** \n")
221
221
222 while(1)
222 while(1)
223 {
223 {
224 status = rtems_message_queue_receive( queue_id, incomingData, &size,
224 status = rtems_message_queue_receive( queue_id, incomingData, &size,
225 RTEMS_WAIT, RTEMS_NO_TIMEOUT );
225 RTEMS_WAIT, RTEMS_NO_TIMEOUT );
226
226
227 if (status!=RTEMS_SUCCESSFUL)
227 if (status!=RTEMS_SUCCESSFUL)
228 {
228 {
229 PRINTF1("in SEND *** (1) ERR = %d\n", status)
229 PRINTF1("in SEND *** (1) ERR = %d\n", status)
230 }
230 }
231 else
231 else
232 {
232 {
233 if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet
233 if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet
234 {
234 {
235 status = write( fdSPW, incomingData, size );
235 status = write( fdSPW, incomingData, size );
236 if (status == -1){
236 if (status == -1){
237 PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size)
237 PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size)
238 }
238 }
239 }
239 }
240 else // the incoming message is a spw_ioctl_pkt_send structure
240 else // the incoming message is a spw_ioctl_pkt_send structure
241 {
241 {
242 spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData;
242 spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData;
243 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send );
243 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send );
244 if (status == -1){
244 if (status == -1){
245 PRINTF2("in SEND *** (2.b) ERRNO = %d, RTEMS = %d\n", errno, status)
245 PRINTF2("in SEND *** (2.b) ERRNO = %d, RTEMS = %d\n", errno, status)
246 }
246 }
247 }
247 }
248 }
248 }
249
249
250 status = rtems_message_queue_get_number_pending( queue_id, &count );
250 status = rtems_message_queue_get_number_pending( queue_id, &count );
251 if (status != RTEMS_SUCCESSFUL)
251 if (status != RTEMS_SUCCESSFUL)
252 {
252 {
253 PRINTF1("in SEND *** (3) ERR = %d\n", status)
253 PRINTF1("in SEND *** (3) ERR = %d\n", status)
254 }
254 }
255 else
255 else
256 {
256 {
257 if (count > maxCount)
257 if (count > maxCount)
258 {
258 {
259 maxCount = count;
259 maxCount = count;
260 }
260 }
261 }
261 }
262 }
262 }
263 }
263 }
264
264
265 rtems_task wtdg_task( rtems_task_argument argument )
265 rtems_task wtdg_task( rtems_task_argument argument )
266 {
266 {
267 rtems_event_set event_out;
267 rtems_event_set event_out;
268 rtems_status_code status;
268 rtems_status_code status;
269 int linkStatus;
269 int linkStatus;
270
270
271 BOOT_PRINTF("in WTDG ***\n")
271 BOOT_PRINTF("in WTDG ***\n")
272
272
273 while(1)
273 while(1)
274 {
274 {
275 // wait for an RTEMS_EVENT
275 // wait for an RTEMS_EVENT
276 rtems_event_receive( RTEMS_EVENT_0,
276 rtems_event_receive( RTEMS_EVENT_0,
277 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
277 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
278 PRINTF("in WTDG *** wait for the link\n")
278 PRINTF("in WTDG *** wait for the link\n")
279 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
279 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
280 while( linkStatus != 5) // wait for the link
280 while( linkStatus != 5) // wait for the link
281 {
281 {
282 rtems_task_wake_after( 10 );
282 rtems_task_wake_after( 10 );
283 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
283 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
284 }
284 }
285
285
286 status = spacewire_stop_start_link( fdSPW );
286 status = spacewire_stop_start_link( fdSPW );
287
287
288 if (status != RTEMS_SUCCESSFUL)
288 if (status != RTEMS_SUCCESSFUL)
289 {
289 {
290 PRINTF1("in WTDG *** ERR link not started %d\n", status)
290 PRINTF1("in WTDG *** ERR link not started %d\n", status)
291 }
291 }
292 else
292 else
293 {
293 {
294 PRINTF("in WTDG *** OK link started\n")
294 PRINTF("in WTDG *** OK link started\n")
295 }
295 }
296
296
297 // restart the SPIQ task
297 // restart the SPIQ task
298 status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 );
298 status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 );
299 if ( status != RTEMS_SUCCESSFUL ) {
299 if ( status != RTEMS_SUCCESSFUL ) {
300 PRINTF("in SPIQ *** ERR restarting SPIQ Task\n")
300 PRINTF("in SPIQ *** ERR restarting SPIQ Task\n")
301 }
301 }
302
302
303 // restart RECV and SEND
303 // restart RECV and SEND
304 status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 );
304 status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 );
305 if ( status != RTEMS_SUCCESSFUL ) {
305 if ( status != RTEMS_SUCCESSFUL ) {
306 PRINTF("in SPIQ *** ERR restarting SEND Task\n")
306 PRINTF("in SPIQ *** ERR restarting SEND Task\n")
307 }
307 }
308 status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 );
308 status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 );
309 if ( status != RTEMS_SUCCESSFUL ) {
309 if ( status != RTEMS_SUCCESSFUL ) {
310 PRINTF("in SPIQ *** ERR restarting RECV Task\n")
310 PRINTF("in SPIQ *** ERR restarting RECV Task\n")
311 }
311 }
312 }
312 }
313 }
313 }
314
314
315 //****************
315 //****************
316 // OTHER FUNCTIONS
316 // OTHER FUNCTIONS
317 int spacewire_open_link( void )
317 int spacewire_open_link( void )
318 {
318 {
319 /** This function opens the SpaceWire link.
319 /** This function opens the SpaceWire link.
320 *
320 *
321 * @return a valid file descriptor in case of success, -1 in case of a failure
321 * @return a valid file descriptor in case of success, -1 in case of a failure
322 *
322 *
323 */
323 */
324 rtems_status_code status;
324 rtems_status_code status;
325
325
326 fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware
326 fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware
327 if ( fdSPW < 0 ) {
327 if ( fdSPW < 0 ) {
328 PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno)
328 PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno)
329 }
329 }
330 else
330 else
331 {
331 {
332 status = RTEMS_SUCCESSFUL;
332 status = RTEMS_SUCCESSFUL;
333 }
333 }
334
334
335 return status;
335 return status;
336 }
336 }
337
337
338 int spacewire_start_link( int fd )
338 int spacewire_start_link( int fd )
339 {
339 {
340 rtems_status_code status;
340 rtems_status_code status;
341
341
342 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
342 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
343 // -1 default hardcoded driver timeout
343 // -1 default hardcoded driver timeout
344
344
345 return status;
345 return status;
346 }
346 }
347
347
348 int spacewire_stop_start_link( int fd )
348 int spacewire_stop_start_link( int fd )
349 {
349 {
350 rtems_status_code status;
350 rtems_status_code status;
351
351
352 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0
352 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0
353 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
353 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
354 // -1 default hardcoded driver timeout
354 // -1 default hardcoded driver timeout
355
355
356 return status;
356 return status;
357 }
357 }
358
358
359 int spacewire_configure_link( int fd )
359 int spacewire_configure_link( int fd )
360 {
360 {
361 /** This function configures the SpaceWire link.
361 /** This function configures the SpaceWire link.
362 *
362 *
363 * @return GR-RTEMS-DRIVER directive status codes:
363 * @return GR-RTEMS-DRIVER directive status codes:
364 * - 22 EINVAL - Null pointer or an out of range value was given as the argument.
364 * - 22 EINVAL - Null pointer or an out of range value was given as the argument.
365 * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode.
365 * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode.
366 * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used.
366 * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used.
367 * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up.
367 * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up.
368 * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers.
368 * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers.
369 * - 5 EIO - Error when writing to grswp hardware registers.
369 * - 5 EIO - Error when writing to grswp hardware registers.
370 * - 2 ENOENT - No such file or directory
370 * - 2 ENOENT - No such file or directory
371 */
371 */
372
372
373 rtems_status_code status;
373 rtems_status_code status;
374
374
375 spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force
375 spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force
376 spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration
376 spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration
377
377
378 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception
378 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception
379 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n")
379 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n")
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) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs
382 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs
383 //
383 //
384 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts
384 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts
385 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n")
385 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n")
386 //
386 //
387 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit
387 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit
388 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
388 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
389 //
389 //
390 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks
390 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks
391 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n")
391 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n")
392 //
392 //
393 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available
393 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available
394 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n")
394 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n")
395 //
395 //
396 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ]
396 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ]
397 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n")
397 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n")
398
398
399 return status;
399 return status;
400 }
400 }
401
401
402 int spacewire_reset_link( void )
402 int spacewire_reset_link( void )
403 {
403 {
404 /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver.
404 /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver.
405 *
405 *
406 * @return RTEMS directive status code:
406 * @return RTEMS directive status code:
407 * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s.
407 * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s.
408 * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout.
408 * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout.
409 *
409 *
410 */
410 */
411
411
412 rtems_status_code status_spw;
412 rtems_status_code status_spw;
413 int i;
413 int i;
414
414
415 for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ )
415 for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ )
416 {
416 {
417 PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i);
417 PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i);
418
418
419 // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM
419 // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM
420
420
421 status_spw = spacewire_stop_start_link( fdSPW );
421 status_spw = spacewire_stop_start_link( fdSPW );
422 if ( status_spw != RTEMS_SUCCESSFUL )
422 if ( status_spw != RTEMS_SUCCESSFUL )
423 {
423 {
424 PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw)
424 PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw)
425 }
425 }
426
426
427 if ( status_spw == RTEMS_SUCCESSFUL)
427 if ( status_spw == RTEMS_SUCCESSFUL)
428 {
428 {
429 break;
429 break;
430 }
430 }
431 }
431 }
432
432
433 return status_spw;
433 return status_spw;
434 }
434 }
435
435
436 void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force
436 void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force
437 {
437 {
438 /** This function sets the [N]o [P]ort force bit of the GRSPW control register.
438 /** This function sets the [N]o [P]ort force bit of the GRSPW control register.
439 *
439 *
440 * @param val is the value, 0 or 1, used to set the value of the NP bit.
440 * @param val is the value, 0 or 1, used to set the value of the NP bit.
441 * @param regAddr is the address of the GRSPW control register.
441 * @param regAddr is the address of the GRSPW control register.
442 *
442 *
443 * NP is the bit 20 of the GRSPW control register.
443 * NP is the bit 20 of the GRSPW control register.
444 *
444 *
445 */
445 */
446
446
447 unsigned int *spwptr = (unsigned int*) regAddr;
447 unsigned int *spwptr = (unsigned int*) regAddr;
448
448
449 if (val == 1) {
449 if (val == 1) {
450 *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit
450 *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit
451 }
451 }
452 if (val== 0) {
452 if (val== 0) {
453 *spwptr = *spwptr & 0xffdfffff;
453 *spwptr = *spwptr & 0xffdfffff;
454 }
454 }
455 }
455 }
456
456
457 void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable
457 void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable
458 {
458 {
459 /** This function sets the [R]MAP [E]nable bit of the GRSPW control register.
459 /** This function sets the [R]MAP [E]nable bit of the GRSPW control register.
460 *
460 *
461 * @param val is the value, 0 or 1, used to set the value of the RE bit.
461 * @param val is the value, 0 or 1, used to set the value of the RE bit.
462 * @param regAddr is the address of the GRSPW control register.
462 * @param regAddr is the address of the GRSPW control register.
463 *
463 *
464 * RE is the bit 16 of the GRSPW control register.
464 * RE is the bit 16 of the GRSPW control register.
465 *
465 *
466 */
466 */
467
467
468 unsigned int *spwptr = (unsigned int*) regAddr;
468 unsigned int *spwptr = (unsigned int*) regAddr;
469
469
470 if (val == 1)
470 if (val == 1)
471 {
471 {
472 *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit
472 *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit
473 }
473 }
474 if (val== 0)
474 if (val== 0)
475 {
475 {
476 *spwptr = *spwptr & 0xfffdffff;
476 *spwptr = *spwptr & 0xfffdffff;
477 }
477 }
478 }
478 }
479
479
480 void spacewire_compute_stats_offsets( void )
480 void spacewire_compute_stats_offsets( void )
481 {
481 {
482 /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising.
482 /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising.
483 *
483 *
484 * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics
484 * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics
485 * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it
485 * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it
486 * during the open systel call).
486 * during the open systel call).
487 *
487 *
488 */
488 */
489
489
490 spw_stats spacewire_stats_grspw;
490 spw_stats spacewire_stats_grspw;
491 rtems_status_code status;
491 rtems_status_code status;
492
492
493 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
493 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
494
494
495 spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received
495 spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received
496 + spacewire_stats.packets_received;
496 + spacewire_stats.packets_received;
497 spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent
497 spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent
498 + spacewire_stats.packets_sent;
498 + spacewire_stats.packets_sent;
499 spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err
499 spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err
500 + spacewire_stats.parity_err;
500 + spacewire_stats.parity_err;
501 spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err
501 spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err
502 + spacewire_stats.disconnect_err;
502 + spacewire_stats.disconnect_err;
503 spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err
503 spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err
504 + spacewire_stats.escape_err;
504 + spacewire_stats.escape_err;
505 spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err
505 spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err
506 + spacewire_stats.credit_err;
506 + spacewire_stats.credit_err;
507 spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err
507 spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err
508 + spacewire_stats.write_sync_err;
508 + spacewire_stats.write_sync_err;
509 spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err
509 spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err
510 + spacewire_stats.rx_rmap_header_crc_err;
510 + spacewire_stats.rx_rmap_header_crc_err;
511 spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err
511 spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err
512 + spacewire_stats.rx_rmap_data_crc_err;
512 + spacewire_stats.rx_rmap_data_crc_err;
513 spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep
513 spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep
514 + spacewire_stats.early_ep;
514 + spacewire_stats.early_ep;
515 spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address
515 spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address
516 + spacewire_stats.invalid_address;
516 + spacewire_stats.invalid_address;
517 spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err
517 spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err
518 + spacewire_stats.rx_eep_err;
518 + spacewire_stats.rx_eep_err;
519 spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated
519 spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated
520 + spacewire_stats.rx_truncated;
520 + spacewire_stats.rx_truncated;
521 }
521 }
522
522
523 void spacewire_update_statistics( void )
523 void spacewire_update_statistics( void )
524 {
524 {
525 rtems_status_code status;
525 rtems_status_code status;
526 spw_stats spacewire_stats_grspw;
526 spw_stats spacewire_stats_grspw;
527
527
528 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
528 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
529
529
530 spacewire_stats.packets_received = spacewire_stats_backup.packets_received
530 spacewire_stats.packets_received = spacewire_stats_backup.packets_received
531 + spacewire_stats_grspw.packets_received;
531 + spacewire_stats_grspw.packets_received;
532 spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent
532 spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent
533 + spacewire_stats_grspw.packets_sent;
533 + spacewire_stats_grspw.packets_sent;
534 spacewire_stats.parity_err = spacewire_stats_backup.parity_err
534 spacewire_stats.parity_err = spacewire_stats_backup.parity_err
535 + spacewire_stats_grspw.parity_err;
535 + spacewire_stats_grspw.parity_err;
536 spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err
536 spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err
537 + spacewire_stats_grspw.disconnect_err;
537 + spacewire_stats_grspw.disconnect_err;
538 spacewire_stats.escape_err = spacewire_stats_backup.escape_err
538 spacewire_stats.escape_err = spacewire_stats_backup.escape_err
539 + spacewire_stats_grspw.escape_err;
539 + spacewire_stats_grspw.escape_err;
540 spacewire_stats.credit_err = spacewire_stats_backup.credit_err
540 spacewire_stats.credit_err = spacewire_stats_backup.credit_err
541 + spacewire_stats_grspw.credit_err;
541 + spacewire_stats_grspw.credit_err;
542 spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err
542 spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err
543 + spacewire_stats_grspw.write_sync_err;
543 + spacewire_stats_grspw.write_sync_err;
544 spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err
544 spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err
545 + spacewire_stats_grspw.rx_rmap_header_crc_err;
545 + spacewire_stats_grspw.rx_rmap_header_crc_err;
546 spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err
546 spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err
547 + spacewire_stats_grspw.rx_rmap_data_crc_err;
547 + spacewire_stats_grspw.rx_rmap_data_crc_err;
548 spacewire_stats.early_ep = spacewire_stats_backup.early_ep
548 spacewire_stats.early_ep = spacewire_stats_backup.early_ep
549 + spacewire_stats_grspw.early_ep;
549 + spacewire_stats_grspw.early_ep;
550 spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address
550 spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address
551 + spacewire_stats_grspw.invalid_address;
551 + spacewire_stats_grspw.invalid_address;
552 spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err
552 spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err
553 + spacewire_stats_grspw.rx_eep_err;
553 + spacewire_stats_grspw.rx_eep_err;
554 spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated
554 spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated
555 + spacewire_stats_grspw.rx_truncated;
555 + spacewire_stats_grspw.rx_truncated;
556 //spacewire_stats.tx_link_err;
556 //spacewire_stats.tx_link_err;
557
557
558 //****************************
558 //****************************
559 // DPU_SPACEWIRE_IF_STATISTICS
559 // DPU_SPACEWIRE_IF_STATISTICS
560 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8);
560 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8);
561 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received);
561 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received);
562 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8);
562 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8);
563 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent);
563 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent);
564 //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt;
564 //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt;
565 //housekeeping_packet.hk_lfr_dpu_spw_last_timc;
565 //housekeeping_packet.hk_lfr_dpu_spw_last_timc;
566
566
567 //******************************************
567 //******************************************
568 // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY
568 // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY
569 housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err;
569 housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err;
570 housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err;
570 housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err;
571 housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err;
571 housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err;
572 housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err;
572 housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err;
573 housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err;
573 housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err;
574 // housekeeping_packet.hk_lfr_dpu_spw_rx_ahb;
574 // housekeeping_packet.hk_lfr_dpu_spw_rx_ahb;
575 // housekeeping_packet.hk_lfr_dpu_spw_tx_ahb;
575 // housekeeping_packet.hk_lfr_dpu_spw_tx_ahb;
576 housekeeping_packet.hk_lfr_dpu_spw_header_crc = (unsigned char) spacewire_stats.rx_rmap_header_crc_err;
576 housekeeping_packet.hk_lfr_dpu_spw_header_crc = (unsigned char) spacewire_stats.rx_rmap_header_crc_err;
577 housekeeping_packet.hk_lfr_dpu_spw_data_crc = (unsigned char) spacewire_stats.rx_rmap_data_crc_err;
577 housekeeping_packet.hk_lfr_dpu_spw_data_crc = (unsigned char) spacewire_stats.rx_rmap_data_crc_err;
578
578
579 //*********************************************
579 //*********************************************
580 // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY
580 // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY
581 housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep;
581 housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep;
582 housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address;
582 housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address;
583 housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err;
583 housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err;
584 housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated;
584 housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated;
585
585
586 }
586 }
587
587
588 void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc )
588 void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc )
589 {
589 {
590 //if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) {
590 //if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) {
591 // printf("In timecode_irq_handler *** Error sending event to DUMB\n");
591 // printf("In timecode_irq_handler *** Error sending event to DUMB\n");
592 //}
592 //}
593 }
593 }
594
594
595 rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data )
595 rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data )
596 {
596 {
597 int linkStatus;
597 int linkStatus;
598 rtems_status_code status;
598 rtems_status_code status;
599
599
600 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
600 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
601
601
602 if ( linkStatus == 5) {
602 if ( linkStatus == 5) {
603 PRINTF("in spacewire_reset_link *** link is running\n")
603 PRINTF("in spacewire_reset_link *** link is running\n")
604 status = RTEMS_SUCCESSFUL;
604 status = RTEMS_SUCCESSFUL;
605 }
605 }
606 }
606 }
607
608 rtems_status_code rtems_message_queue_send_lfr( rtems_id id, const void *buffer, size_t size )
609 {
610 rtems_status_code status;
611 rtems_mode previous_mode_set;
612
613 // set the preemption OFF
614 status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &previous_mode_set );
615
616 // use the message queue
617 status = rtems_message_queue_send_lfr( id, buffer, size );
618
619 // set the preemption ON
620 status = rtems_task_mode( RTEMS_PREEMPT , RTEMS_PREEMPT_MASK, &previous_mode_set );
621
622 return status;
623 }
624
@@ -1,862 +1,862
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 = rtems_message_queue_ident( misc_name[QUEUE_RECV], 0, &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 getting queue_rcv_id %d\n", status)
41 PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status)
42 }
42 }
43
43
44 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &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 getting queue_snd_id %d\n", status)
47 PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status)
48 }
48 }
49
49
50 result = LFR_SUCCESSFUL;
50 result = LFR_SUCCESSFUL;
51 subtype = 0; // subtype of the current TC packet
51 subtype = 0; // subtype of the current TC packet
52
52
53 BOOT_PRINTF("in ACTN *** \n")
53 BOOT_PRINTF("in ACTN *** \n")
54
54
55 while(1)
55 while(1)
56 {
56 {
57 status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
57 status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
58 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
58 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
59 getTime( time ); // set time to the current time
59 getTime( time ); // set time to the current time
60 if (status!=RTEMS_SUCCESSFUL)
60 if (status!=RTEMS_SUCCESSFUL)
61 {
61 {
62 PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
62 PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
63 }
63 }
64 else
64 else
65 {
65 {
66 subtype = TC.serviceSubType;
66 subtype = TC.serviceSubType;
67 switch(subtype)
67 switch(subtype)
68 {
68 {
69 case TC_SUBTYPE_RESET:
69 case TC_SUBTYPE_RESET:
70 result = action_reset( &TC, queue_snd_id, time );
70 result = action_reset( &TC, queue_snd_id, time );
71 close_action( &TC, result, queue_snd_id, time );
71 close_action( &TC, result, queue_snd_id, time );
72 break;
72 break;
73 //
73 //
74 case TC_SUBTYPE_LOAD_COMM:
74 case TC_SUBTYPE_LOAD_COMM:
75 result = action_load_common_par( &TC );
75 result = action_load_common_par( &TC );
76 close_action( &TC, result, queue_snd_id, time );
76 close_action( &TC, result, queue_snd_id, time );
77 break;
77 break;
78 //
78 //
79 case TC_SUBTYPE_LOAD_NORM:
79 case TC_SUBTYPE_LOAD_NORM:
80 result = action_load_normal_par( &TC, queue_snd_id, time );
80 result = action_load_normal_par( &TC, queue_snd_id, time );
81 close_action( &TC, result, queue_snd_id, time );
81 close_action( &TC, result, queue_snd_id, time );
82 break;
82 break;
83 //
83 //
84 case TC_SUBTYPE_LOAD_BURST:
84 case TC_SUBTYPE_LOAD_BURST:
85 result = action_load_burst_par( &TC, queue_snd_id, time );
85 result = action_load_burst_par( &TC, queue_snd_id, time );
86 close_action( &TC, result, queue_snd_id, time );
86 close_action( &TC, result, queue_snd_id, time );
87 break;
87 break;
88 //
88 //
89 case TC_SUBTYPE_LOAD_SBM1:
89 case TC_SUBTYPE_LOAD_SBM1:
90 result = action_load_sbm1_par( &TC, queue_snd_id, time );
90 result = action_load_sbm1_par( &TC, queue_snd_id, time );
91 close_action( &TC, result, queue_snd_id, time );
91 close_action( &TC, result, queue_snd_id, time );
92 break;
92 break;
93 //
93 //
94 case TC_SUBTYPE_LOAD_SBM2:
94 case TC_SUBTYPE_LOAD_SBM2:
95 result = action_load_sbm2_par( &TC, queue_snd_id, time );
95 result = action_load_sbm2_par( &TC, queue_snd_id, time );
96 close_action( &TC, result, queue_snd_id, time );
96 close_action( &TC, result, queue_snd_id, time );
97 break;
97 break;
98 //
98 //
99 case TC_SUBTYPE_DUMP:
99 case TC_SUBTYPE_DUMP:
100 result = action_dump_par( queue_snd_id );
100 result = action_dump_par( queue_snd_id );
101 close_action( &TC, result, queue_snd_id, time );
101 close_action( &TC, result, queue_snd_id, time );
102 break;
102 break;
103 //
103 //
104 case TC_SUBTYPE_ENTER:
104 case TC_SUBTYPE_ENTER:
105 result = action_enter_mode( &TC, queue_snd_id, time );
105 result = action_enter_mode( &TC, queue_snd_id, time );
106 close_action( &TC, result, queue_snd_id, time );
106 close_action( &TC, result, queue_snd_id, time );
107 break;
107 break;
108 //
108 //
109 case TC_SUBTYPE_UPDT_INFO:
109 case TC_SUBTYPE_UPDT_INFO:
110 result = action_update_info( &TC, queue_snd_id );
110 result = action_update_info( &TC, queue_snd_id );
111 close_action( &TC, result, queue_snd_id, time );
111 close_action( &TC, result, queue_snd_id, time );
112 break;
112 break;
113 //
113 //
114 case TC_SUBTYPE_EN_CAL:
114 case TC_SUBTYPE_EN_CAL:
115 result = action_enable_calibration( &TC, queue_snd_id, time );
115 result = action_enable_calibration( &TC, queue_snd_id, time );
116 close_action( &TC, result, queue_snd_id, time );
116 close_action( &TC, result, queue_snd_id, time );
117 break;
117 break;
118 //
118 //
119 case TC_SUBTYPE_DIS_CAL:
119 case TC_SUBTYPE_DIS_CAL:
120 result = action_disable_calibration( &TC, queue_snd_id, time );
120 result = action_disable_calibration( &TC, queue_snd_id, time );
121 close_action( &TC, result, queue_snd_id, time );
121 close_action( &TC, result, queue_snd_id, time );
122 break;
122 break;
123 //
123 //
124 case TC_SUBTYPE_UPDT_TIME:
124 case TC_SUBTYPE_UPDT_TIME:
125 result = action_update_time( &TC );
125 result = action_update_time( &TC );
126 close_action( &TC, result, queue_snd_id, time );
126 close_action( &TC, result, queue_snd_id, time );
127 break;
127 break;
128 //
128 //
129 default:
129 default:
130 break;
130 break;
131 }
131 }
132 }
132 }
133 }
133 }
134 }
134 }
135
135
136 //***********
136 //***********
137 // TC ACTIONS
137 // TC ACTIONS
138
138
139 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
139 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
140 {
140 {
141 /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
141 /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
142 *
142 *
143 * @param TC points to the TeleCommand packet that is being processed
143 * @param TC points to the TeleCommand packet that is being processed
144 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
144 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
145 *
145 *
146 */
146 */
147
147
148 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
148 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
149 return LFR_DEFAULT;
149 return LFR_DEFAULT;
150 }
150 }
151
151
152 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
152 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
153 {
153 {
154 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
154 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
155 *
155 *
156 * @param TC points to the TeleCommand packet that is being processed
156 * @param TC points to the TeleCommand packet that is being processed
157 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
157 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
158 *
158 *
159 */
159 */
160
160
161 rtems_status_code status;
161 rtems_status_code status;
162 unsigned char requestedMode;
162 unsigned char requestedMode;
163
163
164 requestedMode = TC->dataAndCRC[1];
164 requestedMode = TC->dataAndCRC[1];
165
165
166 if ( (requestedMode != LFR_MODE_STANDBY)
166 if ( (requestedMode != LFR_MODE_STANDBY)
167 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
167 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
168 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
168 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
169 {
169 {
170 status = RTEMS_UNSATISFIED;
170 status = RTEMS_UNSATISFIED;
171 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode, time );
171 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode, time );
172 }
172 }
173 else
173 else
174 {
174 {
175 printf("try to enter mode %d\n", requestedMode);
175 printf("try to enter mode %d\n", requestedMode);
176
176
177 #ifdef PRINT_TASK_STATISTICS
177 #ifdef PRINT_TASK_STATISTICS
178 if (requestedMode != LFR_MODE_STANDBY)
178 if (requestedMode != LFR_MODE_STANDBY)
179 {
179 {
180 rtems_cpu_usage_reset();
180 rtems_cpu_usage_reset();
181 maxCount = 0;
181 maxCount = 0;
182 }
182 }
183 #endif
183 #endif
184
184
185 status = transition_validation(requestedMode);
185 status = transition_validation(requestedMode);
186
186
187 if ( status == LFR_SUCCESSFUL ) {
187 if ( status == LFR_SUCCESSFUL ) {
188 if ( lfrCurrentMode != LFR_MODE_STANDBY)
188 if ( lfrCurrentMode != LFR_MODE_STANDBY)
189 {
189 {
190 status = stop_current_mode();
190 status = stop_current_mode();
191 }
191 }
192 if (status != RTEMS_SUCCESSFUL)
192 if (status != RTEMS_SUCCESSFUL)
193 {
193 {
194 PRINTF("ERR *** in action_enter *** stop_current_mode\n")
194 PRINTF("ERR *** in action_enter *** stop_current_mode\n")
195 }
195 }
196 status = enter_mode( requestedMode );
196 status = enter_mode( requestedMode );
197 }
197 }
198 else
198 else
199 {
199 {
200 PRINTF("ERR *** in action_enter *** transition rejected\n")
200 PRINTF("ERR *** in action_enter *** transition rejected\n")
201 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
201 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
202 }
202 }
203 }
203 }
204
204
205 return status;
205 return status;
206 }
206 }
207
207
208 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
208 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
209 {
209 {
210 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
210 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
211 *
211 *
212 * @param TC points to the TeleCommand packet that is being processed
212 * @param TC points to the TeleCommand packet that is being processed
213 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
213 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
214 *
214 *
215 * @return LFR directive status code:
215 * @return LFR directive status code:
216 * - LFR_DEFAULT
216 * - LFR_DEFAULT
217 * - LFR_SUCCESSFUL
217 * - LFR_SUCCESSFUL
218 *
218 *
219 */
219 */
220
220
221 unsigned int val;
221 unsigned int val;
222 int result;
222 int result;
223
223
224 result = LFR_SUCCESSFUL;
224 result = LFR_SUCCESSFUL;
225
225
226 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
226 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
227 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
227 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
228 val++;
228 val++;
229 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
229 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
230 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
230 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
231
231
232 return result;
232 return result;
233 }
233 }
234
234
235 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
235 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
236 {
236 {
237 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
237 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
238 *
238 *
239 * @param TC points to the TeleCommand packet that is being processed
239 * @param TC points to the TeleCommand packet that is being processed
240 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
240 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
241 *
241 *
242 */
242 */
243
243
244 int result;
244 int result;
245 unsigned char lfrMode;
245 unsigned char lfrMode;
246
246
247 result = LFR_DEFAULT;
247 result = LFR_DEFAULT;
248 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
248 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
249
249
250 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
250 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
251 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
251 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
252 result = LFR_DEFAULT;
252 result = LFR_DEFAULT;
253 }
253 }
254 else {
254 else {
255 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
255 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
256 result = LFR_DEFAULT;
256 result = LFR_DEFAULT;
257 }
257 }
258 return result;
258 return result;
259 }
259 }
260
260
261 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
261 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
262 {
262 {
263 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
263 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
264 *
264 *
265 * @param TC points to the TeleCommand packet that is being processed
265 * @param TC points to the TeleCommand packet that is being processed
266 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
266 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
267 *
267 *
268 */
268 */
269
269
270 int result;
270 int result;
271 unsigned char lfrMode;
271 unsigned char lfrMode;
272
272
273 result = LFR_DEFAULT;
273 result = LFR_DEFAULT;
274 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
274 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
275
275
276 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
276 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
277 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
277 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
278 result = LFR_DEFAULT;
278 result = LFR_DEFAULT;
279 }
279 }
280 else {
280 else {
281 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
281 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
282 result = LFR_DEFAULT;
282 result = LFR_DEFAULT;
283 }
283 }
284 return result;
284 return result;
285 }
285 }
286
286
287 int action_update_time(ccsdsTelecommandPacket_t *TC)
287 int action_update_time(ccsdsTelecommandPacket_t *TC)
288 {
288 {
289 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
289 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
290 *
290 *
291 * @param TC points to the TeleCommand packet that is being processed
291 * @param TC points to the TeleCommand packet that is being processed
292 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
292 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
293 *
293 *
294 * @return LFR_SUCCESSFUL
294 * @return LFR_SUCCESSFUL
295 *
295 *
296 */
296 */
297
297
298 unsigned int val;
298 unsigned int val;
299
299
300 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
300 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
301 + (TC->dataAndCRC[1] << 16)
301 + (TC->dataAndCRC[1] << 16)
302 + (TC->dataAndCRC[2] << 8)
302 + (TC->dataAndCRC[2] << 8)
303 + TC->dataAndCRC[3];
303 + TC->dataAndCRC[3];
304 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
304 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
305 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
305 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
306 val++;
306 val++;
307 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
307 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
308 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
308 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
309 time_management_regs->ctrl = time_management_regs->ctrl | 1;
309 time_management_regs->ctrl = time_management_regs->ctrl | 1;
310
310
311 return LFR_SUCCESSFUL;
311 return LFR_SUCCESSFUL;
312 }
312 }
313
313
314 //*******************
314 //*******************
315 // ENTERING THE MODES
315 // ENTERING THE MODES
316
316
317 int transition_validation(unsigned char requestedMode)
317 int transition_validation(unsigned char requestedMode)
318 {
318 {
319 /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
319 /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
320 *
320 *
321 * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
321 * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
322 *
322 *
323 * @return LFR directive status codes:
323 * @return LFR directive status codes:
324 * - LFR_SUCCESSFUL - the transition is authorized
324 * - LFR_SUCCESSFUL - the transition is authorized
325 * - LFR_DEFAULT - the transition is not authorized
325 * - LFR_DEFAULT - the transition is not authorized
326 *
326 *
327 */
327 */
328
328
329 int status;
329 int status;
330
330
331 switch (requestedMode)
331 switch (requestedMode)
332 {
332 {
333 case LFR_MODE_STANDBY:
333 case LFR_MODE_STANDBY:
334 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
334 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
335 status = LFR_DEFAULT;
335 status = LFR_DEFAULT;
336 }
336 }
337 else
337 else
338 {
338 {
339 status = LFR_SUCCESSFUL;
339 status = LFR_SUCCESSFUL;
340 }
340 }
341 break;
341 break;
342 case LFR_MODE_NORMAL:
342 case LFR_MODE_NORMAL:
343 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
343 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
344 status = LFR_DEFAULT;
344 status = LFR_DEFAULT;
345 }
345 }
346 else {
346 else {
347 status = LFR_SUCCESSFUL;
347 status = LFR_SUCCESSFUL;
348 }
348 }
349 break;
349 break;
350 case LFR_MODE_BURST:
350 case LFR_MODE_BURST:
351 if ( lfrCurrentMode == LFR_MODE_BURST ) {
351 if ( lfrCurrentMode == LFR_MODE_BURST ) {
352 status = LFR_DEFAULT;
352 status = LFR_DEFAULT;
353 }
353 }
354 else {
354 else {
355 status = LFR_SUCCESSFUL;
355 status = LFR_SUCCESSFUL;
356 }
356 }
357 break;
357 break;
358 case LFR_MODE_SBM1:
358 case LFR_MODE_SBM1:
359 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
359 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
360 status = LFR_DEFAULT;
360 status = LFR_DEFAULT;
361 }
361 }
362 else {
362 else {
363 status = LFR_SUCCESSFUL;
363 status = LFR_SUCCESSFUL;
364 }
364 }
365 break;
365 break;
366 case LFR_MODE_SBM2:
366 case LFR_MODE_SBM2:
367 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
367 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
368 status = LFR_DEFAULT;
368 status = LFR_DEFAULT;
369 }
369 }
370 else {
370 else {
371 status = LFR_SUCCESSFUL;
371 status = LFR_SUCCESSFUL;
372 }
372 }
373 break;
373 break;
374 default:
374 default:
375 status = LFR_DEFAULT;
375 status = LFR_DEFAULT;
376 break;
376 break;
377 }
377 }
378
378
379 return status;
379 return status;
380 }
380 }
381
381
382 int stop_current_mode()
382 int stop_current_mode()
383 {
383 {
384 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
384 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
385 *
385 *
386 * @return RTEMS directive status codes:
386 * @return RTEMS directive status codes:
387 * - RTEMS_SUCCESSFUL - task restarted successfully
387 * - RTEMS_SUCCESSFUL - task restarted successfully
388 * - RTEMS_INVALID_ID - task id invalid
388 * - RTEMS_INVALID_ID - task id invalid
389 * - RTEMS_ALREADY_SUSPENDED - task already suspended
389 * - RTEMS_ALREADY_SUSPENDED - task already suspended
390 *
390 *
391 */
391 */
392
392
393 rtems_status_code status;
393 rtems_status_code status;
394
394
395 status = RTEMS_SUCCESSFUL;
395 status = RTEMS_SUCCESSFUL;
396
396
397 #ifdef GSA
397 #ifdef GSA
398 LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP)
398 LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP)
399 LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP)
399 LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP)
400 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR );
400 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR );
401 #else
401 #else
402 // mask interruptions
402 // mask interruptions
403 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
403 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
404 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt
404 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt
405 // reset registers
405 // reset registers
406 reset_wfp_burst_enable(); // reset burst and enable bits
406 reset_wfp_burst_enable(); // reset burst and enable bits
407 reset_wfp_status(); // reset all the status bits
407 reset_wfp_status(); // reset all the status bits
408 // creal interruptions
408 // creal interruptions
409 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
409 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
410 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectarl matrix interrupt
410 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectarl matrix interrupt
411 #endif
411 #endif
412 //**********************
412 //**********************
413 // suspend several tasks
413 // suspend several tasks
414 if (lfrCurrentMode != LFR_MODE_STANDBY) {
414 if (lfrCurrentMode != LFR_MODE_STANDBY) {
415 status = suspend_science_tasks();
415 status = suspend_science_tasks();
416 }
416 }
417
417
418 if (status != RTEMS_SUCCESSFUL)
418 if (status != RTEMS_SUCCESSFUL)
419 {
419 {
420 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
420 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
421 }
421 }
422
422
423 return status;
423 return status;
424 }
424 }
425
425
426 int enter_mode(unsigned char mode )
426 int enter_mode(unsigned char mode )
427 {
427 {
428 /** This function is launched after a mode transition validation.
428 /** This function is launched after a mode transition validation.
429 *
429 *
430 * @param mode is the mode in which LFR will be put.
430 * @param mode is the mode in which LFR will be put.
431 *
431 *
432 * @return RTEMS directive status codes:
432 * @return RTEMS directive status codes:
433 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
433 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
434 * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully
434 * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully
435 *
435 *
436 */
436 */
437
437
438 rtems_status_code status;
438 rtems_status_code status;
439
439
440 status = RTEMS_UNSATISFIED;
440 status = RTEMS_UNSATISFIED;
441
441
442 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d);
442 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d);
443 updateLFRCurrentMode();
443 updateLFRCurrentMode();
444
444
445 switch(mode){
445 switch(mode){
446 case LFR_MODE_STANDBY:
446 case LFR_MODE_STANDBY:
447 status = enter_standby_mode( );
447 status = enter_standby_mode( );
448 break;
448 break;
449 case LFR_MODE_NORMAL:
449 case LFR_MODE_NORMAL:
450 status = enter_normal_mode( );
450 status = enter_normal_mode( );
451 break;
451 break;
452 case LFR_MODE_BURST:
452 case LFR_MODE_BURST:
453 status = enter_burst_mode( );
453 status = enter_burst_mode( );
454 break;
454 break;
455 case LFR_MODE_SBM1:
455 case LFR_MODE_SBM1:
456 status = enter_sbm1_mode( );
456 status = enter_sbm1_mode( );
457 break;
457 break;
458 case LFR_MODE_SBM2:
458 case LFR_MODE_SBM2:
459 status = enter_sbm2_mode( );
459 status = enter_sbm2_mode( );
460 break;
460 break;
461 default:
461 default:
462 status = RTEMS_UNSATISFIED;
462 status = RTEMS_UNSATISFIED;
463 }
463 }
464
464
465 if (status != RTEMS_SUCCESSFUL)
465 if (status != RTEMS_SUCCESSFUL)
466 {
466 {
467 PRINTF("in enter_mode *** ERR\n")
467 PRINTF("in enter_mode *** ERR\n")
468 status = RTEMS_UNSATISFIED;
468 status = RTEMS_UNSATISFIED;
469 }
469 }
470
470
471 return status;
471 return status;
472 }
472 }
473
473
474 int enter_standby_mode()
474 int enter_standby_mode()
475 {
475 {
476 /** This function is used to enter the STANDBY mode.
476 /** This function is used to enter the STANDBY mode.
477 *
477 *
478 * @return RTEMS directive status codes:
478 * @return RTEMS directive status codes:
479 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
479 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
480 *
480 *
481 */
481 */
482
482
483 PRINTF1("maxCount = %d\n", maxCount)
483 PRINTF1("maxCount = %d\n", maxCount)
484
484
485 #ifdef PRINT_TASK_STATISTICS
485 #ifdef PRINT_TASK_STATISTICS
486 rtems_cpu_usage_report();
486 rtems_cpu_usage_report();
487 #endif
487 #endif
488
488
489 #ifdef PRINT_STACK_REPORT
489 #ifdef PRINT_STACK_REPORT
490 rtems_stack_checker_report_usage();
490 rtems_stack_checker_report_usage();
491 #endif
491 #endif
492
492
493 return LFR_SUCCESSFUL;
493 return LFR_SUCCESSFUL;
494 }
494 }
495
495
496 int enter_normal_mode()
496 int enter_normal_mode()
497 {
497 {
498 rtems_status_code status;
498 rtems_status_code status;
499
499
500 status = restart_science_tasks();
500 status = restart_science_tasks();
501
501
502 #ifdef GSA
502 #ifdef GSA
503 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR );
503 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR );
504 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
504 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
505 LEON_Clear_interrupt( IRQ_WF );
505 LEON_Clear_interrupt( IRQ_WF );
506 LEON_Unmask_interrupt( IRQ_WF );
506 LEON_Unmask_interrupt( IRQ_WF );
507 //
507 //
508 set_local_nb_interrupt_f0_MAX();
508 set_local_nb_interrupt_f0_MAX();
509 LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board
509 LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board
510 LEON_Unmask_interrupt( IRQ_SM );
510 LEON_Unmask_interrupt( IRQ_SM );
511 #else
511 #else
512 //****************
512 //****************
513 // waveform picker
513 // waveform picker
514 reset_waveform_picker_regs();
514 reset_waveform_picker_regs();
515 set_wfp_burst_enable_register(LFR_MODE_NORMAL);
515 set_wfp_burst_enable_register(LFR_MODE_NORMAL);
516 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
516 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
517 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
517 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
518 //****************
518 //****************
519 // spectral matrix
519 // spectral matrix
520 #endif
520 #endif
521
521
522 return status;
522 return status;
523 }
523 }
524
524
525 int enter_burst_mode()
525 int enter_burst_mode()
526 {
526 {
527 /** This function is used to enter the STANDBY mode.
527 /** This function is used to enter the STANDBY mode.
528 *
528 *
529 * @return RTEMS directive status codes:
529 * @return RTEMS directive status codes:
530 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
530 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
531 * - RTEMS_INVALID_ID - task id invalid
531 * - RTEMS_INVALID_ID - task id invalid
532 * - RTEMS_INCORRECT_STATE - task never started
532 * - RTEMS_INCORRECT_STATE - task never started
533 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
533 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
534 *
534 *
535 */
535 */
536
536
537 rtems_status_code status;
537 rtems_status_code status;
538
538
539 status = restart_science_tasks();
539 status = restart_science_tasks();
540
540
541 #ifdef GSA
541 #ifdef GSA
542 LEON_Unmask_interrupt( IRQ_SM );
542 LEON_Unmask_interrupt( IRQ_SM );
543 #else
543 #else
544 reset_waveform_picker_regs();
544 reset_waveform_picker_regs();
545 set_wfp_burst_enable_register(LFR_MODE_BURST);
545 set_wfp_burst_enable_register(LFR_MODE_BURST);
546 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
546 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
547 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
547 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
548 #endif
548 #endif
549
549
550 return status;
550 return status;
551 }
551 }
552
552
553 int enter_sbm1_mode()
553 int enter_sbm1_mode()
554 {
554 {
555 /** This function is used to enter the SBM1 mode.
555 /** This function is used to enter the SBM1 mode.
556 *
556 *
557 * @return RTEMS directive status codes:
557 * @return RTEMS directive status codes:
558 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
558 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
559 * - RTEMS_INVALID_ID - task id invalid
559 * - RTEMS_INVALID_ID - task id invalid
560 * - RTEMS_INCORRECT_STATE - task never started
560 * - RTEMS_INCORRECT_STATE - task never started
561 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
561 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
562 *
562 *
563 */
563 */
564
564
565 rtems_status_code status;
565 rtems_status_code status;
566
566
567 status = restart_science_tasks();
567 status = restart_science_tasks();
568
568
569 set_local_sbm1_nb_cwf_max();
569 set_local_sbm1_nb_cwf_max();
570
570
571 reset_local_sbm1_nb_cwf_sent();
571 reset_local_sbm1_nb_cwf_sent();
572
572
573 #ifdef GSA
573 #ifdef GSA
574 LEON_Unmask_interrupt( IRQ_SM );
574 LEON_Unmask_interrupt( IRQ_SM );
575 #else
575 #else
576 reset_waveform_picker_regs();
576 reset_waveform_picker_regs();
577 set_wfp_burst_enable_register(LFR_MODE_SBM1);
577 set_wfp_burst_enable_register(LFR_MODE_SBM1);
578 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
578 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
579 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
579 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
580 #endif
580 #endif
581
581
582 return status;
582 return status;
583 }
583 }
584
584
585 int enter_sbm2_mode()
585 int enter_sbm2_mode()
586 {
586 {
587 /** This function is used to enter the SBM2 mode.
587 /** This function is used to enter the SBM2 mode.
588 *
588 *
589 * @return RTEMS directive status codes:
589 * @return RTEMS directive status codes:
590 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
590 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
591 * - RTEMS_INVALID_ID - task id invalid
591 * - RTEMS_INVALID_ID - task id invalid
592 * - RTEMS_INCORRECT_STATE - task never started
592 * - RTEMS_INCORRECT_STATE - task never started
593 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
593 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
594 *
594 *
595 */
595 */
596
596
597 rtems_status_code status;
597 rtems_status_code status;
598
598
599 status = restart_science_tasks();
599 status = restart_science_tasks();
600
600
601 set_local_sbm2_nb_cwf_max();
601 set_local_sbm2_nb_cwf_max();
602
602
603 reset_local_sbm2_nb_cwf_sent();
603 reset_local_sbm2_nb_cwf_sent();
604
604
605 #ifdef GSA
605 #ifdef GSA
606 LEON_Unmask_interrupt( IRQ_SM );
606 LEON_Unmask_interrupt( IRQ_SM );
607 #else
607 #else
608 reset_waveform_picker_regs();
608 reset_waveform_picker_regs();
609 set_wfp_burst_enable_register(LFR_MODE_SBM2);
609 set_wfp_burst_enable_register(LFR_MODE_SBM2);
610 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
610 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
611 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
611 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
612 #endif
612 #endif
613
613
614 return status;
614 return status;
615 }
615 }
616
616
617 int restart_science_tasks()
617 int restart_science_tasks()
618 {
618 {
619 /** This function is used to restart all science tasks.
619 /** This function is used to restart all science tasks.
620 *
620 *
621 * @return RTEMS directive status codes:
621 * @return RTEMS directive status codes:
622 * - RTEMS_SUCCESSFUL - task restarted successfully
622 * - RTEMS_SUCCESSFUL - task restarted successfully
623 * - RTEMS_INVALID_ID - task id invalid
623 * - RTEMS_INVALID_ID - task id invalid
624 * - RTEMS_INCORRECT_STATE - task never started
624 * - RTEMS_INCORRECT_STATE - task never started
625 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
625 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
626 *
626 *
627 * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1
627 * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1
628 *
628 *
629 */
629 */
630
630
631 rtems_status_code status[6];
631 rtems_status_code status[6];
632 rtems_status_code ret;
632 rtems_status_code ret;
633
633
634 ret = RTEMS_SUCCESSFUL;
634 ret = RTEMS_SUCCESSFUL;
635
635
636 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 );
636 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 );
637 if (status[0] != RTEMS_SUCCESSFUL)
637 if (status[0] != RTEMS_SUCCESSFUL)
638 {
638 {
639 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
639 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
640 }
640 }
641
641
642 status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 );
642 status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 );
643 if (status[1] != RTEMS_SUCCESSFUL)
643 if (status[1] != RTEMS_SUCCESSFUL)
644 {
644 {
645 PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1])
645 PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1])
646 }
646 }
647
647
648 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
648 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
649 if (status[2] != RTEMS_SUCCESSFUL)
649 if (status[2] != RTEMS_SUCCESSFUL)
650 {
650 {
651 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
651 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
652 }
652 }
653
653
654 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
654 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
655 if (status[3] != RTEMS_SUCCESSFUL)
655 if (status[3] != RTEMS_SUCCESSFUL)
656 {
656 {
657 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
657 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
658 }
658 }
659
659
660 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
660 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
661 if (status[4] != RTEMS_SUCCESSFUL)
661 if (status[4] != RTEMS_SUCCESSFUL)
662 {
662 {
663 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
663 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
664 }
664 }
665
665
666 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
666 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
667 if (status[5] != RTEMS_SUCCESSFUL)
667 if (status[5] != RTEMS_SUCCESSFUL)
668 {
668 {
669 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
669 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
670 }
670 }
671
671
672 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
672 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
673 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
673 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
674 {
674 {
675 ret = RTEMS_UNSATISFIED;
675 ret = RTEMS_UNSATISFIED;
676 }
676 }
677
677
678 return ret;
678 return ret;
679 }
679 }
680
680
681 int suspend_science_tasks()
681 int suspend_science_tasks()
682 {
682 {
683 /** This function suspends the science tasks.
683 /** This function suspends the science tasks.
684 *
684 *
685 * @return RTEMS directive status codes:
685 * @return RTEMS directive status codes:
686 * - RTEMS_SUCCESSFUL - task restarted successfully
686 * - RTEMS_SUCCESSFUL - task restarted successfully
687 * - RTEMS_INVALID_ID - task id invalid
687 * - RTEMS_INVALID_ID - task id invalid
688 * - RTEMS_ALREADY_SUSPENDED - task already suspended
688 * - RTEMS_ALREADY_SUSPENDED - task already suspended
689 *
689 *
690 */
690 */
691
691
692 rtems_status_code status;
692 rtems_status_code status;
693
693
694 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
694 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
695 if (status != RTEMS_SUCCESSFUL)
695 if (status != RTEMS_SUCCESSFUL)
696 {
696 {
697 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
697 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
698 }
698 }
699
699
700 if (status == RTEMS_SUCCESSFUL) // suspend BPF0
700 if (status == RTEMS_SUCCESSFUL) // suspend BPF0
701 {
701 {
702 status = rtems_task_suspend( Task_id[TASKID_BPF0] );
702 status = rtems_task_suspend( Task_id[TASKID_BPF0] );
703 if (status != RTEMS_SUCCESSFUL)
703 if (status != RTEMS_SUCCESSFUL)
704 {
704 {
705 PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status)
705 PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status)
706 }
706 }
707 }
707 }
708
708
709 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
709 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
710 {
710 {
711 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
711 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
712 if (status != RTEMS_SUCCESSFUL)
712 if (status != RTEMS_SUCCESSFUL)
713 {
713 {
714 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
714 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
715 }
715 }
716 }
716 }
717
717
718 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
718 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
719 {
719 {
720 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
720 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
721 if (status != RTEMS_SUCCESSFUL)
721 if (status != RTEMS_SUCCESSFUL)
722 {
722 {
723 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
723 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
724 }
724 }
725 }
725 }
726
726
727 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
727 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
728 {
728 {
729 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
729 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
730 if (status != RTEMS_SUCCESSFUL)
730 if (status != RTEMS_SUCCESSFUL)
731 {
731 {
732 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
732 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
733 }
733 }
734 }
734 }
735
735
736 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
736 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
737 {
737 {
738 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
738 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
739 if (status != RTEMS_SUCCESSFUL)
739 if (status != RTEMS_SUCCESSFUL)
740 {
740 {
741 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
741 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
742 }
742 }
743 }
743 }
744
744
745 return status;
745 return status;
746 }
746 }
747
747
748 //****************
748 //****************
749 // CLOSING ACTIONS
749 // CLOSING ACTIONS
750 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time)
750 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time)
751 {
751 {
752 /** This function is used to update the HK packets statistics after a successful TC execution.
752 /** This function is used to update the HK packets statistics after a successful TC execution.
753 *
753 *
754 * @param TC points to the TC being processed
754 * @param TC points to the TC being processed
755 * @param time is the time used to date the TC execution
755 * @param time is the time used to date the TC execution
756 *
756 *
757 */
757 */
758
758
759 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
759 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
760 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
760 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
761 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
761 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
762 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
762 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
763 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
763 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
764 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
764 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
765 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
765 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
766 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
766 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
767 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
767 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
768 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
768 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
769 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
769 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
770 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
770 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
771 }
771 }
772
772
773 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time)
773 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time)
774 {
774 {
775 /** This function is used to update the HK packets statistics after a TC rejection.
775 /** This function is used to update the HK packets statistics after a TC rejection.
776 *
776 *
777 * @param TC points to the TC being processed
777 * @param TC points to the TC being processed
778 * @param time is the time used to date the TC rejection
778 * @param time is the time used to date the TC rejection
779 *
779 *
780 */
780 */
781
781
782 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
782 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
783 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
783 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
784 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
784 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
785 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
785 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
786 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
786 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
787 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
787 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
788 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
788 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
789 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
789 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
790 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
790 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
791 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
791 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
792 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
792 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
793 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
793 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
794 }
794 }
795
795
796 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time)
796 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time)
797 {
797 {
798 /** This function is the last step of the TC execution workflow.
798 /** This function is the last step of the TC execution workflow.
799 *
799 *
800 * @param TC points to the TC being processed
800 * @param TC points to the TC being processed
801 * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
801 * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
802 * @param queue_id is the id of the RTEMS message queue used to send TM packets
802 * @param queue_id is the id of the RTEMS message queue used to send TM packets
803 * @param time is the time used to date the TC execution
803 * @param time is the time used to date the TC execution
804 *
804 *
805 */
805 */
806
806
807 unsigned int val = 0;
807 unsigned int val = 0;
808
808
809 if (result == LFR_SUCCESSFUL)
809 if (result == LFR_SUCCESSFUL)
810 {
810 {
811 if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
811 if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
812 &&
812 &&
813 !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
813 !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
814 )
814 )
815 {
815 {
816 send_tm_lfr_tc_exe_success( TC, queue_id, time );
816 send_tm_lfr_tc_exe_success( TC, queue_id, time );
817 }
817 }
818 update_last_TC_exe( TC, time );
818 update_last_TC_exe( TC, time );
819 val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1];
819 val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1];
820 val++;
820 val++;
821 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
821 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
822 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val);
822 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val);
823 }
823 }
824 else
824 else
825 {
825 {
826 update_last_TC_rej( TC, time );
826 update_last_TC_rej( TC, time );
827 val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1];
827 val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1];
828 val++;
828 val++;
829 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
829 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
830 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val);
830 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val);
831 }
831 }
832 }
832 }
833
833
834 //***************************
834 //***************************
835 // Interrupt Service Routines
835 // Interrupt Service Routines
836 rtems_isr commutation_isr1( rtems_vector_number vector )
836 rtems_isr commutation_isr1( rtems_vector_number vector )
837 {
837 {
838 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
838 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
839 printf("In commutation_isr1 *** Error sending event to DUMB\n");
839 printf("In commutation_isr1 *** Error sending event to DUMB\n");
840 }
840 }
841 }
841 }
842
842
843 rtems_isr commutation_isr2( rtems_vector_number vector )
843 rtems_isr commutation_isr2( rtems_vector_number vector )
844 {
844 {
845 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
845 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
846 printf("In commutation_isr2 *** Error sending event to DUMB\n");
846 printf("In commutation_isr2 *** Error sending event to DUMB\n");
847 }
847 }
848 }
848 }
849
849
850 //****************
850 //****************
851 // OTHER FUNCTIONS
851 // OTHER FUNCTIONS
852 void updateLFRCurrentMode()
852 void updateLFRCurrentMode()
853 {
853 {
854 /** This function updates the value of the global variable lfrCurrentMode.
854 /** This function updates the value of the global variable lfrCurrentMode.
855 *
855 *
856 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
856 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
857 *
857 *
858 */
858 */
859 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
859 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
860 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
860 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
861 }
861 }
862
862
@@ -1,1219 +1,1223
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 // SWF
12 // SWF
13 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7];
13 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7];
14 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
14 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
15 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
15 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
16 // CWF
16 // CWF
17 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7];
17 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7];
18 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7];
18 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7];
19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7];
19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7];
20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7];
20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7];
21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[7];
21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[7];
22
22
23 unsigned char doubleSendCWF1 = 0;
23 unsigned char doubleSendCWF1 = 0;
24 unsigned char doubleSendCWF2 = 0;
24 unsigned char doubleSendCWF2 = 0;
25
25
26 rtems_isr waveforms_isr( rtems_vector_number vector )
26 rtems_isr waveforms_isr( rtems_vector_number vector )
27 {
27 {
28 /** This is the interrupt sub routine called by the waveform picker core.
28 /** This is the interrupt sub routine called by the waveform picker core.
29 *
29 *
30 * This ISR launch different actions depending mainly on two pieces of information:
30 * This ISR launch different actions depending mainly on two pieces of information:
31 * 1. the values read in the registers of the waveform picker.
31 * 1. the values read in the registers of the waveform picker.
32 * 2. the current LFR mode.
32 * 2. the current LFR mode.
33 *
33 *
34 */
34 */
35
35
36 #ifdef GSA
36 #ifdef GSA
37 #else
37 #else
38 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
38 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
39 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
39 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
40 { // in modes other than STANDBY and BURST, send the CWF_F3 data
40 { // in modes other than STANDBY and BURST, send the CWF_F3 data
41 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
41 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
42 // (1) change the receiving buffer for the waveform picker
42 // (1) change the receiving buffer for the waveform picker
43 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) {
43 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) {
44 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_bis);
44 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_bis);
45 }
45 }
46 else {
46 else {
47 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3);
47 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3);
48 }
48 }
49 // (2) send an event for the waveforms transmission
49 // (2) send an event for the waveforms transmission
50 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
50 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
51 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
51 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
52 }
52 }
53 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
53 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
54 }
54 }
55 }
55 }
56 #endif
56 #endif
57
57
58 switch(lfrCurrentMode)
58 switch(lfrCurrentMode)
59 {
59 {
60 //********
60 //********
61 // STANDBY
61 // STANDBY
62 case(LFR_MODE_STANDBY):
62 case(LFR_MODE_STANDBY):
63 break;
63 break;
64
64
65 //******
65 //******
66 // NORMAL
66 // NORMAL
67 case(LFR_MODE_NORMAL):
67 case(LFR_MODE_NORMAL):
68 #ifdef GSA
68 #ifdef GSA
69 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
69 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
70 #else
70 #else
71 if ( (waveform_picker_regs->burst_enable & 0x7) == 0x0 ){ // if no channel is enable
71 if ( (waveform_picker_regs->burst_enable & 0x7) == 0x0 ){ // if no channel is enable
72 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
72 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
73 }
73 }
74 else {
74 else {
75 if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full
75 if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full
76 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable & 0x08;
76 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable & 0x08;
77 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
77 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
78 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
78 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
79 }
79 }
80 // waveform_picker_regs->status = waveform_picker_regs->status & 0x00;
80 // waveform_picker_regs->status = waveform_picker_regs->status & 0x00;
81 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888;
81 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888;
82 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x07; // [0111] enable f2 f1 f0
82 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x07; // [0111] enable f2 f1 f0
83 }
83 }
84 }
84 }
85 #endif
85 #endif
86 break;
86 break;
87
87
88 //******
88 //******
89 // BURST
89 // BURST
90 case(LFR_MODE_BURST):
90 case(LFR_MODE_BURST):
91 #ifdef GSA
91 #ifdef GSA
92 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
92 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
93 #else
93 #else
94 if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit
94 if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit
95 // (1) change the receiving buffer for the waveform picker
95 // (1) change the receiving buffer for the waveform picker
96 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
96 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
97 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
97 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
98 }
98 }
99 else {
99 else {
100 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
100 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
101 }
101 }
102 // (2) send an event for the waveforms transmission
102 // (2) send an event for the waveforms transmission
103 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
103 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
104 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
104 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
105 }
105 }
106 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0
106 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0
107 }
107 }
108 #endif
108 #endif
109 break;
109 break;
110
110
111 //*****
111 //*****
112 // SBM1
112 // SBM1
113 case(LFR_MODE_SBM1):
113 case(LFR_MODE_SBM1):
114 #ifdef GSA
114 #ifdef GSA
115 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
115 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
116 #else
116 #else
117 if ((waveform_picker_regs->status & 0x02) == 0x02){ // [0010] check the f1 full bit
117 if ((waveform_picker_regs->status & 0x02) == 0x02){ // [0010] check the f1 full bit
118 // (1) change the receiving buffer for the waveform picker
118 // (1) change the receiving buffer for the waveform picker
119 if ( param_local.local_sbm1_nb_cwf_sent == (param_local.local_sbm1_nb_cwf_max-1) )
119 if ( param_local.local_sbm1_nb_cwf_sent == (param_local.local_sbm1_nb_cwf_max-1) )
120 {
120 {
121 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_norm);
121 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_norm);
122 }
122 }
123 else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1_norm )
123 else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1_norm )
124 {
124 {
125 doubleSendCWF1 = 1;
125 doubleSendCWF1 = 1;
126 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
126 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
127 }
127 }
128 else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1 ) {
128 else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1 ) {
129 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis);
129 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis);
130 }
130 }
131 else {
131 else {
132 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
132 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
133 }
133 }
134 // (2) send an event for the waveforms transmission
134 // (2) send an event for the waveforms transmission
135 if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
135 if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
136 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
136 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
137 }
137 }
138 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0
138 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0
139 }
139 }
140 if ( ( (waveform_picker_regs->status & 0x05) == 0x05 ) ) { // [0101] check the f2 and f0 full bit
140 if ( ( (waveform_picker_regs->status & 0x05) == 0x05 ) ) { // [0101] check the f2 and f0 full bit
141 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
141 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
142 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
142 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
143 }
143 }
144 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0
144 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0
145 reset_local_sbm1_nb_cwf_sent();
145 reset_local_sbm1_nb_cwf_sent();
146 }
146 }
147
147
148 #endif
148 #endif
149 break;
149 break;
150
150
151 //*****
151 //*****
152 // SBM2
152 // SBM2
153 case(LFR_MODE_SBM2):
153 case(LFR_MODE_SBM2):
154 #ifdef GSA
154 #ifdef GSA
155 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
155 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
156 #else
156 #else
157 if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit
157 if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit
158 // (1) change the receiving buffer for the waveform picker
158 // (1) change the receiving buffer for the waveform picker
159 if ( param_local.local_sbm2_nb_cwf_sent == (param_local.local_sbm2_nb_cwf_max-1) )
159 if ( param_local.local_sbm2_nb_cwf_sent == (param_local.local_sbm2_nb_cwf_max-1) )
160 {
160 {
161 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_norm);
161 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_norm);
162 }
162 }
163 else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2_norm ) {
163 else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2_norm ) {
164 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
164 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
165 doubleSendCWF2 = 1;
165 doubleSendCWF2 = 1;
166 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2_WFRM ) != RTEMS_SUCCESSFUL) {
166 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2_WFRM ) != RTEMS_SUCCESSFUL) {
167 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
167 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
168 }
168 }
169 reset_local_sbm2_nb_cwf_sent();
169 reset_local_sbm2_nb_cwf_sent();
170 }
170 }
171 else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2 ) {
171 else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2 ) {
172 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
172 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
173 }
173 }
174 else {
174 else {
175 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
175 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
176 }
176 }
177 // (2) send an event for the waveforms transmission
177 // (2) send an event for the waveforms transmission
178 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
178 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
179 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
179 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
180 }
180 }
181 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
181 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
182 }
182 }
183 if ( ( (waveform_picker_regs->status & 0x03) == 0x03 ) ) { // [0011] f3 f2 f1 f0, f1 and f0 are full
183 if ( ( (waveform_picker_regs->status & 0x03) == 0x03 ) ) { // [0011] f3 f2 f1 f0, f1 and f0 are full
184 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
184 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
185 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
185 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
186 }
186 }
187 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
187 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
188 }
188 }
189 #endif
189 #endif
190 break;
190 break;
191
191
192 //********
192 //********
193 // DEFAULT
193 // DEFAULT
194 default:
194 default:
195 break;
195 break;
196 }
196 }
197 }
197 }
198
198
199 rtems_isr waveforms_simulator_isr( rtems_vector_number vector )
199 rtems_isr waveforms_simulator_isr( rtems_vector_number vector )
200 {
200 {
201 /** This is the interrupt sub routine called by the waveform picker simulator.
201 /** This is the interrupt sub routine called by the waveform picker simulator.
202 *
202 *
203 * This ISR is for debug purpose only.
203 * This ISR is for debug purpose only.
204 *
204 *
205 */
205 */
206
206
207 unsigned char lfrMode;
207 unsigned char lfrMode;
208 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
208 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
209
209
210 switch(lfrMode) {
210 switch(lfrMode) {
211 case (LFR_MODE_STANDBY):
211 case (LFR_MODE_STANDBY):
212 break;
212 break;
213 case (LFR_MODE_NORMAL):
213 case (LFR_MODE_NORMAL):
214 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
214 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
215 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_5 );
215 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_5 );
216 }
216 }
217 break;
217 break;
218 case (LFR_MODE_BURST):
218 case (LFR_MODE_BURST):
219 break;
219 break;
220 case (LFR_MODE_SBM1):
220 case (LFR_MODE_SBM1):
221 break;
221 break;
222 case (LFR_MODE_SBM2):
222 case (LFR_MODE_SBM2):
223 break;
223 break;
224 }
224 }
225 }
225 }
226
226
227 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
227 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
228 {
228 {
229 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
229 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
230 *
230 *
231 * @param unused is the starting argument of the RTEMS task
231 * @param unused is the starting argument of the RTEMS task
232 *
232 *
233 * The following data packets are sent by this task:
233 * The following data packets are sent by this task:
234 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
234 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
235 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
235 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
236 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
236 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
237 *
237 *
238 */
238 */
239
239
240 rtems_event_set event_out;
240 rtems_event_set event_out;
241 rtems_id queue_id;
241 rtems_id queue_id;
242 rtems_status_code status;
242
243
243 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
244 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
244 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
245 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
245 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
246 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
246
247
247 init_waveforms();
248 init_waveforms();
248
249
249 queue_id = get_pkts_queue_id();
250 status = get_message_queue_id_send( &queue_id );
251 if (status != RTEMS_SUCCESSFUL)
252 {
253 PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status)
254 }
250
255
251 BOOT_PRINTF("in WFRM ***\n")
256 BOOT_PRINTF("in WFRM ***\n")
252
257
253 while(1){
258 while(1){
254 // wait for an RTEMS_EVENT
259 // wait for an RTEMS_EVENT
255 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
260 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
256 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
261 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
257 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
262 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
258
263
259 if (event_out == RTEMS_EVENT_MODE_NORMAL)
264 if (event_out == RTEMS_EVENT_MODE_NORMAL)
260 {
265 {
261 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
266 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
262 send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
267 send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
263 send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
268 send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
264 #ifdef GSA
269 #ifdef GSA
265 waveform_picker_regs->status = waveform_picker_regs->status & 0xf888; // [1111 1000 1000 1000] f2, f1, f0 bits =0
270 waveform_picker_regs->status = waveform_picker_regs->status & 0xf888; // [1111 1000 1000 1000] f2, f1, f0 bits =0
266 #endif
271 #endif
267 }
272 }
268 else if (event_out == RTEMS_EVENT_MODE_SBM1)
273 else if (event_out == RTEMS_EVENT_MODE_SBM1)
269 {
274 {
270 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
275 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
271 send_waveform_SWF(wf_snap_f1_norm, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
276 send_waveform_SWF(wf_snap_f1_norm, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
272 send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
277 send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
273 #ifdef GSA
278 #ifdef GSA
274 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2, f0 bits = 0
279 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2, f0 bits = 0
275 #endif
280 #endif
276 }
281 }
277 else if (event_out == RTEMS_EVENT_MODE_SBM2)
282 else if (event_out == RTEMS_EVENT_MODE_SBM2)
278 {
283 {
279 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
284 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
280 send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
285 send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
281 #ifdef GSA
286 #ifdef GSA
282 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
287 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
283 #endif
288 #endif
284 }
289 }
285 else if (event_out == RTEMS_EVENT_MODE_SBM2_WFRM)
290 else if (event_out == RTEMS_EVENT_MODE_SBM2_WFRM)
286 {
291 {
287 send_waveform_SWF(wf_snap_f2_norm, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
292 send_waveform_SWF(wf_snap_f2_norm, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
288 }
293 }
289 else
294 else
290 {
295 {
291 PRINTF("in WFRM *** unexpected event")
296 PRINTF("in WFRM *** unexpected event")
292 }
297 }
293
298
294
299
295 #ifdef GSA
300 #ifdef GSA
296 // irq processed, reset the related register of the timer unit
301 // irq processed, reset the related register of the timer unit
297 gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl = gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl | 0x00000010;
302 gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl = gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl | 0x00000010;
298 // clear the interruption
303 // clear the interruption
299 LEON_Unmask_interrupt( IRQ_WF );
304 LEON_Unmask_interrupt( IRQ_WF );
300 #endif
305 #endif
301 }
306 }
302 }
307 }
303
308
304 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
309 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
305 {
310 {
306 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
311 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
307 *
312 *
308 * @param unused is the starting argument of the RTEMS task
313 * @param unused is the starting argument of the RTEMS task
309 *
314 *
310 * The following data packet is sent by this task:
315 * The following data packet is sent by this task:
311 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
316 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
312 *
317 *
313 */
318 */
314
319
315 rtems_event_set event_out;
320 rtems_event_set event_out;
316 rtems_id queue_id;
321 rtems_id queue_id;
322 rtems_status_code status;
317
323
318 init_header_continuous_wf_table( SID_NORM_CWF_F3, headerCWF_F3 );
324 init_header_continuous_wf_table( SID_NORM_CWF_F3, headerCWF_F3 );
319 init_header_continuous_wf3_light_table( headerCWF_F3_light );
325 init_header_continuous_wf3_light_table( headerCWF_F3_light );
320
326
321 queue_id = get_pkts_queue_id();
327 status = get_message_queue_id_send( &queue_id );
328 if (status != RTEMS_SUCCESSFUL)
329 {
330 PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status)
331 }
322
332
323 BOOT_PRINTF("in CWF3 ***\n")
333 BOOT_PRINTF("in CWF3 ***\n")
324
334
325 while(1){
335 while(1){
326 // wait for an RTEMS_EVENT
336 // wait for an RTEMS_EVENT
327 rtems_event_receive( RTEMS_EVENT_0,
337 rtems_event_receive( RTEMS_EVENT_0,
328 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
338 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
329 PRINTF("send CWF F3 \n")
339 PRINTF("send CWF F3 \n")
330 #ifdef GSA
340 #ifdef GSA
331 #else
341 #else
332 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) {
342 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) {
333 send_waveform_CWF3_light( wf_cont_f3_bis, headerCWF_F3_light, queue_id );
343 send_waveform_CWF3_light( wf_cont_f3_bis, headerCWF_F3_light, queue_id );
334 }
344 }
335 else {
345 else {
336 send_waveform_CWF3_light( wf_cont_f3, headerCWF_F3_light, queue_id );
346 send_waveform_CWF3_light( wf_cont_f3, headerCWF_F3_light, queue_id );
337 }
347 }
338 #endif
348 #endif
339 }
349 }
340 }
350 }
341
351
342 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
352 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
343 {
353 {
344 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
354 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
345 *
355 *
346 * @param unused is the starting argument of the RTEMS task
356 * @param unused is the starting argument of the RTEMS task
347 *
357 *
348 * The following data packet is sent by this function:
358 * The following data packet is sent by this function:
349 * - TM_LFR_SCIENCE_BURST_CWF_F2
359 * - TM_LFR_SCIENCE_BURST_CWF_F2
350 * - TM_LFR_SCIENCE_SBM2_CWF_F2
360 * - TM_LFR_SCIENCE_SBM2_CWF_F2
351 *
361 *
352 */
362 */
353
363
354 rtems_event_set event_out;
364 rtems_event_set event_out;
355 rtems_id queue_id;
365 rtems_id queue_id;
366 rtems_status_code status;
356
367
357 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
368 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
358 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
369 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
359
370
360 queue_id = get_pkts_queue_id();
371 status = get_message_queue_id_send( &queue_id );
372 if (status != RTEMS_SUCCESSFUL)
373 {
374 PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status)
375 }
361
376
362 BOOT_PRINTF("in CWF2 ***\n")
377 BOOT_PRINTF("in CWF2 ***\n")
363
378
364 while(1){
379 while(1){
365 // wait for an RTEMS_EVENT
380 // wait for an RTEMS_EVENT
366 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
381 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
367 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
382 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
368
383
369 if (event_out == RTEMS_EVENT_MODE_BURST)
384 if (event_out == RTEMS_EVENT_MODE_BURST)
370 {
385 {
371 // F2
386 // F2
372 #ifdef GSA
387 #ifdef GSA
373 #else
388 #else
374 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
389 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
375 send_waveform_CWF( wf_snap_f2_bis, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
390 send_waveform_CWF( wf_snap_f2_bis, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
376 }
391 }
377 else {
392 else {
378 send_waveform_CWF( wf_snap_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
393 send_waveform_CWF( wf_snap_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
379 }
394 }
380 #endif
395 #endif
381 }
396 }
382
397
383 else if (event_out == RTEMS_EVENT_MODE_SBM2)
398 else if (event_out == RTEMS_EVENT_MODE_SBM2)
384 {
399 {
385 #ifdef GSA
400 #ifdef GSA
386 #else
401 #else
387 if (doubleSendCWF2 == 1)
402 if (doubleSendCWF2 == 1)
388 {
403 {
389 doubleSendCWF2 = 0;
404 doubleSendCWF2 = 0;
390 send_waveform_CWF( wf_snap_f2_norm, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
405 send_waveform_CWF( wf_snap_f2_norm, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
391 }
406 }
392 else if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
407 else if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
393 send_waveform_CWF( wf_snap_f2_bis, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
408 send_waveform_CWF( wf_snap_f2_bis, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
394 }
409 }
395 else {
410 else {
396 send_waveform_CWF( wf_snap_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
411 send_waveform_CWF( wf_snap_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
397 }
412 }
398 param_local.local_sbm2_nb_cwf_sent ++;
413 param_local.local_sbm2_nb_cwf_sent ++;
399 #endif
414 #endif
400 }
415 }
401 else
416 else
402 {
417 {
403 PRINTF1("in CWF2 *** ERR mode = %d\n", lfrCurrentMode)
418 PRINTF1("in CWF2 *** ERR mode = %d\n", lfrCurrentMode)
404 }
419 }
405 }
420 }
406 }
421 }
407
422
408 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
423 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
409 {
424 {
410 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
425 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
411 *
426 *
412 * @param unused is the starting argument of the RTEMS task
427 * @param unused is the starting argument of the RTEMS task
413 *
428 *
414 * The following data packet is sent by this function:
429 * The following data packet is sent by this function:
415 * - TM_LFR_SCIENCE_SBM1_CWF_F1
430 * - TM_LFR_SCIENCE_SBM1_CWF_F1
416 *
431 *
417 */
432 */
418
433
419 rtems_event_set event_out;
434 rtems_event_set event_out;
420 rtems_id queue_id;
435 rtems_id queue_id;
436 rtems_status_code status;
421
437
422 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
438 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
423
439
424 queue_id = get_pkts_queue_id();
440 status = get_message_queue_id_send( &queue_id );
441 if (status != RTEMS_SUCCESSFUL)
442 {
443 PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status)
444 }
425
445
426 BOOT_PRINTF("in CWF1 ***\n")
446 BOOT_PRINTF("in CWF1 ***\n")
427
447
428 while(1){
448 while(1){
429 // wait for an RTEMS_EVENT
449 // wait for an RTEMS_EVENT
430 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
450 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
431 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
451 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
432 if (event_out == RTEMS_EVENT_MODE_SBM1)
452 if (event_out == RTEMS_EVENT_MODE_SBM1)
433 {
453 {
434 #ifdef GSA
454 #ifdef GSA
435 #else
455 #else
436 if (doubleSendCWF1 == 1)
456 if (doubleSendCWF1 == 1)
437 {
457 {
438 doubleSendCWF1 = 0;
458 doubleSendCWF1 = 0;
439 send_waveform_CWF( wf_snap_f1_norm, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
459 send_waveform_CWF( wf_snap_f1_norm, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
440 }
460 }
441 else if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
461 else if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
442 send_waveform_CWF( wf_snap_f1_bis, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
462 send_waveform_CWF( wf_snap_f1_bis, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
443 }
463 }
444 else {
464 else {
445 send_waveform_CWF( wf_snap_f1, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
465 send_waveform_CWF( wf_snap_f1, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
446 }
466 }
447 param_local.local_sbm1_nb_cwf_sent ++;
467 param_local.local_sbm1_nb_cwf_sent ++;
448 #endif
468 #endif
449 }
469 }
450 else
470 else
451 {
471 {
452 PRINTF1("in CWF1 *** ERR mode = %d\n", lfrCurrentMode)
472 PRINTF1("in CWF1 *** ERR mode = %d\n", lfrCurrentMode)
453 }
473 }
454 }
474 }
455 }
475 }
456
476
457 //******************
477 //******************
458 // general functions
478 // general functions
459 void init_waveforms( void )
479 void init_waveforms( void )
460 {
480 {
461 int i = 0;
481 int i = 0;
462
482
463 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
483 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
464 {
484 {
465 //***
485 //***
466 // F0
486 // F0
467 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
487 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
468 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
488 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
469 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
489 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
470
490
471 //***
491 //***
472 // F1
492 // F1
473 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
493 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
474 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
494 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
475 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
495 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
476
496
477 //***
497 //***
478 // F2
498 // F2
479 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
499 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
480 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
500 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
481 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
501 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
482
502
483 //***
503 //***
484 // F3
504 // F3
485 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
505 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
486 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
506 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
487 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
507 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
488 }
508 }
489 }
509 }
490
510
491 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
511 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
492 {
512 {
493 unsigned char i;
513 unsigned char i;
494
514
495 for (i=0; i<7; i++)
515 for (i=0; i<7; i++)
496 {
516 {
497 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
517 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
498 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
518 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
499 headerSWF[ i ].reserved = DEFAULT_RESERVED;
519 headerSWF[ i ].reserved = DEFAULT_RESERVED;
500 headerSWF[ i ].userApplication = CCSDS_USER_APP;
520 headerSWF[ i ].userApplication = CCSDS_USER_APP;
501 headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
521 headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
502 headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
522 headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
503 if (i == 0)
523 if (i == 0)
504 {
524 {
505 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
525 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
506 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
526 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
507 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
527 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
508 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
528 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
509 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
529 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
510 }
530 }
511 else if (i == 6)
531 else if (i == 6)
512 {
532 {
513 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
533 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
514 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_8 >> 8);
534 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_8 >> 8);
515 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_8 );
535 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_8 );
516 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
536 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
517 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
537 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
518 }
538 }
519 else
539 else
520 {
540 {
521 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
541 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
522 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
542 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
523 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
543 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
524 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
544 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
525 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
545 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
526 }
546 }
527 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
547 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
528 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
548 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
529 headerSWF[ i ].pktNr = i+1; // PKT_NR
549 headerSWF[ i ].pktNr = i+1; // PKT_NR
530 // DATA FIELD HEADER
550 // DATA FIELD HEADER
531 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
551 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
532 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
552 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
533 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
553 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
534 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
554 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
535 // AUXILIARY DATA HEADER
555 // AUXILIARY DATA HEADER
536 headerSWF[ i ].time[0] = 0x00;
556 headerSWF[ i ].time[0] = 0x00;
537 headerSWF[ i ].time[0] = 0x00;
557 headerSWF[ i ].time[0] = 0x00;
538 headerSWF[ i ].time[0] = 0x00;
558 headerSWF[ i ].time[0] = 0x00;
539 headerSWF[ i ].time[0] = 0x00;
559 headerSWF[ i ].time[0] = 0x00;
540 headerSWF[ i ].time[0] = 0x00;
560 headerSWF[ i ].time[0] = 0x00;
541 headerSWF[ i ].time[0] = 0x00;
561 headerSWF[ i ].time[0] = 0x00;
542 headerSWF[ i ].sid = sid;
562 headerSWF[ i ].sid = sid;
543 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
563 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
544 }
564 }
545 return LFR_SUCCESSFUL;
565 return LFR_SUCCESSFUL;
546 }
566 }
547
567
548 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
568 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
549 {
569 {
550 unsigned int i;
570 unsigned int i;
551
571
552 for (i=0; i<7; i++)
572 for (i=0; i<7; i++)
553 {
573 {
554 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
574 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
555 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
575 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
556 headerCWF[ i ].reserved = DEFAULT_RESERVED;
576 headerCWF[ i ].reserved = DEFAULT_RESERVED;
557 headerCWF[ i ].userApplication = CCSDS_USER_APP;
577 headerCWF[ i ].userApplication = CCSDS_USER_APP;
558 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
578 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
559 {
579 {
560 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8);
580 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8);
561 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2);
581 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2);
562 }
582 }
563 else
583 else
564 {
584 {
565 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
585 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
566 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
586 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
567 }
587 }
568 if (i == 0)
588 if (i == 0)
569 {
589 {
570 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
590 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
571 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
591 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
572 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
592 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
573 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
593 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
574 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
594 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
575 }
595 }
576 else if (i == 6)
596 else if (i == 6)
577 {
597 {
578 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
598 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
579 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8);
599 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8);
580 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 );
600 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 );
581 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
601 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
582 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
602 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
583 }
603 }
584 else
604 else
585 {
605 {
586 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
606 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
587 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
607 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
588 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
608 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
589 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
609 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
590 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
610 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
591 }
611 }
592 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
612 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
593 // PKT_CNT
613 // PKT_CNT
594 // PKT_NR
614 // PKT_NR
595 // DATA FIELD HEADER
615 // DATA FIELD HEADER
596 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
616 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
597 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
617 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
598 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
618 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
599 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
619 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
600 // AUXILIARY DATA HEADER
620 // AUXILIARY DATA HEADER
601 headerCWF[ i ].sid = sid;
621 headerCWF[ i ].sid = sid;
602 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
622 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
603 headerCWF[ i ].time[0] = 0x00;
623 headerCWF[ i ].time[0] = 0x00;
604 headerCWF[ i ].time[0] = 0x00;
624 headerCWF[ i ].time[0] = 0x00;
605 headerCWF[ i ].time[0] = 0x00;
625 headerCWF[ i ].time[0] = 0x00;
606 headerCWF[ i ].time[0] = 0x00;
626 headerCWF[ i ].time[0] = 0x00;
607 headerCWF[ i ].time[0] = 0x00;
627 headerCWF[ i ].time[0] = 0x00;
608 headerCWF[ i ].time[0] = 0x00;
628 headerCWF[ i ].time[0] = 0x00;
609 }
629 }
610 return LFR_SUCCESSFUL;
630 return LFR_SUCCESSFUL;
611 }
631 }
612
632
613 int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
633 int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
614 {
634 {
615 unsigned int i;
635 unsigned int i;
616
636
617 for (i=0; i<7; i++)
637 for (i=0; i<7; i++)
618 {
638 {
619 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
639 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
620 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
640 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
621 headerCWF[ i ].reserved = DEFAULT_RESERVED;
641 headerCWF[ i ].reserved = DEFAULT_RESERVED;
622 headerCWF[ i ].userApplication = CCSDS_USER_APP;
642 headerCWF[ i ].userApplication = CCSDS_USER_APP;
623
643
624 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
644 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
625 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
645 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
626 if (i == 0)
646 if (i == 0)
627 {
647 {
628 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
648 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
629 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
649 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
630 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
650 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
631 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
651 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
632 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
652 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
633 }
653 }
634 else if (i == 6)
654 else if (i == 6)
635 {
655 {
636 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
656 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
637 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 >> 8);
657 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 >> 8);
638 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 );
658 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 );
639 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
659 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
640 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
660 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
641 }
661 }
642 else
662 else
643 {
663 {
644 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
664 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
645 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
665 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
646 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
666 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
647 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
667 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
648 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
668 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
649 }
669 }
650 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
670 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
651 // DATA FIELD HEADER
671 // DATA FIELD HEADER
652 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
672 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
653 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
673 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
654 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
674 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
655 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
675 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
656 // AUXILIARY DATA HEADER
676 // AUXILIARY DATA HEADER
657 headerCWF[ i ].sid = SID_NORM_CWF_F3;
677 headerCWF[ i ].sid = SID_NORM_CWF_F3;
658 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
678 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
659 headerCWF[ i ].time[0] = 0x00;
679 headerCWF[ i ].time[0] = 0x00;
660 headerCWF[ i ].time[0] = 0x00;
680 headerCWF[ i ].time[0] = 0x00;
661 headerCWF[ i ].time[0] = 0x00;
681 headerCWF[ i ].time[0] = 0x00;
662 headerCWF[ i ].time[0] = 0x00;
682 headerCWF[ i ].time[0] = 0x00;
663 headerCWF[ i ].time[0] = 0x00;
683 headerCWF[ i ].time[0] = 0x00;
664 headerCWF[ i ].time[0] = 0x00;
684 headerCWF[ i ].time[0] = 0x00;
665 }
685 }
666 return LFR_SUCCESSFUL;
686 return LFR_SUCCESSFUL;
667 }
687 }
668
688
669 void reset_waveforms( void )
689 void reset_waveforms( void )
670 {
690 {
671 int i = 0;
691 int i = 0;
672
692
673 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
693 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
674 {
694 {
675 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000;
695 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000;
676 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
696 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
677 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
697 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
678
698
679 //***
699 //***
680 // F1
700 // F1
681 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000;
701 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000;
682 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000;
702 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000;
683 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
703 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
684
704
685 //***
705 //***
686 // F2
706 // F2
687 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000;
707 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000;
688 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
708 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
689 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000;
709 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000;
690
710
691 //***
711 //***
692 // F3
712 // F3
693 /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1
713 /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1
694 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1
714 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1
695 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/
715 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/
696 }
716 }
697 }
717 }
698
718
699 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
719 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
700 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
720 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
701 {
721 {
702 /** This function sends SWF CCSDS packets (F2, F1 or F0).
722 /** This function sends SWF CCSDS packets (F2, F1 or F0).
703 *
723 *
704 * @param waveform points to the buffer containing the data that will be send.
724 * @param waveform points to the buffer containing the data that will be send.
705 * @param sid is the source identifier of the data that will be sent.
725 * @param sid is the source identifier of the data that will be sent.
706 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
726 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
707 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
727 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
708 * contain information to setup the transmission of the data packets.
728 * contain information to setup the transmission of the data packets.
709 *
729 *
710 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
730 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
711 *
731 *
712 */
732 */
713
733
714 unsigned int i;
734 unsigned int i;
715 int ret;
735 int ret;
716 rtems_status_code status;
736 rtems_status_code status;
717 spw_ioctl_pkt_send spw_ioctl_send_SWF;
737 spw_ioctl_pkt_send spw_ioctl_send_SWF;
718
738
719 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
739 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
720 spw_ioctl_send_SWF.options = 0;
740 spw_ioctl_send_SWF.options = 0;
721
741
722 ret = LFR_DEFAULT;
742 ret = LFR_DEFAULT;
723
743
724 for (i=0; i<7; i++) // send waveform
744 for (i=0; i<7; i++) // send waveform
725 {
745 {
726 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
746 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
727 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
747 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
728 // BUILD THE DATA
748 // BUILD THE DATA
729 if (i==6) {
749 if (i==6) {
730 spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK;
750 spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK;
731 }
751 }
732 else {
752 else {
733 spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK;
753 spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK;
734 }
754 }
735 // SET PACKET SEQUENCE COUNTER
755 // SET PACKET SEQUENCE COUNTER
736 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
756 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
737 // SET PACKET TIME
757 // SET PACKET TIME
738 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
758 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
739 headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
759 headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
740 headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
760 headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
741 headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
761 headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
742 headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
762 headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
743 headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
763 headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
744 headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
764 headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
745 headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
765 headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
746 headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
766 headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
747 headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time);
767 headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time);
748 headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8);
768 headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8);
749 headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time);
769 headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time);
750 // SEND PACKET
770 // SEND PACKET
751 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
771 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
752 if (status != RTEMS_SUCCESSFUL) {
772 if (status != RTEMS_SUCCESSFUL) {
753 printf("%d-%d, ERR %d\n", sid, i, (int) status);
773 printf("%d-%d, ERR %d\n", sid, i, (int) status);
754 ret = LFR_DEFAULT;
774 ret = LFR_DEFAULT;
755 }
775 }
756 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
776 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
757 }
777 }
758
778
759 return ret;
779 return ret;
760 }
780 }
761
781
762 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
782 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
763 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
783 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
764 {
784 {
765 /** This function sends CWF CCSDS packets (F2, F1 or F0).
785 /** This function sends CWF CCSDS packets (F2, F1 or F0).
766 *
786 *
767 * @param waveform points to the buffer containing the data that will be send.
787 * @param waveform points to the buffer containing the data that will be send.
768 * @param sid is the source identifier of the data that will be sent.
788 * @param sid is the source identifier of the data that will be sent.
769 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
789 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
770 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
790 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
771 * contain information to setup the transmission of the data packets.
791 * contain information to setup the transmission of the data packets.
772 *
792 *
773 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
793 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
774 *
794 *
775 */
795 */
776
796
777 unsigned int i;
797 unsigned int i;
778 int ret;
798 int ret;
779 rtems_status_code status;
799 rtems_status_code status;
780 spw_ioctl_pkt_send spw_ioctl_send_CWF;
800 spw_ioctl_pkt_send spw_ioctl_send_CWF;
781
801
782 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
802 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
783 spw_ioctl_send_CWF.options = 0;
803 spw_ioctl_send_CWF.options = 0;
784
804
785 ret = LFR_DEFAULT;
805 ret = LFR_DEFAULT;
786
806
787 for (i=0; i<7; i++) // send waveform
807 for (i=0; i<7; i++) // send waveform
788 {
808 {
789 int coarseTime = 0x00;
809 int coarseTime = 0x00;
790 int fineTime = 0x00;
810 int fineTime = 0x00;
791 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
811 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
792 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
812 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
793 // BUILD THE DATA
813 // BUILD THE DATA
794 if (i==6) {
814 if (i==6) {
795 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK;
815 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK;
796 }
816 }
797 else {
817 else {
798 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK;
818 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK;
799 }
819 }
800 // SET PACKET SEQUENCE COUNTER
820 // SET PACKET SEQUENCE COUNTER
801 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
821 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
802 // SET PACKET TIME
822 // SET PACKET TIME
803 coarseTime = time_management_regs->coarse_time;
823 coarseTime = time_management_regs->coarse_time;
804 fineTime = time_management_regs->fine_time;
824 fineTime = time_management_regs->fine_time;
805 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
825 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
806 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
826 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
807 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
827 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
808 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
828 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
809 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
829 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
810 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
830 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
811 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
831 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
812 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
832 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
813 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
833 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
814 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
834 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
815 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
835 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
816 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
836 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
817 // SEND PACKET
837 // SEND PACKET
818 if (sid == SID_NORM_CWF_F3)
838 if (sid == SID_NORM_CWF_F3)
819 {
839 {
820 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
840 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
821 if (status != RTEMS_SUCCESSFUL) {
841 if (status != RTEMS_SUCCESSFUL) {
822 printf("%d-%d, ERR %d\n", sid, i, (int) status);
842 printf("%d-%d, ERR %d\n", sid, i, (int) status);
823 ret = LFR_DEFAULT;
843 ret = LFR_DEFAULT;
824 }
844 }
825 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
845 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
826 }
846 }
827 else
847 else
828 {
848 {
829 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
849 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
830 if (status != RTEMS_SUCCESSFUL) {
850 if (status != RTEMS_SUCCESSFUL) {
831 printf("%d-%d, ERR %d\n", sid, i, (int) status);
851 printf("%d-%d, ERR %d\n", sid, i, (int) status);
832 ret = LFR_DEFAULT;
852 ret = LFR_DEFAULT;
833 }
853 }
834 }
854 }
835 }
855 }
836
856
837 return ret;
857 return ret;
838 }
858 }
839
859
840 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
860 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
841 {
861 {
842 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
862 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
843 *
863 *
844 * @param waveform points to the buffer containing the data that will be send.
864 * @param waveform points to the buffer containing the data that will be send.
845 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
865 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
846 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
866 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
847 * contain information to setup the transmission of the data packets.
867 * contain information to setup the transmission of the data packets.
848 *
868 *
849 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
869 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
850 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
870 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
851 *
871 *
852 */
872 */
853
873
854 unsigned int i;
874 unsigned int i;
855 int ret;
875 int ret;
856 rtems_status_code status;
876 rtems_status_code status;
857 spw_ioctl_pkt_send spw_ioctl_send_CWF;
877 spw_ioctl_pkt_send spw_ioctl_send_CWF;
858 char *sample;
878 char *sample;
859
879
860 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
880 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
861 spw_ioctl_send_CWF.options = 0;
881 spw_ioctl_send_CWF.options = 0;
862
882
863 ret = LFR_DEFAULT;
883 ret = LFR_DEFAULT;
864
884
865 //**********************
885 //**********************
866 // BUILD CWF3_light DATA
886 // BUILD CWF3_light DATA
867 for ( i=0; i< 2048; i++)
887 for ( i=0; i< 2048; i++)
868 {
888 {
869 sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ];
889 sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ];
870 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ];
890 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ];
871 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ];
891 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ];
872 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ];
892 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ];
873 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ];
893 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ];
874 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ];
894 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ];
875 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ];
895 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ];
876 }
896 }
877
897
878 //*********************
898 //*********************
879 // SEND CWF3_light DATA
899 // SEND CWF3_light DATA
880
900
881 for (i=0; i<7; i++) // send waveform
901 for (i=0; i<7; i++) // send waveform
882 {
902 {
883 int coarseTime = 0x00;
903 int coarseTime = 0x00;
884 int fineTime = 0x00;
904 int fineTime = 0x00;
885 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * 340 * NB_BYTES_CWF3_LIGHT_BLK) ];
905 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * 340 * NB_BYTES_CWF3_LIGHT_BLK) ];
886 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
906 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
887 // BUILD THE DATA
907 // BUILD THE DATA
888 if ( i == WFRM_INDEX_OF_LAST_PACKET ) {
908 if ( i == WFRM_INDEX_OF_LAST_PACKET ) {
889 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_CWF3_LIGHT_BLK;
909 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_CWF3_LIGHT_BLK;
890 }
910 }
891 else {
911 else {
892 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK;
912 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK;
893 }
913 }
894 // SET PACKET SEQUENCE COUNTER
914 // SET PACKET SEQUENCE COUNTER
895 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
915 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
896 // SET PACKET TIME
916 // SET PACKET TIME
897 coarseTime = time_management_regs->coarse_time;
917 coarseTime = time_management_regs->coarse_time;
898 fineTime = time_management_regs->fine_time;
918 fineTime = time_management_regs->fine_time;
899 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
919 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
900 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
920 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
901 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
921 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
902 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
922 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
903 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
923 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
904 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
924 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
905 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
925 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
906 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
926 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
907 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
927 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
908 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
928 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
909 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
929 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
910 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
930 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
911 // SEND PACKET
931 // SEND PACKET
912 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
932 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
913 if (status != RTEMS_SUCCESSFUL) {
933 if (status != RTEMS_SUCCESSFUL) {
914 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
934 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
915 ret = LFR_DEFAULT;
935 ret = LFR_DEFAULT;
916 }
936 }
917 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
937 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
918 }
938 }
919
939
920 return ret;
940 return ret;
921 }
941 }
922
942
923
943
924 //**************
944 //**************
925 // wfp registers
945 // wfp registers
926 void set_wfp_data_shaping()
946 void set_wfp_data_shaping()
927 {
947 {
928 /** This function sets the data_shaping register of the waveform picker module.
948 /** This function sets the data_shaping register of the waveform picker module.
929 *
949 *
930 * The value is read from one field of the parameter_dump_packet structure:\n
950 * The value is read from one field of the parameter_dump_packet structure:\n
931 * bw_sp0_sp1_r0_r1
951 * bw_sp0_sp1_r0_r1
932 *
952 *
933 */
953 */
934
954
935 unsigned char data_shaping;
955 unsigned char data_shaping;
936
956
937 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
957 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
938 // waveform picker : [R1 R0 SP1 SP0 BW]
958 // waveform picker : [R1 R0 SP1 SP0 BW]
939
959
940 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
960 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
941
961
942 #ifdef GSA
962 #ifdef GSA
943 #else
963 #else
944 waveform_picker_regs->data_shaping =
964 waveform_picker_regs->data_shaping =
945 ( (data_shaping & 0x10) >> 4 ) // BW
965 ( (data_shaping & 0x10) >> 4 ) // BW
946 + ( (data_shaping & 0x08) >> 2 ) // SP0
966 + ( (data_shaping & 0x08) >> 2 ) // SP0
947 + ( (data_shaping & 0x04) ) // SP1
967 + ( (data_shaping & 0x04) ) // SP1
948 + ( (data_shaping & 0x02) << 2 ) // R0
968 + ( (data_shaping & 0x02) << 2 ) // R0
949 + ( (data_shaping & 0x01) << 4 ); // R1
969 + ( (data_shaping & 0x01) << 4 ); // R1
950 #endif
970 #endif
951 }
971 }
952
972
953 char set_wfp_delta_snapshot()
973 char set_wfp_delta_snapshot()
954 {
974 {
955 /** This function sets the delta_snapshot register of the waveform picker module.
975 /** This function sets the delta_snapshot register of the waveform picker module.
956 *
976 *
957 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
977 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
958 * - sy_lfr_n_swf_p[0]
978 * - sy_lfr_n_swf_p[0]
959 * - sy_lfr_n_swf_p[1]
979 * - sy_lfr_n_swf_p[1]
960 *
980 *
961 */
981 */
962
982
963 char ret;
983 char ret;
964 unsigned int delta_snapshot;
984 unsigned int delta_snapshot;
965 unsigned int aux;
985 unsigned int aux;
966
986
967 aux = 0;
987 aux = 0;
968 ret = LFR_DEFAULT;
988 ret = LFR_DEFAULT;
969
989
970 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
990 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
971 + parameter_dump_packet.sy_lfr_n_swf_p[1];
991 + parameter_dump_packet.sy_lfr_n_swf_p[1];
972
992
973 #ifdef GSA
993 #ifdef GSA
974 #else
994 #else
975 if ( delta_snapshot < MIN_DELTA_SNAPSHOT )
995 if ( delta_snapshot < MIN_DELTA_SNAPSHOT )
976 {
996 {
977 aux = MIN_DELTA_SNAPSHOT;
997 aux = MIN_DELTA_SNAPSHOT;
978 ret = LFR_DEFAULT;
998 ret = LFR_DEFAULT;
979 }
999 }
980 else
1000 else
981 {
1001 {
982 aux = delta_snapshot ;
1002 aux = delta_snapshot ;
983 ret = LFR_SUCCESSFUL;
1003 ret = LFR_SUCCESSFUL;
984 }
1004 }
985 waveform_picker_regs->delta_snapshot = aux - 1; // max 2 bytes
1005 waveform_picker_regs->delta_snapshot = aux - 1; // max 2 bytes
986 #endif
1006 #endif
987
1007
988 return ret;
1008 return ret;
989 }
1009 }
990
1010
991 void set_wfp_burst_enable_register( unsigned char mode)
1011 void set_wfp_burst_enable_register( unsigned char mode)
992 {
1012 {
993 /** This function sets the waveform picker burst_enable register depending on the mode.
1013 /** This function sets the waveform picker burst_enable register depending on the mode.
994 *
1014 *
995 * @param mode is the LFR mode to launch.
1015 * @param mode is the LFR mode to launch.
996 *
1016 *
997 * The burst bits shall be before the enable bits.
1017 * The burst bits shall be before the enable bits.
998 *
1018 *
999 */
1019 */
1000
1020
1001 #ifdef GSA
1021 #ifdef GSA
1002 #else
1022 #else
1003 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1023 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1004 // the burst bits shall be set first, before the enable bits
1024 // the burst bits shall be set first, before the enable bits
1005 switch(mode) {
1025 switch(mode) {
1006 case(LFR_MODE_NORMAL):
1026 case(LFR_MODE_NORMAL):
1007 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enable
1027 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enable
1008 waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1028 waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1009 break;
1029 break;
1010 case(LFR_MODE_BURST):
1030 case(LFR_MODE_BURST):
1011 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
1031 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
1012 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2
1032 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2
1013 break;
1033 break;
1014 case(LFR_MODE_SBM1):
1034 case(LFR_MODE_SBM1):
1015 waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled
1035 waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled
1016 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1036 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1017 break;
1037 break;
1018 case(LFR_MODE_SBM2):
1038 case(LFR_MODE_SBM2):
1019 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
1039 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
1020 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1040 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1021 break;
1041 break;
1022 default:
1042 default:
1023 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1043 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1024 break;
1044 break;
1025 }
1045 }
1026 #endif
1046 #endif
1027 }
1047 }
1028
1048
1029 void reset_wfp_burst_enable()
1049 void reset_wfp_burst_enable()
1030 {
1050 {
1031 /** This function resets the waveform picker burst_enable register.
1051 /** This function resets the waveform picker burst_enable register.
1032 *
1052 *
1033 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
1053 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
1034 *
1054 *
1035 */
1055 */
1036
1056
1037 #ifdef GSA
1057 #ifdef GSA
1038 #else
1058 #else
1039 waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1059 waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1040 #endif
1060 #endif
1041 }
1061 }
1042
1062
1043 void reset_wfp_status()
1063 void reset_wfp_status()
1044 {
1064 {
1045 /** This function resets the waveform picker status register.
1065 /** This function resets the waveform picker status register.
1046 *
1066 *
1047 * All status bits are set to 0 [new_err full_err full].
1067 * All status bits are set to 0 [new_err full_err full].
1048 *
1068 *
1049 */
1069 */
1050
1070
1051 #ifdef GSA
1071 #ifdef GSA
1052 #else
1072 #else
1053 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1073 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1054 #endif
1074 #endif
1055 }
1075 }
1056
1076
1057 void reset_waveform_picker_regs()
1077 void reset_waveform_picker_regs()
1058 {
1078 {
1059 /** This function resets the waveform picker module registers.
1079 /** This function resets the waveform picker module registers.
1060 *
1080 *
1061 * The registers affected by this function are located at the following offset addresses:
1081 * The registers affected by this function are located at the following offset addresses:
1062 * - 0x00 data_shaping
1082 * - 0x00 data_shaping
1063 * - 0x04 burst_enable
1083 * - 0x04 burst_enable
1064 * - 0x08 addr_data_f0
1084 * - 0x08 addr_data_f0
1065 * - 0x0C addr_data_f1
1085 * - 0x0C addr_data_f1
1066 * - 0x10 addr_data_f2
1086 * - 0x10 addr_data_f2
1067 * - 0x14 addr_data_f3
1087 * - 0x14 addr_data_f3
1068 * - 0x18 status
1088 * - 0x18 status
1069 * - 0x1C delta_snapshot
1089 * - 0x1C delta_snapshot
1070 * - 0x20 delta_f2_f1
1090 * - 0x20 delta_f2_f1
1071 * - 0x24 delta_f2_f0
1091 * - 0x24 delta_f2_f0
1072 * - 0x28 nb_burst
1092 * - 0x28 nb_burst
1073 * - 0x2C nb_snapshot
1093 * - 0x2C nb_snapshot
1074 *
1094 *
1075 */
1095 */
1076
1096
1077 #ifdef GSA
1097 #ifdef GSA
1078 #else
1098 #else
1079 reset_wfp_burst_enable();
1099 reset_wfp_burst_enable();
1080 reset_wfp_status();
1100 reset_wfp_status();
1081 // set buffer addresses
1101 // set buffer addresses
1082 waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); //
1102 waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); //
1083 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); //
1103 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); //
1084 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); //
1104 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); //
1085 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); //
1105 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); //
1086 // set other parameters
1106 // set other parameters
1087 set_wfp_data_shaping();
1107 set_wfp_data_shaping();
1088 set_wfp_delta_snapshot(); // time in seconds between two snapshots
1108 set_wfp_delta_snapshot(); // time in seconds between two snapshots
1089 waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes)
1109 waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes)
1090 waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes)
1110 waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes)
1091 waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
1111 waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
1092 waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1
1112 waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1
1093 #endif
1113 #endif
1094 }
1114 }
1095
1115
1096 //*****************
1116 //*****************
1097 // local parameters
1117 // local parameters
1098 void set_local_sbm1_nb_cwf_max( void )
1118 void set_local_sbm1_nb_cwf_max( void )
1099 {
1119 {
1100 /** This function sets the value of the sbm1_nb_cwf_max local parameter.
1120 /** This function sets the value of the sbm1_nb_cwf_max local parameter.
1101 *
1121 *
1102 * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n
1122 * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n
1103 * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.\n\n
1123 * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.\n\n
1104 * (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot)
1124 * (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot)
1105 *
1125 *
1106 */
1126 */
1107 param_local.local_sbm1_nb_cwf_max = 2 *
1127 param_local.local_sbm1_nb_cwf_max = 2 *
1108 (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256
1128 (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256
1109 + parameter_dump_packet.sy_lfr_n_swf_p[1]) - 8; // 16 CWF1 parts during 1 SWF2
1129 + parameter_dump_packet.sy_lfr_n_swf_p[1]) - 8; // 16 CWF1 parts during 1 SWF2
1110 }
1130 }
1111
1131
1112 void set_local_sbm2_nb_cwf_max(void)
1132 void set_local_sbm2_nb_cwf_max(void)
1113 {
1133 {
1114 /** This function sets the value of the sbm1_nb_cwf_max local parameter.
1134 /** This function sets the value of the sbm1_nb_cwf_max local parameter.
1115 *
1135 *
1116 * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n
1136 * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n
1117 * This parameter is used to send CWF_F2 data as normal data when the SBM2 is active.\n\n
1137 * This parameter is used to send CWF_F2 data as normal data when the SBM2 is active.\n\n
1118 * (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz)
1138 * (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz)
1119 *
1139 *
1120 */
1140 */
1121
1141
1122 param_local.local_sbm2_nb_cwf_max = (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256
1142 param_local.local_sbm2_nb_cwf_max = (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256
1123 + parameter_dump_packet.sy_lfr_n_swf_p[1]) / 8;
1143 + parameter_dump_packet.sy_lfr_n_swf_p[1]) / 8;
1124 }
1144 }
1125
1145
1126 void set_local_nb_interrupt_f0_MAX( void )
1146 void set_local_nb_interrupt_f0_MAX( void )
1127 {
1147 {
1128 /** This function sets the value of the nb_interrupt_f0_MAX local parameter.
1148 /** This function sets the value of the nb_interrupt_f0_MAX local parameter.
1129 *
1149 *
1130 * This parameter is used for the SM validation only.\n
1150 * This parameter is used for the SM validation only.\n
1131 * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices
1151 * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices
1132 * module before launching a basic processing.
1152 * module before launching a basic processing.
1133 *
1153 *
1134 */
1154 */
1135
1155
1136 param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256
1156 param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256
1137 + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100;
1157 + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100;
1138 }
1158 }
1139
1159
1140 void reset_local_sbm1_nb_cwf_sent( void )
1160 void reset_local_sbm1_nb_cwf_sent( void )
1141 {
1161 {
1142 /** This function resets the value of the sbm1_nb_cwf_sent local parameter.
1162 /** This function resets the value of the sbm1_nb_cwf_sent local parameter.
1143 *
1163 *
1144 * The sbm1_nb_cwf_sent parameter counts the number of CWF_F1 records that have been sent.\n
1164 * The sbm1_nb_cwf_sent parameter counts the number of CWF_F1 records that have been sent.\n
1145 * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.
1165 * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.
1146 *
1166 *
1147 */
1167 */
1148
1168
1149 param_local.local_sbm1_nb_cwf_sent = 0;
1169 param_local.local_sbm1_nb_cwf_sent = 0;
1150 }
1170 }
1151
1171
1152 void reset_local_sbm2_nb_cwf_sent( void )
1172 void reset_local_sbm2_nb_cwf_sent( void )
1153 {
1173 {
1154 /** This function resets the value of the sbm2_nb_cwf_sent local parameter.
1174 /** This function resets the value of the sbm2_nb_cwf_sent local parameter.
1155 *
1175 *
1156 * The sbm2_nb_cwf_sent parameter counts the number of CWF_F2 records that have been sent.\n
1176 * The sbm2_nb_cwf_sent parameter counts the number of CWF_F2 records that have been sent.\n
1157 * This parameter is used to send CWF_F2 data as normal data when the SBM2 mode is active.
1177 * This parameter is used to send CWF_F2 data as normal data when the SBM2 mode is active.
1158 *
1178 *
1159 */
1179 */
1160
1180
1161 param_local.local_sbm2_nb_cwf_sent = 0;
1181 param_local.local_sbm2_nb_cwf_sent = 0;
1162 }
1182 }
1163
1183
1164 rtems_id get_pkts_queue_id( void )
1165 {
1166 rtems_id queue_id;
1167 rtems_status_code status;
1168 rtems_name queue_send_name;
1169
1170 queue_send_name = rtems_build_name( 'Q', '_', 'S', 'D' );
1171
1172 status = rtems_message_queue_ident( queue_send_name, 0, &queue_id );
1173 if (status != RTEMS_SUCCESSFUL)
1174 {
1175 PRINTF1("in get_pkts_queue_id *** ERR %d\n", status)
1176 }
1177 return queue_id;
1178 }
1179
1180 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1184 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1181 {
1185 {
1182 unsigned short *sequence_cnt;
1186 unsigned short *sequence_cnt;
1183 unsigned short segmentation_grouping_flag;
1187 unsigned short segmentation_grouping_flag;
1184 unsigned short new_packet_sequence_control;
1188 unsigned short new_packet_sequence_control;
1185
1189
1186 if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2)
1190 if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2)
1187 || (sid ==SID_NORM_CWF_F3) || (sid ==SID_BURST_CWF_F2) )
1191 || (sid ==SID_NORM_CWF_F3) || (sid ==SID_BURST_CWF_F2) )
1188 {
1192 {
1189 sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST;
1193 sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST;
1190 }
1194 }
1191 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) )
1195 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) )
1192 {
1196 {
1193 sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2;
1197 sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2;
1194 }
1198 }
1195 else
1199 else
1196 {
1200 {
1197 sequence_cnt = &sequenceCounters_TC_EXE[ UNKNOWN ];
1201 sequence_cnt = &sequenceCounters_TC_EXE[ UNKNOWN ];
1198 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1202 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1199 }
1203 }
1200
1204
1201 segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8;
1205 segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8;
1202 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1206 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1203
1207
1204 new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ;
1208 new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ;
1205
1209
1206 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1210 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1207 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1211 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1208
1212
1209 // increment the seuqence counter for the next packet
1213 // increment the seuqence counter for the next packet
1210 if ( *sequence_cnt < SEQ_CNT_MAX)
1214 if ( *sequence_cnt < SEQ_CNT_MAX)
1211 {
1215 {
1212 *sequence_cnt = *sequence_cnt + 1;
1216 *sequence_cnt = *sequence_cnt + 1;
1213 }
1217 }
1214 else
1218 else
1215 {
1219 {
1216 *sequence_cnt = 0;
1220 *sequence_cnt = 0;
1217 }
1221 }
1218
1222
1219 }
1223 }
General Comments 0
You need to be logged in to leave comments. Login now