##// END OF EJS Templates
Sync
paul -
r95:2543157c542c VHDLib206
parent child
Show More
@@ -1,248 +1,253
1 #############################################################################
1 #############################################################################
2 # Makefile for building: bin/fsw-vhdl-dev
2 # Makefile for building: bin/fsw-vhdl-dev
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Feb 6 09:29:25 2014
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Feb 13 07:43:27 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=1 -DPRINT_MESSAGES_ON_CONSOLE -DDEBUG_MESSAGES -DVHDL_DEV
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=1 -DPRINT_MESSAGES_ON_CONSOLE -DDEBUG_MESSAGES -DPRINT_TASK_STATISTICS -DVHDL_DEV
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -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 OBJECTS = obj/wf_handler.o \
57 OBJECTS = obj/wf_handler.o \
57 obj/tc_handler.o \
58 obj/tc_handler.o \
58 obj/fsw_processing.o \
59 obj/fsw_processing.o \
59 obj/fsw_misc.o \
60 obj/fsw_misc.o \
60 obj/fsw_init.o \
61 obj/fsw_init.o \
61 obj/fsw_globals.o \
62 obj/fsw_globals.o \
62 obj/fsw_spacewire.o \
63 obj/fsw_spacewire.o \
63 obj/tc_load_dump_parameters.o \
64 obj/tc_load_dump_parameters.o \
64 obj/tm_lfr_tc_exe.o \
65 obj/tm_lfr_tc_exe.o \
65 obj/tc_acceptance.o
66 obj/tc_acceptance.o \
67 obj/basic_parameters.o
66 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
68 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
67 /usr/lib64/qt4/mkspecs/common/linux.conf \
69 /usr/lib64/qt4/mkspecs/common/linux.conf \
68 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
70 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
69 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
71 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
70 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
72 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
71 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
73 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
72 /usr/lib64/qt4/mkspecs/qconfig.pri \
74 /usr/lib64/qt4/mkspecs/qconfig.pri \
73 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
75 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
74 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
76 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
75 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
77 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
76 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
78 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
77 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
79 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
78 sparc.pri \
80 sparc.pri \
79 /usr/lib64/qt4/mkspecs/features/release.prf \
81 /usr/lib64/qt4/mkspecs/features/release.prf \
80 /usr/lib64/qt4/mkspecs/features/default_post.prf \
82 /usr/lib64/qt4/mkspecs/features/default_post.prf \
81 /usr/lib64/qt4/mkspecs/features/shared.prf \
83 /usr/lib64/qt4/mkspecs/features/shared.prf \
82 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
84 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
83 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
85 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
84 /usr/lib64/qt4/mkspecs/features/resources.prf \
86 /usr/lib64/qt4/mkspecs/features/resources.prf \
85 /usr/lib64/qt4/mkspecs/features/uic.prf \
87 /usr/lib64/qt4/mkspecs/features/uic.prf \
86 /usr/lib64/qt4/mkspecs/features/yacc.prf \
88 /usr/lib64/qt4/mkspecs/features/yacc.prf \
87 /usr/lib64/qt4/mkspecs/features/lex.prf \
89 /usr/lib64/qt4/mkspecs/features/lex.prf \
88 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
90 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
89 fsw-qt.pro
91 fsw-qt.pro
90 QMAKE_TARGET = fsw-vhdl-dev
92 QMAKE_TARGET = fsw-vhdl-dev
91 DESTDIR = bin/
93 DESTDIR = bin/
92 TARGET = bin/fsw-vhdl-dev
94 TARGET = bin/fsw-vhdl-dev
93
95
94 first: all
96 first: all
95 ####### Implicit rules
97 ####### Implicit rules
96
98
97 .SUFFIXES: .o .c .cpp .cc .cxx .C
99 .SUFFIXES: .o .c .cpp .cc .cxx .C
98
100
99 .cpp.o:
101 .cpp.o:
100 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
102 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
101
103
102 .cc.o:
104 .cc.o:
103 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
105 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
104
106
105 .cxx.o:
107 .cxx.o:
106 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
108 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
107
109
108 .C.o:
110 .C.o:
109 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
111 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
110
112
111 .c.o:
113 .c.o:
112 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
114 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
113
115
114 ####### Build rules
116 ####### Build rules
115
117
116 all: Makefile $(TARGET)
118 all: Makefile $(TARGET)
117
119
118 $(TARGET): $(OBJECTS)
120 $(TARGET): $(OBJECTS)
119 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
121 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
120 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
122 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
121
123
122 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 \
123 /usr/lib64/qt4/mkspecs/common/linux.conf \
125 /usr/lib64/qt4/mkspecs/common/linux.conf \
124 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
126 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
125 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
127 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
126 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
128 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
127 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
129 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
128 /usr/lib64/qt4/mkspecs/qconfig.pri \
130 /usr/lib64/qt4/mkspecs/qconfig.pri \
129 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
131 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
130 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
132 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
131 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
133 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
132 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
134 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
133 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
135 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
134 sparc.pri \
136 sparc.pri \
135 /usr/lib64/qt4/mkspecs/features/release.prf \
137 /usr/lib64/qt4/mkspecs/features/release.prf \
136 /usr/lib64/qt4/mkspecs/features/default_post.prf \
138 /usr/lib64/qt4/mkspecs/features/default_post.prf \
137 /usr/lib64/qt4/mkspecs/features/shared.prf \
139 /usr/lib64/qt4/mkspecs/features/shared.prf \
138 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
140 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
139 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
141 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
140 /usr/lib64/qt4/mkspecs/features/resources.prf \
142 /usr/lib64/qt4/mkspecs/features/resources.prf \
141 /usr/lib64/qt4/mkspecs/features/uic.prf \
143 /usr/lib64/qt4/mkspecs/features/uic.prf \
142 /usr/lib64/qt4/mkspecs/features/yacc.prf \
144 /usr/lib64/qt4/mkspecs/features/yacc.prf \
143 /usr/lib64/qt4/mkspecs/features/lex.prf \
145 /usr/lib64/qt4/mkspecs/features/lex.prf \
144 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
146 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
145 $(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
146 /usr/lib64/qt4/mkspecs/common/unix.conf:
148 /usr/lib64/qt4/mkspecs/common/unix.conf:
147 /usr/lib64/qt4/mkspecs/common/linux.conf:
149 /usr/lib64/qt4/mkspecs/common/linux.conf:
148 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
150 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
149 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
151 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
150 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
152 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
151 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
153 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
152 /usr/lib64/qt4/mkspecs/qconfig.pri:
154 /usr/lib64/qt4/mkspecs/qconfig.pri:
153 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
155 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
154 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
156 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
155 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
157 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
156 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
158 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
157 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
159 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
158 sparc.pri:
160 sparc.pri:
159 /usr/lib64/qt4/mkspecs/features/release.prf:
161 /usr/lib64/qt4/mkspecs/features/release.prf:
160 /usr/lib64/qt4/mkspecs/features/default_post.prf:
162 /usr/lib64/qt4/mkspecs/features/default_post.prf:
161 /usr/lib64/qt4/mkspecs/features/shared.prf:
163 /usr/lib64/qt4/mkspecs/features/shared.prf:
162 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
164 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
163 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
165 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
164 /usr/lib64/qt4/mkspecs/features/resources.prf:
166 /usr/lib64/qt4/mkspecs/features/resources.prf:
165 /usr/lib64/qt4/mkspecs/features/uic.prf:
167 /usr/lib64/qt4/mkspecs/features/uic.prf:
166 /usr/lib64/qt4/mkspecs/features/yacc.prf:
168 /usr/lib64/qt4/mkspecs/features/yacc.prf:
167 /usr/lib64/qt4/mkspecs/features/lex.prf:
169 /usr/lib64/qt4/mkspecs/features/lex.prf:
168 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
170 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
169 qmake: FORCE
171 qmake: FORCE
170 @$(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
171
173
172 dist:
174 dist:
173 @$(CHK_DIR_EXISTS) obj/fsw-vhdl-dev1.0.0 || $(MKDIR) obj/fsw-vhdl-dev1.0.0
175 @$(CHK_DIR_EXISTS) obj/fsw-vhdl-dev1.0.0 || $(MKDIR) obj/fsw-vhdl-dev1.0.0
174 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw-vhdl-dev1.0.0/ && (cd `dirname obj/fsw-vhdl-dev1.0.0` && $(TAR) fsw-vhdl-dev1.0.0.tar fsw-vhdl-dev1.0.0 && $(COMPRESS) fsw-vhdl-dev1.0.0.tar) && $(MOVE) `dirname obj/fsw-vhdl-dev1.0.0`/fsw-vhdl-dev1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw-vhdl-dev1.0.0
176 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw-vhdl-dev1.0.0/ && (cd `dirname obj/fsw-vhdl-dev1.0.0` && $(TAR) fsw-vhdl-dev1.0.0.tar fsw-vhdl-dev1.0.0 && $(COMPRESS) fsw-vhdl-dev1.0.0.tar) && $(MOVE) `dirname obj/fsw-vhdl-dev1.0.0`/fsw-vhdl-dev1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw-vhdl-dev1.0.0
175
177
176
178
177 clean:compiler_clean
179 clean:compiler_clean
178 -$(DEL_FILE) $(OBJECTS)
180 -$(DEL_FILE) $(OBJECTS)
179 -$(DEL_FILE) *~ core *.core
181 -$(DEL_FILE) *~ core *.core
180
182
181
183
182 ####### Sub-libraries
184 ####### Sub-libraries
183
185
184 distclean: clean
186 distclean: clean
185 -$(DEL_FILE) $(TARGET)
187 -$(DEL_FILE) $(TARGET)
186 -$(DEL_FILE) Makefile
188 -$(DEL_FILE) Makefile
187
189
188
190
189 grmon:
191 grmon:
190 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
191
193
192 check: first
194 check: first
193
195
194 compiler_rcc_make_all:
196 compiler_rcc_make_all:
195 compiler_rcc_clean:
197 compiler_rcc_clean:
196 compiler_uic_make_all:
198 compiler_uic_make_all:
197 compiler_uic_clean:
199 compiler_uic_clean:
198 compiler_image_collection_make_all: qmake_image_collection.cpp
200 compiler_image_collection_make_all: qmake_image_collection.cpp
199 compiler_image_collection_clean:
201 compiler_image_collection_clean:
200 -$(DEL_FILE) qmake_image_collection.cpp
202 -$(DEL_FILE) qmake_image_collection.cpp
201 compiler_yacc_decl_make_all:
203 compiler_yacc_decl_make_all:
202 compiler_yacc_decl_clean:
204 compiler_yacc_decl_clean:
203 compiler_yacc_impl_make_all:
205 compiler_yacc_impl_make_all:
204 compiler_yacc_impl_clean:
206 compiler_yacc_impl_clean:
205 compiler_lex_make_all:
207 compiler_lex_make_all:
206 compiler_lex_clean:
208 compiler_lex_clean:
207 compiler_clean:
209 compiler_clean:
208
210
209 ####### Compile
211 ####### Compile
210
212
211 obj/wf_handler.o: ../src/wf_handler.c
213 obj/wf_handler.o: ../src/wf_handler.c
212 $(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
213
215
214 obj/tc_handler.o: ../src/tc_handler.c
216 obj/tc_handler.o: ../src/tc_handler.c
215 $(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
216
218
217 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
218 $(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
219
221
220 obj/fsw_misc.o: ../src/fsw_misc.c
222 obj/fsw_misc.o: ../src/fsw_misc.c
221 $(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
222
224
223 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
224 $(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
225
227
226 obj/fsw_globals.o: ../src/fsw_globals.c
228 obj/fsw_globals.o: ../src/fsw_globals.c
227 $(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
228
230
229 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
231 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
230 $(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
231
233
232 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
233 $(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
234
236
235 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
236 $(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
237
239
238 obj/tc_acceptance.o: ../src/tc_acceptance.c
240 obj/tc_acceptance.o: ../src/tc_acceptance.c
239 $(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
240
242
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
245
241 ####### Install
246 ####### Install
242
247
243 install: FORCE
248 install: FORCE
244
249
245 uninstall: FORCE
250 uninstall: FORCE
246
251
247 FORCE:
252 FORCE:
248
253
@@ -1,85 +1,88
1 TEMPLATE = app
1 TEMPLATE = app
2 # CONFIG += console v8 sim
2 # CONFIG += console v8 sim
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** gsa *** vhdl_dev
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** gsa *** vhdl_dev
4 CONFIG += console verbose debug_messages vhdl_dev
4 CONFIG += console verbose debug_messages vhdl_dev cpu_usage_report
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=1 # internal
14 DEFINES += SW_VERSION_N4=1 # internal
15
15
16 contains( CONFIG, verbose ) {
16 contains( CONFIG, verbose ) {
17 DEFINES += PRINT_MESSAGES_ON_CONSOLE
17 DEFINES += PRINT_MESSAGES_ON_CONSOLE
18 }
18 }
19
19
20 contains( CONFIG, debug_messages ) {
20 contains( CONFIG, debug_messages ) {
21 DEFINES += DEBUG_MESSAGES
21 DEFINES += DEBUG_MESSAGES
22 }
22 }
23
23
24 contains( CONFIG, cpu_usage_report ) {
24 contains( CONFIG, cpu_usage_report ) {
25 DEFINES += PRINT_TASK_STATISTICS
25 DEFINES += PRINT_TASK_STATISTICS
26 }
26 }
27
27
28 contains( CONFIG, stack_report ) {
28 contains( CONFIG, stack_report ) {
29 DEFINES += PRINT_STACK_REPORT
29 DEFINES += PRINT_STACK_REPORT
30 }
30 }
31
31
32 contains( CONFIG, boot_messages ) {
32 contains( CONFIG, boot_messages ) {
33 DEFINES += BOOT_MESSAGES
33 DEFINES += BOOT_MESSAGES
34 }
34 }
35
35
36 #doxygen.target = doxygen
36 #doxygen.target = doxygen
37 #doxygen.commands = doxygen ../doc/Doxyfile
37 #doxygen.commands = doxygen ../doc/Doxyfile
38 #QMAKE_EXTRA_TARGETS += doxygen
38 #QMAKE_EXTRA_TARGETS += doxygen
39
39
40 TARGET = fsw
40 TARGET = fsw
41 contains( CONFIG, gsa ) {
41 contains( CONFIG, gsa ) {
42 DEFINES += GSA
42 DEFINES += GSA
43 TARGET = fsw-gsa
43 TARGET = fsw-gsa
44 }
44 }
45
45
46 TARGET = fsw
46 TARGET = fsw
47 contains( CONFIG, vhdl_dev ) {
47 contains( CONFIG, vhdl_dev ) {
48 DEFINES += VHDL_DEV
48 DEFINES += VHDL_DEV
49 TARGET = fsw-vhdl-dev
49 TARGET = fsw-vhdl-dev
50 }
50 }
51
51
52 INCLUDEPATH += \
52 INCLUDEPATH += \
53 ../src \
53 ../src \
54 ../header
54 ../header \
55 ../../LFR_basic-parameters
55
56
56 SOURCES += \
57 SOURCES += \
57 ../src/wf_handler.c \
58 ../src/wf_handler.c \
58 ../src/tc_handler.c \
59 ../src/tc_handler.c \
59 ../src/fsw_processing.c \
60 ../src/fsw_processing.c \
60 ../src/fsw_misc.c \
61 ../src/fsw_misc.c \
61 ../src/fsw_init.c \
62 ../src/fsw_init.c \
62 ../src/fsw_globals.c \
63 ../src/fsw_globals.c \
63 ../src/fsw_spacewire.c \
64 ../src/fsw_spacewire.c \
64 ../src/tc_load_dump_parameters.c \
65 ../src/tc_load_dump_parameters.c \
65 ../src/tm_lfr_tc_exe.c \
66 ../src/tm_lfr_tc_exe.c \
66 ../src/tc_acceptance.c
67 ../src/tc_acceptance.c \
68 ../../LFR_basic-parameters/basic_parameters.c
67
69
68
70
69 HEADERS += \
71 HEADERS += \
70 ../header/wf_handler.h \
72 ../header/wf_handler.h \
71 ../header/tc_handler.h \
73 ../header/tc_handler.h \
72 ../header/grlib_regs.h \
74 ../header/grlib_regs.h \
73 ../header/fsw_processing.h \
75 ../header/fsw_processing.h \
74 ../header/fsw_params.h \
76 ../header/fsw_params.h \
75 ../header/fsw_misc.h \
77 ../header/fsw_misc.h \
76 ../header/fsw_init.h \
78 ../header/fsw_init.h \
77 ../header/ccsds_types.h \
79 ../header/ccsds_types.h \
78 ../header/fsw_params_processing.h \
80 ../header/fsw_params_processing.h \
79 ../header/fsw_spacewire.h \
81 ../header/fsw_spacewire.h \
80 ../header/tm_byte_positions.h \
82 ../header/tm_byte_positions.h \
81 ../header/tc_load_dump_parameters.h \
83 ../header/tc_load_dump_parameters.h \
82 ../header/tm_lfr_tc_exe.h \
84 ../header/tm_lfr_tc_exe.h \
83 ../header/tc_acceptance.h \
85 ../header/tc_acceptance.h \
84 ../header/fsw_params_nb_bytes.h
86 ../header/fsw_params_nb_bytes.h \
87 ../../LFR_basic-parameters/basic_parameters.h
85
88
@@ -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.0, 2014-02-06T15:45:54. -->
3 <!-- Written by QtCreator 3.0.0, 2014-02-13T07:01:15. -->
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,222 +1,230
1 #ifndef FSW_PARAMS_H_INCLUDED
1 #ifndef FSW_PARAMS_H_INCLUDED
2 #define FSW_PARAMS_H_INCLUDED
2 #define FSW_PARAMS_H_INCLUDED
3
3
4 #include "grlib_regs.h"
4 #include "grlib_regs.h"
5 #include "fsw_params_processing.h"
5 #include "fsw_params_processing.h"
6 #include "tm_byte_positions.h"
6 #include "tm_byte_positions.h"
7 #include "ccsds_types.h"
7 #include "ccsds_types.h"
8
8
9 #define GRSPW_DEVICE_NAME "/dev/grspw0"
9 #define GRSPW_DEVICE_NAME "/dev/grspw0"
10 #define UART_DEVICE_NAME "/dev/console"
10 #define UART_DEVICE_NAME "/dev/console"
11
11
12 typedef struct ring_node
12 typedef struct ring_node
13 {
13 {
14 struct ring_node *previous;
14 struct ring_node *previous;
15 int buffer_address;
15 int buffer_address;
16 struct ring_node *next;
16 struct ring_node *next;
17 unsigned int status;
17 unsigned int status;
18 } ring_node;
18 } ring_node;
19
19
20 typedef struct ring_node_sm
21 {
22 struct ring_node *previous;
23 volatile int *buffer_address;
24 struct ring_node *next;
25 unsigned int status;
26 } ring_node_sm;
27
20 //************************
28 //************************
21 // flight software version
29 // flight software version
22 // this parameters is handled by the Qt project options
30 // this parameters is handled by the Qt project options
23
31
24 //#define NB_SAMPLES_PER_SNAPSHOT 2048
32 //#define NB_SAMPLES_PER_SNAPSHOT 2048
25 #define NB_SAMPLES_PER_SNAPSHOT 2352 // 336 * 7 = 2352
33 #define NB_SAMPLES_PER_SNAPSHOT 2352 // 336 * 7 = 2352
26 #define TIME_OFFSET 2
34 #define TIME_OFFSET 2
27 #define TIME_OFFSET_IN_BYTES 8
35 #define TIME_OFFSET_IN_BYTES 8
28 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
36 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
29 #define NB_BYTES_SWF_BLK (2 * 6)
37 #define NB_BYTES_SWF_BLK (2 * 6)
30 #define NB_WORDS_SWF_BLK 3
38 #define NB_WORDS_SWF_BLK 3
31 #define NB_BYTES_CWF3_LIGHT_BLK 6
39 #define NB_BYTES_CWF3_LIGHT_BLK 6
32 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
40 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
33 #define NB_RING_NODES_F0 3 // AT LEAST 3
41 #define NB_RING_NODES_F0 3 // AT LEAST 3
34 #define NB_RING_NODES_F1 5 // AT LEAST 3
42 #define NB_RING_NODES_F1 5 // AT LEAST 3
35 #define NB_RING_NODES_F2 5 // AT LEAST 3
43 #define NB_RING_NODES_F2 5 // AT LEAST 3
36 #define NB_RING_NODES_ASM_F0 8 // AT LEAST 3
44 #define NB_RING_NODES_ASM_F0 12 // AT LEAST 3
37 #define NB_RING_NODES_ASM_F1 2 // AT LEAST 3
45 #define NB_RING_NODES_ASM_F1 2 // AT LEAST 3
38 #define NB_RING_NODES_ASM_F2 2 // AT LEAST 3
46 #define NB_RING_NODES_ASM_F2 2 // AT LEAST 3
39
47
40 //**********
48 //**********
41 // LFR MODES
49 // LFR MODES
42 #define LFR_MODE_STANDBY 0
50 #define LFR_MODE_STANDBY 0
43 #define LFR_MODE_NORMAL 1
51 #define LFR_MODE_NORMAL 1
44 #define LFR_MODE_BURST 2
52 #define LFR_MODE_BURST 2
45 #define LFR_MODE_SBM1 3
53 #define LFR_MODE_SBM1 3
46 #define LFR_MODE_SBM2 4
54 #define LFR_MODE_SBM2 4
47 #define LFR_MODE_NORMAL_CWF_F3 5
55 #define LFR_MODE_NORMAL_CWF_F3 5
48
56
49 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
57 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
50 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
58 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
51 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
59 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
52 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
60 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
53 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
61 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
54 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
62 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
55 #define RTEMS_EVENT_MODE_NORMAL_SWF_F0 RTEMS_EVENT_6
63 #define RTEMS_EVENT_MODE_NORMAL_SWF_F0 RTEMS_EVENT_6
56 #define RTEMS_EVENT_MODE_NORMAL_SWF_F1 RTEMS_EVENT_7
64 #define RTEMS_EVENT_MODE_NORMAL_SWF_F1 RTEMS_EVENT_7
57 #define RTEMS_EVENT_MODE_NORMAL_SWF_F2 RTEMS_EVENT_8
65 #define RTEMS_EVENT_MODE_NORMAL_SWF_F2 RTEMS_EVENT_8
58
66
59 //****************************
67 //****************************
60 // LFR DEFAULT MODE PARAMETERS
68 // LFR DEFAULT MODE PARAMETERS
61 // COMMON
69 // COMMON
62 #define DEFAULT_SY_LFR_COMMON0 0x00
70 #define DEFAULT_SY_LFR_COMMON0 0x00
63 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
71 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
64 // NORM
72 // NORM
65 #define SY_LFR_N_SWF_L 2048 // nb sample
73 #define SY_LFR_N_SWF_L 2048 // nb sample
66 #define SY_LFR_N_SWF_P 20 // sec
74 #define SY_LFR_N_SWF_P 20 // sec
67 #define SY_LFR_N_ASM_P 3600 // sec
75 #define SY_LFR_N_ASM_P 3600 // sec
68 #define SY_LFR_N_BP_P0 4 // sec
76 #define SY_LFR_N_BP_P0 4 // sec
69 #define SY_LFR_N_BP_P1 20 // sec
77 #define SY_LFR_N_BP_P1 20 // sec
70 #define MIN_DELTA_SNAPSHOT 16 // sec
78 #define MIN_DELTA_SNAPSHOT 16 // sec
71 // BURST
79 // BURST
72 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
80 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
73 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
81 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
74 // SBM1
82 // SBM1
75 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
83 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
76 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
84 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
77 // SBM2
85 // SBM2
78 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
86 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
79 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
87 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
80 // ADDITIONAL PARAMETERS
88 // ADDITIONAL PARAMETERS
81 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
89 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
82 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
90 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
83 // STATUS WORD
91 // STATUS WORD
84 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
92 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
85 #define DEFAULT_STATUS_WORD_BYTE1 0x00
93 #define DEFAULT_STATUS_WORD_BYTE1 0x00
86 //
94 //
87 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
95 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
88 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
96 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
89 //****************************
97 //****************************
90
98
91 //*****************************
99 //*****************************
92 // APB REGISTERS BASE ADDRESSES
100 // APB REGISTERS BASE ADDRESSES
93 #define REGS_ADDR_APBUART 0x80000100
101 #define REGS_ADDR_APBUART 0x80000100
94 #define REGS_ADDR_GPTIMER 0x80000300
102 #define REGS_ADDR_GPTIMER 0x80000300
95 #define REGS_ADDR_GRSPW 0x80000500
103 #define REGS_ADDR_GRSPW 0x80000500
96 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
104 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
97 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
105 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
98
106
99 #ifdef GSA
107 #ifdef GSA
100 #else
108 #else
101 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20
109 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20
102 #endif
110 #endif
103
111
104 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
112 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
105 #define APBUART_CTRL_REG_MASK_TE 0x00000002
113 #define APBUART_CTRL_REG_MASK_TE 0x00000002
106 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
114 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
107
115
108 //**********
116 //**********
109 // IRQ LINES
117 // IRQ LINES
110 #define IRQ_SM 9
118 #define IRQ_SM 9
111 #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels
119 #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels
112 #define IRQ_WF 10
120 #define IRQ_WF 10
113 #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels
121 #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels
114 #define IRQ_TIME1 12
122 #define IRQ_TIME1 12
115 #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels
123 #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels
116 #define IRQ_TIME2 13
124 #define IRQ_TIME2 13
117 #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels
125 #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels
118 #define IRQ_WAVEFORM_PICKER 14
126 #define IRQ_WAVEFORM_PICKER 14
119 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
127 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
120 #define IRQ_SPECTRAL_MATRIX 6
128 #define IRQ_SPECTRAL_MATRIX 6
121 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
129 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
122
130
123 //*****
131 //*****
124 // TIME
132 // TIME
125 #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms
133 #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms
126 #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s
134 #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s
127 #define TIMER_SM_SIMULATOR 1
135 #define TIMER_SM_SIMULATOR 1
128 #define TIMER_WF_SIMULATOR 2
136 #define TIMER_WF_SIMULATOR 2
129 #define HK_PERIOD 100 // 100 * 10ms => 1sec
137 #define HK_PERIOD 100 // 100 * 10ms => 1sec
130
138
131 //**********
139 //**********
132 // LPP CODES
140 // LPP CODES
133 #define LFR_SUCCESSFUL 0
141 #define LFR_SUCCESSFUL 0
134 #define LFR_DEFAULT 1
142 #define LFR_DEFAULT 1
135
143
136 //******
144 //******
137 // RTEMS
145 // RTEMS
138 #define TASKID_RECV 1
146 #define TASKID_RECV 1
139 #define TASKID_ACTN 2
147 #define TASKID_ACTN 2
140 #define TASKID_SPIQ 3
148 #define TASKID_SPIQ 3
141 #define TASKID_SMIQ 4
149 #define TASKID_SMIQ 4
142 #define TASKID_STAT 5
150 #define TASKID_STAT 5
143 #define TASKID_AVF0 6
151 #define TASKID_AVF0 6
144 #define TASKID_BPF0 7
152 #define TASKID_BPF0 7
145 #define TASKID_WFRM 8
153 #define TASKID_WFRM 8
146 #define TASKID_DUMB 9
154 #define TASKID_DUMB 9
147 #define TASKID_HOUS 10
155 #define TASKID_HOUS 10
148 #define TASKID_MATR 11
156 #define TASKID_MATR 11
149 #define TASKID_CWF3 12
157 #define TASKID_CWF3 12
150 #define TASKID_CWF2 13
158 #define TASKID_CWF2 13
151 #define TASKID_CWF1 14
159 #define TASKID_CWF1 14
152 #define TASKID_SEND 15
160 #define TASKID_SEND 15
153 #define TASKID_WTDG 16
161 #define TASKID_WTDG 16
154
162
155 #define TASK_PRIORITY_SPIQ 5
163 #define TASK_PRIORITY_SPIQ 5
156 #define TASK_PRIORITY_SMIQ 10
164 #define TASK_PRIORITY_SMIQ 10
157 #define TASK_PRIORITY_WTDG 20
165 #define TASK_PRIORITY_WTDG 20
158 #define TASK_PRIORITY_HOUS 30
166 #define TASK_PRIORITY_HOUS 30
159 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
167 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
160 #define TASK_PRIORITY_CWF2 35 //
168 #define TASK_PRIORITY_CWF2 35 //
161 #define TASK_PRIORITY_WFRM 40
169 #define TASK_PRIORITY_WFRM 40
162 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
170 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
163 #define TASK_PRIORITY_SEND 45
171 #define TASK_PRIORITY_SEND 45
164 #define TASK_PRIORITY_RECV 50
172 #define TASK_PRIORITY_RECV 50
165 #define TASK_PRIORITY_ACTN 50
173 #define TASK_PRIORITY_ACTN 50
166 #define TASK_PRIORITY_AVF0 60
174 #define TASK_PRIORITY_AVF0 60
167 #define TASK_PRIORITY_BPF0 60
175 #define TASK_PRIORITY_BPF0 60
168 #define TASK_PRIORITY_MATR 100
176 #define TASK_PRIORITY_MATR 100
169 #define TASK_PRIORITY_STAT 200
177 #define TASK_PRIORITY_STAT 200
170 #define TASK_PRIORITY_DUMB 200
178 #define TASK_PRIORITY_DUMB 200
171
179
172 #define ACTION_MSG_QUEUE_COUNT 10
180 #define ACTION_MSG_QUEUE_COUNT 10
173 #define ACTION_MSG_PKTS_COUNT 50
181 #define ACTION_MSG_PKTS_COUNT 50
174 #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
182 #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
175 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
183 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
176
184
177 #define QUEUE_RECV 0
185 #define QUEUE_RECV 0
178 #define QUEUE_SEND 1
186 #define QUEUE_SEND 1
179
187
180 //*******
188 //*******
181 // MACROS
189 // MACROS
182 #ifdef PRINT_MESSAGES_ON_CONSOLE
190 #ifdef PRINT_MESSAGES_ON_CONSOLE
183 #define PRINTF(x) printf(x);
191 #define PRINTF(x) printf(x);
184 #define PRINTF1(x,y) printf(x,y);
192 #define PRINTF1(x,y) printf(x,y);
185 #define PRINTF2(x,y,z) printf(x,y,z);
193 #define PRINTF2(x,y,z) printf(x,y,z);
186 #else
194 #else
187 #define PRINTF(x) ;
195 #define PRINTF(x) ;
188 #define PRINTF1(x,y) ;
196 #define PRINTF1(x,y) ;
189 #define PRINTF2(x,y,z) ;
197 #define PRINTF2(x,y,z) ;
190 #endif
198 #endif
191
199
192 #ifdef BOOT_MESSAGES
200 #ifdef BOOT_MESSAGES
193 #define BOOT_PRINTF(x) printf(x);
201 #define BOOT_PRINTF(x) printf(x);
194 #define BOOT_PRINTF1(x,y) printf(x,y);
202 #define BOOT_PRINTF1(x,y) printf(x,y);
195 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
203 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
196 #else
204 #else
197 #define BOOT_PRINTF(x) ;
205 #define BOOT_PRINTF(x) ;
198 #define BOOT_PRINTF1(x,y) ;
206 #define BOOT_PRINTF1(x,y) ;
199 #define BOOT_PRINTF2(x,y,z) ;
207 #define BOOT_PRINTF2(x,y,z) ;
200 #endif
208 #endif
201
209
202 #ifdef DEBUG_MESSAGES
210 #ifdef DEBUG_MESSAGES
203 #define DEBUG_PRINTF(x) printf(x);
211 #define DEBUG_PRINTF(x) printf(x);
204 #define DEBUG_PRINTF1(x,y) printf(x,y);
212 #define DEBUG_PRINTF1(x,y) printf(x,y);
205 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
213 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
206 #else
214 #else
207 #define DEBUG_PRINTF(x) ;
215 #define DEBUG_PRINTF(x) ;
208 #define DEBUG_PRINTF1(x,y) ;
216 #define DEBUG_PRINTF1(x,y) ;
209 #define DEBUG_PRINTF2(x,y,z) ;
217 #define DEBUG_PRINTF2(x,y,z) ;
210 #endif
218 #endif
211
219
212 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
220 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
213
221
214 struct param_local_str{
222 struct param_local_str{
215 unsigned int local_sbm1_nb_cwf_sent;
223 unsigned int local_sbm1_nb_cwf_sent;
216 unsigned int local_sbm1_nb_cwf_max;
224 unsigned int local_sbm1_nb_cwf_max;
217 unsigned int local_sbm2_nb_cwf_sent;
225 unsigned int local_sbm2_nb_cwf_sent;
218 unsigned int local_sbm2_nb_cwf_max;
226 unsigned int local_sbm2_nb_cwf_max;
219 unsigned int local_nb_interrupt_f0_MAX;
227 unsigned int local_nb_interrupt_f0_MAX;
220 };
228 };
221
229
222 #endif // FSW_PARAMS_H_INCLUDED
230 #endif // FSW_PARAMS_H_INCLUDED
@@ -1,54 +1,56
1 #ifndef FSW_PROCESSING_H_INCLUDED
1 #ifndef FSW_PROCESSING_H_INCLUDED
2 #define FSW_PROCESSING_H_INCLUDED
2 #define FSW_PROCESSING_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <grspw.h>
5 #include <grspw.h>
6 #include <math.h>
6 #include <math.h>
7 #include <stdlib.h> // abs() is in the stdlib
7 #include <stdlib.h> // abs() is in the stdlib
8 #include <stdio.h> // printf()
8 #include <stdio.h> // printf()
9 #include <math.h>
9 #include <math.h>
10
10
11 #include "fsw_params.h"
11 #include "fsw_params.h"
12 #include "fsw_spacewire.h"
12 #include "fsw_spacewire.h"
13 #include "basic_parameters.h"
13
14
14 extern volatile int sm_f0[ ][ SM_HEADER + TOTAL_SIZE_SM ];
15 extern volatile int sm_f0[ ][ SM_HEADER + TOTAL_SIZE_SM ];
15 extern volatile int sm_f1[ ][ SM_HEADER + TOTAL_SIZE_SM ];
16 extern volatile int sm_f1[ ][ SM_HEADER + TOTAL_SIZE_SM ];
16 extern volatile int sm_f2[ ][ SM_HEADER + TOTAL_SIZE_SM ];
17 extern volatile int sm_f2[ ][ SM_HEADER + TOTAL_SIZE_SM ];
17
18
18 // parameters
19 // parameters
19 extern struct param_local_str param_local;
20 extern struct param_local_str param_local;
20
21
21 // registers
22 // registers
22 extern time_management_regs_t *time_management_regs;
23 extern time_management_regs_t *time_management_regs;
23 extern spectral_matrix_regs_t *spectral_matrix_regs;
24 extern spectral_matrix_regs_t *spectral_matrix_regs;
24
25
25 extern rtems_name misc_name[5];
26 extern rtems_name misc_name[5];
26 extern rtems_id Task_id[20]; /* array of task ids */
27 extern rtems_id Task_id[20]; /* array of task ids */
27
28
28 //
29 //
29 void init_asm_rings( void );
30 void init_sm_rings( void );
31 void reset_current_sm_ring_nodes( void );
30
32
31 // ISR
33 // ISR
32 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
34 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
33 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
35 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
34
36
35 // RTEMS TASKS
37 // RTEMS TASKS
36 rtems_task spw_bppr_task(rtems_task_argument argument);
38 rtems_task spw_bppr_task(rtems_task_argument argument);
37 rtems_task avf0_task(rtems_task_argument argument);
39 rtems_task avf0_task(rtems_task_argument argument);
38 rtems_task bpf0_task(rtems_task_argument argument);
40 rtems_task bpf0_task(rtems_task_argument argument);
39 rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator
41 rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator
40 rtems_task matr_task(rtems_task_argument argument);
42 rtems_task matr_task(rtems_task_argument argument);
41
43
42 void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat);
44 void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat);
43 void matrix_reset(volatile float *averaged_spec_mat);
45 void matrix_reset(volatile float *averaged_spec_mat);
44 void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1);
46 void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1);
45 void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat);
47 void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat);
46 //
48 //
47 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header);
49 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header);
48 void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
50 void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
49 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id);
51 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id);
50 void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix);
52 void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix);
51 void fill_averaged_spectral_matrix( void );
53 void fill_averaged_spectral_matrix( void );
52 void reset_spectral_matrix_regs();
54 void reset_spectral_matrix_regs();
53
55
54 #endif // FSW_PROCESSING_H_INCLUDED
56 #endif // FSW_PROCESSING_H_INCLUDED
@@ -1,58 +1,60
1 #ifndef TC_HANDLER_H_INCLUDED
1 #ifndef TC_HANDLER_H_INCLUDED
2 #define TC_HANDLER_H_INCLUDED
2 #define TC_HANDLER_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <leon.h>
5 #include <leon.h>
6
6
7 #include "tc_load_dump_parameters.h"
7 #include "tc_load_dump_parameters.h"
8 #include "tc_acceptance.h"
8 #include "tc_acceptance.h"
9 #include "tm_lfr_tc_exe.h"
9 #include "tm_lfr_tc_exe.h"
10 #include "wf_handler.h"
10 #include "wf_handler.h"
11 #include "fsw_processing.h"
11
12
12 // MODE PARAMETERS
13 // MODE PARAMETERS
13 extern unsigned int maxCount;
14 extern unsigned int maxCount;
14
15
15 //****
16 //****
16 // ISR
17 // ISR
17 rtems_isr commutation_isr1( rtems_vector_number vector );
18 rtems_isr commutation_isr1( rtems_vector_number vector );
18 rtems_isr commutation_isr2( rtems_vector_number vector );
19 rtems_isr commutation_isr2( rtems_vector_number vector );
19
20
20 //***********
21 //***********
21 // RTEMS TASK
22 // RTEMS TASK
22 rtems_task actn_task( rtems_task_argument unused );
23 rtems_task actn_task( rtems_task_argument unused );
23
24
24 //***********
25 //***********
25 // TC ACTIONS
26 // TC ACTIONS
26 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
27 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
27 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
28 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
28 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
29 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
29 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
30 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
30 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
31 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
31 int action_update_time(ccsdsTelecommandPacket_t *TC);
32 int action_update_time(ccsdsTelecommandPacket_t *TC);
32
33
33 // mode transition
34 // mode transition
34 int transition_validation(unsigned char requestedMode);
35 int transition_validation(unsigned char requestedMode);
35 int stop_current_mode();
36 int stop_current_mode();
36 int enter_mode(unsigned char mode);
37 int enter_mode(unsigned char mode);
37 int enter_standby_mode();
38 int enter_standby_mode();
38 int enter_normal_mode();
39 int enter_normal_mode();
39 int enter_burst_mode();
40 int enter_burst_mode();
40 int enter_sbm1_mode();
41 int enter_sbm1_mode();
41 int enter_sbm2_mode();
42 int enter_sbm2_mode();
42 int restart_science_tasks();
43 int restart_science_tasks();
43 int suspend_science_tasks();
44 int suspend_science_tasks();
44 void launch_waveform_picker( unsigned char mode );
45 void launch_waveform_picker( unsigned char mode );
46 void launch_spectral_matrix( unsigned char mode );
45
47
46 // other functions
48 // other functions
47 void updateLFRCurrentMode();
49 void updateLFRCurrentMode();
48 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time);
50 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time);
49 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time);
51 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time);
50 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time);
52 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time);
51
53
52 extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id );
54 extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id );
53 extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id );
55 extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id );
54
56
55 #endif // TC_HANDLER_H_INCLUDED
57 #endif // TC_HANDLER_H_INCLUDED
56
58
57
59
58
60
@@ -1,88 +1,92
1 #ifndef WF_HANDLER_H_INCLUDED
1 #ifndef WF_HANDLER_H_INCLUDED
2 #define WF_HANDLER_H_INCLUDED
2 #define WF_HANDLER_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <grspw.h>
5 #include <grspw.h>
6 #include <stdio.h>
6 #include <stdio.h>
7 #include <math.h>
7 #include <math.h>
8
8
9 #include "fsw_params.h"
9 #include "fsw_params.h"
10 #include "fsw_spacewire.h"
10 #include "fsw_spacewire.h"
11 #include "fsw_misc.h"
11 #include "fsw_misc.h"
12
12
13 #define pi 3.1415
13 #define pi 3.1415
14
14
15 extern int fdSPW;
15 extern int fdSPW;
16
16
17 //*****************
17 //*****************
18 // waveform buffers
18 // waveform buffers
19 // F0
19 // F0
20 //extern volatile int wf_snap_f0[ ];
20 //extern volatile int wf_snap_f0[ ];
21 // F1 F2
21 // F1 F2
22 extern volatile int wf_snap_f0[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ];
22 extern volatile int wf_snap_f0[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ];
23 extern volatile int wf_snap_f1[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ];
23 extern volatile int wf_snap_f1[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ];
24 extern volatile int wf_snap_f2[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ];
24 extern volatile int wf_snap_f2[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ];
25 // F3
25 // F3
26 extern volatile int wf_cont_f3_a[ ];
26 extern volatile int wf_cont_f3_a[ ];
27 extern volatile int wf_cont_f3_b[ ];
27 extern volatile int wf_cont_f3_b[ ];
28 extern char wf_cont_f3_light[ ];
28 extern char wf_cont_f3_light[ ];
29
29
30 #ifdef VHDL_DEV
30 #ifdef VHDL_DEV
31 extern waveform_picker_regs_new_t *waveform_picker_regs;
31 extern waveform_picker_regs_new_t *waveform_picker_regs;
32 #else
32 #else
33 extern waveform_picker_regs_t *waveform_picker_regs;
33 extern waveform_picker_regs_t *waveform_picker_regs;
34 #endif
34 #endif
35 extern time_management_regs_t *time_management_regs;
35 extern time_management_regs_t *time_management_regs;
36 extern Packet_TM_LFR_HK_t housekeeping_packet;
36 extern Packet_TM_LFR_HK_t housekeeping_packet;
37 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
37 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
38 extern struct param_local_str param_local;
38 extern struct param_local_str param_local;
39
39
40 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
40 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
41 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
41 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
42
42
43 extern rtems_id Task_id[20]; /* array of task ids */
43 extern rtems_id Task_id[20]; /* array of task ids */
44
44
45 extern unsigned char lfrCurrentMode;
45 extern unsigned char lfrCurrentMode;
46
46
47 rtems_isr waveforms_isr( rtems_vector_number vector );
47 rtems_isr waveforms_isr( rtems_vector_number vector );
48 rtems_isr waveforms_isr_alt( rtems_vector_number vector );
48 rtems_task wfrm_task( rtems_task_argument argument );
49 rtems_task wfrm_task( rtems_task_argument argument );
49 rtems_task cwf3_task( rtems_task_argument argument );
50 rtems_task cwf3_task( rtems_task_argument argument );
50 rtems_task cwf2_task( rtems_task_argument argument );
51 rtems_task cwf2_task( rtems_task_argument argument );
51 rtems_task cwf1_task( rtems_task_argument argument );
52 rtems_task cwf1_task( rtems_task_argument argument );
52
53
53 //******************
54 //******************
54 // general functions
55 // general functions
55 void init_waveforms( void );
56 void init_waveforms( void );
56 void init_waveform_rings( void );
57 void init_waveform_rings( void );
57 void reset_current_ring_nodes( void );
58 void reset_current_ring_nodes( void );
58 //
59 //
59 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
60 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
60 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
61 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
61 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
62 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
62 //
63 //
63 int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
64 int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
64 int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
65 int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
65 int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
66 int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
66 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
67 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
67 //
68 //
68 void compute_acquisition_time(unsigned int *coarseTime, unsigned int *fineTime, unsigned int sid, unsigned char pa_lfr_pkt_nr );
69 void compute_acquisition_time(unsigned int *coarseTime, unsigned int *fineTime, unsigned int sid, unsigned char pa_lfr_pkt_nr );
69 //
70 //
70 rtems_id get_pkts_queue_id( void );
71 rtems_id get_pkts_queue_id( void );
71
72
72 //**************
73 //**************
73 // wfp registers
74 // wfp registers
74 void set_wfp_data_shaping();
75 void set_wfp_data_shaping();
75 char set_wfp_delta_snapshot();
76 char set_wfp_delta_snapshot();
76 void set_wfp_burst_enable_register( unsigned char mode );
77 void set_wfp_burst_enable_register( unsigned char mode );
77 void reset_wfp_burst_enable();
78 void reset_wfp_burst_enable();
78 void reset_wfp_status();
79 void reset_wfp_status();
80 void reset_waveform_picker_regs_vhdl_dev();
81 void reset_waveform_picker_regs_vhdl_dev_debug();
82 void reset_waveform_picker_regs_vhdl_dev_debug_64();
79 void reset_waveform_picker_regs();
83 void reset_waveform_picker_regs();
80 void reset_new_waveform_picker_regs();
84 void reset_new_waveform_picker_regs();
81
85
82 //*****************
86 //*****************
83 // local parameters
87 // local parameters
84 void set_local_nb_interrupt_f0_MAX( void );
88 void set_local_nb_interrupt_f0_MAX( void );
85
89
86 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid );
90 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid );
87
91
88 #endif // WF_HANDLER_H_INCLUDED
92 #endif // WF_HANDLER_H_INCLUDED
@@ -1,609 +1,610
1 /** This is the RTEMS initialization module.
1 /** This is the RTEMS initialization module.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * This module contains two very different information:
6 * This module contains two very different information:
7 * - specific instructions to configure the compilation of the RTEMS executive
7 * - specific instructions to configure the compilation of the RTEMS executive
8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
9 *
9 *
10 */
10 */
11
11
12 //*************************
12 //*************************
13 // GPL reminder to be added
13 // GPL reminder to be added
14 //*************************
14 //*************************
15
15
16 #include <rtems.h>
16 #include <rtems.h>
17
17
18 /* configuration information */
18 /* configuration information */
19
19
20 #define CONFIGURE_INIT
20 #define CONFIGURE_INIT
21
21
22 #include <bsp.h> /* for device driver prototypes */
22 #include <bsp.h> /* for device driver prototypes */
23
23
24 /* configuration information */
24 /* configuration information */
25
25
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
28
28
29 #define CONFIGURE_MAXIMUM_TASKS 20
29 #define CONFIGURE_MAXIMUM_TASKS 20
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
35 #define CONFIGURE_MAXIMUM_DRIVERS 16
35 #define CONFIGURE_MAXIMUM_DRIVERS 16
36 #define CONFIGURE_MAXIMUM_PERIODS 5
36 #define CONFIGURE_MAXIMUM_PERIODS 5
37 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
37 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
38 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2
38 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2
39 #ifdef PRINT_STACK_REPORT
39 #ifdef PRINT_STACK_REPORT
40 #define CONFIGURE_STACK_CHECKER_ENABLED
40 #define CONFIGURE_STACK_CHECKER_ENABLED
41 #endif
41 #endif
42
42
43 #include <rtems/confdefs.h>
43 #include <rtems/confdefs.h>
44
44
45 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
45 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
46 #ifdef RTEMS_DRVMGR_STARTUP
46 #ifdef RTEMS_DRVMGR_STARTUP
47 #ifdef LEON3
47 #ifdef LEON3
48 /* Add Timer and UART Driver */
48 /* Add Timer and UART Driver */
49 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
49 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
50 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
50 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
51 #endif
51 #endif
52 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
52 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
53 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
53 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
54 #endif
54 #endif
55 #endif
55 #endif
56 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
56 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
57 #include <drvmgr/drvmgr_confdefs.h>
57 #include <drvmgr/drvmgr_confdefs.h>
58 #endif
58 #endif
59
59
60 #include "fsw_init.h"
60 #include "fsw_init.h"
61 #include "fsw_config.c"
61 #include "fsw_config.c"
62
62
63 rtems_task Init( rtems_task_argument ignored )
63 rtems_task Init( rtems_task_argument ignored )
64 {
64 {
65 /** This is the RTEMS INIT taks, it the first task launched by the system.
65 /** This is the RTEMS INIT taks, it the first task launched by the system.
66 *
66 *
67 * @param unused is the starting argument of the RTEMS task
67 * @param unused is the starting argument of the RTEMS task
68 *
68 *
69 * The INIT task create and run all other RTEMS tasks.
69 * The INIT task create and run all other RTEMS tasks.
70 *
70 *
71 */
71 */
72
72
73
73
74 rtems_status_code status;
74 rtems_status_code status;
75 rtems_status_code status_spw;
75 rtems_status_code status_spw;
76 rtems_isr_entry old_isr_handler;
76 rtems_isr_entry old_isr_handler;
77
77
78 // UART settings
78 // UART settings
79 send_console_outputs_on_apbuart_port();
79 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
80 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
80 send_console_outputs_on_apbuart_port();
81 enable_apbuart_transmitter();
81 enable_apbuart_transmitter();
82 PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
82 PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
83
83
84 BOOT_PRINTF("\n\n\n\n\n")
84 BOOT_PRINTF("\n\n\n\n\n")
85 BOOT_PRINTF("***************************\n")
85 BOOT_PRINTF("***************************\n")
86 BOOT_PRINTF("** START Flight Software **\n")
86 BOOT_PRINTF("** START Flight Software **\n")
87 #ifdef VHDL_DEV
87 #ifdef VHDL_DEV
88 PRINTF("/!\\ this is the VHDL_DEV flight software /!\\ \n")
88 PRINTF("/!\\ this is the VHDL_DEV flight software /!\\ \n")
89 #endif
89 #endif
90 BOOT_PRINTF("***************************\n")
90 BOOT_PRINTF("***************************\n")
91 BOOT_PRINTF("\n\n")
91 BOOT_PRINTF("\n\n")
92
92
93 reset_wfp_burst_enable(); // stop the waveform picker if it was running
93 reset_wfp_burst_enable(); // stop the waveform picker if it was running
94 init_waveform_rings(); // initialize the waveform rings
94 init_waveform_rings(); // initialize the waveform rings
95 init_sm_rings();
95
96
96 init_parameter_dump();
97 init_parameter_dump();
97 init_local_mode_parameters();
98 init_local_mode_parameters();
98 init_housekeeping_parameters();
99 init_housekeeping_parameters();
99
100
100 updateLFRCurrentMode();
101 updateLFRCurrentMode();
101
102
102 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
103 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
103
104
104 create_names(); // create all names
105 create_names(); // create all names
105
106
106 status = create_message_queues(); // create message queues
107 status = create_message_queues(); // create message queues
107 if (status != RTEMS_SUCCESSFUL)
108 if (status != RTEMS_SUCCESSFUL)
108 {
109 {
109 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
110 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
110 }
111 }
111
112
112 status = create_all_tasks(); // create all tasks
113 status = create_all_tasks(); // create all tasks
113 if (status != RTEMS_SUCCESSFUL)
114 if (status != RTEMS_SUCCESSFUL)
114 {
115 {
115 PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status)
116 PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status)
116 }
117 }
117
118
118 // **************************
119 // **************************
119 // <SPACEWIRE INITIALIZATION>
120 // <SPACEWIRE INITIALIZATION>
120 grspw_timecode_callback = &timecode_irq_handler;
121 grspw_timecode_callback = &timecode_irq_handler;
121
122
122 status_spw = spacewire_open_link(); // (1) open the link
123 status_spw = spacewire_open_link(); // (1) open the link
123 if ( status_spw != RTEMS_SUCCESSFUL )
124 if ( status_spw != RTEMS_SUCCESSFUL )
124 {
125 {
125 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
126 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
126 }
127 }
127
128
128 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
129 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
129 {
130 {
130 status_spw = spacewire_configure_link( fdSPW );
131 status_spw = spacewire_configure_link( fdSPW );
131 if ( status_spw != RTEMS_SUCCESSFUL )
132 if ( status_spw != RTEMS_SUCCESSFUL )
132 {
133 {
133 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
134 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
134 }
135 }
135 }
136 }
136
137
137 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
138 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
138 {
139 {
139 status_spw = spacewire_start_link( fdSPW );
140 status_spw = spacewire_start_link( fdSPW );
140 if ( status_spw != RTEMS_SUCCESSFUL )
141 if ( status_spw != RTEMS_SUCCESSFUL )
141 {
142 {
142 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
143 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
143 }
144 }
144 }
145 }
145 // </SPACEWIRE INITIALIZATION>
146 // </SPACEWIRE INITIALIZATION>
146 // ***************************
147 // ***************************
147
148
148 status = start_all_tasks(); // start all tasks
149 status = start_all_tasks(); // start all tasks
149 if (status != RTEMS_SUCCESSFUL)
150 if (status != RTEMS_SUCCESSFUL)
150 {
151 {
151 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
152 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
152 }
153 }
153
154
154 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
155 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
155 status = start_recv_send_tasks();
156 status = start_recv_send_tasks();
156 if ( status != RTEMS_SUCCESSFUL )
157 if ( status != RTEMS_SUCCESSFUL )
157 {
158 {
158 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
159 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
159 }
160 }
160
161
161 // suspend science tasks. they will be restarted later depending on the mode
162 // suspend science tasks. they will be restarted later depending on the mode
162 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
163 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
163 if (status != RTEMS_SUCCESSFUL)
164 if (status != RTEMS_SUCCESSFUL)
164 {
165 {
165 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
166 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
166 }
167 }
167
168
168
169
169 //******************************
170 //******************************
170 // <SPECTRAL MATRICES SIMULATOR>
171 // <SPECTRAL MATRICES SIMULATOR>
171 LEON_Mask_interrupt( IRQ_SM );
172 LEON_Mask_interrupt( IRQ_SM );
172 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
173 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
173 IRQ_SPARC_SM, spectral_matrices_isr_simu );
174 IRQ_SPARC_SM, spectral_matrices_isr_simu );
174 // </SPECTRAL MATRICES SIMULATOR>
175 // </SPECTRAL MATRICES SIMULATOR>
175 //*******************************
176 //*******************************
176
177
177 // configure IRQ handling for the waveform picker unit
178 // configure IRQ handling for the waveform picker unit
178 status = rtems_interrupt_catch( waveforms_isr,
179 status = rtems_interrupt_catch( waveforms_isr,
179 IRQ_SPARC_WAVEFORM_PICKER,
180 IRQ_SPARC_WAVEFORM_PICKER,
180 &old_isr_handler) ;
181 &old_isr_handler) ;
181
182
182 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
183 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
183 if ( status_spw != RTEMS_SUCCESSFUL )
184 if ( status_spw != RTEMS_SUCCESSFUL )
184 {
185 {
185 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
186 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
186 if ( status != RTEMS_SUCCESSFUL ) {
187 if ( status != RTEMS_SUCCESSFUL ) {
187 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
188 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
188 }
189 }
189 }
190 }
190
191
191 BOOT_PRINTF("delete INIT\n")
192 BOOT_PRINTF("delete INIT\n")
192
193
193 status = rtems_task_delete(RTEMS_SELF);
194 status = rtems_task_delete(RTEMS_SELF);
194
195
195 }
196 }
196
197
197 void init_local_mode_parameters( void )
198 void init_local_mode_parameters( void )
198 {
199 {
199 /** This function initialize the param_local global variable with default values.
200 /** This function initialize the param_local global variable with default values.
200 *
201 *
201 */
202 */
202
203
203 unsigned int i;
204 unsigned int i;
204
205
205 // LOCAL PARAMETERS
206 // LOCAL PARAMETERS
206 set_local_nb_interrupt_f0_MAX();
207 set_local_nb_interrupt_f0_MAX();
207
208
208 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
209 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
209 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
210 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
210 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
211 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
211
212
212 // init sequence counters
213 // init sequence counters
213
214
214 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
215 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
215 {
216 {
216 sequenceCounters_TC_EXE[i] = 0x00;
217 sequenceCounters_TC_EXE[i] = 0x00;
217 }
218 }
218 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
219 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
219 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
220 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
220 }
221 }
221
222
222 void create_names( void ) // create all names for tasks and queues
223 void create_names( void ) // create all names for tasks and queues
223 {
224 {
224 /** This function creates all RTEMS names used in the software for tasks and queues.
225 /** This function creates all RTEMS names used in the software for tasks and queues.
225 *
226 *
226 * @return RTEMS directive status codes:
227 * @return RTEMS directive status codes:
227 * - RTEMS_SUCCESSFUL - successful completion
228 * - RTEMS_SUCCESSFUL - successful completion
228 *
229 *
229 */
230 */
230
231
231 // task names
232 // task names
232 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
233 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
233 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
234 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
234 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
235 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
235 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
236 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
236 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
237 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
237 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
238 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
238 Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' );
239 Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' );
239 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
240 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
240 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
241 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
241 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
242 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
242 Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' );
243 Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' );
243 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
244 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
244 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
245 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
245 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
246 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
246 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
247 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
247 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
248 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
248
249
249 // rate monotonic period names
250 // rate monotonic period names
250 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
251 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
251
252
252 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
253 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
253 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
254 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
254 }
255 }
255
256
256 int create_all_tasks( void ) // create all tasks which run in the software
257 int create_all_tasks( void ) // create all tasks which run in the software
257 {
258 {
258 /** This function creates all RTEMS tasks used in the software.
259 /** This function creates all RTEMS tasks used in the software.
259 *
260 *
260 * @return RTEMS directive status codes:
261 * @return RTEMS directive status codes:
261 * - RTEMS_SUCCESSFUL - task created successfully
262 * - RTEMS_SUCCESSFUL - task created successfully
262 * - RTEMS_INVALID_ADDRESS - id is NULL
263 * - RTEMS_INVALID_ADDRESS - id is NULL
263 * - RTEMS_INVALID_NAME - invalid task name
264 * - RTEMS_INVALID_NAME - invalid task name
264 * - RTEMS_INVALID_PRIORITY - invalid task priority
265 * - RTEMS_INVALID_PRIORITY - invalid task priority
265 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
266 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
266 * - RTEMS_TOO_MANY - too many tasks created
267 * - RTEMS_TOO_MANY - too many tasks created
267 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
268 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
268 * - RTEMS_TOO_MANY - too many global objects
269 * - RTEMS_TOO_MANY - too many global objects
269 *
270 *
270 */
271 */
271
272
272 rtems_status_code status;
273 rtems_status_code status;
273
274
274 // RECV
275 // RECV
275 status = rtems_task_create(
276 status = rtems_task_create(
276 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
277 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
277 RTEMS_DEFAULT_MODES,
278 RTEMS_DEFAULT_MODES,
278 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
279 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
279 );
280 );
280
281
281 if (status == RTEMS_SUCCESSFUL) // ACTN
282 if (status == RTEMS_SUCCESSFUL) // ACTN
282 {
283 {
283 status = rtems_task_create(
284 status = rtems_task_create(
284 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
285 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
285 RTEMS_DEFAULT_MODES,
286 RTEMS_DEFAULT_MODES,
286 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
287 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
287 );
288 );
288 }
289 }
289 if (status == RTEMS_SUCCESSFUL) // SPIQ
290 if (status == RTEMS_SUCCESSFUL) // SPIQ
290 {
291 {
291 status = rtems_task_create(
292 status = rtems_task_create(
292 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
293 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
293 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
294 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
294 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
295 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
295 );
296 );
296 }
297 }
297 if (status == RTEMS_SUCCESSFUL) // SMIQ
298 if (status == RTEMS_SUCCESSFUL) // SMIQ
298 {
299 {
299 status = rtems_task_create(
300 status = rtems_task_create(
300 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE,
301 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE,
301 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
302 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
302 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
303 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
303 );
304 );
304 }
305 }
305 if (status == RTEMS_SUCCESSFUL) // STAT
306 if (status == RTEMS_SUCCESSFUL) // STAT
306 {
307 {
307 status = rtems_task_create(
308 status = rtems_task_create(
308 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
309 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
309 RTEMS_DEFAULT_MODES,
310 RTEMS_DEFAULT_MODES,
310 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
311 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
311 );
312 );
312 }
313 }
313 if (status == RTEMS_SUCCESSFUL) // AVF0
314 if (status == RTEMS_SUCCESSFUL) // AVF0
314 {
315 {
315 status = rtems_task_create(
316 status = rtems_task_create(
316 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
317 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
317 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
318 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
318 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
319 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
319 );
320 );
320 }
321 }
321 if (status == RTEMS_SUCCESSFUL) // BPF0
322 if (status == RTEMS_SUCCESSFUL) // BPF0
322 {
323 {
323 status = rtems_task_create(
324 status = rtems_task_create(
324 Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE,
325 Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE,
325 RTEMS_DEFAULT_MODES,
326 RTEMS_DEFAULT_MODES,
326 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0]
327 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0]
327 );
328 );
328 }
329 }
329 if (status == RTEMS_SUCCESSFUL) // WFRM
330 if (status == RTEMS_SUCCESSFUL) // WFRM
330 {
331 {
331 status = rtems_task_create(
332 status = rtems_task_create(
332 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
333 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
333 RTEMS_DEFAULT_MODES,
334 RTEMS_DEFAULT_MODES,
334 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
335 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
335 );
336 );
336 }
337 }
337 if (status == RTEMS_SUCCESSFUL) // DUMB
338 if (status == RTEMS_SUCCESSFUL) // DUMB
338 {
339 {
339 status = rtems_task_create(
340 status = rtems_task_create(
340 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
341 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
341 RTEMS_DEFAULT_MODES,
342 RTEMS_DEFAULT_MODES,
342 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
343 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
343 );
344 );
344 }
345 }
345 if (status == RTEMS_SUCCESSFUL) // HOUS
346 if (status == RTEMS_SUCCESSFUL) // HOUS
346 {
347 {
347 status = rtems_task_create(
348 status = rtems_task_create(
348 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
349 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
349 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
350 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
350 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
351 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
351 );
352 );
352 }
353 }
353 if (status == RTEMS_SUCCESSFUL) // MATR
354 if (status == RTEMS_SUCCESSFUL) // MATR
354 {
355 {
355 status = rtems_task_create(
356 status = rtems_task_create(
356 Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE,
357 Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE,
357 RTEMS_DEFAULT_MODES,
358 RTEMS_DEFAULT_MODES,
358 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR]
359 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR]
359 );
360 );
360 }
361 }
361 if (status == RTEMS_SUCCESSFUL) // CWF3
362 if (status == RTEMS_SUCCESSFUL) // CWF3
362 {
363 {
363 status = rtems_task_create(
364 status = rtems_task_create(
364 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
365 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
365 RTEMS_DEFAULT_MODES,
366 RTEMS_DEFAULT_MODES,
366 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3]
367 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3]
367 );
368 );
368 }
369 }
369 if (status == RTEMS_SUCCESSFUL) // CWF2
370 if (status == RTEMS_SUCCESSFUL) // CWF2
370 {
371 {
371 status = rtems_task_create(
372 status = rtems_task_create(
372 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
373 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
373 RTEMS_DEFAULT_MODES,
374 RTEMS_DEFAULT_MODES,
374 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2]
375 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2]
375 );
376 );
376 }
377 }
377 if (status == RTEMS_SUCCESSFUL) // CWF1
378 if (status == RTEMS_SUCCESSFUL) // CWF1
378 {
379 {
379 status = rtems_task_create(
380 status = rtems_task_create(
380 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
381 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
381 RTEMS_DEFAULT_MODES,
382 RTEMS_DEFAULT_MODES,
382 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1]
383 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1]
383 );
384 );
384 }
385 }
385 if (status == RTEMS_SUCCESSFUL) // SEND
386 if (status == RTEMS_SUCCESSFUL) // SEND
386 {
387 {
387 status = rtems_task_create(
388 status = rtems_task_create(
388 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
389 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
389 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
390 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
390 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
391 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
391 );
392 );
392 }
393 }
393 if (status == RTEMS_SUCCESSFUL) // WTDG
394 if (status == RTEMS_SUCCESSFUL) // WTDG
394 {
395 {
395 status = rtems_task_create(
396 status = rtems_task_create(
396 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
397 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
397 RTEMS_DEFAULT_MODES,
398 RTEMS_DEFAULT_MODES,
398 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
399 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
399 );
400 );
400 }
401 }
401
402
402 return status;
403 return status;
403 }
404 }
404
405
405 int start_recv_send_tasks( void )
406 int start_recv_send_tasks( void )
406 {
407 {
407 rtems_status_code status;
408 rtems_status_code status;
408
409
409 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
410 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
410 if (status!=RTEMS_SUCCESSFUL) {
411 if (status!=RTEMS_SUCCESSFUL) {
411 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
412 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
412 }
413 }
413
414
414 if (status == RTEMS_SUCCESSFUL) // SEND
415 if (status == RTEMS_SUCCESSFUL) // SEND
415 {
416 {
416 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
417 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
417 if (status!=RTEMS_SUCCESSFUL) {
418 if (status!=RTEMS_SUCCESSFUL) {
418 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
419 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
419 }
420 }
420 }
421 }
421
422
422 return status;
423 return status;
423 }
424 }
424
425
425 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
426 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
426 {
427 {
427 /** This function starts all RTEMS tasks used in the software.
428 /** This function starts all RTEMS tasks used in the software.
428 *
429 *
429 * @return RTEMS directive status codes:
430 * @return RTEMS directive status codes:
430 * - RTEMS_SUCCESSFUL - ask started successfully
431 * - RTEMS_SUCCESSFUL - ask started successfully
431 * - RTEMS_INVALID_ADDRESS - invalid task entry point
432 * - RTEMS_INVALID_ADDRESS - invalid task entry point
432 * - RTEMS_INVALID_ID - invalid task id
433 * - RTEMS_INVALID_ID - invalid task id
433 * - RTEMS_INCORRECT_STATE - task not in the dormant state
434 * - RTEMS_INCORRECT_STATE - task not in the dormant state
434 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
435 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
435 *
436 *
436 */
437 */
437 // starts all the tasks fot eh flight software
438 // starts all the tasks fot eh flight software
438
439
439 rtems_status_code status;
440 rtems_status_code status;
440
441
441 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
442 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
442 if (status!=RTEMS_SUCCESSFUL) {
443 if (status!=RTEMS_SUCCESSFUL) {
443 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
444 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
444 }
445 }
445
446
446 if (status == RTEMS_SUCCESSFUL) // WTDG
447 if (status == RTEMS_SUCCESSFUL) // WTDG
447 {
448 {
448 status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 );
449 status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 );
449 if (status!=RTEMS_SUCCESSFUL) {
450 if (status!=RTEMS_SUCCESSFUL) {
450 BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n")
451 BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n")
451 }
452 }
452 }
453 }
453
454
454 if (status == RTEMS_SUCCESSFUL) // SMIQ
455 if (status == RTEMS_SUCCESSFUL) // SMIQ
455 {
456 {
456 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
457 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
457 if (status!=RTEMS_SUCCESSFUL) {
458 if (status!=RTEMS_SUCCESSFUL) {
458 BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n")
459 BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n")
459 }
460 }
460 }
461 }
461
462
462 if (status == RTEMS_SUCCESSFUL) // ACTN
463 if (status == RTEMS_SUCCESSFUL) // ACTN
463 {
464 {
464 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
465 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
465 if (status!=RTEMS_SUCCESSFUL) {
466 if (status!=RTEMS_SUCCESSFUL) {
466 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
467 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
467 }
468 }
468 }
469 }
469
470
470 if (status == RTEMS_SUCCESSFUL) // STAT
471 if (status == RTEMS_SUCCESSFUL) // STAT
471 {
472 {
472 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
473 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
473 if (status!=RTEMS_SUCCESSFUL) {
474 if (status!=RTEMS_SUCCESSFUL) {
474 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
475 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
475 }
476 }
476 }
477 }
477
478
478 if (status == RTEMS_SUCCESSFUL) // AVF0
479 if (status == RTEMS_SUCCESSFUL) // AVF0
479 {
480 {
480 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
481 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
481 if (status!=RTEMS_SUCCESSFUL) {
482 if (status!=RTEMS_SUCCESSFUL) {
482 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
483 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
483 }
484 }
484 }
485 }
485
486
486 if (status == RTEMS_SUCCESSFUL) // BPF0
487 if (status == RTEMS_SUCCESSFUL) // BPF0
487 {
488 {
488 status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 );
489 status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 );
489 if (status!=RTEMS_SUCCESSFUL) {
490 if (status!=RTEMS_SUCCESSFUL) {
490 BOOT_PRINTF("in INIT *** Error starting TASK_BPF0\n")
491 BOOT_PRINTF("in INIT *** Error starting TASK_BPF0\n")
491 }
492 }
492 }
493 }
493
494
494 if (status == RTEMS_SUCCESSFUL) // WFRM
495 if (status == RTEMS_SUCCESSFUL) // WFRM
495 {
496 {
496 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
497 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
497 if (status!=RTEMS_SUCCESSFUL) {
498 if (status!=RTEMS_SUCCESSFUL) {
498 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
499 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
499 }
500 }
500 }
501 }
501
502
502 if (status == RTEMS_SUCCESSFUL) // DUMB
503 if (status == RTEMS_SUCCESSFUL) // DUMB
503 {
504 {
504 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
505 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
505 if (status!=RTEMS_SUCCESSFUL) {
506 if (status!=RTEMS_SUCCESSFUL) {
506 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
507 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
507 }
508 }
508 }
509 }
509
510
510 if (status == RTEMS_SUCCESSFUL) // HOUS
511 if (status == RTEMS_SUCCESSFUL) // HOUS
511 {
512 {
512 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
513 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
513 if (status!=RTEMS_SUCCESSFUL) {
514 if (status!=RTEMS_SUCCESSFUL) {
514 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
515 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
515 }
516 }
516 }
517 }
517
518
518 if (status == RTEMS_SUCCESSFUL) // MATR
519 if (status == RTEMS_SUCCESSFUL) // MATR
519 {
520 {
520 status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 );
521 status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 );
521 if (status!=RTEMS_SUCCESSFUL) {
522 if (status!=RTEMS_SUCCESSFUL) {
522 BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n")
523 BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n")
523 }
524 }
524 }
525 }
525
526
526 if (status == RTEMS_SUCCESSFUL) // CWF3
527 if (status == RTEMS_SUCCESSFUL) // CWF3
527 {
528 {
528 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
529 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
529 if (status!=RTEMS_SUCCESSFUL) {
530 if (status!=RTEMS_SUCCESSFUL) {
530 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
531 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
531 }
532 }
532 }
533 }
533
534
534 if (status == RTEMS_SUCCESSFUL) // CWF2
535 if (status == RTEMS_SUCCESSFUL) // CWF2
535 {
536 {
536 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
537 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
537 if (status!=RTEMS_SUCCESSFUL) {
538 if (status!=RTEMS_SUCCESSFUL) {
538 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
539 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
539 }
540 }
540 }
541 }
541
542
542 if (status == RTEMS_SUCCESSFUL) // CWF1
543 if (status == RTEMS_SUCCESSFUL) // CWF1
543 {
544 {
544 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
545 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
545 if (status!=RTEMS_SUCCESSFUL) {
546 if (status!=RTEMS_SUCCESSFUL) {
546 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
547 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
547 }
548 }
548 }
549 }
549 return status;
550 return status;
550 }
551 }
551
552
552 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
553 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
553 {
554 {
554 rtems_status_code status_recv;
555 rtems_status_code status_recv;
555 rtems_status_code status_send;
556 rtems_status_code status_send;
556 rtems_status_code ret;
557 rtems_status_code ret;
557 rtems_id queue_id;
558 rtems_id queue_id;
558
559
559 // create the queue for handling valid TCs
560 // create the queue for handling valid TCs
560 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
561 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
561 ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE,
562 ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE,
562 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
563 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
563 if ( status_recv != RTEMS_SUCCESSFUL ) {
564 if ( status_recv != RTEMS_SUCCESSFUL ) {
564 PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv)
565 PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv)
565 }
566 }
566
567
567 // create the queue for handling TM packet sending
568 // create the queue for handling TM packet sending
568 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
569 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
569 ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE,
570 ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE,
570 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
571 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
571 if ( status_send != RTEMS_SUCCESSFUL ) {
572 if ( status_send != RTEMS_SUCCESSFUL ) {
572 PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send)
573 PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send)
573 }
574 }
574
575
575 if ( status_recv != RTEMS_SUCCESSFUL )
576 if ( status_recv != RTEMS_SUCCESSFUL )
576 {
577 {
577 ret = status_recv;
578 ret = status_recv;
578 }
579 }
579 else
580 else
580 {
581 {
581 ret = status_send;
582 ret = status_send;
582 }
583 }
583
584
584 return ret;
585 return ret;
585 }
586 }
586
587
587 rtems_status_code get_message_queue_id_send( rtems_id *queue_id )
588 rtems_status_code get_message_queue_id_send( rtems_id *queue_id )
588 {
589 {
589 rtems_status_code status;
590 rtems_status_code status;
590 rtems_name queue_name;
591 rtems_name queue_name;
591
592
592 queue_name = rtems_build_name( 'Q', '_', 'S', 'D' );
593 queue_name = rtems_build_name( 'Q', '_', 'S', 'D' );
593
594
594 status = rtems_message_queue_ident( queue_name, 0, queue_id );
595 status = rtems_message_queue_ident( queue_name, 0, queue_id );
595
596
596 return status;
597 return status;
597 }
598 }
598
599
599 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id )
600 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id )
600 {
601 {
601 rtems_status_code status;
602 rtems_status_code status;
602 rtems_name queue_name;
603 rtems_name queue_name;
603
604
604 queue_name = rtems_build_name( 'Q', '_', 'R', 'V' );
605 queue_name = rtems_build_name( 'Q', '_', 'R', 'V' );
605
606
606 status = rtems_message_queue_ident( queue_name, 0, queue_id );
607 status = rtems_message_queue_ident( queue_name, 0, queue_id );
607
608
608 return status;
609 return status;
609 }
610 }
@@ -1,341 +1,341
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 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
28 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
29 if (status!=RTEMS_SUCCESSFUL)
29 if (status!=RTEMS_SUCCESSFUL)
30 {
30 {
31 PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n")
31 PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n")
32 }
32 }
33
33
34 timer_set_clock_divider( gptimer_regs, timer, clock_divider);
34 timer_set_clock_divider( gptimer_regs, timer, clock_divider);
35 }
35 }
36
36
37 void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer)
37 void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer)
38 {
38 {
39 /** This function starts a GPTIMER timer.
39 /** This function starts a GPTIMER timer.
40 *
40 *
41 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
41 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
42 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
42 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
43 *
43 *
44 */
44 */
45
45
46 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
46 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
47 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register
47 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register
48 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer
48 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer
49 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart
49 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart
50 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable
50 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable
51 }
51 }
52
52
53 void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer)
53 void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer)
54 {
54 {
55 /** This function stops a GPTIMER timer.
55 /** This function stops a GPTIMER timer.
56 *
56 *
57 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
57 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
58 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
58 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
59 *
59 *
60 */
60 */
61
61
62 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer
62 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer
63 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable
63 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable
64 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
64 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
65 }
65 }
66
66
67 void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider)
67 void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider)
68 {
68 {
69 /** This function sets the clock divider of a GPTIMER timer.
69 /** This function sets the clock divider of a GPTIMER timer.
70 *
70 *
71 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
71 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
72 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
72 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
73 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
73 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
74 *
74 *
75 */
75 */
76
76
77 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
77 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
78 }
78 }
79
79
80 int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port
80 int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port
81 {
81 {
82 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
82 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
83
83
84 apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB;
84 apbuart_regs->ctrl = APBUART_CTRL_REG_MASK_TE;
85
85
86 return 0;
86 return 0;
87 }
87 }
88
88
89 int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register
89 int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register
90 {
90 {
91 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
91 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
92
92
93 apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE;
93 apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE;
94
94
95 return 0;
95 return 0;
96 }
96 }
97
97
98 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
98 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
99 {
99 {
100 /** This function sets the scaler reload register of the apbuart module
100 /** This function sets the scaler reload register of the apbuart module
101 *
101 *
102 * @param regs is the address of the apbuart registers in memory
102 * @param regs is the address of the apbuart registers in memory
103 * @param value is the value that will be stored in the scaler register
103 * @param value is the value that will be stored in the scaler register
104 *
104 *
105 * The value shall be set by the software to get data on the serial interface.
105 * The value shall be set by the software to get data on the serial interface.
106 *
106 *
107 */
107 */
108
108
109 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
109 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
110
110
111 apbuart_regs->scaler = value;
111 apbuart_regs->scaler = value;
112 BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value)
112 BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value)
113 }
113 }
114
114
115 //************
115 //************
116 // RTEMS TASKS
116 // RTEMS TASKS
117
117
118 rtems_task stat_task(rtems_task_argument argument)
118 rtems_task stat_task(rtems_task_argument argument)
119 {
119 {
120 int i;
120 int i;
121 int j;
121 int j;
122 i = 0;
122 i = 0;
123 j = 0;
123 j = 0;
124 BOOT_PRINTF("in STAT *** \n")
124 BOOT_PRINTF("in STAT *** \n")
125 while(1){
125 while(1){
126 rtems_task_wake_after(1000);
126 rtems_task_wake_after(1000);
127 PRINTF1("%d\n", j)
127 PRINTF1("%d\n", j)
128 if (i == CPU_USAGE_REPORT_PERIOD) {
128 if (i == CPU_USAGE_REPORT_PERIOD) {
129 // #ifdef PRINT_TASK_STATISTICS
129 // #ifdef PRINT_TASK_STATISTICS
130 // rtems_cpu_usage_report();
130 // rtems_cpu_usage_report();
131 // rtems_cpu_usage_reset();
131 // rtems_cpu_usage_reset();
132 // #endif
132 // #endif
133 i = 0;
133 i = 0;
134 }
134 }
135 else i++;
135 else i++;
136 j++;
136 j++;
137 }
137 }
138 }
138 }
139
139
140 rtems_task hous_task(rtems_task_argument argument)
140 rtems_task hous_task(rtems_task_argument argument)
141 {
141 {
142 rtems_status_code status;
142 rtems_status_code status;
143 rtems_id queue_id;
143 rtems_id queue_id;
144
144
145 status = get_message_queue_id_send( &queue_id );
145 status = get_message_queue_id_send( &queue_id );
146 if (status != RTEMS_SUCCESSFUL)
146 if (status != RTEMS_SUCCESSFUL)
147 {
147 {
148 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
148 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
149 }
149 }
150
150
151 BOOT_PRINTF("in HOUS ***\n")
151 BOOT_PRINTF("in HOUS ***\n")
152
152
153 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
153 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
154 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
154 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
155 if( status != RTEMS_SUCCESSFUL ) {
155 if( status != RTEMS_SUCCESSFUL ) {
156 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
156 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
157 }
157 }
158 }
158 }
159
159
160 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
160 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
161 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
161 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
162 housekeeping_packet.reserved = DEFAULT_RESERVED;
162 housekeeping_packet.reserved = DEFAULT_RESERVED;
163 housekeeping_packet.userApplication = CCSDS_USER_APP;
163 housekeeping_packet.userApplication = CCSDS_USER_APP;
164 housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8);
164 housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8);
165 housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK);
165 housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK);
166 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
166 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
167 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
167 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
168 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
168 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
169 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
169 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
170 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
170 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
171 housekeeping_packet.serviceType = TM_TYPE_HK;
171 housekeeping_packet.serviceType = TM_TYPE_HK;
172 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
172 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
173 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
173 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
174 housekeeping_packet.sid = SID_HK;
174 housekeeping_packet.sid = SID_HK;
175
175
176 status = rtems_rate_monotonic_cancel(HK_id);
176 status = rtems_rate_monotonic_cancel(HK_id);
177 if( status != RTEMS_SUCCESSFUL ) {
177 if( status != RTEMS_SUCCESSFUL ) {
178 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
178 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
179 }
179 }
180 else {
180 else {
181 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
181 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
182 }
182 }
183
183
184 while(1){ // launch the rate monotonic task
184 while(1){ // launch the rate monotonic task
185 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
185 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
186 if ( status != RTEMS_SUCCESSFUL ) {
186 if ( status != RTEMS_SUCCESSFUL ) {
187 PRINTF1( "in HOUS *** ERR period: %d\n", status);
187 PRINTF1( "in HOUS *** ERR period: %d\n", status);
188 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
188 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
189 }
189 }
190 else {
190 else {
191 increment_seq_counter( housekeeping_packet.packetSequenceControl );
191 increment_seq_counter( housekeeping_packet.packetSequenceControl );
192 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
192 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
193 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
193 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
194 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
194 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
195 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
195 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
196 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
196 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
197 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
197 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
198
198
199 spacewire_update_statistics();
199 spacewire_update_statistics();
200
200
201 // SEND PACKET
201 // SEND PACKET
202 status = rtems_message_queue_send( queue_id, &housekeeping_packet,
202 status = rtems_message_queue_send( queue_id, &housekeeping_packet,
203 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
203 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
204 if (status != RTEMS_SUCCESSFUL) {
204 if (status != RTEMS_SUCCESSFUL) {
205 PRINTF1("in HOUS *** ERR send: %d\n", status)
205 PRINTF1("in HOUS *** ERR send: %d\n", status)
206 }
206 }
207 }
207 }
208 }
208 }
209
209
210 PRINTF("in HOUS *** deleting task\n")
210 PRINTF("in HOUS *** deleting task\n")
211
211
212 status = rtems_task_delete( RTEMS_SELF ); // should not return
212 status = rtems_task_delete( RTEMS_SELF ); // should not return
213 printf( "rtems_task_delete returned with status of %d.\n", status );
213 printf( "rtems_task_delete returned with status of %d.\n", status );
214 return;
214 return;
215 }
215 }
216
216
217 rtems_task dumb_task( rtems_task_argument unused )
217 rtems_task dumb_task( rtems_task_argument unused )
218 {
218 {
219 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
219 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
220 *
220 *
221 * @param unused is the starting argument of the RTEMS task
221 * @param unused is the starting argument of the RTEMS task
222 *
222 *
223 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
223 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
224 *
224 *
225 */
225 */
226
226
227 unsigned int i;
227 unsigned int i;
228 unsigned int intEventOut;
228 unsigned int intEventOut;
229 unsigned int coarse_time = 0;
229 unsigned int coarse_time = 0;
230 unsigned int fine_time = 0;
230 unsigned int fine_time = 0;
231 rtems_event_set event_out;
231 rtems_event_set event_out;
232
232
233 char *DumbMessages[8] = {"in DUMB *** default", // RTEMS_EVENT_0
233 char *DumbMessages[8] = {"in DUMB *** default", // RTEMS_EVENT_0
234 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
234 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
235 "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
235 "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
236 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
236 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
237 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
237 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
238 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
238 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
239 "ERR HK", // RTEMS_EVENT_6
239 "ERR HK", // RTEMS_EVENT_6
240 "ready for dump" // RTEMS_EVENT_7
240 "ready for dump" // RTEMS_EVENT_7
241 };
241 };
242
242
243 BOOT_PRINTF("in DUMB *** \n")
243 BOOT_PRINTF("in DUMB *** \n")
244
244
245 while(1){
245 while(1){
246 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
246 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
247 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7,
247 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7,
248 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
248 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
249 intEventOut = (unsigned int) event_out;
249 intEventOut = (unsigned int) event_out;
250 for ( i=0; i<32; i++)
250 for ( i=0; i<32; i++)
251 {
251 {
252 if ( ((intEventOut >> i) & 0x0001) != 0)
252 if ( ((intEventOut >> i) & 0x0001) != 0)
253 {
253 {
254 coarse_time = time_management_regs->coarse_time;
254 coarse_time = time_management_regs->coarse_time;
255 fine_time = time_management_regs->fine_time;
255 fine_time = time_management_regs->fine_time;
256 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
256 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
257 PRINTF1("status = %x\n", waveform_picker_regs->status)
257 PRINTF1("status = %x\n", waveform_picker_regs->status)
258 }
258 }
259 }
259 }
260 }
260 }
261 }
261 }
262
262
263 //*****************************
263 //*****************************
264 // init housekeeping parameters
264 // init housekeeping parameters
265
265
266 void init_housekeeping_parameters( void )
266 void init_housekeeping_parameters( void )
267 {
267 {
268 /** This function initialize the housekeeping_packet global variable with default values.
268 /** This function initialize the housekeeping_packet global variable with default values.
269 *
269 *
270 */
270 */
271
271
272 unsigned int i = 0;
272 unsigned int i = 0;
273 unsigned char *parameters;
273 unsigned char *parameters;
274
274
275 parameters = (unsigned char*) &housekeeping_packet.lfr_status_word;
275 parameters = (unsigned char*) &housekeeping_packet.lfr_status_word;
276 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
276 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
277 {
277 {
278 parameters[i] = 0x00;
278 parameters[i] = 0x00;
279 }
279 }
280 // init status word
280 // init status word
281 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
281 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
282 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
282 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
283 // init software version
283 // init software version
284 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
284 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
285 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
285 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
286 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
286 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
287 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
287 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
288 // init fpga version
288 // init fpga version
289 parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xd0);
289 parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xd0);
290 housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1
290 housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1
291 housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2
291 housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2
292 housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3
292 housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3
293 }
293 }
294
294
295 void increment_seq_counter( unsigned char *packet_sequence_control)
295 void increment_seq_counter( unsigned char *packet_sequence_control)
296 {
296 {
297 /** This function increment the sequence counter psased in argument.
297 /** This function increment the sequence counter psased in argument.
298 *
298 *
299 * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0.
299 * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0.
300 *
300 *
301 */
301 */
302
302
303 unsigned short sequence_cnt;
303 unsigned short sequence_cnt;
304 unsigned short segmentation_grouping_flag;
304 unsigned short segmentation_grouping_flag;
305 unsigned short new_packet_sequence_control;
305 unsigned short new_packet_sequence_control;
306
306
307 segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6
307 segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6
308 sequence_cnt = (unsigned short) (
308 sequence_cnt = (unsigned short) (
309 ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0
309 ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0
310 + packet_sequence_control[1]
310 + packet_sequence_control[1]
311 );
311 );
312
312
313 if ( sequence_cnt < SEQ_CNT_MAX)
313 if ( sequence_cnt < SEQ_CNT_MAX)
314 {
314 {
315 sequence_cnt = sequence_cnt + 1;
315 sequence_cnt = sequence_cnt + 1;
316 }
316 }
317 else
317 else
318 {
318 {
319 sequence_cnt = 0;
319 sequence_cnt = 0;
320 }
320 }
321
321
322 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
322 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
323
323
324 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
324 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
325 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
325 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
326 }
326 }
327
327
328 void getTime( unsigned char *time)
328 void getTime( unsigned char *time)
329 {
329 {
330 /** This function write the current local time in the time buffer passed in argument.
330 /** This function write the current local time in the time buffer passed in argument.
331 *
331 *
332 */
332 */
333
333
334 time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
334 time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
335 time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
335 time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
336 time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
336 time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
337 time[3] = (unsigned char) (time_management_regs->coarse_time);
337 time[3] = (unsigned char) (time_management_regs->coarse_time);
338 time[4] = (unsigned char) (time_management_regs->fine_time>>8);
338 time[4] = (unsigned char) (time_management_regs->fine_time>>8);
339 time[5] = (unsigned char) (time_management_regs->fine_time);
339 time[5] = (unsigned char) (time_management_regs->fine_time);
340 }
340 }
341
341
@@ -1,646 +1,658
1 /** Functions related to data processing.
1 /** Functions related to data processing.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
7 *
7 *
8 */
8 */
9
9
10 #include <fsw_processing.h>
10 #include <fsw_processing.h>
11
11
12 #include "fsw_processing_globals.c"
12 #include "fsw_processing_globals.c"
13
13
14 //************************
14 //************************
15 // spectral matrices rings
15 // spectral matrices rings
16 ring_node sm_ring_f0[NB_RING_NODES_ASM_F0];
16 ring_node sm_ring_f0[NB_RING_NODES_ASM_F0];
17 ring_node sm_ring_f1[NB_RING_NODES_ASM_F1];
17 ring_node sm_ring_f1[NB_RING_NODES_ASM_F1];
18 ring_node sm_ring_f2[NB_RING_NODES_ASM_F2];
18 ring_node sm_ring_f2[NB_RING_NODES_ASM_F2];
19 ring_node *current_ring_node_sm_f0;
19 ring_node *current_ring_node_sm_f0;
20 ring_node *ring_node_for_averaging_sm_f0;
20 ring_node *current_ring_node_sm_f1;
21 ring_node *current_ring_node_sm_f1;
21 ring_node *current_ring_node_sm_f2;
22 ring_node *current_ring_node_sm_f2;
22
23
23 BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ];
24 BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ];
24 float averaged_sm_f0[ TOTAL_SIZE_SM ];
25 float averaged_sm_f0[ TOTAL_SIZE_SM ];
25 char averaged_sm_f0_char[ TOTAL_SIZE_SM * 2 ];
26 char averaged_sm_f0_char[ TOTAL_SIZE_SM * 2 ];
26 float compressed_sm_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
27 float compressed_sm_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
27
28
28 void init_asm_rings( void )
29 void init_sm_rings( void )
29 {
30 {
30 unsigned char i;
31 unsigned char i;
31
32
32 // F0 RING
33 // F0 RING
33 sm_ring_f0[0].next = (ring_node*) &sm_ring_f0[1];
34 sm_ring_f0[0].next = (ring_node*) &sm_ring_f0[1];
34 sm_ring_f0[0].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-1];
35 sm_ring_f0[0].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-1];
35 sm_ring_f0[0].buffer_address = (int) &sm_f0[0][0];
36 sm_ring_f0[0].buffer_address = (int) &sm_f0[0][0];
36
37
37 sm_ring_f0[NB_RING_NODES_ASM_F0-1].next = (ring_node*) &sm_ring_f0[0];
38 sm_ring_f0[NB_RING_NODES_ASM_F0-1].next = (ring_node*) &sm_ring_f0[0];
38 sm_ring_f0[NB_RING_NODES_ASM_F0-1].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-2];
39 sm_ring_f0[NB_RING_NODES_ASM_F0-1].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-2];
39 sm_ring_f0[NB_RING_NODES_ASM_F0-1].buffer_address = (int) &sm_f0[NB_RING_NODES_ASM_F0-1][0];
40 sm_ring_f0[NB_RING_NODES_ASM_F0-1].buffer_address = (int) &sm_f0[NB_RING_NODES_ASM_F0-1][0];
40
41
41 for(i=1; i<NB_RING_NODES_ASM_F0-1; i++)
42 for(i=1; i<NB_RING_NODES_ASM_F0-1; i++)
42 {
43 {
43 sm_ring_f0[i].next = (ring_node*) &sm_ring_f0[i+1];
44 sm_ring_f0[i].next = (ring_node*) &sm_ring_f0[i+1];
44 sm_ring_f0[i].previous = (ring_node*) &sm_ring_f0[i-1];
45 sm_ring_f0[i].previous = (ring_node*) &sm_ring_f0[i-1];
45 sm_ring_f0[i].buffer_address = (int) &sm_f0[i][0];
46 sm_ring_f0[i].buffer_address = (int) &sm_f0[i][0];
46 }
47 }
47
48
48 DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0)
49 DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0)
49
50
50 }
51 }
51
52
52 void reset_current_sm_ring_nodes( void )
53 void reset_current_sm_ring_nodes( void )
53 {
54 {
54 current_ring_node_sm_f0 = sm_ring_f0;
55 current_ring_node_sm_f0 = sm_ring_f0;
56 ring_node_for_averaging_sm_f0 = sm_ring_f0;
55 }
57 }
56
58
57 //***********************************************************
59 //***********************************************************
58 // Interrupt Service Routine for spectral matrices processing
60 // Interrupt Service Routine for spectral matrices processing
59 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
61 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
60 {
62 {
61 unsigned char status;
63 unsigned char status;
62 unsigned char i;
64 unsigned char i;
65 static unsigned int nb_interrupt_f0 = 0;
63
66
64 status = spectral_matrix_regs->status; //[f2 f1 f0_1 f0_0]
67 status = spectral_matrix_regs->status; //[f2 f1 f0_1 f0_0]
65 for (i=0; i<4; i++)
68 for (i=0; i<4; i++)
66 {
69 {
67 if ( ( (status >> i) & 0x01) == 1) // (1) buffer rotation
70 if ( ( (status >> i) & 0x01) == 1) // (1) buffer rotation
68 {
71 {
69 switch(i)
72 switch(i)
70 {
73 {
71 case 0:
74 case 0:
72 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
75 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
73 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
76 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
74 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe;
77 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe;
78 nb_interrupt_f0 = nb_interrupt_f0 + 1;
79 if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){
80 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
81 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
82 {
83 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
84 }
85 nb_interrupt_f0 = 0;
86 }
75 break;
87 break;
76 case 1:
88 case 1:
77 break;
89 break;
78 case 2:
90 case 2:
79 break;
91 break;
80 default:
92 default:
81 break;
93 break;
82 }
94 }
83 }
95 }
84 }
96 }
85
97
86 // reset error codes to 0
98 // reset error codes to 0
87 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // [1100 1111]
99 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // [1100 1111]
88
89 if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
90 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 );
91 }
92 }
100 }
93
101
94 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
102 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
95 {
103 {
96 if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
104 static unsigned int nb_interrupt_f0 = 0;
97 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 );
105
106 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
107 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
108 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe;
109 nb_interrupt_f0 = nb_interrupt_f0 + 1;
110 if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 )
111 {
112 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
113 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
114 {
115 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
116 }
117 nb_interrupt_f0 = 0;
98 }
118 }
99 }
119 }
100
120
101 //************
121 //************
102 // RTEMS TASKS
122 // RTEMS TASKS
103
123
104 rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ
124 rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ
105 {
125 {
106 rtems_event_set event_out;
126 rtems_event_set event_out;
107 unsigned int nb_interrupt_f0 = 0;
108
127
109 BOOT_PRINTF("in SMIQ *** \n")
128 BOOT_PRINTF("in SMIQ *** \n")
110
129
111 while(1){
130 while(1){
112 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
131 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
113 nb_interrupt_f0 = nb_interrupt_f0 + 1;
114 if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){
115 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
116 {
117 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
118 }
119 nb_interrupt_f0 = 0;
120 }
121 }
132 }
122 }
133 }
123
134
124 rtems_task spw_bppr_task(rtems_task_argument argument)
135 rtems_task spw_bppr_task(rtems_task_argument argument)
125 {
136 {
126 rtems_status_code status;
137 rtems_status_code status;
127 rtems_event_set event_out;
138 rtems_event_set event_out;
128
139
129 BOOT_PRINTF("in BPPR ***\n");
140 BOOT_PRINTF("in BPPR ***\n");
130
141
131 while( true ){ // wait for an event to begin with the processing
142 while( true ){ // wait for an event to begin with the processing
132 status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out);
143 status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out);
133 }
144 }
134 }
145 }
135
146
136 rtems_task avf0_task(rtems_task_argument argument)
147 rtems_task avf0_task(rtems_task_argument argument)
137 {
148 {
138 int i;
149 int i;
139 static int nb_average;
150 static int nb_average;
140 rtems_event_set event_out;
151 rtems_event_set event_out;
141 rtems_status_code status;
152 rtems_status_code status;
142
153
143 nb_average = 0;
154 nb_average = 0;
144
155
145 BOOT_PRINTF("in AVFO *** \n")
156 BOOT_PRINTF("in AVFO *** \n")
146
157
147 while(1){
158 while(1){
148 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
159 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
160 for (i=0; i<NB_SM_TO_RECEIVE_BEFORE_AVF0; i++)
161 {
162 ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous;
163 }
149 for(i=0; i<TOTAL_SIZE_SM; i++){
164 for(i=0; i<TOTAL_SIZE_SM; i++){
150 averaged_sm_f0[i] = current_ring_node_sm_f0[0].buffer_address
165 averaged_sm_f0[i] = ( (int *) (ring_node_for_averaging_sm_f0[0].buffer_address) )[i]
151 + current_ring_node_sm_f0[1].buffer_address
166 + ( (int *) (ring_node_for_averaging_sm_f0[1].buffer_address) )[i]
152 + current_ring_node_sm_f0[2].buffer_address
167 + ( (int *) (ring_node_for_averaging_sm_f0[2].buffer_address) )[i]
153 + current_ring_node_sm_f0[3].buffer_address
168 + ( (int *) (ring_node_for_averaging_sm_f0[3].buffer_address) )[i]
154 + current_ring_node_sm_f0[4].buffer_address
169 + ( (int *) (ring_node_for_averaging_sm_f0[4].buffer_address) )[i]
155 + current_ring_node_sm_f0[5].buffer_address
170 + ( (int *) (ring_node_for_averaging_sm_f0[5].buffer_address) )[i]
156 + current_ring_node_sm_f0[6].buffer_address
171 + ( (int *) (ring_node_for_averaging_sm_f0[6].buffer_address) )[i]
157 + current_ring_node_sm_f0[7].buffer_address;
172 + ( (int *) (ring_node_for_averaging_sm_f0[7].buffer_address) )[i];
158 }
173 }
159 nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0;
174 nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0;
160 if (nb_average == NB_AVERAGE_NORMAL_f0) {
175 if (nb_average == NB_AVERAGE_NORMAL_f0) {
161 nb_average = 0;
176 nb_average = 0;
162 status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0
177 status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0
163 if (status != RTEMS_SUCCESSFUL) {
178 if (status != RTEMS_SUCCESSFUL) {
164 printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status);
179 printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status);
165 }
180 }
166 }
181 }
167 }
182 }
168 }
183 }
169
184
170 rtems_task bpf0_task(rtems_task_argument argument)
185 rtems_task bpf0_task(rtems_task_argument argument)
171 {
186 {
172 rtems_event_set event_out;
187 rtems_event_set event_out;
173 static unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_SM_F0 * 9 ];
188 static unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_SM_F0 * 9 ];
174
189
175 BOOT_PRINTF("in BPFO *** \n")
190 BOOT_PRINTF("in BPFO *** \n")
176
191
177 while(1){
192 while(1){
178 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
193 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
179 matrix_compression(averaged_sm_f0, 0, compressed_sm_f0);
194 matrix_compression(averaged_sm_f0, 0, compressed_sm_f0);
180 BP1_set(compressed_sm_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0);
195 BP1_set(compressed_sm_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0);
181 }
196 }
182 }
197 }
183
198
184 rtems_task matr_task(rtems_task_argument argument)
199 rtems_task matr_task(rtems_task_argument argument)
185 {
200 {
186 spw_ioctl_pkt_send spw_ioctl_send_ASM;
201 spw_ioctl_pkt_send spw_ioctl_send_ASM;
187 rtems_event_set event_out;
202 rtems_event_set event_out;
188 rtems_status_code status;
203 rtems_status_code status;
189 rtems_id queue_id;
204 rtems_id queue_id;
190 Header_TM_LFR_SCIENCE_ASM_t headerASM;
205 Header_TM_LFR_SCIENCE_ASM_t headerASM;
191
206
192 init_header_asm( &headerASM );
207 init_header_asm( &headerASM );
193
208
194 status = get_message_queue_id_send( &queue_id );
209 status = get_message_queue_id_send( &queue_id );
195 if (status != RTEMS_SUCCESSFUL)
210 if (status != RTEMS_SUCCESSFUL)
196 {
211 {
197 PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status)
212 PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status)
198 }
213 }
199
214
200 BOOT_PRINTF("in MATR *** \n")
215 BOOT_PRINTF("in MATR *** \n")
201
216
202 fill_averaged_spectral_matrix( );
217 fill_averaged_spectral_matrix( );
203
218
204 while(1){
219 while(1){
205 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
220 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
206 // 1) convert the float array in a char array
221 // 1) convert the float array in a char array
207 convert_averaged_spectral_matrix( averaged_sm_f0, averaged_sm_f0_char);
222 convert_averaged_spectral_matrix( averaged_sm_f0, averaged_sm_f0_char);
208 // 2) send the spectral matrix packets
223 // 2) send the spectral matrix packets
209 send_spectral_matrix( &headerASM, averaged_sm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
224 send_spectral_matrix( &headerASM, averaged_sm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
210 }
225 }
211 }
226 }
212
227
213 //*****************************
228 //*****************************
214 // Spectral matrices processing
229 // Spectral matrices processing
215
230
216 void matrix_reset(volatile float *averaged_spec_mat)
231 void matrix_reset(volatile float *averaged_spec_mat)
217 {
232 {
218 int i;
233 int i;
219 for(i=0; i<TOTAL_SIZE_SM; i++){
234 for(i=0; i<TOTAL_SIZE_SM; i++){
220 averaged_spec_mat[i] = 0;
235 averaged_spec_mat[i] = 0;
221 }
236 }
222 }
237 }
223
238
224 void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat)
239 void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat)
225 {
240 {
226 int i;
241 int i;
227 int j;
242 int j;
228 switch (fChannel){
243 switch (fChannel){
229 case 0:
244 case 0:
230 for(i=0;i<NB_BINS_COMPRESSED_SM_F0;i++){
245 for(i=0;i<NB_BINS_COMPRESSED_SM_F0;i++){
231 j = 17 + (i * 8);
246 j = 17 + (i * 8);
232 compressed_spec_mat[i] = (averaged_spec_mat[j]
247 compressed_spec_mat[i] = (averaged_spec_mat[j]
233 + averaged_spec_mat[j+1]
248 + averaged_spec_mat[j+1]
234 + averaged_spec_mat[j+2]
249 + averaged_spec_mat[j+2]
235 + averaged_spec_mat[j+3]
250 + averaged_spec_mat[j+3]
236 + averaged_spec_mat[j+4]
251 + averaged_spec_mat[j+4]
237 + averaged_spec_mat[j+5]
252 + averaged_spec_mat[j+5]
238 + averaged_spec_mat[j+6]
253 + averaged_spec_mat[j+6]
239 + averaged_spec_mat[j+7])/(8*NB_AVERAGE_NORMAL_f0);
254 + averaged_spec_mat[j+7])/(8*NB_AVERAGE_NORMAL_f0);
240 }
255 }
241 break;
256 break;
242 case 1:
257 case 1:
243 // case fChannel = f1 to be completed later
258 // case fChannel = f1 to be completed later
244 break;
259 break;
245 case 2:
260 case 2:
246 // case fChannel = f1 to be completed later
261 // case fChannel = f1 to be completed later
247 break;
262 break;
248 default:
263 default:
249 break;
264 break;
250 }
265 }
251 }
266 }
252
267
253 void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){
268 void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){
254 int i;
269 int i;
255 int j;
270 int j;
256 unsigned char tmp_u_char;
271 unsigned char tmp_u_char;
257 unsigned char * pt_char = NULL;
272 unsigned char * pt_char = NULL;
258 float PSDB, PSDE;
273 float PSDB, PSDE;
259 float NVEC_V0;
274 float NVEC_V0;
260 float NVEC_V1;
275 float NVEC_V1;
261 float NVEC_V2;
276 float NVEC_V2;
262 //float significand;
277 //float significand;
263 //int exponent;
278 //int exponent;
264 float aux;
279 float aux;
265 float tr_SB_SB;
280 float tr_SB_SB;
266 float tmp;
281 float tmp;
267 float sx_re;
282 float sx_re;
268 float sx_im;
283 float sx_im;
269 float nebx_re = 0;
284 float nebx_re = 0;
270 float nebx_im = 0;
285 float nebx_im = 0;
271 float ny = 0;
286 float ny = 0;
272 float nz = 0;
287 float nz = 0;
273 float bx_bx_star = 0;
288 float bx_bx_star = 0;
274 for(i=0; i<nb_bins_compressed_spec_mat; i++){
289 for(i=0; i<nb_bins_compressed_spec_mat; i++){
275 //==============================================
290 //==============================================
276 // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits
291 // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits
277 PSDB = compressed_spec_mat[i*30] // S11
292 PSDB = compressed_spec_mat[i*30] // S11
278 + compressed_spec_mat[(i*30) + 10] // S22
293 + compressed_spec_mat[(i*30) + 10] // S22
279 + compressed_spec_mat[(i*30) + 18]; // S33
294 + compressed_spec_mat[(i*30) + 18]; // S33
280 //significand = frexp(PSDB, &exponent);
295 //significand = frexp(PSDB, &exponent);
281 pt_char = (unsigned char*) &PSDB;
296 pt_char = (unsigned char*) &PSDB;
282 LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float
297 LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float
283 LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float
298 LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float
284 //==============================================
299 //==============================================
285 // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits
300 // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits
286 PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44
301 PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44
287 + compressed_spec_mat[(i*30) + 28] * K55_pe // S55
302 + compressed_spec_mat[(i*30) + 28] * K55_pe // S55
288 + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45
303 + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45
289 - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45
304 - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45
290 pt_char = (unsigned char*) &PSDE;
305 pt_char = (unsigned char*) &PSDE;
291 LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float
306 LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float
292 LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float
307 LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float
293 //==============================================================================
308 //==============================================================================
294 // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits
309 // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits
295 // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits
310 // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits
296 // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits
311 // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits
297 tmp = sqrt(
312 tmp = sqrt(
298 compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12
313 compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12
299 +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13
314 +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13
300 +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23
315 +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23
301 );
316 );
302 NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23
317 NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23
303 NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13
318 NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13
304 NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12
319 NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12
305 LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127);
320 LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127);
306 LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127);
321 LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127);
307 pt_char = (unsigned char*) &NVEC_V2;
322 pt_char = (unsigned char*) &NVEC_V2;
308 LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2
323 LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2
309 //=======================================================
324 //=======================================================
310 // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits
325 // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits
311 aux = 2*tmp / PSDB; // compute the ellipticity
326 aux = 2*tmp / PSDB; // compute the ellipticity
312 tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity
327 tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity
313 LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char
328 LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char
314 //==============================================================
329 //==============================================================
315 // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits
330 // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits
316 for(j = 0; j<NB_VALUES_PER_SM;j++){
331 for(j = 0; j<NB_VALUES_PER_SM;j++){
317 tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30]
332 tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30]
318 + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10]
333 + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10]
319 + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18]
334 + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18]
320 + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2]
335 + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2]
321 + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3]
336 + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3]
322 + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4]
337 + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4]
323 + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5]
338 + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5]
324 + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12]
339 + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12]
325 + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13];
340 + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13];
326 }
341 }
327 aux = PSDB*PSDB;
342 aux = PSDB*PSDB;
328 tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) );
343 tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) );
329 tmp_u_char = (unsigned char) (NVEC_V0*(8-1));
344 tmp_u_char = (unsigned char) (NVEC_V0*(8-1));
330 LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char
345 LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char
331 //=======================================================================================
346 //=======================================================================================
332 // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1)
347 // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1)
333 sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re
348 sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re
334 + compressed_spec_mat[(i*30) + 6] * K14_sx_re
349 + compressed_spec_mat[(i*30) + 6] * K14_sx_re
335 + compressed_spec_mat[(i*30) + 8] * K15_sx_re
350 + compressed_spec_mat[(i*30) + 8] * K15_sx_re
336 + compressed_spec_mat[(i*30) + 14] * K24_sx_re
351 + compressed_spec_mat[(i*30) + 14] * K24_sx_re
337 + compressed_spec_mat[(i*30) + 16] * K25_sx_re
352 + compressed_spec_mat[(i*30) + 16] * K25_sx_re
338 + compressed_spec_mat[(i*30) + 22] * K35_sx_re;
353 + compressed_spec_mat[(i*30) + 22] * K35_sx_re;
339 sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im
354 sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im
340 + compressed_spec_mat[(i*30) + 7] * K14_sx_im
355 + compressed_spec_mat[(i*30) + 7] * K14_sx_im
341 + compressed_spec_mat[(i*30) + 9] * K15_sx_im
356 + compressed_spec_mat[(i*30) + 9] * K15_sx_im
342 + compressed_spec_mat[(i*30) + 15] * K24_sx_im
357 + compressed_spec_mat[(i*30) + 15] * K24_sx_im
343 + compressed_spec_mat[(i*30) + 17] * K25_sx_im
358 + compressed_spec_mat[(i*30) + 17] * K25_sx_im
344 + compressed_spec_mat[(i*30) + 23] * K35_sx_im;
359 + compressed_spec_mat[(i*30) + 23] * K35_sx_im;
345 LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression
360 LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression
346 if ( abs(sx_re) > abs(sx_im) ) {
361 if ( abs(sx_re) > abs(sx_im) ) {
347 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx
362 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx
348 }
363 }
349 else {
364 else {
350 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx
365 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx
351 }
366 }
352 //======================================================================
367 //======================================================================
353 // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1)
368 // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1)
354 ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2;
369 ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2;
355 nz = NVEC_V0;
370 nz = NVEC_V0;
356 bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22
371 bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22
357 + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33
372 + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33
358 - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23
373 - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23
359 nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re
374 nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re
360 +compressed_spec_mat[(i*30) + 16] * K25_ny_re
375 +compressed_spec_mat[(i*30) + 16] * K25_ny_re
361 +compressed_spec_mat[(i*30) + 20] * K34_ny_re
376 +compressed_spec_mat[(i*30) + 20] * K34_ny_re
362 +compressed_spec_mat[(i*30) + 22] * K35_ny_re)
377 +compressed_spec_mat[(i*30) + 22] * K35_ny_re)
363 + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re
378 + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re
364 +compressed_spec_mat[(i*30) + 16] * K25_nz_re
379 +compressed_spec_mat[(i*30) + 16] * K25_nz_re
365 +compressed_spec_mat[(i*30) + 20] * K34_nz_re
380 +compressed_spec_mat[(i*30) + 20] * K34_nz_re
366 +compressed_spec_mat[(i*30) + 22] * K35_nz_re);
381 +compressed_spec_mat[(i*30) + 22] * K35_nz_re);
367 nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re
382 nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re
368 +compressed_spec_mat[(i*30) + 17] * K25_ny_re
383 +compressed_spec_mat[(i*30) + 17] * K25_ny_re
369 +compressed_spec_mat[(i*30) + 21] * K34_ny_re
384 +compressed_spec_mat[(i*30) + 21] * K34_ny_re
370 +compressed_spec_mat[(i*30) + 23] * K35_ny_re)
385 +compressed_spec_mat[(i*30) + 23] * K35_ny_re)
371 + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im
386 + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im
372 +compressed_spec_mat[(i*30) + 17] * K25_nz_im
387 +compressed_spec_mat[(i*30) + 17] * K25_nz_im
373 +compressed_spec_mat[(i*30) + 21] * K34_nz_im
388 +compressed_spec_mat[(i*30) + 21] * K34_nz_im
374 +compressed_spec_mat[(i*30) + 23] * K35_nz_im);
389 +compressed_spec_mat[(i*30) + 23] * K35_nz_im);
375 tmp = nebx_re / bx_bx_star;
390 tmp = nebx_re / bx_bx_star;
376 LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression
391 LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression
377 if ( abs(nebx_re) > abs(nebx_im) ) {
392 if ( abs(nebx_re) > abs(nebx_im) ) {
378 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx
393 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx
379 }
394 }
380 else {
395 else {
381 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx
396 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx
382 }
397 }
383 }
398 }
384
399
385 }
400 }
386
401
387 void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){
402 void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){
388 // BP2 autocorrelation
403 // BP2 autocorrelation
389 int i;
404 int i;
390 int aux = 0;
405 int aux = 0;
391
406
392 for(i = 0; i<nb_bins_compressed_spec_mat; i++){
407 for(i = 0; i<nb_bins_compressed_spec_mat; i++){
393 // S12
408 // S12
394 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]);
409 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]);
395 compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux;
410 compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux;
396 compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux;
411 compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux;
397 // S13
412 // S13
398 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]);
413 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]);
399 compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux;
414 compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux;
400 compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux;
415 compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux;
401 // S23
416 // S23
402 aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]);
417 aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]);
403 compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux;
418 compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux;
404 compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux;
419 compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux;
405 // S45
420 // S45
406 aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]);
421 aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]);
407 compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux;
422 compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux;
408 compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux;
423 compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux;
409 // S14
424 // S14
410 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]);
425 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]);
411 compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux;
426 compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux;
412 compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux;
427 compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux;
413 // S15
428 // S15
414 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]);
429 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]);
415 compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux;
430 compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux;
416 compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux;
431 compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux;
417 // S24
432 // S24
418 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]);
433 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]);
419 compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux;
434 compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux;
420 compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux;
435 compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux;
421 // S25
436 // S25
422 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]);
437 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]);
423 compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux;
438 compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux;
424 compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux;
439 compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux;
425 // S34
440 // S34
426 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]);
441 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]);
427 compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux;
442 compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux;
428 compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux;
443 compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux;
429 // S35
444 // S35
430 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]);
445 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]);
431 compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux;
446 compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux;
432 compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux;
447 compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux;
433 }
448 }
434 }
449 }
435
450
436 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header)
451 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header)
437 {
452 {
438 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
453 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
439 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
454 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
440 header->reserved = 0x00;
455 header->reserved = 0x00;
441 header->userApplication = CCSDS_USER_APP;
456 header->userApplication = CCSDS_USER_APP;
442 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
457 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
443 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
458 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
444 header->packetSequenceControl[0] = 0xc0;
459 header->packetSequenceControl[0] = 0xc0;
445 header->packetSequenceControl[1] = 0x00;
460 header->packetSequenceControl[1] = 0x00;
446 header->packetLength[0] = 0x00;
461 header->packetLength[0] = 0x00;
447 header->packetLength[1] = 0x00;
462 header->packetLength[1] = 0x00;
448 // DATA FIELD HEADER
463 // DATA FIELD HEADER
449 header->spare1_pusVersion_spare2 = 0x10;
464 header->spare1_pusVersion_spare2 = 0x10;
450 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
465 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
451 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
466 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
452 header->destinationID = TM_DESTINATION_ID_GROUND;
467 header->destinationID = TM_DESTINATION_ID_GROUND;
453 // AUXILIARY DATA HEADER
468 // AUXILIARY DATA HEADER
454 header->sid = 0x00;
469 header->sid = 0x00;
455 header->biaStatusInfo = 0x00;
470 header->biaStatusInfo = 0x00;
456 header->cntASM = 0x00;
471 header->cntASM = 0x00;
457 header->nrASM = 0x00;
472 header->nrASM = 0x00;
458 header->time[0] = 0x00;
473 header->time[0] = 0x00;
459 header->time[0] = 0x00;
474 header->time[0] = 0x00;
460 header->time[0] = 0x00;
475 header->time[0] = 0x00;
461 header->time[0] = 0x00;
476 header->time[0] = 0x00;
462 header->time[0] = 0x00;
477 header->time[0] = 0x00;
463 header->time[0] = 0x00;
478 header->time[0] = 0x00;
464 header->blkNr[0] = 0x00; // BLK_NR MSB
479 header->blkNr[0] = 0x00; // BLK_NR MSB
465 header->blkNr[1] = 0x00; // BLK_NR LSB
480 header->blkNr[1] = 0x00; // BLK_NR LSB
466 }
481 }
467
482
468 void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
483 void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
469 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id)
484 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id)
470 {
485 {
471 unsigned int i;
486 unsigned int i;
472 unsigned int length = 0;
487 unsigned int length = 0;
473 rtems_status_code status;
488 rtems_status_code status;
474
489
475 header->sid = (unsigned char) sid;
490 header->sid = (unsigned char) sid;
476
491
477 for (i=0; i<2; i++)
492 for (i=0; i<2; i++)
478 {
493 {
479 // BUILD THE DATA
494 // BUILD THE DATA
480 spw_ioctl_send->dlen = TOTAL_SIZE_SM;
495 spw_ioctl_send->dlen = TOTAL_SIZE_SM;
481 spw_ioctl_send->data = &spectral_matrix[ i * TOTAL_SIZE_SM];
496 spw_ioctl_send->data = &spectral_matrix[ i * TOTAL_SIZE_SM];
482 spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES;
497 spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES;
483 spw_ioctl_send->hdr = (char *) header;
498 spw_ioctl_send->hdr = (char *) header;
484 spw_ioctl_send->options = 0;
499 spw_ioctl_send->options = 0;
485
500
486 // BUILD THE HEADER
501 // BUILD THE HEADER
487 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM;
502 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM;
488 header->packetLength[0] = (unsigned char) (length>>8);
503 header->packetLength[0] = (unsigned char) (length>>8);
489 header->packetLength[1] = (unsigned char) (length);
504 header->packetLength[1] = (unsigned char) (length);
490 header->sid = (unsigned char) sid; // SID
505 header->sid = (unsigned char) sid; // SID
491 header->cntASM = 2;
506 header->cntASM = 2;
492 header->nrASM = (unsigned char) (i+1);
507 header->nrASM = (unsigned char) (i+1);
493 header->blkNr[0] =(unsigned char) ( (NB_BINS_PER_SM/2) >> 8 ); // BLK_NR MSB
508 header->blkNr[0] =(unsigned char) ( (NB_BINS_PER_SM/2) >> 8 ); // BLK_NR MSB
494 header->blkNr[1] = (unsigned char) (NB_BINS_PER_SM/2); // BLK_NR LSB
509 header->blkNr[1] = (unsigned char) (NB_BINS_PER_SM/2); // BLK_NR LSB
495 // SET PACKET TIME
510 // SET PACKET TIME
496 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
511 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
497 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
512 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
498 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
513 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
499 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
514 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
500 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
515 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
501 header->time[5] = (unsigned char) (time_management_regs->fine_time);
516 header->time[5] = (unsigned char) (time_management_regs->fine_time);
502 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
517 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
503 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
518 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
504 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
519 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
505 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
520 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
506 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
521 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
507 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
522 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
508 // SEND PACKET
523 // SEND PACKET
509 status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
524 status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
510 if (status != RTEMS_SUCCESSFUL) {
525 if (status != RTEMS_SUCCESSFUL) {
511 printf("in send_spectral_matrix *** ERR %d\n", (int) status);
526 printf("in send_spectral_matrix *** ERR %d\n", (int) status);
512 }
527 }
513 }
528 }
514 }
529 }
515
530
516 void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix)
531 void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix)
517 {
532 {
518 unsigned int i;
533 unsigned int i;
519 unsigned int j;
534 unsigned int j;
520 char * pt_char_input;
535 char * pt_char_input;
521 char * pt_char_output;
536 char * pt_char_output;
522
537
523 pt_char_input = NULL;
538 pt_char_input = NULL;
524 pt_char_output = NULL;
539 pt_char_output = NULL;
525
540
526 for( i=0; i<NB_BINS_PER_SM; i++)
541 for( i=0; i<NB_BINS_PER_SM; i++)
527 {
542 {
528 for ( j=0; j<NB_VALUES_PER_SM; j++)
543 for ( j=0; j<NB_VALUES_PER_SM; j++)
529 {
544 {
530 pt_char_input = (char*) &input_matrix [ (i*NB_VALUES_PER_SM) + j ];
545 pt_char_input = (char*) &input_matrix [ (i*NB_VALUES_PER_SM) + j ];
531 pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ];
546 pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ];
532 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
547 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
533 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
548 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
534 }
549 }
535 }
550 }
536 }
551 }
537
552
538 void fill_averaged_spectral_matrix(void)
553 void fill_averaged_spectral_matrix(void)
539 {
554 {
540 /** This function fills spectral matrices related buffers with arbitrary data.
555 /** This function fills spectral matrices related buffers with arbitrary data.
541 *
556 *
542 * This function is for testing purpose only.
557 * This function is for testing purpose only.
543 *
558 *
544 */
559 */
545
560
546 float offset;
561 float offset;
547 float coeff;
562 float coeff;
548
563
549 offset = 10.;
564 offset = 10.;
550 coeff = 100000.;
565 coeff = 100000.;
551 averaged_sm_f0[ 0 + 25 * 0 ] = 0. + offset;
566 averaged_sm_f0[ 0 + 25 * 0 ] = 0. + offset;
552 averaged_sm_f0[ 0 + 25 * 1 ] = 1. + offset;
567 averaged_sm_f0[ 0 + 25 * 1 ] = 1. + offset;
553 averaged_sm_f0[ 0 + 25 * 2 ] = 2. + offset;
568 averaged_sm_f0[ 0 + 25 * 2 ] = 2. + offset;
554 averaged_sm_f0[ 0 + 25 * 3 ] = 3. + offset;
569 averaged_sm_f0[ 0 + 25 * 3 ] = 3. + offset;
555 averaged_sm_f0[ 0 + 25 * 4 ] = 4. + offset;
570 averaged_sm_f0[ 0 + 25 * 4 ] = 4. + offset;
556 averaged_sm_f0[ 0 + 25 * 5 ] = 5. + offset;
571 averaged_sm_f0[ 0 + 25 * 5 ] = 5. + offset;
557 averaged_sm_f0[ 0 + 25 * 6 ] = 6. + offset;
572 averaged_sm_f0[ 0 + 25 * 6 ] = 6. + offset;
558 averaged_sm_f0[ 0 + 25 * 7 ] = 7. + offset;
573 averaged_sm_f0[ 0 + 25 * 7 ] = 7. + offset;
559 averaged_sm_f0[ 0 + 25 * 8 ] = 8. + offset;
574 averaged_sm_f0[ 0 + 25 * 8 ] = 8. + offset;
560 averaged_sm_f0[ 0 + 25 * 9 ] = 9. + offset;
575 averaged_sm_f0[ 0 + 25 * 9 ] = 9. + offset;
561 averaged_sm_f0[ 0 + 25 * 10 ] = 10. + offset;
576 averaged_sm_f0[ 0 + 25 * 10 ] = 10. + offset;
562 averaged_sm_f0[ 0 + 25 * 11 ] = 11. + offset;
577 averaged_sm_f0[ 0 + 25 * 11 ] = 11. + offset;
563 averaged_sm_f0[ 0 + 25 * 12 ] = 12. + offset;
578 averaged_sm_f0[ 0 + 25 * 12 ] = 12. + offset;
564 averaged_sm_f0[ 0 + 25 * 13 ] = 13. + offset;
579 averaged_sm_f0[ 0 + 25 * 13 ] = 13. + offset;
565 averaged_sm_f0[ 0 + 25 * 14 ] = 14. + offset;
580 averaged_sm_f0[ 0 + 25 * 14 ] = 14. + offset;
566 averaged_sm_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff;
581 averaged_sm_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff;
567 averaged_sm_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff;
582 averaged_sm_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff;
568 averaged_sm_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff;
583 averaged_sm_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff;
569 averaged_sm_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff;
584 averaged_sm_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff;
570 averaged_sm_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff;
585 averaged_sm_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff;
571 averaged_sm_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff;
586 averaged_sm_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff;
572 averaged_sm_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff;
587 averaged_sm_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff;
573 averaged_sm_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff;
588 averaged_sm_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff;
574 averaged_sm_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff;
589 averaged_sm_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff;
575 averaged_sm_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff;
590 averaged_sm_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff;
576 averaged_sm_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff;
591 averaged_sm_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff;
577 averaged_sm_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff;
592 averaged_sm_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff;
578 averaged_sm_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff;
593 averaged_sm_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff;
579 averaged_sm_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff;
594 averaged_sm_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff;
580 averaged_sm_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff;
595 averaged_sm_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff;
581
596
582 offset = 10000000;
597 offset = 10000000;
583 averaged_sm_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff;
598 averaged_sm_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff;
584 averaged_sm_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff;
599 averaged_sm_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff;
585 averaged_sm_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff;
600 averaged_sm_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff;
586 averaged_sm_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff;
601 averaged_sm_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff;
587 averaged_sm_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff;
602 averaged_sm_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff;
588 averaged_sm_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff;
603 averaged_sm_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff;
589 averaged_sm_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff;
604 averaged_sm_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff;
590 averaged_sm_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff;
605 averaged_sm_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff;
591 averaged_sm_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff;
606 averaged_sm_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff;
592 averaged_sm_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff;
607 averaged_sm_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff;
593 averaged_sm_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff;
608 averaged_sm_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff;
594 averaged_sm_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff;
609 averaged_sm_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff;
595 averaged_sm_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff;
610 averaged_sm_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff;
596 averaged_sm_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff;
611 averaged_sm_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff;
597 averaged_sm_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff;
612 averaged_sm_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff;
598
613
599 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_sm_f0[ 0 ];
614 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_sm_f0[ 0 ];
600 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_sm_f0[ 1 ];
615 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_sm_f0[ 1 ];
601 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_sm_f0[ 2 ];
616 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_sm_f0[ 2 ];
602 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_sm_f0[ 3 ];
617 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_sm_f0[ 3 ];
603 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_sm_f0[ 4 ];
618 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_sm_f0[ 4 ];
604 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_sm_f0[ 5 ];
619 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_sm_f0[ 5 ];
605 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_sm_f0[ 6 ];
620 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_sm_f0[ 6 ];
606 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_sm_f0[ 7 ];
621 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_sm_f0[ 7 ];
607 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_sm_f0[ 8 ];
622 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_sm_f0[ 8 ];
608 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_sm_f0[ 9 ];
623 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_sm_f0[ 9 ];
609 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_sm_f0[ 10 ];
624 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_sm_f0[ 10 ];
610 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_sm_f0[ 11 ];
625 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_sm_f0[ 11 ];
611 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_sm_f0[ 12 ];
626 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_sm_f0[ 12 ];
612 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_sm_f0[ 13 ];
627 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_sm_f0[ 13 ];
613 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_sm_f0[ 14 ];
628 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_sm_f0[ 14 ];
614 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_sm_f0[ 15 ];
629 averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_sm_f0[ 15 ];
615 }
630 }
616
631
617 void reset_spectral_matrix_regs()
632 void reset_spectral_matrix_regs()
618 {
633 {
619 /** This function resets the spectral matrices module registers.
634 /** This function resets the spectral matrices module registers.
620 *
635 *
621 * The registers affected by this function are located at the following offset addresses:
636 * The registers affected by this function are located at the following offset addresses:
622 *
637 *
623 * - 0x00 config
638 * - 0x00 config
624 * - 0x04 status
639 * - 0x04 status
625 * - 0x08 matrixF0_Address0
640 * - 0x08 matrixF0_Address0
626 * - 0x10 matrixFO_Address1
641 * - 0x10 matrixFO_Address1
627 * - 0x14 matrixF1_Address
642 * - 0x14 matrixF1_Address
628 * - 0x18 matrixF2_Address
643 * - 0x18 matrixF2_Address
629 *
644 *
630 */
645 */
631
646
632 #ifdef GSA
633 #else
634 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
647 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
635 spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address;
648 spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address;
636 spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address;
649 spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address;
637 spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address;
650 spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address;
638 #endif
639 }
651 }
640
652
641 //******************
653 //******************
642 // general functions
654 // general functions
643
655
644
656
645
657
646
658
@@ -1,833 +1,837
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, time );
71 close_action( &TC, result, queue_snd_id, time );
72 break;
72 break;
73 //
73 //
74 case TC_SUBTYPE_LOAD_COMM:
74 case TC_SUBTYPE_LOAD_COMM:
75 result = action_load_common_par( &TC );
75 result = action_load_common_par( &TC );
76 close_action( &TC, result, queue_snd_id, time );
76 close_action( &TC, result, queue_snd_id, time );
77 break;
77 break;
78 //
78 //
79 case TC_SUBTYPE_LOAD_NORM:
79 case TC_SUBTYPE_LOAD_NORM:
80 result = action_load_normal_par( &TC, queue_snd_id, time );
80 result = action_load_normal_par( &TC, queue_snd_id, time );
81 close_action( &TC, result, queue_snd_id, time );
81 close_action( &TC, result, queue_snd_id, time );
82 break;
82 break;
83 //
83 //
84 case TC_SUBTYPE_LOAD_BURST:
84 case TC_SUBTYPE_LOAD_BURST:
85 result = action_load_burst_par( &TC, queue_snd_id, time );
85 result = action_load_burst_par( &TC, queue_snd_id, time );
86 close_action( &TC, result, queue_snd_id, time );
86 close_action( &TC, result, queue_snd_id, time );
87 break;
87 break;
88 //
88 //
89 case TC_SUBTYPE_LOAD_SBM1:
89 case TC_SUBTYPE_LOAD_SBM1:
90 result = action_load_sbm1_par( &TC, queue_snd_id, time );
90 result = action_load_sbm1_par( &TC, queue_snd_id, time );
91 close_action( &TC, result, queue_snd_id, time );
91 close_action( &TC, result, queue_snd_id, time );
92 break;
92 break;
93 //
93 //
94 case TC_SUBTYPE_LOAD_SBM2:
94 case TC_SUBTYPE_LOAD_SBM2:
95 result = action_load_sbm2_par( &TC, queue_snd_id, time );
95 result = action_load_sbm2_par( &TC, queue_snd_id, time );
96 close_action( &TC, result, queue_snd_id, time );
96 close_action( &TC, result, queue_snd_id, time );
97 break;
97 break;
98 //
98 //
99 case TC_SUBTYPE_DUMP:
99 case TC_SUBTYPE_DUMP:
100 result = action_dump_par( queue_snd_id );
100 result = action_dump_par( queue_snd_id );
101 close_action( &TC, result, queue_snd_id, time );
101 close_action( &TC, result, queue_snd_id, time );
102 break;
102 break;
103 //
103 //
104 case TC_SUBTYPE_ENTER:
104 case TC_SUBTYPE_ENTER:
105 result = action_enter_mode( &TC, queue_snd_id, time );
105 result = action_enter_mode( &TC, queue_snd_id, time );
106 close_action( &TC, result, queue_snd_id, time );
106 close_action( &TC, result, queue_snd_id, time );
107 break;
107 break;
108 //
108 //
109 case TC_SUBTYPE_UPDT_INFO:
109 case TC_SUBTYPE_UPDT_INFO:
110 result = action_update_info( &TC, queue_snd_id );
110 result = action_update_info( &TC, queue_snd_id );
111 close_action( &TC, result, queue_snd_id, time );
111 close_action( &TC, result, queue_snd_id, time );
112 break;
112 break;
113 //
113 //
114 case TC_SUBTYPE_EN_CAL:
114 case TC_SUBTYPE_EN_CAL:
115 result = action_enable_calibration( &TC, queue_snd_id, time );
115 result = action_enable_calibration( &TC, queue_snd_id, time );
116 close_action( &TC, result, queue_snd_id, time );
116 close_action( &TC, result, queue_snd_id, time );
117 break;
117 break;
118 //
118 //
119 case TC_SUBTYPE_DIS_CAL:
119 case TC_SUBTYPE_DIS_CAL:
120 result = action_disable_calibration( &TC, queue_snd_id, time );
120 result = action_disable_calibration( &TC, queue_snd_id, time );
121 close_action( &TC, result, queue_snd_id, time );
121 close_action( &TC, result, queue_snd_id, time );
122 break;
122 break;
123 //
123 //
124 case TC_SUBTYPE_UPDT_TIME:
124 case TC_SUBTYPE_UPDT_TIME:
125 result = action_update_time( &TC );
125 result = action_update_time( &TC );
126 close_action( &TC, result, queue_snd_id, time );
126 close_action( &TC, result, queue_snd_id, time );
127 break;
127 break;
128 //
128 //
129 default:
129 default:
130 break;
130 break;
131 }
131 }
132 }
132 }
133 }
133 }
134 }
134 }
135
135
136 //***********
136 //***********
137 // TC ACTIONS
137 // TC ACTIONS
138
138
139 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
139 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
140 {
140 {
141 /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
141 /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
142 *
142 *
143 * @param TC points to the TeleCommand packet that is being processed
143 * @param TC points to the TeleCommand packet that is being processed
144 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
144 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
145 *
145 *
146 */
146 */
147
147
148 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
148 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
149 return LFR_DEFAULT;
149 return LFR_DEFAULT;
150 }
150 }
151
151
152 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
152 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
153 {
153 {
154 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
154 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
155 *
155 *
156 * @param TC points to the TeleCommand packet that is being processed
156 * @param TC points to the TeleCommand packet that is being processed
157 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
157 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
158 *
158 *
159 */
159 */
160
160
161 rtems_status_code status;
161 rtems_status_code status;
162 unsigned char requestedMode;
162 unsigned char requestedMode;
163
163
164 requestedMode = TC->dataAndCRC[1];
164 requestedMode = TC->dataAndCRC[1];
165
165
166 if ( (requestedMode != LFR_MODE_STANDBY)
166 if ( (requestedMode != LFR_MODE_STANDBY)
167 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
167 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
168 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
168 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
169 {
169 {
170 status = RTEMS_UNSATISFIED;
170 status = RTEMS_UNSATISFIED;
171 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode, time );
171 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode, time );
172 }
172 }
173 else
173 else
174 {
174 {
175 printf("in action_enter_mode *** enter mode %d\n", requestedMode);
175 printf("in action_enter_mode *** enter mode %d\n", requestedMode);
176
176
177 #ifdef PRINT_TASK_STATISTICS
177 #ifdef PRINT_TASK_STATISTICS
178 if (requestedMode != LFR_MODE_STANDBY)
178 if (requestedMode != LFR_MODE_STANDBY)
179 {
179 {
180 rtems_cpu_usage_reset();
180 rtems_cpu_usage_reset();
181 maxCount = 0;
181 maxCount = 0;
182 }
182 }
183 #endif
183 #endif
184
184
185 status = transition_validation(requestedMode);
185 status = transition_validation(requestedMode);
186
186
187 if ( status == LFR_SUCCESSFUL ) {
187 if ( status == LFR_SUCCESSFUL ) {
188 if ( lfrCurrentMode != LFR_MODE_STANDBY)
188 if ( lfrCurrentMode != LFR_MODE_STANDBY)
189 {
189 {
190 status = stop_current_mode();
190 status = stop_current_mode();
191 }
191 }
192 if (status != RTEMS_SUCCESSFUL)
192 if (status != RTEMS_SUCCESSFUL)
193 {
193 {
194 PRINTF("ERR *** in action_enter *** stop_current_mode\n")
194 PRINTF("ERR *** in action_enter *** stop_current_mode\n")
195 }
195 }
196 status = enter_mode( requestedMode );
196 status = enter_mode( requestedMode );
197 }
197 }
198 else
198 else
199 {
199 {
200 PRINTF("ERR *** in action_enter *** transition rejected\n")
200 PRINTF("ERR *** in action_enter *** transition rejected\n")
201 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
201 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
202 }
202 }
203 }
203 }
204
204
205 return status;
205 return status;
206 }
206 }
207
207
208 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
208 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
209 {
209 {
210 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
210 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
211 *
211 *
212 * @param TC points to the TeleCommand packet that is being processed
212 * @param TC points to the TeleCommand packet that is being processed
213 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
213 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
214 *
214 *
215 * @return LFR directive status code:
215 * @return LFR directive status code:
216 * - LFR_DEFAULT
216 * - LFR_DEFAULT
217 * - LFR_SUCCESSFUL
217 * - LFR_SUCCESSFUL
218 *
218 *
219 */
219 */
220
220
221 unsigned int val;
221 unsigned int val;
222 int result;
222 int result;
223
223
224 result = LFR_SUCCESSFUL;
224 result = LFR_SUCCESSFUL;
225
225
226 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
226 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
227 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
227 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
228 val++;
228 val++;
229 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
229 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
230 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
230 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
231
231
232 return result;
232 return result;
233 }
233 }
234
234
235 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
235 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
236 {
236 {
237 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
237 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
238 *
238 *
239 * @param TC points to the TeleCommand packet that is being processed
239 * @param TC points to the TeleCommand packet that is being processed
240 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
240 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
241 *
241 *
242 */
242 */
243
243
244 int result;
244 int result;
245 unsigned char lfrMode;
245 unsigned char lfrMode;
246
246
247 result = LFR_DEFAULT;
247 result = LFR_DEFAULT;
248 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
248 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
249
249
250 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
250 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
251 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
251 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
252 result = LFR_DEFAULT;
252 result = LFR_DEFAULT;
253 }
253 }
254 else {
254 else {
255 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
255 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
256 result = LFR_DEFAULT;
256 result = LFR_DEFAULT;
257 }
257 }
258 return result;
258 return result;
259 }
259 }
260
260
261 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
261 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
262 {
262 {
263 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
263 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
264 *
264 *
265 * @param TC points to the TeleCommand packet that is being processed
265 * @param TC points to the TeleCommand packet that is being processed
266 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
266 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
267 *
267 *
268 */
268 */
269
269
270 int result;
270 int result;
271 unsigned char lfrMode;
271 unsigned char lfrMode;
272
272
273 result = LFR_DEFAULT;
273 result = LFR_DEFAULT;
274 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
274 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
275
275
276 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
276 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
277 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
277 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
278 result = LFR_DEFAULT;
278 result = LFR_DEFAULT;
279 }
279 }
280 else {
280 else {
281 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
281 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
282 result = LFR_DEFAULT;
282 result = LFR_DEFAULT;
283 }
283 }
284 return result;
284 return result;
285 }
285 }
286
286
287 int action_update_time(ccsdsTelecommandPacket_t *TC)
287 int action_update_time(ccsdsTelecommandPacket_t *TC)
288 {
288 {
289 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
289 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
290 *
290 *
291 * @param TC points to the TeleCommand packet that is being processed
291 * @param TC points to the TeleCommand packet that is being processed
292 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
292 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
293 *
293 *
294 * @return LFR_SUCCESSFUL
294 * @return LFR_SUCCESSFUL
295 *
295 *
296 */
296 */
297
297
298 unsigned int val;
298 unsigned int val;
299
299
300 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
300 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
301 + (TC->dataAndCRC[1] << 16)
301 + (TC->dataAndCRC[1] << 16)
302 + (TC->dataAndCRC[2] << 8)
302 + (TC->dataAndCRC[2] << 8)
303 + TC->dataAndCRC[3];
303 + TC->dataAndCRC[3];
304 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
304 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
305 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
305 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
306 val++;
306 val++;
307 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
307 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
308 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
308 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
309 time_management_regs->ctrl = time_management_regs->ctrl | 1;
309 time_management_regs->ctrl = time_management_regs->ctrl | 1;
310
310
311 return LFR_SUCCESSFUL;
311 return LFR_SUCCESSFUL;
312 }
312 }
313
313
314 //*******************
314 //*******************
315 // ENTERING THE MODES
315 // ENTERING THE MODES
316
316
317 int transition_validation(unsigned char requestedMode)
317 int transition_validation(unsigned char requestedMode)
318 {
318 {
319 /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
319 /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
320 *
320 *
321 * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
321 * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
322 *
322 *
323 * @return LFR directive status codes:
323 * @return LFR directive status codes:
324 * - LFR_SUCCESSFUL - the transition is authorized
324 * - LFR_SUCCESSFUL - the transition is authorized
325 * - LFR_DEFAULT - the transition is not authorized
325 * - LFR_DEFAULT - the transition is not authorized
326 *
326 *
327 */
327 */
328
328
329 int status;
329 int status;
330
330
331 switch (requestedMode)
331 switch (requestedMode)
332 {
332 {
333 case LFR_MODE_STANDBY:
333 case LFR_MODE_STANDBY:
334 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
334 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
335 status = LFR_DEFAULT;
335 status = LFR_DEFAULT;
336 }
336 }
337 else
337 else
338 {
338 {
339 status = LFR_SUCCESSFUL;
339 status = LFR_SUCCESSFUL;
340 }
340 }
341 break;
341 break;
342 case LFR_MODE_NORMAL:
342 case LFR_MODE_NORMAL:
343 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
343 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
344 status = LFR_DEFAULT;
344 status = LFR_DEFAULT;
345 }
345 }
346 else {
346 else {
347 status = LFR_SUCCESSFUL;
347 status = LFR_SUCCESSFUL;
348 }
348 }
349 break;
349 break;
350 case LFR_MODE_BURST:
350 case LFR_MODE_BURST:
351 if ( lfrCurrentMode == LFR_MODE_BURST ) {
351 if ( lfrCurrentMode == LFR_MODE_BURST ) {
352 status = LFR_DEFAULT;
352 status = LFR_DEFAULT;
353 }
353 }
354 else {
354 else {
355 status = LFR_SUCCESSFUL;
355 status = LFR_SUCCESSFUL;
356 }
356 }
357 break;
357 break;
358 case LFR_MODE_SBM1:
358 case LFR_MODE_SBM1:
359 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
359 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
360 status = LFR_DEFAULT;
360 status = LFR_DEFAULT;
361 }
361 }
362 else {
362 else {
363 status = LFR_SUCCESSFUL;
363 status = LFR_SUCCESSFUL;
364 }
364 }
365 break;
365 break;
366 case LFR_MODE_SBM2:
366 case LFR_MODE_SBM2:
367 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
367 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
368 status = LFR_DEFAULT;
368 status = LFR_DEFAULT;
369 }
369 }
370 else {
370 else {
371 status = LFR_SUCCESSFUL;
371 status = LFR_SUCCESSFUL;
372 }
372 }
373 break;
373 break;
374 default:
374 default:
375 status = LFR_DEFAULT;
375 status = LFR_DEFAULT;
376 break;
376 break;
377 }
377 }
378
378
379 return status;
379 return status;
380 }
380 }
381
381
382 int stop_current_mode()
382 int stop_current_mode()
383 {
383 {
384 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
384 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
385 *
385 *
386 * @return RTEMS directive status codes:
386 * @return RTEMS directive status codes:
387 * - RTEMS_SUCCESSFUL - task restarted successfully
387 * - RTEMS_SUCCESSFUL - task restarted successfully
388 * - RTEMS_INVALID_ID - task id invalid
388 * - RTEMS_INVALID_ID - task id invalid
389 * - RTEMS_ALREADY_SUSPENDED - task already suspended
389 * - RTEMS_ALREADY_SUSPENDED - task already suspended
390 *
390 *
391 */
391 */
392
392
393 rtems_status_code status;
393 rtems_status_code status;
394
394
395 status = RTEMS_SUCCESSFUL;
395 status = RTEMS_SUCCESSFUL;
396
396
397 // mask interruptions
397 // mask interruptions
398 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
398 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
399 //LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
399 //LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
400 LEON_Mask_interrupt( IRQ_SM ); // mask spectral matrix interrupt simulator
400 LEON_Mask_interrupt( IRQ_SM ); // mask spectral matrix interrupt simulator
401 // reset registers
401 // reset registers
402 reset_wfp_burst_enable(); // reset burst and enable bits
402 reset_wfp_burst_enable(); // reset burst and enable bits
403 reset_wfp_status(); // reset all the status bits
403 reset_wfp_status(); // reset all the status bits
404 // clear interruptions
404 // clear interruptions
405 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
405 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
406 //LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
406 //LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
407 LEON_Clear_interrupt( IRQ_SM ); // clear spectral matrix interrupt simulator
407 LEON_Clear_interrupt( IRQ_SM ); // clear spectral matrix interrupt simulator
408 //**********************
408 //**********************
409 // suspend several tasks
409 // suspend several tasks
410 if (lfrCurrentMode != LFR_MODE_STANDBY) {
410 if (lfrCurrentMode != LFR_MODE_STANDBY) {
411 status = suspend_science_tasks();
411 status = suspend_science_tasks();
412 }
412 }
413
413
414 if (status != RTEMS_SUCCESSFUL)
414 if (status != RTEMS_SUCCESSFUL)
415 {
415 {
416 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
416 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
417 }
417 }
418
418
419 return status;
419 return status;
420 }
420 }
421
421
422 int enter_mode(unsigned char mode )
422 int enter_mode(unsigned char mode )
423 {
423 {
424 /** This function is launched after a mode transition validation.
424 /** This function is launched after a mode transition validation.
425 *
425 *
426 * @param mode is the mode in which LFR will be put.
426 * @param mode is the mode in which LFR will be put.
427 *
427 *
428 * @return RTEMS directive status codes:
428 * @return RTEMS directive status codes:
429 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
429 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
430 * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully
430 * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully
431 *
431 *
432 */
432 */
433
433
434 rtems_status_code status;
434 rtems_status_code status;
435
435
436 status = RTEMS_UNSATISFIED;
436 status = RTEMS_UNSATISFIED;
437
437
438 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d);
438 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d);
439 updateLFRCurrentMode();
439 updateLFRCurrentMode();
440
440
441 switch(mode){
441 switch(mode){
442 case LFR_MODE_STANDBY:
442 case LFR_MODE_STANDBY:
443 status = enter_standby_mode( );
443 status = enter_standby_mode( );
444 break;
444 break;
445 case LFR_MODE_NORMAL:
445 case LFR_MODE_NORMAL:
446 status = enter_normal_mode( );
446 status = enter_normal_mode( );
447 break;
447 break;
448 case LFR_MODE_BURST:
448 case LFR_MODE_BURST:
449 status = enter_burst_mode( );
449 status = enter_burst_mode( );
450 break;
450 break;
451 case LFR_MODE_SBM1:
451 case LFR_MODE_SBM1:
452 status = enter_sbm1_mode( );
452 status = enter_sbm1_mode( );
453 break;
453 break;
454 case LFR_MODE_SBM2:
454 case LFR_MODE_SBM2:
455 status = enter_sbm2_mode( );
455 status = enter_sbm2_mode( );
456 break;
456 break;
457 default:
457 default:
458 status = RTEMS_UNSATISFIED;
458 status = RTEMS_UNSATISFIED;
459 }
459 }
460
460
461 if (status != RTEMS_SUCCESSFUL)
461 if (status != RTEMS_SUCCESSFUL)
462 {
462 {
463 PRINTF("in enter_mode *** ERR\n")
463 PRINTF("in enter_mode *** ERR\n")
464 status = RTEMS_UNSATISFIED;
464 status = RTEMS_UNSATISFIED;
465 }
465 }
466
466
467 return status;
467 return status;
468 }
468 }
469
469
470 int enter_standby_mode()
470 int enter_standby_mode()
471 {
471 {
472 /** This function is used to enter the STANDBY mode.
472 /** This function is used to enter the STANDBY mode.
473 *
473 *
474 * @return RTEMS directive status codes:
474 * @return RTEMS directive status codes:
475 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
475 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
476 *
476 *
477 */
477 */
478
478
479 PRINTF1("maxCount = %d\n", maxCount)
479 PRINTF1("maxCount = %d\n", maxCount)
480
480
481 #ifdef PRINT_TASK_STATISTICS
481 #ifdef PRINT_TASK_STATISTICS
482 rtems_cpu_usage_report();
482 rtems_cpu_usage_report();
483 #endif
483 #endif
484
484
485 #ifdef PRINT_STACK_REPORT
485 #ifdef PRINT_STACK_REPORT
486 rtems_stack_checker_report_usage();
486 rtems_stack_checker_report_usage();
487 #endif
487 #endif
488
488
489 return LFR_SUCCESSFUL;
489 return LFR_SUCCESSFUL;
490 }
490 }
491
491
492 int enter_normal_mode()
492 int enter_normal_mode()
493 {
493 {
494 rtems_status_code status;
494 rtems_status_code status;
495
495
496 status = restart_science_tasks();
496 status = restart_science_tasks();
497
497
498 // Spectral Matrices simulator
499 // timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
500 // set_local_nb_interrupt_f0_MAX();
501 // LEON_Clear_interrupt( IRQ_SM );
502 // LEON_Unmask_interrupt( IRQ_SM );
503
504 launch_waveform_picker( LFR_MODE_NORMAL );
498 launch_waveform_picker( LFR_MODE_NORMAL );
499 // launch_spectral_matrix( LFR_MODE_NORMAL );
505
500
506 return status;
501 return status;
507 }
502 }
508
503
509 int enter_burst_mode()
504 int enter_burst_mode()
510 {
505 {
511 /** This function is used to enter the STANDBY mode.
506 /** This function is used to enter the STANDBY mode.
512 *
507 *
513 * @return RTEMS directive status codes:
508 * @return RTEMS directive status codes:
514 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
509 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
515 * - RTEMS_INVALID_ID - task id invalid
510 * - RTEMS_INVALID_ID - task id invalid
516 * - RTEMS_INCORRECT_STATE - task never started
511 * - RTEMS_INCORRECT_STATE - task never started
517 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
512 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
518 *
513 *
519 */
514 */
520
515
521 rtems_status_code status;
516 rtems_status_code status;
522
517
523 status = restart_science_tasks();
518 status = restart_science_tasks();
524
519
525 launch_waveform_picker( LFR_MODE_BURST );
520 launch_waveform_picker( LFR_MODE_BURST );
526
521
527 return status;
522 return status;
528 }
523 }
529
524
530 int enter_sbm1_mode()
525 int enter_sbm1_mode()
531 {
526 {
532 /** This function is used to enter the SBM1 mode.
527 /** This function is used to enter the SBM1 mode.
533 *
528 *
534 * @return RTEMS directive status codes:
529 * @return RTEMS directive status codes:
535 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
530 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
536 * - RTEMS_INVALID_ID - task id invalid
531 * - RTEMS_INVALID_ID - task id invalid
537 * - RTEMS_INCORRECT_STATE - task never started
532 * - RTEMS_INCORRECT_STATE - task never started
538 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
533 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
539 *
534 *
540 */
535 */
541
536
542 rtems_status_code status;
537 rtems_status_code status;
543
538
544 status = restart_science_tasks();
539 status = restart_science_tasks();
545
540
546 launch_waveform_picker( LFR_MODE_SBM1 );
541 launch_waveform_picker( LFR_MODE_SBM1 );
547
542
548 return status;
543 return status;
549 }
544 }
550
545
551 int enter_sbm2_mode()
546 int enter_sbm2_mode()
552 {
547 {
553 /** This function is used to enter the SBM2 mode.
548 /** This function is used to enter the SBM2 mode.
554 *
549 *
555 * @return RTEMS directive status codes:
550 * @return RTEMS directive status codes:
556 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
551 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
557 * - RTEMS_INVALID_ID - task id invalid
552 * - RTEMS_INVALID_ID - task id invalid
558 * - RTEMS_INCORRECT_STATE - task never started
553 * - RTEMS_INCORRECT_STATE - task never started
559 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
554 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
560 *
555 *
561 */
556 */
562
557
563 rtems_status_code status;
558 rtems_status_code status;
564
559
565 status = restart_science_tasks();
560 status = restart_science_tasks();
566
561
567 launch_waveform_picker( LFR_MODE_SBM2 );
562 launch_waveform_picker( LFR_MODE_SBM2 );
568
563
569 return status;
564 return status;
570 }
565 }
571
566
572 int restart_science_tasks()
567 int restart_science_tasks()
573 {
568 {
574 /** This function is used to restart all science tasks.
569 /** This function is used to restart all science tasks.
575 *
570 *
576 * @return RTEMS directive status codes:
571 * @return RTEMS directive status codes:
577 * - RTEMS_SUCCESSFUL - task restarted successfully
572 * - RTEMS_SUCCESSFUL - task restarted successfully
578 * - RTEMS_INVALID_ID - task id invalid
573 * - RTEMS_INVALID_ID - task id invalid
579 * - RTEMS_INCORRECT_STATE - task never started
574 * - RTEMS_INCORRECT_STATE - task never started
580 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
575 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
581 *
576 *
582 * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1
577 * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1
583 *
578 *
584 */
579 */
585
580
586 rtems_status_code status[6];
581 rtems_status_code status[6];
587 rtems_status_code ret;
582 rtems_status_code ret;
588
583
589 ret = RTEMS_SUCCESSFUL;
584 ret = RTEMS_SUCCESSFUL;
590
585
591 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 );
586 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 );
592 if (status[0] != RTEMS_SUCCESSFUL)
587 if (status[0] != RTEMS_SUCCESSFUL)
593 {
588 {
594 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
589 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
595 }
590 }
596
591
597 status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 );
592 status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 );
598 if (status[1] != RTEMS_SUCCESSFUL)
593 if (status[1] != RTEMS_SUCCESSFUL)
599 {
594 {
600 PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1])
595 PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1])
601 }
596 }
602
597
603 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
598 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
604 if (status[2] != RTEMS_SUCCESSFUL)
599 if (status[2] != RTEMS_SUCCESSFUL)
605 {
600 {
606 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
601 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
607 }
602 }
608
603
609 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
604 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
610 if (status[3] != RTEMS_SUCCESSFUL)
605 if (status[3] != RTEMS_SUCCESSFUL)
611 {
606 {
612 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
607 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
613 }
608 }
614
609
615 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
610 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
616 if (status[4] != RTEMS_SUCCESSFUL)
611 if (status[4] != RTEMS_SUCCESSFUL)
617 {
612 {
618 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
613 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
619 }
614 }
620
615
621 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
616 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
622 if (status[5] != RTEMS_SUCCESSFUL)
617 if (status[5] != RTEMS_SUCCESSFUL)
623 {
618 {
624 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
619 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
625 }
620 }
626
621
627 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
622 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
628 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
623 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
629 {
624 {
630 ret = RTEMS_UNSATISFIED;
625 ret = RTEMS_UNSATISFIED;
631 }
626 }
632
627
633 return ret;
628 return ret;
634 }
629 }
635
630
636 int suspend_science_tasks()
631 int suspend_science_tasks()
637 {
632 {
638 /** This function suspends the science tasks.
633 /** This function suspends the science tasks.
639 *
634 *
640 * @return RTEMS directive status codes:
635 * @return RTEMS directive status codes:
641 * - RTEMS_SUCCESSFUL - task restarted successfully
636 * - RTEMS_SUCCESSFUL - task restarted successfully
642 * - RTEMS_INVALID_ID - task id invalid
637 * - RTEMS_INVALID_ID - task id invalid
643 * - RTEMS_ALREADY_SUSPENDED - task already suspended
638 * - RTEMS_ALREADY_SUSPENDED - task already suspended
644 *
639 *
645 */
640 */
646
641
647 rtems_status_code status;
642 rtems_status_code status;
648
643
649 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
644 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
650 if (status != RTEMS_SUCCESSFUL)
645 if (status != RTEMS_SUCCESSFUL)
651 {
646 {
652 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
647 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
653 }
648 }
654
649
655 if (status == RTEMS_SUCCESSFUL) // suspend BPF0
650 if (status == RTEMS_SUCCESSFUL) // suspend BPF0
656 {
651 {
657 status = rtems_task_suspend( Task_id[TASKID_BPF0] );
652 status = rtems_task_suspend( Task_id[TASKID_BPF0] );
658 if (status != RTEMS_SUCCESSFUL)
653 if (status != RTEMS_SUCCESSFUL)
659 {
654 {
660 PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status)
655 PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status)
661 }
656 }
662 }
657 }
663
658
664 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
659 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
665 {
660 {
666 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
661 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
667 if (status != RTEMS_SUCCESSFUL)
662 if (status != RTEMS_SUCCESSFUL)
668 {
663 {
669 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
664 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
670 }
665 }
671 }
666 }
672
667
673 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
668 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
674 {
669 {
675 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
670 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
676 if (status != RTEMS_SUCCESSFUL)
671 if (status != RTEMS_SUCCESSFUL)
677 {
672 {
678 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
673 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
679 }
674 }
680 }
675 }
681
676
682 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
677 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
683 {
678 {
684 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
679 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
685 if (status != RTEMS_SUCCESSFUL)
680 if (status != RTEMS_SUCCESSFUL)
686 {
681 {
687 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
682 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
688 }
683 }
689 }
684 }
690
685
691 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
686 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
692 {
687 {
693 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
688 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
694 if (status != RTEMS_SUCCESSFUL)
689 if (status != RTEMS_SUCCESSFUL)
695 {
690 {
696 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
691 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
697 }
692 }
698 }
693 }
699
694
700 return status;
695 return status;
701 }
696 }
702
697
703 void launch_waveform_picker( unsigned char mode )
698 void launch_waveform_picker( unsigned char mode )
704 {
699 {
705 int startDate;
700 int startDate;
706
701
707 reset_current_ring_nodes();
702 reset_current_ring_nodes();
708 reset_waveform_picker_regs();
703 reset_waveform_picker_regs_vhdl_dev_debug_64();
709 set_wfp_burst_enable_register( mode );
704 set_wfp_burst_enable_register( mode );
710 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
705 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
711 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
706 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
712 #ifdef VHDL_DEV
713 startDate = time_management_regs->coarse_time + 2;
707 startDate = time_management_regs->coarse_time + 2;
714 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000]
708 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000]
715 waveform_picker_regs->start_date = startDate;
709 waveform_picker_regs->start_date = startDate;
716 #endif
710 }
711
712 void launch_spectral_matrix( unsigned char mode )
713 {
714 reset_current_sm_ring_nodes();
715 reset_spectral_matrix_regs();
716 // Spectral Matrices simulator
717 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
718 set_local_nb_interrupt_f0_MAX();
719 LEON_Clear_interrupt( IRQ_SM );
720 LEON_Unmask_interrupt( IRQ_SM );
717 }
721 }
718
722
719 //****************
723 //****************
720 // CLOSING ACTIONS
724 // CLOSING ACTIONS
721 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time)
725 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time)
722 {
726 {
723 /** This function is used to update the HK packets statistics after a successful TC execution.
727 /** This function is used to update the HK packets statistics after a successful TC execution.
724 *
728 *
725 * @param TC points to the TC being processed
729 * @param TC points to the TC being processed
726 * @param time is the time used to date the TC execution
730 * @param time is the time used to date the TC execution
727 *
731 *
728 */
732 */
729
733
730 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
734 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
731 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
735 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
732 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
736 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
733 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
737 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
734 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
738 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
735 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
739 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
736 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
740 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
737 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
741 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
738 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
742 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
739 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
743 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
740 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
744 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
741 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
745 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
742 }
746 }
743
747
744 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time)
748 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time)
745 {
749 {
746 /** This function is used to update the HK packets statistics after a TC rejection.
750 /** This function is used to update the HK packets statistics after a TC rejection.
747 *
751 *
748 * @param TC points to the TC being processed
752 * @param TC points to the TC being processed
749 * @param time is the time used to date the TC rejection
753 * @param time is the time used to date the TC rejection
750 *
754 *
751 */
755 */
752
756
753 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
757 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
754 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
758 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
755 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
759 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
756 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
760 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
757 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
761 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
758 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
762 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
759 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
763 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
760 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
764 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
761 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
765 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
762 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
766 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
763 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
767 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
764 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
768 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
765 }
769 }
766
770
767 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time)
771 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time)
768 {
772 {
769 /** This function is the last step of the TC execution workflow.
773 /** This function is the last step of the TC execution workflow.
770 *
774 *
771 * @param TC points to the TC being processed
775 * @param TC points to the TC being processed
772 * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
776 * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
773 * @param queue_id is the id of the RTEMS message queue used to send TM packets
777 * @param queue_id is the id of the RTEMS message queue used to send TM packets
774 * @param time is the time used to date the TC execution
778 * @param time is the time used to date the TC execution
775 *
779 *
776 */
780 */
777
781
778 unsigned int val = 0;
782 unsigned int val = 0;
779
783
780 if (result == LFR_SUCCESSFUL)
784 if (result == LFR_SUCCESSFUL)
781 {
785 {
782 if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
786 if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
783 &&
787 &&
784 !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
788 !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
785 )
789 )
786 {
790 {
787 send_tm_lfr_tc_exe_success( TC, queue_id, time );
791 send_tm_lfr_tc_exe_success( TC, queue_id, time );
788 }
792 }
789 update_last_TC_exe( TC, time );
793 update_last_TC_exe( TC, time );
790 val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1];
794 val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1];
791 val++;
795 val++;
792 housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8);
796 housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8);
793 housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val);
797 housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val);
794 }
798 }
795 else
799 else
796 {
800 {
797 update_last_TC_rej( TC, time );
801 update_last_TC_rej( TC, time );
798 val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1];
802 val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1];
799 val++;
803 val++;
800 housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8);
804 housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8);
801 housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val);
805 housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val);
802 }
806 }
803 }
807 }
804
808
805 //***************************
809 //***************************
806 // Interrupt Service Routines
810 // Interrupt Service Routines
807 rtems_isr commutation_isr1( rtems_vector_number vector )
811 rtems_isr commutation_isr1( rtems_vector_number vector )
808 {
812 {
809 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
813 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
810 printf("In commutation_isr1 *** Error sending event to DUMB\n");
814 printf("In commutation_isr1 *** Error sending event to DUMB\n");
811 }
815 }
812 }
816 }
813
817
814 rtems_isr commutation_isr2( rtems_vector_number vector )
818 rtems_isr commutation_isr2( rtems_vector_number vector )
815 {
819 {
816 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
820 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
817 printf("In commutation_isr2 *** Error sending event to DUMB\n");
821 printf("In commutation_isr2 *** Error sending event to DUMB\n");
818 }
822 }
819 }
823 }
820
824
821 //****************
825 //****************
822 // OTHER FUNCTIONS
826 // OTHER FUNCTIONS
823 void updateLFRCurrentMode()
827 void updateLFRCurrentMode()
824 {
828 {
825 /** This function updates the value of the global variable lfrCurrentMode.
829 /** This function updates the value of the global variable lfrCurrentMode.
826 *
830 *
827 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
831 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
828 *
832 *
829 */
833 */
830 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
834 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
831 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
835 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
832 }
836 }
833
837
@@ -1,1261 +1,1519
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[7];
19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7];
20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7];
20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7];
21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7];
21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7];
22 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7];
22 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7];
23 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[7];
23 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[7];
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 rtems_isr waveforms_isr( rtems_vector_number vector )
39 rtems_isr waveforms_isr( rtems_vector_number vector )
40 {
40 {
41 /** This is the interrupt sub routine called by the waveform picker core.
41 /** This is the interrupt sub routine called by the waveform picker core.
42 *
42 *
43 * This ISR launch different actions depending mainly on two pieces of information:
43 * This ISR launch different actions depending mainly on two pieces of information:
44 * 1. the values read in the registers of the waveform picker.
44 * 1. the values read in the registers of the waveform picker.
45 * 2. the current LFR mode.
45 * 2. the current LFR mode.
46 *
46 *
47 */
47 */
48
48
49 static unsigned char nb_swf = 0;
50
49 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
51 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
50 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
52 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
51 { // in modes other than STANDBY and BURST, send the CWF_F3 data
53 { // in modes other than STANDBY and BURST, send the CWF_F3 data
52 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
54 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
53 // (1) change the receiving buffer for the waveform picker
55 // (1) change the receiving buffer for the waveform picker
54 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
56 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
55 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b);
57 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b);
56 }
58 }
57 else {
59 else {
58 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a);
60 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a);
59 }
61 }
60 // (2) send an event for the waveforms transmission
62 // (2) send an event for the waveforms transmission
61 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
63 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
62 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
64 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
63 }
65 }
64 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
66 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
65 }
67 }
66 }
68 }
67
69
68 switch(lfrCurrentMode)
70 switch(lfrCurrentMode)
69 {
71 {
70 //********
72 //********
71 // STANDBY
73 // STANDBY
72 case(LFR_MODE_STANDBY):
74 case(LFR_MODE_STANDBY):
73 break;
75 break;
74
76
75 //******
77 //******
76 // NORMAL
78 // NORMAL
77 case(LFR_MODE_NORMAL):
79 case(LFR_MODE_NORMAL):
78 if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits
80 if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits
79 {
81 {
80 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
82 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
81 }
83 }
82 if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits
84 if ( (waveform_picker_regs->status & 0x07) == 0x07) // [0111] check the f2, f1, f0 full bits
83 {
85 {
84 // change F0 ring node
86 // change F0 ring node
85 ring_node_to_send_swf_f0 = current_ring_node_f0;
87 ring_node_to_send_swf_f0 = current_ring_node_f0;
86 current_ring_node_f0 = current_ring_node_f0->next;
88 current_ring_node_f0 = current_ring_node_f0->next;
87 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address;
89 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address;
88 // change F1 ring node
90 // change F1 ring node
89 ring_node_to_send_swf_f1 = current_ring_node_f1;
91 ring_node_to_send_swf_f1 = current_ring_node_f1;
90 current_ring_node_f1 = current_ring_node_f1->next;
92 current_ring_node_f1 = current_ring_node_f1->next;
91 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
93 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
92 // change F2 ring node
94 // change F2 ring node
93 ring_node_to_send_swf_f2 = current_ring_node_f2;
95 ring_node_to_send_swf_f2 = current_ring_node_f2;
94 current_ring_node_f2 = current_ring_node_f2->next;
96 current_ring_node_f2 = current_ring_node_f2->next;
95 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
97 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
96 //
98 //
99 if (nb_swf < 2)
100 // if (true)
101 {
97 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
102 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
98 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
103 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
99 }
104 }
100 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000]
105 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000]
106 nb_swf = nb_swf + 1;
107 }
108 else
109 {
110 reset_wfp_burst_enable();
111 nb_swf = 0;
112 }
113
101 }
114 }
102
115
103 break;
116 break;
104
117
105 //******
118 //******
106 // BURST
119 // BURST
107 case(LFR_MODE_BURST):
120 case(LFR_MODE_BURST):
108 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
121 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
109 // (1) change the receiving buffer for the waveform picker
122 // (1) change the receiving buffer for the waveform picker
110 ring_node_to_send_cwf_f2 = current_ring_node_f2;
123 ring_node_to_send_cwf_f2 = current_ring_node_f2;
111 current_ring_node_f2 = current_ring_node_f2->next;
124 current_ring_node_f2 = current_ring_node_f2->next;
112 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
125 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
113 // (2) send an event for the waveforms transmission
126 // (2) send an event for the waveforms transmission
114 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
127 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
115 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
128 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
116 }
129 }
117 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
130 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
118 }
131 }
119 break;
132 break;
120
133
121 //*****
134 //*****
122 // SBM1
135 // SBM1
123 case(LFR_MODE_SBM1):
136 case(LFR_MODE_SBM1):
124 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
137 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
125 // (1) change the receiving buffer for the waveform picker
138 // (1) change the receiving buffer for the waveform picker
126 ring_node_to_send_cwf_f1 = current_ring_node_f1;
139 ring_node_to_send_cwf_f1 = current_ring_node_f1;
127 current_ring_node_f1 = current_ring_node_f1->next;
140 current_ring_node_f1 = current_ring_node_f1->next;
128 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
141 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
129 // (2) send an event for the waveforms transmission
142 // (2) send an event for the waveforms transmission
130 if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
143 if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
131 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
144 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
132 }
145 }
133 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0
146 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0
134 }
147 }
135 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
148 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
136 ring_node_to_send_swf_f1 = current_ring_node_f1->previous;
149 ring_node_to_send_swf_f1 = current_ring_node_f1->previous;
137 }
150 }
138 if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit
151 if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit
139 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
152 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
140 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
153 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
141 }
154 }
142 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0
155 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0
143 }
156 }
144 break;
157 break;
145
158
146 //*****
159 //*****
147 // SBM2
160 // SBM2
148 case(LFR_MODE_SBM2):
161 case(LFR_MODE_SBM2):
149 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
162 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
150 // (1) change the receiving buffer for the waveform picker
163 // (1) change the receiving buffer for the waveform picker
151 ring_node_to_send_cwf_f2 = current_ring_node_f2;
164 ring_node_to_send_cwf_f2 = current_ring_node_f2;
152 current_ring_node_f2 = current_ring_node_f2->next;
165 current_ring_node_f2 = current_ring_node_f2->next;
153 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
166 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
154 // (2) send an event for the waveforms transmission
167 // (2) send an event for the waveforms transmission
155 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
168 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
156 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
169 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
157 }
170 }
158 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
171 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
159 }
172 }
160 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
173 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
161 ring_node_to_send_swf_f2 = current_ring_node_f2->previous;
174 ring_node_to_send_swf_f2 = current_ring_node_f2->previous;
162 }
175 }
163 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
176 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
164 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
177 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
165 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
178 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
166 }
179 }
167 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
180 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
168 }
181 }
169 break;
182 break;
170
183
171 //********
184 //********
172 // DEFAULT
185 // DEFAULT
173 default:
186 default:
174 break;
187 break;
175 }
188 }
176 }
189 }
177
190
191 rtems_isr waveforms_isr_alt( rtems_vector_number vector )
192 {
193 /** This is the interrupt sub routine called by the waveform picker core.
194 *
195 * This ISR launch different actions depending mainly on two pieces of information:
196 * 1. the values read in the registers of the waveform picker.
197 * 2. the current LFR mode.
198 *
199 */
200
201 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
202 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
203 { // in modes other than STANDBY and BURST, send the CWF_F3 data
204 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
205 // (1) change the receiving buffer for the waveform picker
206 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
207 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b);
208 }
209 else {
210 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a);
211 }
212 // (2) send an event for the waveforms transmission
213 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
214 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
215 }
216 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
217 }
218 }
219
220 switch(lfrCurrentMode)
221 {
222 //********
223 // STANDBY
224 case(LFR_MODE_STANDBY):
225 break;
226
227 //******
228 // NORMAL
229 case(LFR_MODE_NORMAL):
230 if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits
231 {
232 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
233 }
234 if ( (waveform_picker_regs->status & 0x01) == 0x01) // [0001] check the f0 full bit
235 {
236 // change F0 ring node
237 ring_node_to_send_swf_f0 = current_ring_node_f0;
238 current_ring_node_f0 = current_ring_node_f0->next;
239 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address;
240 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1110 1110 1110]
241 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL_SWF_F0 ) != RTEMS_SUCCESSFUL) {
242 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
243 }
244 }
245 if ( (waveform_picker_regs->status & 0x02) == 0x02) // [0010] check the f1 full bit
246 {
247 // change F1 ring node
248 ring_node_to_send_swf_f1 = current_ring_node_f1;
249 current_ring_node_f1 = current_ring_node_f1->next;
250 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
251 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1101 1101 1101]
252 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL_SWF_F1 ) != RTEMS_SUCCESSFUL) {
253 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
254 }
255 }
256 if ( (waveform_picker_regs->status & 0x04) == 0x04) // [0100] check the f2 full bit
257 {
258 // change F2 ring node
259 ring_node_to_send_swf_f2 = current_ring_node_f2;
260 current_ring_node_f2 = current_ring_node_f2->next;
261 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
262 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1011 1011 1011]
263 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL_SWF_F2 ) != RTEMS_SUCCESSFUL) {
264 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
265 }
266 }
267 break;
268
269 //******
270 // BURST
271 case(LFR_MODE_BURST):
272 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
273 // (1) change the receiving buffer for the waveform picker
274 ring_node_to_send_cwf_f2 = current_ring_node_f2;
275 current_ring_node_f2 = current_ring_node_f2->next;
276 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
277 // (2) send an event for the waveforms transmission
278 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
279 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
280 }
281 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
282 }
283 break;
284
285 //*****
286 // SBM1
287 case(LFR_MODE_SBM1):
288 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
289 // (1) change the receiving buffer for the waveform picker
290 ring_node_to_send_cwf_f1 = current_ring_node_f1;
291 current_ring_node_f1 = current_ring_node_f1->next;
292 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
293 // (2) send an event for the waveforms transmission
294 if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
295 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
296 }
297 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0
298 }
299 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
300 ring_node_to_send_swf_f1 = current_ring_node_f1->previous;
301 }
302 if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit
303 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
304 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
305 }
306 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0
307 }
308 break;
309
310 //*****
311 // SBM2
312 case(LFR_MODE_SBM2):
313 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
314 // (1) change the receiving buffer for the waveform picker
315 ring_node_to_send_cwf_f2 = current_ring_node_f2;
316 current_ring_node_f2 = current_ring_node_f2->next;
317 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
318 // (2) send an event for the waveforms transmission
319 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
320 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
321 }
322 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
323 }
324 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
325 ring_node_to_send_swf_f2 = current_ring_node_f2->previous;
326 }
327 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
328 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
329 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
330 }
331 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
332 }
333 break;
334
335 //********
336 // DEFAULT
337 default:
338 break;
339 }
340 }
341
178 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
342 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
179 {
343 {
180 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
344 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
181 *
345 *
182 * @param unused is the starting argument of the RTEMS task
346 * @param unused is the starting argument of the RTEMS task
183 *
347 *
184 * The following data packets are sent by this task:
348 * The following data packets are sent by this task:
185 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
349 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
186 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
350 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
187 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
351 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
188 *
352 *
189 */
353 */
190
354
191 rtems_event_set event_out;
355 rtems_event_set event_out;
192 rtems_id queue_id;
356 rtems_id queue_id;
193 rtems_status_code status;
357 rtems_status_code status;
194
358
195 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
359 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
196 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
360 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
197 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
361 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
198
362
199 init_waveforms();
363 init_waveforms();
200
364
201 status = get_message_queue_id_send( &queue_id );
365 status = get_message_queue_id_send( &queue_id );
202 if (status != RTEMS_SUCCESSFUL)
366 if (status != RTEMS_SUCCESSFUL)
203 {
367 {
204 PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status)
368 PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status)
205 }
369 }
206
370
207 BOOT_PRINTF("in WFRM ***\n")
371 BOOT_PRINTF("in WFRM ***\n")
208
372
209 while(1){
373 while(1){
210 // wait for an RTEMS_EVENT
374 // wait for an RTEMS_EVENT
211 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
375 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
212 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM
376 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM
213 | RTEMS_EVENT_MODE_NORMAL_SWF_F0
377 | RTEMS_EVENT_MODE_NORMAL_SWF_F0
214 | RTEMS_EVENT_MODE_NORMAL_SWF_F1
378 | RTEMS_EVENT_MODE_NORMAL_SWF_F1
215 | RTEMS_EVENT_MODE_NORMAL_SWF_F2,
379 | RTEMS_EVENT_MODE_NORMAL_SWF_F2,
216 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
380 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
217 if (event_out == RTEMS_EVENT_MODE_NORMAL)
381 if (event_out == RTEMS_EVENT_MODE_NORMAL)
218 {
382 {
219 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
383 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
220 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
384 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
221 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
385 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
222 }
386 }
223 if ( (event_out & RTEMS_EVENT_MODE_NORMAL_SWF_F0) == RTEMS_EVENT_MODE_NORMAL_SWF_F0)
387 if ( (event_out & RTEMS_EVENT_MODE_NORMAL_SWF_F0) == RTEMS_EVENT_MODE_NORMAL_SWF_F0)
224 {
388 {
225 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
389 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
226 }
390 }
227 if ( (event_out & RTEMS_EVENT_MODE_NORMAL_SWF_F1) == RTEMS_EVENT_MODE_NORMAL_SWF_F1)
391 if ( (event_out & RTEMS_EVENT_MODE_NORMAL_SWF_F1) == RTEMS_EVENT_MODE_NORMAL_SWF_F1)
228 {
392 {
229 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
393 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
230 }
394 }
231 if ( (event_out & RTEMS_EVENT_MODE_NORMAL_SWF_F2) == RTEMS_EVENT_MODE_NORMAL_SWF_F2)
395 if ( (event_out & RTEMS_EVENT_MODE_NORMAL_SWF_F2) == RTEMS_EVENT_MODE_NORMAL_SWF_F2)
232 {
396 {
233 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
397 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
234 }
398 }
235 }
399 }
236 }
400 }
237
401
238 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
402 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
239 {
403 {
240 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
404 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
241 *
405 *
242 * @param unused is the starting argument of the RTEMS task
406 * @param unused is the starting argument of the RTEMS task
243 *
407 *
244 * The following data packet is sent by this task:
408 * The following data packet is sent by this task:
245 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
409 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
246 *
410 *
247 */
411 */
248
412
249 rtems_event_set event_out;
413 rtems_event_set event_out;
250 rtems_id queue_id;
414 rtems_id queue_id;
251 rtems_status_code status;
415 rtems_status_code status;
252
416
253 init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 );
417 init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 );
254 init_header_continuous_cwf3_light_table( headerCWF_F3_light );
418 init_header_continuous_cwf3_light_table( headerCWF_F3_light );
255
419
256 status = get_message_queue_id_send( &queue_id );
420 status = get_message_queue_id_send( &queue_id );
257 if (status != RTEMS_SUCCESSFUL)
421 if (status != RTEMS_SUCCESSFUL)
258 {
422 {
259 PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status)
423 PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status)
260 }
424 }
261
425
262 BOOT_PRINTF("in CWF3 ***\n")
426 BOOT_PRINTF("in CWF3 ***\n")
263
427
264 while(1){
428 while(1){
265 // wait for an RTEMS_EVENT
429 // wait for an RTEMS_EVENT
266 rtems_event_receive( RTEMS_EVENT_0,
430 rtems_event_receive( RTEMS_EVENT_0,
267 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
431 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
268 PRINTF("send CWF F3 \n")
432 PRINTF("send CWF F3 \n")
269 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
433 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
270 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
434 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
271 {
435 {
272 send_waveform_CWF( wf_cont_f3_b, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
436 send_waveform_CWF( wf_cont_f3_b, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
273 }
437 }
274 else
438 else
275 {
439 {
276 send_waveform_CWF3_light( wf_cont_f3_b, headerCWF_F3_light, queue_id );
440 send_waveform_CWF3_light( wf_cont_f3_b, headerCWF_F3_light, queue_id );
277 }
441 }
278 }
442 }
279 else
443 else
280 {
444 {
281 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x00)
445 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x00)
282 {
446 {
283 send_waveform_CWF( wf_cont_f3_a, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
447 send_waveform_CWF( wf_cont_f3_a, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
284 }
448 }
285 else
449 else
286 {
450 {
287 send_waveform_CWF3_light( wf_cont_f3_a, headerCWF_F3_light, queue_id );
451 send_waveform_CWF3_light( wf_cont_f3_a, headerCWF_F3_light, queue_id );
288 }
452 }
289
453
290 }
454 }
291 }
455 }
292 }
456 }
293
457
294 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
458 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
295 {
459 {
296 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
460 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
297 *
461 *
298 * @param unused is the starting argument of the RTEMS task
462 * @param unused is the starting argument of the RTEMS task
299 *
463 *
300 * The following data packet is sent by this function:
464 * The following data packet is sent by this function:
301 * - TM_LFR_SCIENCE_BURST_CWF_F2
465 * - TM_LFR_SCIENCE_BURST_CWF_F2
302 * - TM_LFR_SCIENCE_SBM2_CWF_F2
466 * - TM_LFR_SCIENCE_SBM2_CWF_F2
303 *
467 *
304 */
468 */
305
469
306 rtems_event_set event_out;
470 rtems_event_set event_out;
307 rtems_id queue_id;
471 rtems_id queue_id;
308 rtems_status_code status;
472 rtems_status_code status;
309
473
310 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
474 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
311 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
475 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
312
476
313 status = get_message_queue_id_send( &queue_id );
477 status = get_message_queue_id_send( &queue_id );
314 if (status != RTEMS_SUCCESSFUL)
478 if (status != RTEMS_SUCCESSFUL)
315 {
479 {
316 PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status)
480 PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status)
317 }
481 }
318
482
319 BOOT_PRINTF("in CWF2 ***\n")
483 BOOT_PRINTF("in CWF2 ***\n")
320
484
321 while(1){
485 while(1){
322 // wait for an RTEMS_EVENT
486 // wait for an RTEMS_EVENT
323 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
487 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
324 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
488 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
325 if (event_out == RTEMS_EVENT_MODE_BURST)
489 if (event_out == RTEMS_EVENT_MODE_BURST)
326 {
490 {
327 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
491 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
328 }
492 }
329 if (event_out == RTEMS_EVENT_MODE_SBM2)
493 if (event_out == RTEMS_EVENT_MODE_SBM2)
330 {
494 {
331 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
495 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
332 }
496 }
333 }
497 }
334 }
498 }
335
499
336 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
500 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
337 {
501 {
338 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
502 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
339 *
503 *
340 * @param unused is the starting argument of the RTEMS task
504 * @param unused is the starting argument of the RTEMS task
341 *
505 *
342 * The following data packet is sent by this function:
506 * The following data packet is sent by this function:
343 * - TM_LFR_SCIENCE_SBM1_CWF_F1
507 * - TM_LFR_SCIENCE_SBM1_CWF_F1
344 *
508 *
345 */
509 */
346
510
347 rtems_event_set event_out;
511 rtems_event_set event_out;
348 rtems_id queue_id;
512 rtems_id queue_id;
349 rtems_status_code status;
513 rtems_status_code status;
350
514
351 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
515 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
352
516
353 status = get_message_queue_id_send( &queue_id );
517 status = get_message_queue_id_send( &queue_id );
354 if (status != RTEMS_SUCCESSFUL)
518 if (status != RTEMS_SUCCESSFUL)
355 {
519 {
356 PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status)
520 PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status)
357 }
521 }
358
522
359 BOOT_PRINTF("in CWF1 ***\n")
523 BOOT_PRINTF("in CWF1 ***\n")
360
524
361 while(1){
525 while(1){
362 // wait for an RTEMS_EVENT
526 // wait for an RTEMS_EVENT
363 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
527 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
364 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
528 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
365 send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
529 send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
366 }
530 }
367 }
531 }
368
532
369 //******************
533 //******************
370 // general functions
534 // general functions
371 void init_waveforms( void )
535 void init_waveforms( void )
372 {
536 {
373 int i = 0;
537 int i = 0;
374
538
375 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
539 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
376 {
540 {
377 //***
541 //***
378 // F0
542 // F0
379 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
543 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
380 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
544 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
381 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
545 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
382
546
383 //***
547 //***
384 // F1
548 // F1
385 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
549 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
386 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
550 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
387 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
551 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
388
552
389 //***
553 //***
390 // F2
554 // F2
391 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
555 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
392 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
556 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
393 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
557 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
394
558
395 //***
559 //***
396 // F3
560 // F3
397 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
561 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
398 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
562 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
399 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
563 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
400 }
564 }
401 }
565 }
402
566
403 void init_waveform_rings( void )
567 void init_waveform_rings( void )
404 {
568 {
405 unsigned char i;
569 unsigned char i;
406
570
407 // F0 RING
571 // F0 RING
408 waveform_ring_f0[0].next = (ring_node*) &waveform_ring_f0[1];
572 waveform_ring_f0[0].next = (ring_node*) &waveform_ring_f0[1];
409 waveform_ring_f0[0].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-1];
573 waveform_ring_f0[0].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-1];
410 waveform_ring_f0[0].buffer_address = (int) &wf_snap_f0[0][0];
574 waveform_ring_f0[0].buffer_address = (int) &wf_snap_f0[0][0];
411
575
412 waveform_ring_f0[NB_RING_NODES_F0-1].next = (ring_node*) &waveform_ring_f0[0];
576 waveform_ring_f0[NB_RING_NODES_F0-1].next = (ring_node*) &waveform_ring_f0[0];
413 waveform_ring_f0[NB_RING_NODES_F0-1].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-2];
577 waveform_ring_f0[NB_RING_NODES_F0-1].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-2];
414 waveform_ring_f0[NB_RING_NODES_F0-1].buffer_address = (int) &wf_snap_f0[NB_RING_NODES_F0-1][0];
578 waveform_ring_f0[NB_RING_NODES_F0-1].buffer_address = (int) &wf_snap_f0[NB_RING_NODES_F0-1][0];
415
579
416 for(i=1; i<NB_RING_NODES_F0-1; i++)
580 for(i=1; i<NB_RING_NODES_F0-1; i++)
417 {
581 {
418 waveform_ring_f0[i].next = (ring_node*) &waveform_ring_f0[i+1];
582 waveform_ring_f0[i].next = (ring_node*) &waveform_ring_f0[i+1];
419 waveform_ring_f0[i].previous = (ring_node*) &waveform_ring_f0[i-1];
583 waveform_ring_f0[i].previous = (ring_node*) &waveform_ring_f0[i-1];
420 waveform_ring_f0[i].buffer_address = (int) &wf_snap_f0[i][0];
584 waveform_ring_f0[i].buffer_address = (int) &wf_snap_f0[i][0];
421 }
585 }
422
586
423 // F1 RING
587 // F1 RING
424 waveform_ring_f1[0].next = (ring_node*) &waveform_ring_f1[1];
588 waveform_ring_f1[0].next = (ring_node*) &waveform_ring_f1[1];
425 waveform_ring_f1[0].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-1];
589 waveform_ring_f1[0].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-1];
426 waveform_ring_f1[0].buffer_address = (int) &wf_snap_f1[0][0];
590 waveform_ring_f1[0].buffer_address = (int) &wf_snap_f1[0][0];
427
591
428 waveform_ring_f1[NB_RING_NODES_F1-1].next = (ring_node*) &waveform_ring_f1[0];
592 waveform_ring_f1[NB_RING_NODES_F1-1].next = (ring_node*) &waveform_ring_f1[0];
429 waveform_ring_f1[NB_RING_NODES_F1-1].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-2];
593 waveform_ring_f1[NB_RING_NODES_F1-1].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-2];
430 waveform_ring_f1[NB_RING_NODES_F1-1].buffer_address = (int) &wf_snap_f1[NB_RING_NODES_F1-1][0];
594 waveform_ring_f1[NB_RING_NODES_F1-1].buffer_address = (int) &wf_snap_f1[NB_RING_NODES_F1-1][0];
431
595
432 for(i=1; i<NB_RING_NODES_F1-1; i++)
596 for(i=1; i<NB_RING_NODES_F1-1; i++)
433 {
597 {
434 waveform_ring_f1[i].next = (ring_node*) &waveform_ring_f1[i+1];
598 waveform_ring_f1[i].next = (ring_node*) &waveform_ring_f1[i+1];
435 waveform_ring_f1[i].previous = (ring_node*) &waveform_ring_f1[i-1];
599 waveform_ring_f1[i].previous = (ring_node*) &waveform_ring_f1[i-1];
436 waveform_ring_f1[i].buffer_address = (int) &wf_snap_f1[i][0];
600 waveform_ring_f1[i].buffer_address = (int) &wf_snap_f1[i][0];
437 }
601 }
438
602
439 // F2 RING
603 // F2 RING
440 waveform_ring_f2[0].next = (ring_node*) &waveform_ring_f2[1];
604 waveform_ring_f2[0].next = (ring_node*) &waveform_ring_f2[1];
441 waveform_ring_f2[0].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-1];
605 waveform_ring_f2[0].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-1];
442 waveform_ring_f2[0].buffer_address = (int) &wf_snap_f2[0][0];
606 waveform_ring_f2[0].buffer_address = (int) &wf_snap_f2[0][0];
443
607
444 waveform_ring_f2[NB_RING_NODES_F2-1].next = (ring_node*) &waveform_ring_f2[0];
608 waveform_ring_f2[NB_RING_NODES_F2-1].next = (ring_node*) &waveform_ring_f2[0];
445 waveform_ring_f2[NB_RING_NODES_F2-1].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-2];
609 waveform_ring_f2[NB_RING_NODES_F2-1].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-2];
446 waveform_ring_f2[NB_RING_NODES_F2-1].buffer_address = (int) &wf_snap_f2[NB_RING_NODES_F2-1][0];
610 waveform_ring_f2[NB_RING_NODES_F2-1].buffer_address = (int) &wf_snap_f2[NB_RING_NODES_F2-1][0];
447
611
448 for(i=1; i<NB_RING_NODES_F2-1; i++)
612 for(i=1; i<NB_RING_NODES_F2-1; i++)
449 {
613 {
450 waveform_ring_f2[i].next = (ring_node*) &waveform_ring_f2[i+1];
614 waveform_ring_f2[i].next = (ring_node*) &waveform_ring_f2[i+1];
451 waveform_ring_f2[i].previous = (ring_node*) &waveform_ring_f2[i-1];
615 waveform_ring_f2[i].previous = (ring_node*) &waveform_ring_f2[i-1];
452 waveform_ring_f2[i].buffer_address = (int) &wf_snap_f2[i][0];
616 waveform_ring_f2[i].buffer_address = (int) &wf_snap_f2[i][0];
453 }
617 }
454
618
455 DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0)
619 DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0)
456 DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1)
620 DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1)
457 DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2)
621 DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2)
458
622
459 }
623 }
460
624
461 void reset_current_ring_nodes( void )
625 void reset_current_ring_nodes( void )
462 {
626 {
463 current_ring_node_f0 = waveform_ring_f0;
627 current_ring_node_f0 = waveform_ring_f0;
464 ring_node_to_send_swf_f0 = waveform_ring_f0;
628 ring_node_to_send_swf_f0 = waveform_ring_f0;
465
629
466 current_ring_node_f1 = waveform_ring_f1;
630 current_ring_node_f1 = waveform_ring_f1;
467 ring_node_to_send_cwf_f1 = waveform_ring_f1;
631 ring_node_to_send_cwf_f1 = waveform_ring_f1;
468 ring_node_to_send_swf_f1 = waveform_ring_f1;
632 ring_node_to_send_swf_f1 = waveform_ring_f1;
469
633
470 current_ring_node_f2 = waveform_ring_f2;
634 current_ring_node_f2 = waveform_ring_f2;
471 ring_node_to_send_cwf_f2 = waveform_ring_f2;
635 ring_node_to_send_cwf_f2 = waveform_ring_f2;
472 ring_node_to_send_swf_f2 = waveform_ring_f2;
636 ring_node_to_send_swf_f2 = waveform_ring_f2;
473 }
637 }
474
638
475 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
639 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
476 {
640 {
477 unsigned char i;
641 unsigned char i;
478
642
479 for (i=0; i<7; i++)
643 for (i=0; i<7; i++)
480 {
644 {
481 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
645 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
482 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
646 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
483 headerSWF[ i ].reserved = DEFAULT_RESERVED;
647 headerSWF[ i ].reserved = DEFAULT_RESERVED;
484 headerSWF[ i ].userApplication = CCSDS_USER_APP;
648 headerSWF[ i ].userApplication = CCSDS_USER_APP;
485 headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
649 headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
486 headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
650 headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
487 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
651 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
488 if (i == 6)
652 if (i == 6)
489 {
653 {
490 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8);
654 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8);
491 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 );
655 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 );
492 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8);
656 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8);
493 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 );
657 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 );
494 }
658 }
495 else
659 else
496 {
660 {
497 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8);
661 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8);
498 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 );
662 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 );
499 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8);
663 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8);
500 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 );
664 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 );
501 }
665 }
502 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
666 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
503 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
667 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
504 headerSWF[ i ].pktNr = i+1; // PKT_NR
668 headerSWF[ i ].pktNr = i+1; // PKT_NR
505 // DATA FIELD HEADER
669 // DATA FIELD HEADER
506 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
670 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
507 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
671 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
508 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
672 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
509 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
673 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
510 // AUXILIARY DATA HEADER
674 // AUXILIARY DATA HEADER
511 headerSWF[ i ].time[0] = 0x00;
675 headerSWF[ i ].time[0] = 0x00;
512 headerSWF[ i ].time[0] = 0x00;
676 headerSWF[ i ].time[0] = 0x00;
513 headerSWF[ i ].time[0] = 0x00;
677 headerSWF[ i ].time[0] = 0x00;
514 headerSWF[ i ].time[0] = 0x00;
678 headerSWF[ i ].time[0] = 0x00;
515 headerSWF[ i ].time[0] = 0x00;
679 headerSWF[ i ].time[0] = 0x00;
516 headerSWF[ i ].time[0] = 0x00;
680 headerSWF[ i ].time[0] = 0x00;
517 headerSWF[ i ].sid = sid;
681 headerSWF[ i ].sid = sid;
518 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
682 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
519 }
683 }
520 return LFR_SUCCESSFUL;
684 return LFR_SUCCESSFUL;
521 }
685 }
522
686
523 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
687 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
524 {
688 {
525 unsigned int i;
689 unsigned int i;
526
690
527 for (i=0; i<7; i++)
691 for (i=0; i<7; i++)
528 {
692 {
529 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
693 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
530 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
694 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
531 headerCWF[ i ].reserved = DEFAULT_RESERVED;
695 headerCWF[ i ].reserved = DEFAULT_RESERVED;
532 headerCWF[ i ].userApplication = CCSDS_USER_APP;
696 headerCWF[ i ].userApplication = CCSDS_USER_APP;
533 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
697 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
534 {
698 {
535 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8);
699 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8);
536 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2);
700 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2);
537 }
701 }
538 else
702 else
539 {
703 {
540 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
704 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
541 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
705 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
542 }
706 }
543 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
707 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
544 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8);
708 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_336 >> 8);
545 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 );
709 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_336 );
546 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8);
710 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF >> 8);
547 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF );
711 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF );
548 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
712 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
549 // DATA FIELD HEADER
713 // DATA FIELD HEADER
550 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
714 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
551 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
715 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
552 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
716 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
553 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
717 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
554 // AUXILIARY DATA HEADER
718 // AUXILIARY DATA HEADER
555 headerCWF[ i ].sid = sid;
719 headerCWF[ i ].sid = sid;
556 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
720 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
557 headerCWF[ i ].time[0] = 0x00;
721 headerCWF[ i ].time[0] = 0x00;
558 headerCWF[ i ].time[0] = 0x00;
722 headerCWF[ i ].time[0] = 0x00;
559 headerCWF[ i ].time[0] = 0x00;
723 headerCWF[ i ].time[0] = 0x00;
560 headerCWF[ i ].time[0] = 0x00;
724 headerCWF[ i ].time[0] = 0x00;
561 headerCWF[ i ].time[0] = 0x00;
725 headerCWF[ i ].time[0] = 0x00;
562 headerCWF[ i ].time[0] = 0x00;
726 headerCWF[ i ].time[0] = 0x00;
563 }
727 }
564 return LFR_SUCCESSFUL;
728 return LFR_SUCCESSFUL;
565 }
729 }
566
730
567 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
731 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
568 {
732 {
569 unsigned int i;
733 unsigned int i;
570
734
571 for (i=0; i<7; i++)
735 for (i=0; i<7; i++)
572 {
736 {
573 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
737 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
574 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
738 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
575 headerCWF[ i ].reserved = DEFAULT_RESERVED;
739 headerCWF[ i ].reserved = DEFAULT_RESERVED;
576 headerCWF[ i ].userApplication = CCSDS_USER_APP;
740 headerCWF[ i ].userApplication = CCSDS_USER_APP;
577
741
578 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
742 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
579 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
743 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
580
744
581 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
745 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
582 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8);
746 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_672 >> 8);
583 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 );
747 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_672 );
584 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8);
748 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_CWF_SHORT_F3 >> 8);
585 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 );
749 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_CWF_SHORT_F3 );
586
750
587 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
751 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
588 // DATA FIELD HEADER
752 // DATA FIELD HEADER
589 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
753 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
590 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
754 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
591 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
755 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
592 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
756 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
593 // AUXILIARY DATA HEADER
757 // AUXILIARY DATA HEADER
594 headerCWF[ i ].sid = SID_NORM_CWF_F3;
758 headerCWF[ i ].sid = SID_NORM_CWF_F3;
595 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
759 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
596 headerCWF[ i ].time[0] = 0x00;
760 headerCWF[ i ].time[0] = 0x00;
597 headerCWF[ i ].time[0] = 0x00;
761 headerCWF[ i ].time[0] = 0x00;
598 headerCWF[ i ].time[0] = 0x00;
762 headerCWF[ i ].time[0] = 0x00;
599 headerCWF[ i ].time[0] = 0x00;
763 headerCWF[ i ].time[0] = 0x00;
600 headerCWF[ i ].time[0] = 0x00;
764 headerCWF[ i ].time[0] = 0x00;
601 headerCWF[ i ].time[0] = 0x00;
765 headerCWF[ i ].time[0] = 0x00;
602 }
766 }
603 return LFR_SUCCESSFUL;
767 return LFR_SUCCESSFUL;
604 }
768 }
605
769
606 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
770 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
607 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
771 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
608 {
772 {
609 /** This function sends SWF CCSDS packets (F2, F1 or F0).
773 /** This function sends SWF CCSDS packets (F2, F1 or F0).
610 *
774 *
611 * @param waveform points to the buffer containing the data that will be send.
775 * @param waveform points to the buffer containing the data that will be send.
612 * @param sid is the source identifier of the data that will be sent.
776 * @param sid is the source identifier of the data that will be sent.
613 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
777 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
614 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
778 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
615 * contain information to setup the transmission of the data packets.
779 * contain information to setup the transmission of the data packets.
616 *
780 *
617 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
781 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
618 *
782 *
619 */
783 */
620
784
621 unsigned int i;
785 unsigned int i;
622 int ret;
786 int ret;
623 unsigned int coarseTime;
787 unsigned int coarseTime;
624 unsigned int fineTime;
788 unsigned int fineTime;
625 rtems_status_code status;
789 rtems_status_code status;
626 spw_ioctl_pkt_send spw_ioctl_send_SWF;
790 spw_ioctl_pkt_send spw_ioctl_send_SWF;
627
791
628 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
792 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
629 spw_ioctl_send_SWF.options = 0;
793 spw_ioctl_send_SWF.options = 0;
630
794
631 ret = LFR_DEFAULT;
795 ret = LFR_DEFAULT;
632
796
633 PRINTF1("sid = %d, ", sid)
797 PRINTF1("sid = %d, ", sid)
634 PRINTF2("coarse = %x, fine = %x\n", waveform[0], waveform[1])
798 PRINTF2("coarse = %x, fine = %x\n", waveform[0], waveform[1])
635
799
636 for (i=0; i<7; i++) // send waveform
800 for (i=0; i<7; i++) // send waveform
637 {
801 {
638 #ifdef VHDL_DEV
802 #ifdef VHDL_DEV
639 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET];
803 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET];
640 #else
804 #else
641 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) ];
805 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) ];
642 #endif
806 #endif
643 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
807 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
644 // BUILD THE DATA
808 // BUILD THE DATA
645 if (i==6) {
809 if (i==6) {
646 spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK;
810 spw_ioctl_send_SWF.dlen = BLK_NR_224 * NB_BYTES_SWF_BLK;
647 }
811 }
648 else {
812 else {
649 spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK;
813 spw_ioctl_send_SWF.dlen = BLK_NR_304 * NB_BYTES_SWF_BLK;
650 }
814 }
651 // SET PACKET SEQUENCE COUNTER
815 // SET PACKET SEQUENCE COUNTER
652 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
816 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
653 // SET PACKET TIME
817 // SET PACKET TIME
654 #ifdef VHDL_DEV
818 #ifdef VHDL_DEV
655 coarseTime = waveform[0];
819 coarseTime = waveform[0];
656 fineTime = waveform[1];
820 fineTime = waveform[1];
657 compute_acquisition_time( &coarseTime, &fineTime, sid, i);
821 compute_acquisition_time( &coarseTime, &fineTime, sid, i);
658
822
659 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime >> 24 );
823 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime >> 24 );
660 headerSWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime >> 16 );
824 headerSWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime >> 16 );
661 headerSWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime >> 8 );
825 headerSWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime >> 8 );
662 headerSWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime );
826 headerSWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime );
663 headerSWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime >> 8 );
827 headerSWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime >> 8 );
664 headerSWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime );
828 headerSWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime );
665 #else
829 #else
666 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
830 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
667 headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
831 headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
668 headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
832 headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
669 headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
833 headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
670 headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
834 headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
671 headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
835 headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
672 #endif
836 #endif
673 headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
837 headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
674 headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
838 headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
675 headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
839 headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
676 headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time);
840 headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time);
677 headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8);
841 headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8);
678 headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time);
842 headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time);
679 // SEND PACKET
843 // SEND PACKET
680 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
844 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
681 if (status != RTEMS_SUCCESSFUL) {
845 if (status != RTEMS_SUCCESSFUL) {
682 printf("%d-%d, ERR %d\n", sid, i, (int) status);
846 printf("%d-%d, ERR %d\n", sid, i, (int) status);
683 ret = LFR_DEFAULT;
847 ret = LFR_DEFAULT;
684 }
848 }
685 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
849 // rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
686 }
850 }
687
851
688 return ret;
852 return ret;
689 }
853 }
690
854
691 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
855 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
692 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
856 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
693 {
857 {
694 /** This function sends CWF CCSDS packets (F2, F1 or F0).
858 /** This function sends CWF CCSDS packets (F2, F1 or F0).
695 *
859 *
696 * @param waveform points to the buffer containing the data that will be send.
860 * @param waveform points to the buffer containing the data that will be send.
697 * @param sid is the source identifier of the data that will be sent.
861 * @param sid is the source identifier of the data that will be sent.
698 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
862 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
699 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
863 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
700 * contain information to setup the transmission of the data packets.
864 * contain information to setup the transmission of the data packets.
701 *
865 *
702 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
866 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
703 *
867 *
704 */
868 */
705
869
706 unsigned int i;
870 unsigned int i;
707 int ret;
871 int ret;
708 unsigned char *coarseTimePtr;
872 unsigned char *coarseTimePtr;
709 unsigned char *fineTimePtr;
873 unsigned char *fineTimePtr;
710 rtems_status_code status;
874 rtems_status_code status;
711 spw_ioctl_pkt_send spw_ioctl_send_CWF;
875 spw_ioctl_pkt_send spw_ioctl_send_CWF;
712
876
713 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
877 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
714 spw_ioctl_send_CWF.options = 0;
878 spw_ioctl_send_CWF.options = 0;
715
879
716 ret = LFR_DEFAULT;
880 ret = LFR_DEFAULT;
717
881
718 for (i=0; i<7; i++) // send waveform
882 for (i=0; i<7; i++) // send waveform
719 {
883 {
720 int coarseTime = 0x00;
884 int coarseTime = 0x00;
721 int fineTime = 0x00;
885 int fineTime = 0x00;
722 #ifdef VHDL_DEV
886 #ifdef VHDL_DEV
723 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET];
887 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET];
724 #else
888 #else
725 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) ];
889 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) ];
726 #endif
890 #endif
727 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
891 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
728 // BUILD THE DATA
892 // BUILD THE DATA
729 spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK;
893 spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK;
730 // SET PACKET SEQUENCE COUNTER
894 // SET PACKET SEQUENCE COUNTER
731 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
895 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
732 // SET PACKET TIME
896 // SET PACKET TIME
733 #ifdef VHDL_DEV
897 #ifdef VHDL_DEV
734 coarseTimePtr = (unsigned char *) &waveform;
898 coarseTimePtr = (unsigned char *) &waveform;
735 fineTimePtr = (unsigned char *) &waveform[1];
899 fineTimePtr = (unsigned char *) &waveform[1];
736 headerCWF[ i ].acquisitionTime[0] = coarseTimePtr[2];
900 headerCWF[ i ].acquisitionTime[0] = coarseTimePtr[2];
737 headerCWF[ i ].acquisitionTime[1] = coarseTimePtr[3];
901 headerCWF[ i ].acquisitionTime[1] = coarseTimePtr[3];
738 headerCWF[ i ].acquisitionTime[2] = coarseTimePtr[0];
902 headerCWF[ i ].acquisitionTime[2] = coarseTimePtr[0];
739 headerCWF[ i ].acquisitionTime[3] = coarseTimePtr[1];
903 headerCWF[ i ].acquisitionTime[3] = coarseTimePtr[1];
740 headerCWF[ i ].acquisitionTime[4] = fineTimePtr[0];
904 headerCWF[ i ].acquisitionTime[4] = fineTimePtr[0];
741 headerCWF[ i ].acquisitionTime[5] = fineTimePtr[1];
905 headerCWF[ i ].acquisitionTime[5] = fineTimePtr[1];
742 #else
906 #else
743 coarseTime = time_management_regs->coarse_time;
907 coarseTime = time_management_regs->coarse_time;
744 fineTime = time_management_regs->fine_time;
908 fineTime = time_management_regs->fine_time;
745 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
909 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
746 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
910 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
747 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
911 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
748 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
912 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
749 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
913 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
750 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
914 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
751 #endif
915 #endif
752
916
753 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
917 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
754 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
918 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
755 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
919 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
756 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
920 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
757 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
921 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
758 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
922 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
759 // SEND PACKET
923 // SEND PACKET
760 if (sid == SID_NORM_CWF_LONG_F3)
924 if (sid == SID_NORM_CWF_LONG_F3)
761 {
925 {
762 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
926 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
763 if (status != RTEMS_SUCCESSFUL) {
927 if (status != RTEMS_SUCCESSFUL) {
764 printf("%d-%d, ERR %d\n", sid, i, (int) status);
928 printf("%d-%d, ERR %d\n", sid, i, (int) status);
765 ret = LFR_DEFAULT;
929 ret = LFR_DEFAULT;
766 }
930 }
767 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
931 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
768 }
932 }
769 else
933 else
770 {
934 {
771 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
935 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
772 if (status != RTEMS_SUCCESSFUL) {
936 if (status != RTEMS_SUCCESSFUL) {
773 printf("%d-%d, ERR %d\n", sid, i, (int) status);
937 printf("%d-%d, ERR %d\n", sid, i, (int) status);
774 ret = LFR_DEFAULT;
938 ret = LFR_DEFAULT;
775 }
939 }
776 }
940 }
777 }
941 }
778
942
779 return ret;
943 return ret;
780 }
944 }
781
945
782 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
946 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
783 {
947 {
784 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
948 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
785 *
949 *
786 * @param waveform points to the buffer containing the data that will be send.
950 * @param waveform points to the buffer containing the data that will be send.
787 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
951 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
788 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
952 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
789 * contain information to setup the transmission of the data packets.
953 * contain information to setup the transmission of the data packets.
790 *
954 *
791 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
955 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
792 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
956 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
793 *
957 *
794 */
958 */
795
959
796 unsigned int i;
960 unsigned int i;
797 int ret;
961 int ret;
798 unsigned char *coarseTimePtr;
962 unsigned char *coarseTimePtr;
799 unsigned char *fineTimePtr;
963 unsigned char *fineTimePtr;
800 rtems_status_code status;
964 rtems_status_code status;
801 spw_ioctl_pkt_send spw_ioctl_send_CWF;
965 spw_ioctl_pkt_send spw_ioctl_send_CWF;
802 char *sample;
966 char *sample;
803
967
804 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
968 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
805 spw_ioctl_send_CWF.options = 0;
969 spw_ioctl_send_CWF.options = 0;
806
970
807 ret = LFR_DEFAULT;
971 ret = LFR_DEFAULT;
808
972
809 //**********************
973 //**********************
810 // BUILD CWF3_light DATA
974 // BUILD CWF3_light DATA
811 for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
975 for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
812 {
976 {
813 #ifdef VHDL_DEV
977 #ifdef VHDL_DEV
814 sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
978 sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
815 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ];
979 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ];
816 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ];
980 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ];
817 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ];
981 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ];
818 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ];
982 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ];
819 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ];
983 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ];
820 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ];
984 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ];
821 #else
985 #else
822 sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ];
986 sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ];
823 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ];
987 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ];
824 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ];
988 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ];
825 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ];
989 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ];
826 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ];
990 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ];
827 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ];
991 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ];
828 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ];
992 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ];
829 #endif
993 #endif
830 }
994 }
831
995
832 //*********************
996 //*********************
833 // SEND CWF3_light DATA
997 // SEND CWF3_light DATA
834
998
835 for (i=0; i<7; i++) // send waveform
999 for (i=0; i<7; i++) // send waveform
836 {
1000 {
837 int coarseTime = 0x00;
1001 int coarseTime = 0x00;
838 int fineTime = 0x00;
1002 int fineTime = 0x00;
839
1003
840 #ifdef VHDL_DEV
1004 #ifdef VHDL_DEV
841 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];
1005 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];
842 #else
1006 #else
843 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK) ];
1007 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK) ];
844 #endif
1008 #endif
845 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
1009 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
846 // BUILD THE DATA
1010 // BUILD THE DATA
847 spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK;
1011 spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK;
848 // SET PACKET SEQUENCE COUNTER
1012 // SET PACKET SEQUENCE COUNTER
849 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
1013 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
850 // SET PACKET TIME
1014 // SET PACKET TIME
851 #ifdef VHDL_DEV
1015 #ifdef VHDL_DEV
852 coarseTimePtr = (unsigned char *) &waveform;
1016 coarseTimePtr = (unsigned char *) &waveform;
853 fineTimePtr = (unsigned char *) &waveform[1];
1017 fineTimePtr = (unsigned char *) &waveform[1];
854 headerCWF[ i ].acquisitionTime[0] = coarseTimePtr[2];
1018 headerCWF[ i ].acquisitionTime[0] = coarseTimePtr[2];
855 headerCWF[ i ].acquisitionTime[1] = coarseTimePtr[3];
1019 headerCWF[ i ].acquisitionTime[1] = coarseTimePtr[3];
856 headerCWF[ i ].acquisitionTime[2] = coarseTimePtr[0];
1020 headerCWF[ i ].acquisitionTime[2] = coarseTimePtr[0];
857 headerCWF[ i ].acquisitionTime[3] = coarseTimePtr[1];
1021 headerCWF[ i ].acquisitionTime[3] = coarseTimePtr[1];
858 headerCWF[ i ].acquisitionTime[4] = fineTimePtr[0];
1022 headerCWF[ i ].acquisitionTime[4] = fineTimePtr[0];
859 headerCWF[ i ].acquisitionTime[5] = fineTimePtr[1];
1023 headerCWF[ i ].acquisitionTime[5] = fineTimePtr[1];
860 #else
1024 #else
861 coarseTime = time_management_regs->coarse_time;
1025 coarseTime = time_management_regs->coarse_time;
862 fineTime = time_management_regs->fine_time;
1026 fineTime = time_management_regs->fine_time;
863 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
1027 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
864 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
1028 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
865 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
1029 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
866 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
1030 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
867 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
1031 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
868 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
1032 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
869 #endif
1033 #endif
870 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
1034 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
871 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
1035 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
872 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
1036 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
873 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
1037 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
874 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
1038 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
875 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
1039 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
876 // SEND PACKET
1040 // SEND PACKET
877 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
1041 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
878 if (status != RTEMS_SUCCESSFUL) {
1042 if (status != RTEMS_SUCCESSFUL) {
879 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
1043 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
880 ret = LFR_DEFAULT;
1044 ret = LFR_DEFAULT;
881 }
1045 }
882 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
1046 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
883 }
1047 }
884
1048
885 return ret;
1049 return ret;
886 }
1050 }
887
1051
888 void compute_acquisition_time( unsigned int *coarseTime, unsigned int *fineTime, unsigned int sid, unsigned char pa_lfr_pkt_nr )
1052 void compute_acquisition_time( unsigned int *coarseTime, unsigned int *fineTime, unsigned int sid, unsigned char pa_lfr_pkt_nr )
889 {
1053 {
890 unsigned long long int acquisitionTimeAsLong;
1054 unsigned long long int acquisitionTimeAsLong;
891 unsigned char acquisitionTime[6];
1055 unsigned char acquisitionTime[6];
892 float deltaT = 0.;
1056 float deltaT = 0.;
893
1057
894 acquisitionTime[0] = (unsigned char) ( *coarseTime >> 8 );
1058 acquisitionTime[0] = (unsigned char) ( *coarseTime >> 8 );
895 acquisitionTime[1] = (unsigned char) ( *coarseTime );
1059 acquisitionTime[1] = (unsigned char) ( *coarseTime );
896 acquisitionTime[2] = (unsigned char) ( *coarseTime >> 24 );
1060 acquisitionTime[2] = (unsigned char) ( *coarseTime >> 24 );
897 acquisitionTime[3] = (unsigned char) ( *coarseTime >> 16 );
1061 acquisitionTime[3] = (unsigned char) ( *coarseTime >> 16 );
898 acquisitionTime[4] = (unsigned char) ( *fineTime >> 24 );
1062 acquisitionTime[4] = (unsigned char) ( *fineTime >> 24 );
899 acquisitionTime[5] = (unsigned char) ( *fineTime >> 16 );
1063 acquisitionTime[5] = (unsigned char) ( *fineTime >> 16 );
900
1064
901 acquisitionTimeAsLong = ( (unsigned long long int) acquisitionTime[0] << 40 )
1065 acquisitionTimeAsLong = ( (unsigned long long int) acquisitionTime[0] << 40 )
902 + ( (unsigned long long int) acquisitionTime[1] << 32 )
1066 + ( (unsigned long long int) acquisitionTime[1] << 32 )
903 + ( acquisitionTime[2] << 24 )
1067 + ( acquisitionTime[2] << 24 )
904 + ( acquisitionTime[3] << 16 )
1068 + ( acquisitionTime[3] << 16 )
905 + ( acquisitionTime[4] << 8 )
1069 + ( acquisitionTime[4] << 8 )
906 + ( acquisitionTime[5] );
1070 + ( acquisitionTime[5] );
907
1071
908 switch( sid )
1072 switch( sid )
909 {
1073 {
910 case SID_NORM_SWF_F0:
1074 case SID_NORM_SWF_F0:
911 deltaT = ( (float ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ;
1075 deltaT = ( (float ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ;
912 break;
1076 break;
913
1077
914 case SID_NORM_SWF_F1:
1078 case SID_NORM_SWF_F1:
915 deltaT = ( (float ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ;
1079 deltaT = ( (float ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ;
916 break;
1080 break;
917
1081
918 case SID_NORM_SWF_F2:
1082 case SID_NORM_SWF_F2:
919 deltaT = ( (float ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ;
1083 deltaT = ( (float ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ;
920 break;
1084 break;
921
1085
922 default:
1086 default:
923 deltaT = 0.;
1087 deltaT = 0.;
924 break;
1088 break;
925 }
1089 }
926
1090
927 acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT;
1091 acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT;
928
1092
929 *coarseTime = (unsigned int) (acquisitionTimeAsLong >> 16);
1093 *coarseTime = (unsigned int) (acquisitionTimeAsLong >> 16);
930 *fineTime = (unsigned int) (acquisitionTimeAsLong & 0xffff);
1094 *fineTime = (unsigned int) (acquisitionTimeAsLong & 0xffff);
931 }
1095 }
932
1096
933 //**************
1097 //**************
934 // wfp registers
1098 // wfp registers
935 void set_wfp_data_shaping()
1099 void set_wfp_data_shaping()
936 {
1100 {
937 /** This function sets the data_shaping register of the waveform picker module.
1101 /** This function sets the data_shaping register of the waveform picker module.
938 *
1102 *
939 * The value is read from one field of the parameter_dump_packet structure:\n
1103 * The value is read from one field of the parameter_dump_packet structure:\n
940 * bw_sp0_sp1_r0_r1
1104 * bw_sp0_sp1_r0_r1
941 *
1105 *
942 */
1106 */
943
1107
944 unsigned char data_shaping;
1108 unsigned char data_shaping;
945
1109
946 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
1110 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
947 // waveform picker : [R1 R0 SP1 SP0 BW]
1111 // waveform picker : [R1 R0 SP1 SP0 BW]
948
1112
949 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
1113 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
950
1114
951 #ifdef GSA
1115 #ifdef GSA
952 #else
1116 #else
953 waveform_picker_regs->data_shaping =
1117 waveform_picker_regs->data_shaping =
954 ( (data_shaping & 0x10) >> 4 ) // BW
1118 ( (data_shaping & 0x10) >> 4 ) // BW
955 + ( (data_shaping & 0x08) >> 2 ) // SP0
1119 + ( (data_shaping & 0x08) >> 2 ) // SP0
956 + ( (data_shaping & 0x04) ) // SP1
1120 + ( (data_shaping & 0x04) ) // SP1
957 + ( (data_shaping & 0x02) << 2 ) // R0
1121 + ( (data_shaping & 0x02) << 2 ) // R0
958 + ( (data_shaping & 0x01) << 4 ); // R1
1122 + ( (data_shaping & 0x01) << 4 ); // R1
959 #endif
1123 #endif
960 }
1124 }
961
1125
962 char set_wfp_delta_snapshot()
1126 char set_wfp_delta_snapshot()
963 {
1127 {
964 /** This function sets the delta_snapshot register of the waveform picker module.
1128 /** This function sets the delta_snapshot register of the waveform picker module.
965 *
1129 *
966 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
1130 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
967 * - sy_lfr_n_swf_p[0]
1131 * - sy_lfr_n_swf_p[0]
968 * - sy_lfr_n_swf_p[1]
1132 * - sy_lfr_n_swf_p[1]
969 *
1133 *
970 */
1134 */
971
1135
972 char ret;
1136 char ret;
973 unsigned int delta_snapshot;
1137 unsigned int delta_snapshot;
974 unsigned int aux;
1138 unsigned int aux;
975
1139
976 aux = 0;
1140 aux = 0;
977 ret = LFR_DEFAULT;
1141 ret = LFR_DEFAULT;
978
1142
979 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
1143 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
980 + parameter_dump_packet.sy_lfr_n_swf_p[1];
1144 + parameter_dump_packet.sy_lfr_n_swf_p[1];
981
1145
982 #ifdef GSA
1146 #ifdef GSA
983 #else
1147 #else
984 if ( delta_snapshot < MIN_DELTA_SNAPSHOT )
1148 if ( delta_snapshot < MIN_DELTA_SNAPSHOT )
985 {
1149 {
986 aux = MIN_DELTA_SNAPSHOT;
1150 aux = MIN_DELTA_SNAPSHOT;
987 ret = LFR_DEFAULT;
1151 ret = LFR_DEFAULT;
988 }
1152 }
989 else
1153 else
990 {
1154 {
991 aux = delta_snapshot ;
1155 aux = delta_snapshot ;
992 ret = LFR_SUCCESSFUL;
1156 ret = LFR_SUCCESSFUL;
993 }
1157 }
994 waveform_picker_regs->delta_snapshot = aux - 1; // max 2 bytes
1158 waveform_picker_regs->delta_snapshot = aux - 1; // max 2 bytes
995 #endif
1159 #endif
996
1160
997 return ret;
1161 return ret;
998 }
1162 }
999
1163
1000 #ifdef VHDL_DEV
1164 #ifdef VHDL_DEV
1001 void set_wfp_burst_enable_register( unsigned char mode )
1165 void set_wfp_burst_enable_register( unsigned char mode )
1002 {
1166 {
1003 /** This function sets the waveform picker burst_enable register depending on the mode.
1167 /** This function sets the waveform picker burst_enable register depending on the mode.
1004 *
1168 *
1005 * @param mode is the LFR mode to launch.
1169 * @param mode is the LFR mode to launch.
1006 *
1170 *
1007 * The burst bits shall be before the enable bits.
1171 * The burst bits shall be before the enable bits.
1008 *
1172 *
1009 */
1173 */
1010
1174
1011 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1175 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1012 // the burst bits shall be set first, before the enable bits
1176 // the burst bits shall be set first, before the enable bits
1013 switch(mode) {
1177 switch(mode) {
1014 case(LFR_MODE_NORMAL):
1178 case(LFR_MODE_NORMAL):
1015 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable
1179 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable
1016 waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1180 waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1017 break;
1181 break;
1018 case(LFR_MODE_BURST):
1182 case(LFR_MODE_BURST):
1019 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1183 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1020 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2
1184 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2
1021 break;
1185 break;
1022 case(LFR_MODE_SBM1):
1186 case(LFR_MODE_SBM1):
1023 waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled
1187 waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled
1024 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1188 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1025 break;
1189 break;
1026 case(LFR_MODE_SBM2):
1190 case(LFR_MODE_SBM2):
1027 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1191 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1028 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1192 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1029 break;
1193 break;
1030 default:
1194 default:
1031 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1195 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1032 break;
1196 break;
1033 }
1197 }
1034 }
1198 }
1035 #else
1199 #else
1036 void set_wfp_burst_enable_register( unsigned char mode )
1200 void set_wfp_burst_enable_register( unsigned char mode )
1037 {
1201 {
1038 /** This function sets the waveform picker burst_enable register depending on the mode.
1202 /** This function sets the waveform picker burst_enable register depending on the mode.
1039 *
1203 *
1040 * @param mode is the LFR mode to launch.
1204 * @param mode is the LFR mode to launch.
1041 *
1205 *
1042 * The burst bits shall be before the enable bits.
1206 * The burst bits shall be before the enable bits.
1043 *
1207 *
1044 */
1208 */
1045
1209
1046 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1210 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1047 // the burst bits shall be set first, before the enable bits
1211 // the burst bits shall be set first, before the enable bits
1048 switch(mode) {
1212 switch(mode) {
1049 case(LFR_MODE_NORMAL):
1213 case(LFR_MODE_NORMAL):
1050 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enable
1214 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enable
1051 waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1215 waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1052 break;
1216 break;
1053 case(LFR_MODE_BURST):
1217 case(LFR_MODE_BURST):
1054 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
1218 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
1055 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2
1219 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2
1056 break;
1220 break;
1057 case(LFR_MODE_SBM1):
1221 case(LFR_MODE_SBM1):
1058 waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled
1222 waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled
1059 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1223 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1060 break;
1224 break;
1061 case(LFR_MODE_SBM2):
1225 case(LFR_MODE_SBM2):
1062 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
1226 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
1063 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1227 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1064 break;
1228 break;
1065 default:
1229 default:
1066 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1230 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1067 break;
1231 break;
1068 }
1232 }
1069 }
1233 }
1070 #endif
1234 #endif
1071
1235
1072 void reset_wfp_burst_enable()
1236 void reset_wfp_burst_enable()
1073 {
1237 {
1074 /** This function resets the waveform picker burst_enable register.
1238 /** This function resets the waveform picker burst_enable register.
1075 *
1239 *
1076 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
1240 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
1077 *
1241 *
1078 */
1242 */
1079
1243
1080 #ifdef VHDL_DEV
1244 #ifdef VHDL_DEV
1081 waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1245 waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1082 #else
1246 #else
1083 waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1247 waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1084 #endif
1248 #endif
1085 }
1249 }
1086
1250
1087 void reset_wfp_status()
1251 void reset_wfp_status()
1088 {
1252 {
1089 /** This function resets the waveform picker status register.
1253 /** This function resets the waveform picker status register.
1090 *
1254 *
1091 * All status bits are set to 0 [new_err full_err full].
1255 * All status bits are set to 0 [new_err full_err full].
1092 *
1256 *
1093 */
1257 */
1094
1258
1095 #ifdef GSA
1259 #ifdef GSA
1096 #else
1260 #else
1097 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1261 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1098 #endif
1262 #endif
1099 }
1263 }
1100
1264
1101 #ifdef VHDL_DEV
1265 void reset_waveform_picker_regs_vhdl_dev()
1102 void reset_waveform_picker_regs()
1103 {
1266 {
1104 /** This function resets the waveform picker module registers.
1267 /** This function resets the waveform picker module registers.
1105 *
1268 *
1106 * The registers affected by this function are located at the following offset addresses:
1269 * The registers affected by this function are located at the following offset addresses:
1107 * - 0x00 data_shaping
1270 * - 0x00 data_shaping
1108 * - 0x04 run_burst_enable
1271 * - 0x04 run_burst_enable
1109 * - 0x08 addr_data_f0
1272 * - 0x08 addr_data_f0
1110 * - 0x0C addr_data_f1
1273 * - 0x0C addr_data_f1
1111 * - 0x10 addr_data_f2
1274 * - 0x10 addr_data_f2
1112 * - 0x14 addr_data_f3
1275 * - 0x14 addr_data_f3
1113 * - 0x18 status
1276 * - 0x18 status
1114 * - 0x1C delta_snapshot
1277 * - 0x1C delta_snapshot
1115 * - 0x20 delta_f0
1278 * - 0x20 delta_f0
1116 * - 0x24 delta_f0_2
1279 * - 0x24 delta_f0_2
1117 * - 0x28 delta_f1
1280 * - 0x28 delta_f1
1118 * - 0x2c delta_f2
1281 * - 0x2c delta_f2
1119 * - 0x30 nb_data_by_buffer
1282 * - 0x30 nb_data_by_buffer
1120 * - 0x34 nb_snapshot_param
1283 * - 0x34 nb_snapshot_param
1121 * - 0x38 start_date
1284 * - 0x38 start_date
1122 * - 0x3c nb_word_in_buffer
1285 * - 0x3c nb_word_in_buffer
1123 *
1286 *
1124 */
1287 */
1125 waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW
1288 waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW
1126 waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1289 waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1127 //waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // 0x08
1290 //waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // 0x08
1128 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08
1291 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08
1129 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c
1292 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c
1130 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10
1293 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10
1131 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14
1294 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14
1132 waveform_picker_regs->status = 0x00; // 0x18
1295 waveform_picker_regs->status = 0x00; // 0x18
1133 //
1296 //
1134 waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c *** 4096 = 16 * 256
1297 waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c *** 4096 = 16 * 256
1135 waveform_picker_regs->delta_f0 = 0xc0b; // 0x20 *** 3083 = 4096 - 1013
1298 waveform_picker_regs->delta_f0 = 0xc0b; // 0x20 *** 3083 = 4096 - 1013
1136 waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits]
1299 waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits]
1137 waveform_picker_regs->delta_f1 = 0xc40; // 0x28 *** 3136 = 4096 - 960
1300 waveform_picker_regs->delta_f1 = 0xc40; // 0x28 *** 3136 = 4096 - 960
1138 waveform_picker_regs->delta_f2 = 0xc00; // 0x2c *** 3072 = 12 * 256
1301 waveform_picker_regs->delta_f2 = 0xc00; // 0x2c *** 3072 = 12 * 256
1139 //
1302 //
1140 // waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c *** 4096 = 16 * 256
1303 // waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c *** 4096 = 16 * 256
1141 // waveform_picker_regs->delta_f0 = 0x1; // 0x20 ***
1304 // waveform_picker_regs->delta_f0 = 0x1; // 0x20 ***
1142 // waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits]
1305 // waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits]
1143 // waveform_picker_regs->delta_f1 = 0x1; // 0x28 ***
1306 // waveform_picker_regs->delta_f1 = 0x1; // 0x28 ***
1144 // waveform_picker_regs->delta_f2 = 0x1; // 0x2c ***
1307 // waveform_picker_regs->delta_f2 = 0x1; // 0x2c ***
1145 //
1308 //
1146 // waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c *** 4096 = 16 * 256
1309 // waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c *** 4096 = 16 * 256
1147 // waveform_picker_regs->delta_f0 = 0x0fff; // 0x20 ***
1310 // waveform_picker_regs->delta_f0 = 0x0fff; // 0x20 ***
1148 // waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits]
1311 // waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits]
1149 // waveform_picker_regs->delta_f1 = 0x0fff; // 0x28 ***
1312 // waveform_picker_regs->delta_f1 = 0x0fff; // 0x28 ***
1150 // waveform_picker_regs->delta_f2 = 0x1; // 0x2c ***
1313 // waveform_picker_regs->delta_f2 = 0x1; // 0x2c ***
1151 // 2048
1314 // 2048
1152 // waveform_picker_regs->nb_data_by_buffer = 0x7ff; // 0x30 *** 2048 -1 => nb samples -1
1315 // waveform_picker_regs->nb_data_by_buffer = 0x7ff; // 0x30 *** 2048 -1 => nb samples -1
1153 // waveform_picker_regs->snapshot_param = 0x800; // 0x34 *** 2048 => nb samples
1316 // waveform_picker_regs->snapshot_param = 0x800; // 0x34 *** 2048 => nb samples
1154 // waveform_picker_regs->start_date = 0x00; // 0x38
1317 // waveform_picker_regs->start_date = 0x00; // 0x38
1155 // waveform_picker_regs->nb_word_in_buffer = 0x1802; // 0x3c *** 2048 * 3 + 2 = 6146
1318 // waveform_picker_regs->nb_word_in_buffer = 0x1802; // 0x3c *** 2048 * 3 + 2 = 6146
1156 // 2352 = 7 * 336
1319 // 2352 = 7 * 336
1157 waveform_picker_regs->nb_data_by_buffer = 0x92f; // 0x30 *** 2352 - 1 => nb samples -1
1320 // waveform_picker_regs->nb_data_by_buffer = 0x92f; // 0x30 *** 2352 - 1 => nb samples -1
1158 waveform_picker_regs->snapshot_param = 0x930; // 0x34 *** 2352 => nb samples
1321 // waveform_picker_regs->snapshot_param = 0x930; // 0x34 *** 2352 => nb samples
1322 // waveform_picker_regs->start_date = 0x00; // 0x38
1323 // waveform_picker_regs->nb_word_in_buffer = 0x1b92; // 0x3c *** 2352 * 3 + 2 = 7058
1324 // 128
1325 waveform_picker_regs->nb_data_by_buffer = 0x7f; // 0x30 *** 128 - 1 => nb samples -1
1326 waveform_picker_regs->snapshot_param = 0x80; // 0x34 *** 128 => nb samples
1159 waveform_picker_regs->start_date = 0x00; // 0x38
1327 waveform_picker_regs->start_date = 0x00; // 0x38
1160 waveform_picker_regs->nb_word_in_buffer = 0x1b92; // 0x3c *** 2352 * 3 + 2 = 7058
1328 waveform_picker_regs->nb_word_in_buffer = 0x182; // 0x3c *** 128 * 3 + 2 = 386
1329 }
1330
1331 void reset_waveform_picker_regs_vhdl_dev_debug()
1332 {
1333 /** This function resets the waveform picker module registers.
1334 *
1335 * The registers affected by this function are located at the following offset addresses:
1336 * - 0x00 data_shaping
1337 * - 0x04 run_burst_enable
1338 * - 0x08 addr_data_f0
1339 * - 0x0C addr_data_f1
1340 * - 0x10 addr_data_f2
1341 * - 0x14 addr_data_f3
1342 * - 0x18 status
1343 * - 0x1C delta_snapshot
1344 * - 0x20 delta_f0
1345 * - 0x24 delta_f0_2
1346 * - 0x28 delta_f1
1347 * - 0x2c delta_f2
1348 * - 0x30 nb_data_by_buffer
1349 * - 0x34 nb_snapshot_param
1350 * - 0x38 start_date
1351 * - 0x3c nb_word_in_buffer
1352 *
1353 */
1354 waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW
1355 waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1356 //waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // 0x08
1357 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08
1358 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c
1359 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10
1360 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14
1361 waveform_picker_regs->status = 0x00; // 0x18
1362 //
1363 waveform_picker_regs->delta_snapshot = 0x100; // 0x1c *** 256
1364 waveform_picker_regs->delta_f0 = 0xc1; // 0x20 *** 256 - 63
1365 waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits]
1366 waveform_picker_regs->delta_f1 = 0xc4; // 0x28 *** 256 - 60
1367 waveform_picker_regs->delta_f2 = 0xc0; // 0x2c *** 192
1368 // 128
1369 waveform_picker_regs->nb_data_by_buffer = 0x7f; // 0x30 *** 128 - 1 => nb samples -1
1370 waveform_picker_regs->snapshot_param = 0x80; // 0x34 *** 128 => nb samples
1371 waveform_picker_regs->start_date = 0x00; // 0x38
1372 waveform_picker_regs->nb_word_in_buffer = 0x182; // 0x3c *** 128 * 3 + 2 = 386
1161 }
1373 }
1162 #else
1374
1375 void reset_waveform_picker_regs_vhdl_dev_debug_64()
1376 {
1377 /** This function resets the waveform picker module registers.
1378 *
1379 * The registers affected by this function are located at the following offset addresses:
1380 * - 0x00 data_shaping
1381 * - 0x04 run_burst_enable
1382 * - 0x08 addr_data_f0
1383 * - 0x0C addr_data_f1
1384 * - 0x10 addr_data_f2
1385 * - 0x14 addr_data_f3
1386 * - 0x18 status
1387 * - 0x1C delta_snapshot
1388 * - 0x20 delta_f0
1389 * - 0x24 delta_f0_2
1390 * - 0x28 delta_f1
1391 * - 0x2c delta_f2
1392 * - 0x30 nb_data_by_buffer
1393 * - 0x34 nb_snapshot_param
1394 * - 0x38 start_date
1395 * - 0x3c nb_word_in_buffer
1396 *
1397 */
1398 waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW
1399 waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1400 //waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // 0x08
1401 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08
1402 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c
1403 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10
1404 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14
1405 waveform_picker_regs->status = 0x00; // 0x18
1406 //
1407 waveform_picker_regs->delta_snapshot = 0x80; // 0x1c *** 128
1408 waveform_picker_regs->delta_f0 = 0x60; // 0x20 *** 128 - 32 = 96
1409 waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits]
1410 waveform_picker_regs->delta_f1 = 0x62; // 0x28 *** 128 - 30 = 90
1411 waveform_picker_regs->delta_f2 = 0x60; // 0x2c *** 192
1412 // 128
1413 waveform_picker_regs->nb_data_by_buffer = 0x3f; // 0x30 *** 64 - 1 => nb samples -1
1414 waveform_picker_regs->snapshot_param = 0x40; // 0x34 *** 64 => nb samples
1415 waveform_picker_regs->start_date = 0x00; // 0x38
1416 waveform_picker_regs->nb_word_in_buffer = 0xc2; // 0x3c *** 64 * 3 + 2 = 194
1417 }
1418
1163 void reset_waveform_picker_regs()
1419 void reset_waveform_picker_regs()
1164 {
1420 {
1165 /** This function resets the waveform picker module registers.
1421 /** This function resets the waveform picker module registers.
1166 *
1422 *
1167 * The registers affected by this function are located at the following offset addresses:
1423 * The registers affected by this function are located at the following offset addresses:
1168 * - 0x00 data_shaping
1424 * - 0x00 data_shaping
1169 * - 0x04 burst_enable
1425 * - 0x04 burst_enable
1170 * - 0x08 addr_data_f0
1426 * - 0x08 addr_data_f0
1171 * - 0x0C addr_data_f1
1427 * - 0x0C addr_data_f1
1172 * - 0x10 addr_data_f2
1428 * - 0x10 addr_data_f2
1173 * - 0x14 addr_data_f3
1429 * - 0x14 addr_data_f3
1174 * - 0x18 status
1430 * - 0x18 status
1175 * - 0x1C delta_snapshot
1431 * - 0x1C delta_snapshot
1176 * - 0x20 delta_f2_f1
1432 * - 0x20 delta_f2_f1
1177 * - 0x24 delta_f2_f0
1433 * - 0x24 delta_f2_f0
1178 * - 0x28 nb_burst
1434 * - 0x28 nb_burst
1179 * - 0x2C nb_snapshot
1435 * - 0x2C nb_snapshot
1180 *
1436 *
1181 */
1437 */
1182
1438
1439 #ifdef VHDL_DEV
1440 #else
1183 reset_wfp_burst_enable();
1441 reset_wfp_burst_enable();
1184 reset_wfp_status();
1442 reset_wfp_status();
1185 // set buffer addresses
1443 // set buffer addresses
1186 waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0);
1444 waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0);
1187 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
1445 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
1188 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
1446 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
1189 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a);
1447 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a);
1190 // set other parameters
1448 // set other parameters
1191 set_wfp_data_shaping();
1449 set_wfp_data_shaping();
1192 set_wfp_delta_snapshot(); // time in seconds between two snapshots
1450 set_wfp_delta_snapshot(); // time in seconds between two snapshots
1193 waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes)
1451 waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes)
1194 waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes)
1452 waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes)
1195 // waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
1453 // waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
1196 // // 3 * 2048 / 16 = 384
1454 // // 3 * 2048 / 16 = 384
1197 // waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1
1455 // waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1
1198 waveform_picker_regs->nb_burst_available = 0x1b9; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
1456 waveform_picker_regs->nb_burst_available = 0x1b9; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
1199 // 3 * 2352 / 16 = 441
1457 // 3 * 2352 / 16 = 441
1200 waveform_picker_regs->nb_snapshot_param = 0x944; // max 3 octets, 2372 - 1
1458 waveform_picker_regs->nb_snapshot_param = 0x944; // max 3 octets, 2372 - 1
1459 #endif
1201 }
1460 }
1202 #endif
1203
1461
1204 //*****************
1462 //*****************
1205 // local parameters
1463 // local parameters
1206 void set_local_nb_interrupt_f0_MAX( void )
1464 void set_local_nb_interrupt_f0_MAX( void )
1207 {
1465 {
1208 /** This function sets the value of the nb_interrupt_f0_MAX local parameter.
1466 /** This function sets the value of the nb_interrupt_f0_MAX local parameter.
1209 *
1467 *
1210 * This parameter is used for the SM validation only.\n
1468 * This parameter is used for the SM validation only.\n
1211 * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices
1469 * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices
1212 * module before launching a basic processing.
1470 * module before launching a basic processing.
1213 *
1471 *
1214 */
1472 */
1215
1473
1216 param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256
1474 param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256
1217 + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100;
1475 + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100;
1218 }
1476 }
1219
1477
1220 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1478 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1221 {
1479 {
1222 unsigned short *sequence_cnt;
1480 unsigned short *sequence_cnt;
1223 unsigned short segmentation_grouping_flag;
1481 unsigned short segmentation_grouping_flag;
1224 unsigned short new_packet_sequence_control;
1482 unsigned short new_packet_sequence_control;
1225
1483
1226 if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2)
1484 if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2)
1227 || (sid ==SID_NORM_CWF_F3) || (sid==SID_NORM_CWF_LONG_F3) || (sid ==SID_BURST_CWF_F2) )
1485 || (sid ==SID_NORM_CWF_F3) || (sid==SID_NORM_CWF_LONG_F3) || (sid ==SID_BURST_CWF_F2) )
1228 {
1486 {
1229 sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST;
1487 sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST;
1230 }
1488 }
1231 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) )
1489 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) )
1232 {
1490 {
1233 sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2;
1491 sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2;
1234 }
1492 }
1235 else
1493 else
1236 {
1494 {
1237 sequence_cnt = NULL;
1495 sequence_cnt = NULL;
1238 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1496 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1239 }
1497 }
1240
1498
1241 if (sequence_cnt != NULL)
1499 if (sequence_cnt != NULL)
1242 {
1500 {
1243 segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8;
1501 segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8;
1244 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1502 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1245
1503
1246 new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ;
1504 new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ;
1247
1505
1248 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1506 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1249 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1507 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1250
1508
1251 // increment the sequence counter for the next packet
1509 // increment the sequence counter for the next packet
1252 if ( *sequence_cnt < SEQ_CNT_MAX)
1510 if ( *sequence_cnt < SEQ_CNT_MAX)
1253 {
1511 {
1254 *sequence_cnt = *sequence_cnt + 1;
1512 *sequence_cnt = *sequence_cnt + 1;
1255 }
1513 }
1256 else
1514 else
1257 {
1515 {
1258 *sequence_cnt = 0;
1516 *sequence_cnt = 0;
1259 }
1517 }
1260 }
1518 }
1261 }
1519 }
General Comments 0
You need to be logged in to leave comments. Login now