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