##// END OF EJS Templates
sequence counters management added
paul -
r56:7b010fae8e4e default
parent child
Show More
@@ -1,248 +1,248
1 #############################################################################
1 #############################################################################
2 # Makefile for building: bin/fsw
2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Nov 5 13:12:35 2013
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Nov 7 08:03:44 2013
4 # Project: fsw-qt.pro
4 # Project: fsw-qt.pro
5 # Template: app
5 # Template: app
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
7 #############################################################################
7 #############################################################################
8
8
9 ####### Compiler, tools and options
9 ####### Compiler, tools and options
10
10
11 CC = sparc-rtems-gcc
11 CC = sparc-rtems-gcc
12 CXX = sparc-rtems-g++
12 CXX = sparc-rtems-g++
13 DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=20 -DPRINT_MESSAGES_ON_CONSOLE
13 DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=20 -DPRINT_MESSAGES_ON_CONSOLE
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header
17 LINK = sparc-rtems-g++
17 LINK = sparc-rtems-g++
18 LFLAGS =
18 LFLAGS =
19 LIBS = $(SUBLIBS)
19 LIBS = $(SUBLIBS)
20 AR = sparc-rtems-ar rcs
20 AR = sparc-rtems-ar rcs
21 RANLIB =
21 RANLIB =
22 QMAKE = /usr/bin/qmake-qt4
22 QMAKE = /usr/bin/qmake-qt4
23 TAR = tar -cf
23 TAR = tar -cf
24 COMPRESS = gzip -9f
24 COMPRESS = gzip -9f
25 COPY = cp -f
25 COPY = cp -f
26 SED = sed
26 SED = sed
27 COPY_FILE = $(COPY)
27 COPY_FILE = $(COPY)
28 COPY_DIR = $(COPY) -r
28 COPY_DIR = $(COPY) -r
29 STRIP = sparc-rtems-strip
29 STRIP = sparc-rtems-strip
30 INSTALL_FILE = install -m 644 -p
30 INSTALL_FILE = install -m 644 -p
31 INSTALL_DIR = $(COPY_DIR)
31 INSTALL_DIR = $(COPY_DIR)
32 INSTALL_PROGRAM = install -m 755 -p
32 INSTALL_PROGRAM = install -m 755 -p
33 DEL_FILE = rm -f
33 DEL_FILE = rm -f
34 SYMLINK = ln -f -s
34 SYMLINK = ln -f -s
35 DEL_DIR = rmdir
35 DEL_DIR = rmdir
36 MOVE = mv -f
36 MOVE = mv -f
37 CHK_DIR_EXISTS= test -d
37 CHK_DIR_EXISTS= test -d
38 MKDIR = mkdir -p
38 MKDIR = mkdir -p
39
39
40 ####### Output directory
40 ####### Output directory
41
41
42 OBJECTS_DIR = obj/
42 OBJECTS_DIR = obj/
43
43
44 ####### Files
44 ####### Files
45
45
46 SOURCES = ../src/wf_handler.c \
46 SOURCES = ../src/wf_handler.c \
47 ../src/tc_handler.c \
47 ../src/tc_handler.c \
48 ../src/fsw_processing.c \
48 ../src/fsw_processing.c \
49 ../src/fsw_misc.c \
49 ../src/fsw_misc.c \
50 ../src/fsw_init.c \
50 ../src/fsw_init.c \
51 ../src/fsw_globals.c \
51 ../src/fsw_globals.c \
52 ../src/fsw_spacewire.c \
52 ../src/fsw_spacewire.c \
53 ../src/tc_load_dump_parameters.c \
53 ../src/tc_load_dump_parameters.c \
54 ../src/tm_lfr_tc_exe.c \
54 ../src/tm_lfr_tc_exe.c \
55 ../src/tc_acceptance.c
55 ../src/tc_acceptance.c
56 OBJECTS = obj/wf_handler.o \
56 OBJECTS = obj/wf_handler.o \
57 obj/tc_handler.o \
57 obj/tc_handler.o \
58 obj/fsw_processing.o \
58 obj/fsw_processing.o \
59 obj/fsw_misc.o \
59 obj/fsw_misc.o \
60 obj/fsw_init.o \
60 obj/fsw_init.o \
61 obj/fsw_globals.o \
61 obj/fsw_globals.o \
62 obj/fsw_spacewire.o \
62 obj/fsw_spacewire.o \
63 obj/tc_load_dump_parameters.o \
63 obj/tc_load_dump_parameters.o \
64 obj/tm_lfr_tc_exe.o \
64 obj/tm_lfr_tc_exe.o \
65 obj/tc_acceptance.o
65 obj/tc_acceptance.o
66 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
66 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
67 /usr/lib64/qt4/mkspecs/common/linux.conf \
67 /usr/lib64/qt4/mkspecs/common/linux.conf \
68 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
68 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
69 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
69 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
70 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
70 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
71 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
71 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
72 /usr/lib64/qt4/mkspecs/qconfig.pri \
72 /usr/lib64/qt4/mkspecs/qconfig.pri \
73 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
73 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
74 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
74 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
75 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
75 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
76 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
76 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
77 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
77 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
78 sparc.pri \
78 sparc.pri \
79 /usr/lib64/qt4/mkspecs/features/release.prf \
79 /usr/lib64/qt4/mkspecs/features/release.prf \
80 /usr/lib64/qt4/mkspecs/features/default_post.prf \
80 /usr/lib64/qt4/mkspecs/features/default_post.prf \
81 /usr/lib64/qt4/mkspecs/features/shared.prf \
81 /usr/lib64/qt4/mkspecs/features/shared.prf \
82 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
82 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
83 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
83 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
84 /usr/lib64/qt4/mkspecs/features/resources.prf \
84 /usr/lib64/qt4/mkspecs/features/resources.prf \
85 /usr/lib64/qt4/mkspecs/features/uic.prf \
85 /usr/lib64/qt4/mkspecs/features/uic.prf \
86 /usr/lib64/qt4/mkspecs/features/yacc.prf \
86 /usr/lib64/qt4/mkspecs/features/yacc.prf \
87 /usr/lib64/qt4/mkspecs/features/lex.prf \
87 /usr/lib64/qt4/mkspecs/features/lex.prf \
88 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
88 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
89 fsw-qt.pro
89 fsw-qt.pro
90 QMAKE_TARGET = fsw
90 QMAKE_TARGET = fsw
91 DESTDIR = bin/
91 DESTDIR = bin/
92 TARGET = bin/fsw
92 TARGET = bin/fsw
93
93
94 first: all
94 first: all
95 ####### Implicit rules
95 ####### Implicit rules
96
96
97 .SUFFIXES: .o .c .cpp .cc .cxx .C
97 .SUFFIXES: .o .c .cpp .cc .cxx .C
98
98
99 .cpp.o:
99 .cpp.o:
100 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
100 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
101
101
102 .cc.o:
102 .cc.o:
103 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
103 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
104
104
105 .cxx.o:
105 .cxx.o:
106 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
106 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
107
107
108 .C.o:
108 .C.o:
109 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
109 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
110
110
111 .c.o:
111 .c.o:
112 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
112 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
113
113
114 ####### Build rules
114 ####### Build rules
115
115
116 all: Makefile $(TARGET)
116 all: Makefile $(TARGET)
117
117
118 $(TARGET): $(OBJECTS)
118 $(TARGET): $(OBJECTS)
119 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
119 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
120 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
120 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
121
121
122 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
122 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
123 /usr/lib64/qt4/mkspecs/common/linux.conf \
123 /usr/lib64/qt4/mkspecs/common/linux.conf \
124 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
124 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
125 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
125 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
126 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
126 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
127 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
127 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
128 /usr/lib64/qt4/mkspecs/qconfig.pri \
128 /usr/lib64/qt4/mkspecs/qconfig.pri \
129 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
129 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
130 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
130 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
131 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
131 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
132 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
132 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
133 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
133 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
134 sparc.pri \
134 sparc.pri \
135 /usr/lib64/qt4/mkspecs/features/release.prf \
135 /usr/lib64/qt4/mkspecs/features/release.prf \
136 /usr/lib64/qt4/mkspecs/features/default_post.prf \
136 /usr/lib64/qt4/mkspecs/features/default_post.prf \
137 /usr/lib64/qt4/mkspecs/features/shared.prf \
137 /usr/lib64/qt4/mkspecs/features/shared.prf \
138 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
138 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
139 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
139 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
140 /usr/lib64/qt4/mkspecs/features/resources.prf \
140 /usr/lib64/qt4/mkspecs/features/resources.prf \
141 /usr/lib64/qt4/mkspecs/features/uic.prf \
141 /usr/lib64/qt4/mkspecs/features/uic.prf \
142 /usr/lib64/qt4/mkspecs/features/yacc.prf \
142 /usr/lib64/qt4/mkspecs/features/yacc.prf \
143 /usr/lib64/qt4/mkspecs/features/lex.prf \
143 /usr/lib64/qt4/mkspecs/features/lex.prf \
144 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
144 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
145 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
145 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
146 /usr/lib64/qt4/mkspecs/common/unix.conf:
146 /usr/lib64/qt4/mkspecs/common/unix.conf:
147 /usr/lib64/qt4/mkspecs/common/linux.conf:
147 /usr/lib64/qt4/mkspecs/common/linux.conf:
148 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
148 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
149 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
149 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
150 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
150 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
151 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
151 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
152 /usr/lib64/qt4/mkspecs/qconfig.pri:
152 /usr/lib64/qt4/mkspecs/qconfig.pri:
153 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
153 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
154 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
154 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
155 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
155 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
156 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
156 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
157 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
157 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
158 sparc.pri:
158 sparc.pri:
159 /usr/lib64/qt4/mkspecs/features/release.prf:
159 /usr/lib64/qt4/mkspecs/features/release.prf:
160 /usr/lib64/qt4/mkspecs/features/default_post.prf:
160 /usr/lib64/qt4/mkspecs/features/default_post.prf:
161 /usr/lib64/qt4/mkspecs/features/shared.prf:
161 /usr/lib64/qt4/mkspecs/features/shared.prf:
162 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
162 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
163 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
163 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
164 /usr/lib64/qt4/mkspecs/features/resources.prf:
164 /usr/lib64/qt4/mkspecs/features/resources.prf:
165 /usr/lib64/qt4/mkspecs/features/uic.prf:
165 /usr/lib64/qt4/mkspecs/features/uic.prf:
166 /usr/lib64/qt4/mkspecs/features/yacc.prf:
166 /usr/lib64/qt4/mkspecs/features/yacc.prf:
167 /usr/lib64/qt4/mkspecs/features/lex.prf:
167 /usr/lib64/qt4/mkspecs/features/lex.prf:
168 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
168 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
169 qmake: FORCE
169 qmake: FORCE
170 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
170 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
171
171
172 dist:
172 dist:
173 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
173 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
174 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0
174 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0
175
175
176
176
177 clean:compiler_clean
177 clean:compiler_clean
178 -$(DEL_FILE) $(OBJECTS)
178 -$(DEL_FILE) $(OBJECTS)
179 -$(DEL_FILE) *~ core *.core
179 -$(DEL_FILE) *~ core *.core
180
180
181
181
182 ####### Sub-libraries
182 ####### Sub-libraries
183
183
184 distclean: clean
184 distclean: clean
185 -$(DEL_FILE) $(TARGET)
185 -$(DEL_FILE) $(TARGET)
186 -$(DEL_FILE) Makefile
186 -$(DEL_FILE) Makefile
187
187
188
188
189 grmon:
189 grmon:
190 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
190 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
191
191
192 check: first
192 check: first
193
193
194 compiler_rcc_make_all:
194 compiler_rcc_make_all:
195 compiler_rcc_clean:
195 compiler_rcc_clean:
196 compiler_uic_make_all:
196 compiler_uic_make_all:
197 compiler_uic_clean:
197 compiler_uic_clean:
198 compiler_image_collection_make_all: qmake_image_collection.cpp
198 compiler_image_collection_make_all: qmake_image_collection.cpp
199 compiler_image_collection_clean:
199 compiler_image_collection_clean:
200 -$(DEL_FILE) qmake_image_collection.cpp
200 -$(DEL_FILE) qmake_image_collection.cpp
201 compiler_yacc_decl_make_all:
201 compiler_yacc_decl_make_all:
202 compiler_yacc_decl_clean:
202 compiler_yacc_decl_clean:
203 compiler_yacc_impl_make_all:
203 compiler_yacc_impl_make_all:
204 compiler_yacc_impl_clean:
204 compiler_yacc_impl_clean:
205 compiler_lex_make_all:
205 compiler_lex_make_all:
206 compiler_lex_clean:
206 compiler_lex_clean:
207 compiler_clean:
207 compiler_clean:
208
208
209 ####### Compile
209 ####### Compile
210
210
211 obj/wf_handler.o: ../src/wf_handler.c
211 obj/wf_handler.o: ../src/wf_handler.c
212 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
212 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
213
213
214 obj/tc_handler.o: ../src/tc_handler.c
214 obj/tc_handler.o: ../src/tc_handler.c
215 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
215 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
216
216
217 obj/fsw_processing.o: ../src/fsw_processing.c ../src/fsw_processing_globals.c
217 obj/fsw_processing.o: ../src/fsw_processing.c ../src/fsw_processing_globals.c
218 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c
218 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c
219
219
220 obj/fsw_misc.o: ../src/fsw_misc.c
220 obj/fsw_misc.o: ../src/fsw_misc.c
221 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
221 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
222
222
223 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
223 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
224 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
224 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
225
225
226 obj/fsw_globals.o: ../src/fsw_globals.c
226 obj/fsw_globals.o: ../src/fsw_globals.c
227 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
227 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
228
228
229 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
229 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
230 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
230 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
231
231
232 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
232 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
233 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
233 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
234
234
235 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
235 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
236 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
236 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
237
237
238 obj/tc_acceptance.o: ../src/tc_acceptance.c
238 obj/tc_acceptance.o: ../src/tc_acceptance.c
239 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
239 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
240
240
241 ####### Install
241 ####### Install
242
242
243 install: FORCE
243 install: FORCE
244
244
245 uninstall: FORCE
245 uninstall: FORCE
246
246
247 FORCE:
247 FORCE:
248
248
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -1,305 +1,305
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 2.8.1, 2013-11-05T13:11:18. -->
3 <!-- Written by QtCreator 2.8.1, 2013-11-08T07:03:44. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
7 <value type="int">0</value>
7 <value type="int">0</value>
8 </data>
8 </data>
9 <data>
9 <data>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
11 <valuemap type="QVariantMap">
11 <valuemap type="QVariantMap">
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
16 <value type="QString" key="language">Cpp</value>
16 <value type="QString" key="language">Cpp</value>
17 <valuemap type="QVariantMap" key="value">
17 <valuemap type="QVariantMap" key="value">
18 <value type="QString" key="CurrentPreferences">CppGlobal</value>
18 <value type="QString" key="CurrentPreferences">CppGlobal</value>
19 </valuemap>
19 </valuemap>
20 </valuemap>
20 </valuemap>
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
22 <value type="QString" key="language">QmlJS</value>
22 <value type="QString" key="language">QmlJS</value>
23 <valuemap type="QVariantMap" key="value">
23 <valuemap type="QVariantMap" key="value">
24 <value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
24 <value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
25 </valuemap>
25 </valuemap>
26 </valuemap>
26 </valuemap>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
28 <value type="QByteArray" key="EditorConfiguration.Codec">System</value>
28 <value type="QByteArray" key="EditorConfiguration.Codec">System</value>
29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
32 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
32 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
33 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
33 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
34 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
34 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
35 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
35 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
36 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
36 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
37 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
37 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
38 <value type="int" key="EditorConfiguration.TabSize">8</value>
38 <value type="int" key="EditorConfiguration.TabSize">8</value>
39 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
39 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
40 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
40 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
41 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
41 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
42 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
42 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
43 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
43 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
44 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
44 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
45 </valuemap>
45 </valuemap>
46 </data>
46 </data>
47 <data>
47 <data>
48 <variable>ProjectExplorer.Project.PluginSettings</variable>
48 <variable>ProjectExplorer.Project.PluginSettings</variable>
49 <valuemap type="QVariantMap"/>
49 <valuemap type="QVariantMap"/>
50 </data>
50 </data>
51 <data>
51 <data>
52 <variable>ProjectExplorer.Project.Target.0</variable>
52 <variable>ProjectExplorer.Project.Target.0</variable>
53 <valuemap type="QVariantMap">
53 <valuemap type="QVariantMap">
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">1</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">1</value>
60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
61 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
61 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
63 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
63 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
64 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
64 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
67 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
67 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
69 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
69 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
70 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
70 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
71 </valuemap>
71 </valuemap>
72 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
72 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
73 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
73 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
74 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
74 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
77 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
77 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
78 <value type="QString">-w</value>
78 <value type="QString">-w</value>
79 <value type="QString">-r</value>
79 <value type="QString">-r</value>
80 </valuelist>
80 </valuelist>
81 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
81 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
82 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w -j 4</value>
82 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w -j 4</value>
83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
84 </valuemap>
84 </valuemap>
85 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
85 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
86 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
86 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
89 </valuemap>
89 </valuemap>
90 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
90 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
92 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
92 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
93 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
93 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
96 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
96 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
97 <value type="QString">-w</value>
97 <value type="QString">-w</value>
98 <value type="QString">-r</value>
98 <value type="QString">-r</value>
99 </valuelist>
99 </valuelist>
100 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
100 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
101 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value>
101 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value>
102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
103 </valuemap>
103 </valuemap>
104 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
104 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
105 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
105 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
108 </valuemap>
108 </valuemap>
109 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
109 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
110 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
110 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
111 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
111 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
112 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value>
112 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
115 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
115 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
116 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
116 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
118 </valuemap>
118 </valuemap>
119 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
119 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
120 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
120 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
122 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
122 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
126 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
126 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
127 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
127 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
128 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
128 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
129 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
129 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
130 </valuemap>
130 </valuemap>
131 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
131 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
132 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
132 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
133 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
133 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
134 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
134 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
136 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
136 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
137 <value type="QString">-w</value>
137 <value type="QString">-w</value>
138 <value type="QString">-r</value>
138 <value type="QString">-r</value>
139 </valuelist>
139 </valuelist>
140 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
140 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
141 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w </value>
141 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w </value>
142 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
142 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
143 </valuemap>
143 </valuemap>
144 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
144 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
145 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
145 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
146 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
146 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
147 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
147 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
148 </valuemap>
148 </valuemap>
149 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
149 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
150 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
150 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
151 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
151 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
152 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
152 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
153 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
153 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
154 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
154 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
155 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
155 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
156 <value type="QString">-w</value>
156 <value type="QString">-w</value>
157 <value type="QString">-r</value>
157 <value type="QString">-r</value>
158 </valuelist>
158 </valuelist>
159 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
159 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
160 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value>
160 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value>
161 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
161 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
162 </valuemap>
162 </valuemap>
163 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
163 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
164 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
164 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
165 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
165 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
166 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
166 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
167 </valuemap>
167 </valuemap>
168 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
168 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
169 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
169 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
170 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
170 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
171 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value>
171 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
174 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
174 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
175 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
175 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
176 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
176 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
177 </valuemap>
177 </valuemap>
178 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
178 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
179 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
179 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
180 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
180 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
181 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
181 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
182 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
182 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
183 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
183 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
184 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
184 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
185 </valuemap>
185 </valuemap>
186 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
186 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
187 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value>
187 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value>
188 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
188 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
189 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
189 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
190 </valuemap>
190 </valuemap>
191 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
191 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
192 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
192 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
193 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
193 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
194 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
194 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
195 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
195 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
196 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
196 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
197 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
197 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
198 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
198 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
199 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
199 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
200 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
200 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
201 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
201 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
202 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
202 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
203 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
203 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
204 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
204 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
205 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
205 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
206 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
206 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
207 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
207 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
208 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
208 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
209 <value type="int">0</value>
209 <value type="int">0</value>
210 <value type="int">1</value>
210 <value type="int">1</value>
211 <value type="int">2</value>
211 <value type="int">2</value>
212 <value type="int">3</value>
212 <value type="int">3</value>
213 <value type="int">4</value>
213 <value type="int">4</value>
214 <value type="int">5</value>
214 <value type="int">5</value>
215 <value type="int">6</value>
215 <value type="int">6</value>
216 <value type="int">7</value>
216 <value type="int">7</value>
217 <value type="int">8</value>
217 <value type="int">8</value>
218 <value type="int">9</value>
218 <value type="int">9</value>
219 <value type="int">10</value>
219 <value type="int">10</value>
220 <value type="int">11</value>
220 <value type="int">11</value>
221 <value type="int">12</value>
221 <value type="int">12</value>
222 <value type="int">13</value>
222 <value type="int">13</value>
223 <value type="int">14</value>
223 <value type="int">14</value>
224 </valuelist>
224 </valuelist>
225 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
225 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
226 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
226 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
227 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
227 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
228 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
228 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
229 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
229 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
230 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
230 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
231 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
231 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
232 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
232 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
233 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
233 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
234 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
234 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
235 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
235 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
236 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
236 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
237 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
237 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
238 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
238 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
239 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
239 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
240 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
240 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
241 </valuemap>
241 </valuemap>
242 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
242 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
243 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
243 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
244 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
244 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
245 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
245 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
246 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
246 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
247 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
247 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
248 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
248 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
249 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
249 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
250 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
250 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
251 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
251 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
252 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
252 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
253 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
253 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
254 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
254 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
255 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
255 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
256 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
256 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
257 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
257 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
258 <value type="int">0</value>
258 <value type="int">0</value>
259 <value type="int">1</value>
259 <value type="int">1</value>
260 <value type="int">2</value>
260 <value type="int">2</value>
261 <value type="int">3</value>
261 <value type="int">3</value>
262 <value type="int">4</value>
262 <value type="int">4</value>
263 <value type="int">5</value>
263 <value type="int">5</value>
264 <value type="int">6</value>
264 <value type="int">6</value>
265 <value type="int">7</value>
265 <value type="int">7</value>
266 <value type="int">8</value>
266 <value type="int">8</value>
267 <value type="int">9</value>
267 <value type="int">9</value>
268 <value type="int">10</value>
268 <value type="int">10</value>
269 <value type="int">11</value>
269 <value type="int">11</value>
270 <value type="int">12</value>
270 <value type="int">12</value>
271 <value type="int">13</value>
271 <value type="int">13</value>
272 <value type="int">14</value>
272 <value type="int">14</value>
273 </valuelist>
273 </valuelist>
274 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
274 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
275 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
275 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
276 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
276 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
277 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">doxygen</value>
277 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">doxygen</value>
278 <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">true</value>
278 <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">true</value>
279 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">/opt/DEV_PLE/doc</value>
279 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">/opt/DEV_PLE/doc</value>
280 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run doxygen</value>
280 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run doxygen</value>
281 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
281 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
282 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
282 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
283 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
283 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
284 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
284 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
285 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
285 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
286 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
286 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
287 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
287 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
288 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
288 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
289 </valuemap>
289 </valuemap>
290 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">2</value>
290 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">2</value>
291 </valuemap>
291 </valuemap>
292 </data>
292 </data>
293 <data>
293 <data>
294 <variable>ProjectExplorer.Project.TargetCount</variable>
294 <variable>ProjectExplorer.Project.TargetCount</variable>
295 <value type="int">1</value>
295 <value type="int">1</value>
296 </data>
296 </data>
297 <data>
297 <data>
298 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
298 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
299 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
299 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
300 </data>
300 </data>
301 <data>
301 <data>
302 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
302 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
303 <value type="int">14</value>
303 <value type="int">14</value>
304 </data>
304 </data>
305 </qtcreator>
305 </qtcreator>
@@ -1,643 +1,661
1 #ifndef CCSDS_TYPES_H_INCLUDED
1 #ifndef CCSDS_TYPES_H_INCLUDED
2 #define CCSDS_TYPES_H_INCLUDED
2 #define CCSDS_TYPES_H_INCLUDED
3
3
4 #define CCSDS_PROTOCOLE_EXTRA_BYTES 4
4 #define CCSDS_PROTOCOLE_EXTRA_BYTES 4
5 #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4
5 #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4
6 #define CCSDS_TM_PKT_MAX_SIZE 4412
6 #define CCSDS_TM_PKT_MAX_SIZE 4412
7 #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4
7 #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4
8 #define CCSDS_TC_PKT_MAX_SIZE 256
8 #define CCSDS_TC_PKT_MAX_SIZE 256
9 #define CCSDS_TC_PKT_MIN_SIZE 16
9 #define CCSDS_TC_PKT_MIN_SIZE 16
10 #define CCSDS_TC_TM_PACKET_OFFSET 7
10 #define CCSDS_TC_TM_PACKET_OFFSET 7
11 #define CCSDS_PROCESS_ID 76
11 #define CCSDS_PROCESS_ID 76
12 #define CCSDS_PACKET_CATEGORY 12
12 #define CCSDS_PACKET_CATEGORY 12
13 #define CCSDS_NODE_ADDRESS 0xfe
13 #define CCSDS_NODE_ADDRESS 0xfe
14 #define CCSDS_USER_APP 0x00
14 #define CCSDS_USER_APP 0x00
15
15
16 #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10
16 #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10
17 #define DEFAULT_RESERVED 0x00
17 #define DEFAULT_RESERVED 0x00
18 #define DEFAULT_HKBIA 0x1e // 0001 1110
18 #define DEFAULT_HKBIA 0x1e // 0001 1110
19
19
20 // PACKET ID
20 // PACKET ID
21 #define TM_PACKET_ID_TC_EXE 0x0cc1 // PID 76 CAT 1
21 #define TM_PACKET_ID_TC_EXE 0x0cc1 // PID 76 CAT 1
22 #define TM_PACKET_ID_HK 0x0cc4 // PID 76 CAT 4
22 #define TM_PACKET_ID_HK 0x0cc4 // PID 76 CAT 4
23 #define TM_PACKET_ID_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9
23 #define TM_PACKET_ID_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9
24 #define TM_PACKET_ID_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12
24 #define TM_PACKET_ID_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12
25 #define TM_PACKET_ID_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12
25 #define TM_PACKET_ID_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12
26 #define TM_PACKET_PID_DEFAULT 76
26 #define TM_PACKET_PID_DEFAULT 76
27 #define TM_PACKET_PID_BURST_SBM1_SBM2 79
27 #define TM_PACKET_PID_BURST_SBM1_SBM2 79
28 #define TM_PACKET_CAT_TC_EXE 1
28 #define TM_PACKET_CAT_TC_EXE 1
29 #define TM_PACKET_CAT_HK 4
29 #define TM_PACKET_CAT_HK 4
30 #define TM_PACKET_CAT_PARAMETER_DUMP 9
30 #define TM_PACKET_CAT_PARAMETER_DUMP 9
31 #define TM_PACKET_CAT_SCIENCE 12
31 #define TM_PACKET_CAT_SCIENCE 12
32
32
33 // PACKET SEQUENCE CONTROL
33 // PACKET SEQUENCE CONTROL
34 #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000]
34 #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000]
35 #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000]
35 #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000]
36 #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000]
36 #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000]
37 #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000]
37 #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000]
38 #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000]
38 #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000]
39
39
40 // DESTINATION ID
40 // DESTINATION ID
41 #define TM_DESTINATION_ID_GROUND 0
41 #define TM_DESTINATION_ID_GROUND 0
42 #define TM_DESTINATION_ID_MISSION_TIMELINE 110
42 #define TM_DESTINATION_ID_MISSION_TIMELINE 110
43 #define TM_DESTINATION_ID_TC_SEQUENCES 111
43 #define TM_DESTINATION_ID_TC_SEQUENCES 111
44 #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112
44 #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112
45 #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113
45 #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113
46 #define TM_DESTINATION_ID_DIRECT_CMD 120
46 #define TM_DESTINATION_ID_DIRECT_CMD 120
47 #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121
47 #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121
48 #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122
48 #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122
49 #define TM_DESTINATION_ID_OBCP 15
49 #define TM_DESTINATION_ID_OBCP 15
50 #define TM_DESTINATION_ID_SYSTEM_CONTROL 14
50 #define TM_DESTINATION_ID_SYSTEM_CONTROL 14
51 #define TM_DESTINATION_ID_AOCS 11
51 #define TM_DESTINATION_ID_AOCS 11
52
52
53 #define CCSDS_DESTINATION_ID 0x01
53 #define CCSDS_DESTINATION_ID 0x01
54 #define CCSDS_PROTOCOLE_ID 0x02
54 #define CCSDS_PROTOCOLE_ID 0x02
55 #define CCSDS_RESERVED 0x00
55 #define CCSDS_RESERVED 0x00
56 #define CCSDS_USER_APP 0x00
56 #define CCSDS_USER_APP 0x00
57
57
58 #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24
58 #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24
59 #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32
59 #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32
60 #define SIZE_HK_PARAMETERS 112
60 #define SIZE_HK_PARAMETERS 112
61
61
62 // TC TYPES
62 // TC TYPES
63 #define TC_TYPE_GEN 181
63 #define TC_TYPE_GEN 181
64 #define TC_TYPE_TIME 9
64 #define TC_TYPE_TIME 9
65
65
66 // TC SUBTYPES
66 // TC SUBTYPES
67 #define TC_SUBTYPE_RESET 1
67 #define TC_SUBTYPE_RESET 1
68 #define TC_SUBTYPE_LOAD_COMM 11
68 #define TC_SUBTYPE_LOAD_COMM 11
69 #define TC_SUBTYPE_LOAD_NORM 13
69 #define TC_SUBTYPE_LOAD_NORM 13
70 #define TC_SUBTYPE_LOAD_BURST 19
70 #define TC_SUBTYPE_LOAD_BURST 19
71 #define TC_SUBTYPE_LOAD_SBM1 25
71 #define TC_SUBTYPE_LOAD_SBM1 25
72 #define TC_SUBTYPE_LOAD_SBM2 27
72 #define TC_SUBTYPE_LOAD_SBM2 27
73 #define TC_SUBTYPE_DUMP 31
73 #define TC_SUBTYPE_DUMP 31
74 #define TC_SUBTYPE_ENTER 41
74 #define TC_SUBTYPE_ENTER 41
75 #define TC_SUBTYPE_UPDT_INFO 51
75 #define TC_SUBTYPE_UPDT_INFO 51
76 #define TC_SUBTYPE_EN_CAL 61
76 #define TC_SUBTYPE_EN_CAL 61
77 #define TC_SUBTYPE_DIS_CAL 63
77 #define TC_SUBTYPE_DIS_CAL 63
78 #define TC_SUBTYPE_UPDT_TIME 129
78 #define TC_SUBTYPE_UPDT_TIME 129
79
79
80 // TC LEN
80 // TC LEN
81 #define TC_LEN_RESET 12
81 #define TC_LEN_RESET 12
82 #define TC_LEN_LOAD_COMM 14
82 #define TC_LEN_LOAD_COMM 14
83 #define TC_LEN_LOAD_NORM 20
83 #define TC_LEN_LOAD_NORM 20
84 #define TC_LEN_LOAD_BURST 14
84 #define TC_LEN_LOAD_BURST 14
85 #define TC_LEN_LOAD_SBM1 14
85 #define TC_LEN_LOAD_SBM1 14
86 #define TC_LEN_LOAD_SBM2 14
86 #define TC_LEN_LOAD_SBM2 14
87 #define TC_LEN_DUMP 12
87 #define TC_LEN_DUMP 12
88 #define TC_LEN_ENTER 20
88 #define TC_LEN_ENTER 20
89 #define TC_LEN_UPDT_INFO 48
89 #define TC_LEN_UPDT_INFO 48
90 #define TC_LEN_EN_CAL 12
90 #define TC_LEN_EN_CAL 12
91 #define TC_LEN_DIS_CAL 12
91 #define TC_LEN_DIS_CAL 12
92 #define TC_LEN_UPDT_TIME 18
92 #define TC_LEN_UPDT_TIME 18
93
93
94 // TM TYPES
94 // TM TYPES
95 #define TM_TYPE_TC_EXE 1
95 #define TM_TYPE_TC_EXE 1
96 #define TM_TYPE_HK 3
96 #define TM_TYPE_HK 3
97 #define TM_TYPE_PARAMETER_DUMP 3
97 #define TM_TYPE_PARAMETER_DUMP 3
98 #define TM_TYPE_LFR_SCIENCE 21
98 #define TM_TYPE_LFR_SCIENCE 21
99
99
100 // TM SUBTYPES
100 // TM SUBTYPES
101 #define TM_SUBTYPE_EXE_OK 7
101 #define TM_SUBTYPE_EXE_OK 7
102 #define TM_SUBTYPE_EXE_NOK 8
102 #define TM_SUBTYPE_EXE_NOK 8
103 #define TM_SUBTYPE_HK 25
103 #define TM_SUBTYPE_HK 25
104 #define TM_SUBTYPE_PARAMETER_DUMP 25
104 #define TM_SUBTYPE_PARAMETER_DUMP 25
105 #define TM_SUBTYPE_SCIENCE 3
105 #define TM_SUBTYPE_SCIENCE 3
106 #define TM_SUBTYPE_LFR_SCIENCE 3
106 #define TM_SUBTYPE_LFR_SCIENCE 3
107
107
108 // FAILURE CODES
108 // FAILURE CODES
109 #define ILLEGAL_APID 0
109 #define ILLEGAL_APID 0
110 #define WRONG_LEN_PKT 1
110 #define WRONG_LEN_PKT 1
111 #define INCOR_CHECKSUM 2
111 #define INCOR_CHECKSUM 2
112 #define ILL_TYPE 3
112 #define ILL_TYPE 3
113 #define ILL_SUBTYPE 4
113 #define ILL_SUBTYPE 4
114 #define WRONG_APP_DATA 5 // 0x00 0x05
114 #define WRONG_APP_DATA 5 // 0x00 0x05
115 #define TC_NOT_EXE 42000 // 0xa4 0x10
115 #define TC_NOT_EXE 42000 // 0xa4 0x10
116 #define WRONG_SRC_ID 42001 // 0xa4 0x11
116 #define WRONG_SRC_ID 42001 // 0xa4 0x11
117 #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12
117 #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12
118 #define FAIL_DETECTED 42003 // 0xa4 0x13
118 #define FAIL_DETECTED 42003 // 0xa4 0x13
119 #define NOT_ALLOWED 42004 // 0xa4 0x14
119 #define NOT_ALLOWED 42004 // 0xa4 0x14
120 #define CORRUPTED 42005 // 0xa4 0x15
120 #define CORRUPTED 42005 // 0xa4 0x15
121 #define CCSDS_TM_VALID 7
121 #define CCSDS_TM_VALID 7
122
122
123 // TC SID
123 // TC SID
124 #define SID_TC_DEFAULT 0 // the default SID for TC sent to the LFR
125 #define SID_TC_GROUND 0
124 #define SID_TC_GROUND 0
126 #define SID_TC_MISSION_TIMELINE 110
125 #define SID_TC_MISSION_TIMELINE 110
127 #define SID_TC_TC_SEQUENCES 111
126 #define SID_TC_TC_SEQUENCES 111
128 #define SID_TC_RECOVERY_ACTION_CMD 112
127 #define SID_TC_RECOVERY_ACTION_CMD 112
129 #define SID_TC_BACKUP_MISSION_TIMELINE 113
128 #define SID_TC_BACKUP_MISSION_TIMELINE 113
130 #define SID_TC_DIRECT_CMD 120
129 #define SID_TC_DIRECT_CMD 120
131 #define SID_TC_SPARE_GRD_SRC1 121
130 #define SID_TC_SPARE_GRD_SRC1 121
132 #define SID_TC_SPARE_GRD_SRC2 122
131 #define SID_TC_SPARE_GRD_SRC2 122
133 #define SID_TC_OBCP 15
132 #define SID_TC_OBCP 15
134 #define SID_TC_SYSTEM_CONTROL 14
133 #define SID_TC_SYSTEM_CONTROL 14
135 #define SID_TC_AOCS 11
134 #define SID_TC_AOCS 11
136 #define SID_TC_RPW_INTERNAL 254
135 #define SID_TC_RPW_INTERNAL 254
137
136
137 enum apid_destid{
138 GROUND,
139 MISSION_TIMELINE,
140 TC_SEQUENCES,
141 RECOVERY_ACTION_CMD,
142 BACKUP_MISSION_TIMELINE,
143 DIRECT_CMD,
144 SPARE_GRD_SRC1,
145 SPARE_GRD_SRC2,
146 OBCP,
147 SYSTEM_CONTROL,
148 AOCS,
149 RPW_INTERNAL,
150 UNKNOWN
151 };
152 // SEQUENCE COUNTERS
153 #define SEQ_CNT_MAX 16383
154 #define SEQ_CNT_NB_DEST_ID 12
155
138 // TM SID
156 // TM SID
139 #define SID_HK 1
157 #define SID_HK 1
140 #define SID_PARAMETER_DUMP 10
158 #define SID_PARAMETER_DUMP 10
141
159
142 #define SID_NORM_SWF_F0 3
160 #define SID_NORM_SWF_F0 3
143 #define SID_NORM_SWF_F1 4
161 #define SID_NORM_SWF_F1 4
144 #define SID_NORM_SWF_F2 5
162 #define SID_NORM_SWF_F2 5
145 #define SID_NORM_CWF_F3 1
163 #define SID_NORM_CWF_F3 1
146 #define SID_BURST_CWF_F2 2
164 #define SID_BURST_CWF_F2 2
147 #define SID_SBM1_CWF_F1 24
165 #define SID_SBM1_CWF_F1 24
148 #define SID_SBM2_CWF_F2 25
166 #define SID_SBM2_CWF_F2 25
149 #define SID_NORM_ASM_F0 11
167 #define SID_NORM_ASM_F0 11
150 #define SID_NORM_ASM_F1 12
168 #define SID_NORM_ASM_F1 12
151 #define SID_NORM_ASM_F2 13
169 #define SID_NORM_ASM_F2 13
152 #define SID_NORM_BP1_F0 14
170 #define SID_NORM_BP1_F0 14
153 #define SID_NORM_BP1_F1 15
171 #define SID_NORM_BP1_F1 15
154 #define SID_NORM_BP1_F2 16
172 #define SID_NORM_BP1_F2 16
155 #define SID_NORM_BP2_F0 19
173 #define SID_NORM_BP2_F0 19
156 #define SID_NORM_BP2_F1 20
174 #define SID_NORM_BP2_F1 20
157 #define SID_NORM_BP2_F2 21
175 #define SID_NORM_BP2_F2 21
158 #define SID_BURST_BP1_F0 17
176 #define SID_BURST_BP1_F0 17
159 #define SID_BURST_BP2_F0 22
177 #define SID_BURST_BP2_F0 22
160 #define SID_BURST_BP1_F1 18
178 #define SID_BURST_BP1_F1 18
161 #define SID_BURST_BP2_F1 23
179 #define SID_BURST_BP2_F1 23
162 #define SID_SBM1_BP1_F0 28
180 #define SID_SBM1_BP1_F0 28
163 #define SID_SBM1_BP2_F0 31
181 #define SID_SBM1_BP2_F0 31
164 #define SID_SBM2_BP1_F0 29
182 #define SID_SBM2_BP1_F0 29
165 #define SID_SBM2_BP2_F0 32
183 #define SID_SBM2_BP2_F0 32
166 #define SID_SBM2_BP1_F1 30
184 #define SID_SBM2_BP1_F1 30
167 #define SID_SBM2_BP2_F1 33
185 #define SID_SBM2_BP2_F1 33
168
186
169 // LENGTH (BYTES)
187 // LENGTH (BYTES)
170 #define LENGTH_TM_LFR_TC_EXE_MAX 32
188 #define LENGTH_TM_LFR_TC_EXE_MAX 32
171 #define LENGTH_TM_LFR_HK 126
189 #define LENGTH_TM_LFR_HK 126
172
190
173 // HEADER_LENGTH
191 // HEADER_LENGTH
174 #define TM_HEADER_LEN 16
192 #define TM_HEADER_LEN 16
175 #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28
193 #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28
176 // PACKET_LENGTH
194 // PACKET_LENGTH
177 #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET)
195 #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET)
178 #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET)
196 #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET)
179 #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET)
197 #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET)
180 #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET)
198 #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET)
181 #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET)
199 #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET)
182 #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET)
200 #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET)
183 #define PACKET_LENGTH_HK (126 - CCSDS_TC_TM_PACKET_OFFSET)
201 #define PACKET_LENGTH_HK (126 - CCSDS_TC_TM_PACKET_OFFSET)
184 #define PACKET_LENGTH_PARAMETER_DUMP (34 - CCSDS_TC_TM_PACKET_OFFSET)
202 #define PACKET_LENGTH_PARAMETER_DUMP (34 - CCSDS_TC_TM_PACKET_OFFSET)
185 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM (TOTAL_SIZE_SM + HEADER_LENGTH_TM_LFR_SCIENCE_ASM - CCSDS_TC_TM_PACKET_OFFSET)
203 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM (TOTAL_SIZE_SM + HEADER_LENGTH_TM_LFR_SCIENCE_ASM - CCSDS_TC_TM_PACKET_OFFSET)
186
204
187 #define SPARE1_PUSVERSION_SPARE2 0x10
205 #define SPARE1_PUSVERSION_SPARE2 0x10
188
206
189 #define LEN_TM_LFR_HK 130 // 126 + 4
207 #define LEN_TM_LFR_HK 130 // 126 + 4
190 #define LEN_TM_LFR_TC_EXE_NOT_IMP 28 // 24 + 4
208 #define LEN_TM_LFR_TC_EXE_NOT_IMP 28 // 24 + 4
191
209
192 #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1
210 #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1
193 #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1
211 #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1
194 #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1
212 #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1
195 #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1
213 #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1
196 #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1
214 #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1
197 #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1
215 #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1
198 #define DEFAULT_PKTCNT 0x07
216 #define DEFAULT_PKTCNT 0x07
199 #define BLK_NR_340 0x0154
217 #define BLK_NR_340 0x0154
200 #define BLK_NR_8 0x0008
218 #define BLK_NR_8 0x0008
201
219
202 enum TM_TYPE{
220 enum TM_TYPE{
203 TM_LFR_TC_EXE_OK,
221 TM_LFR_TC_EXE_OK,
204 TM_LFR_TC_EXE_ERR,
222 TM_LFR_TC_EXE_ERR,
205 TM_LFR_HK,
223 TM_LFR_HK,
206 TM_LFR_SCI,
224 TM_LFR_SCI,
207 TM_LFR_SCI_SBM,
225 TM_LFR_SCI_SBM,
208 TM_LFR_PAR_DUMP
226 TM_LFR_PAR_DUMP
209 };
227 };
210
228
211 struct TMHeader_str
229 struct TMHeader_str
212 {
230 {
213 volatile unsigned char targetLogicalAddress;
231 unsigned char targetLogicalAddress;
214 volatile unsigned char protocolIdentifier;
232 unsigned char protocolIdentifier;
215 volatile unsigned char reserved;
233 unsigned char reserved;
216 volatile unsigned char userApplication;
234 unsigned char userApplication;
217 volatile unsigned char packetID[2];
235 unsigned char packetID[2];
218 volatile unsigned char packetSequenceControl[2];
236 unsigned char packetSequenceControl[2];
219 volatile unsigned char packetLength[2];
237 unsigned char packetLength[2];
220 // DATA FIELD HEADER
238 // DATA FIELD HEADER
221 volatile unsigned char spare1_pusVersion_spare2;
239 unsigned char spare1_pusVersion_spare2;
222 volatile unsigned char serviceType;
240 unsigned char serviceType;
223 volatile unsigned char serviceSubType;
241 unsigned char serviceSubType;
224 volatile unsigned char destinationID;
242 unsigned char destinationID;
225 volatile unsigned char time[6];
243 unsigned char time[6];
226 };
244 };
227 typedef struct TMHeader_str TMHeader_t;
245 typedef struct TMHeader_str TMHeader_t;
228
246
229 struct Packet_TM_LFR_TC_EXE_str
247 struct Packet_TM_LFR_TC_EXE_str
230 {
248 {
231 volatile unsigned char targetLogicalAddress;
249 unsigned char targetLogicalAddress;
232 volatile unsigned char protocolIdentifier;
250 unsigned char protocolIdentifier;
233 volatile unsigned char reserved;
251 unsigned char reserved;
234 volatile unsigned char userApplication;
252 unsigned char userApplication;
235 volatile unsigned char packetID[2];
253 unsigned char packetID[2];
236 volatile unsigned char packetSequenceControl[2];
254 unsigned char packetSequenceControl[2];
237 volatile unsigned char packetLength[2];
255 unsigned char packetLength[2];
238 // DATA FIELD HEADER
256 // DATA FIELD HEADER
239 volatile unsigned char spare1_pusVersion_spare2;
257 unsigned char spare1_pusVersion_spare2;
240 volatile unsigned char serviceType;
258 unsigned char serviceType;
241 volatile unsigned char serviceSubType;
259 unsigned char serviceSubType;
242 volatile unsigned char destinationID;
260 unsigned char destinationID;
243 volatile unsigned char time[6];
261 unsigned char time[6];
244 volatile unsigned char data[LENGTH_TM_LFR_TC_EXE_MAX - 10 + 1];
262 unsigned char data[LENGTH_TM_LFR_TC_EXE_MAX - 10 + 1];
245 };
263 };
246 typedef struct Packet_TM_LFR_TC_EXE_str Packet_TM_LFR_TC_EXE_t;
264 typedef struct Packet_TM_LFR_TC_EXE_str Packet_TM_LFR_TC_EXE_t;
247
265
248 struct Packet_TM_LFR_TC_EXE_SUCCESS_str
266 struct Packet_TM_LFR_TC_EXE_SUCCESS_str
249 {
267 {
250 volatile unsigned char targetLogicalAddress;
268 unsigned char targetLogicalAddress;
251 volatile unsigned char protocolIdentifier;
269 unsigned char protocolIdentifier;
252 volatile unsigned char reserved;
270 unsigned char reserved;
253 volatile unsigned char userApplication;
271 unsigned char userApplication;
254 // PACKET HEADER
272 // PACKET HEADER
255 volatile unsigned char packetID[2];
273 unsigned char packetID[2];
256 volatile unsigned char packetSequenceControl[2];
274 unsigned char packetSequenceControl[2];
257 volatile unsigned char packetLength[2];
275 unsigned char packetLength[2];
258 // DATA FIELD HEADER
276 // DATA FIELD HEADER
259 volatile unsigned char spare1_pusVersion_spare2;
277 unsigned char spare1_pusVersion_spare2;
260 volatile unsigned char serviceType;
278 unsigned char serviceType;
261 volatile unsigned char serviceSubType;
279 unsigned char serviceSubType;
262 volatile unsigned char destinationID;
280 unsigned char destinationID;
263 volatile unsigned char time[6];
281 unsigned char time[6];
264 //
282 //
265 volatile unsigned char telecommand_pkt_id[2];
283 unsigned char telecommand_pkt_id[2];
266 volatile unsigned char pkt_seq_control[2];
284 unsigned char pkt_seq_control[2];
267 };
285 };
268 typedef struct Packet_TM_LFR_TC_EXE_SUCCESS_str Packet_TM_LFR_TC_EXE_SUCCESS_t;
286 typedef struct Packet_TM_LFR_TC_EXE_SUCCESS_str Packet_TM_LFR_TC_EXE_SUCCESS_t;
269
287
270 struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str
288 struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str
271 {
289 {
272 volatile unsigned char targetLogicalAddress;
290 unsigned char targetLogicalAddress;
273 volatile unsigned char protocolIdentifier;
291 unsigned char protocolIdentifier;
274 volatile unsigned char reserved;
292 unsigned char reserved;
275 volatile unsigned char userApplication;
293 unsigned char userApplication;
276 // PACKET HEADER
294 // PACKET HEADER
277 volatile unsigned char packetID[2];
295 unsigned char packetID[2];
278 volatile unsigned char packetSequenceControl[2];
296 unsigned char packetSequenceControl[2];
279 volatile unsigned char packetLength[2];
297 unsigned char packetLength[2];
280 // DATA FIELD HEADER
298 // DATA FIELD HEADER
281 volatile unsigned char spare1_pusVersion_spare2;
299 unsigned char spare1_pusVersion_spare2;
282 volatile unsigned char serviceType;
300 unsigned char serviceType;
283 volatile unsigned char serviceSubType;
301 unsigned char serviceSubType;
284 volatile unsigned char destinationID;
302 unsigned char destinationID;
285 volatile unsigned char time[6];
303 unsigned char time[6];
286 //
304 //
287 volatile unsigned char tc_failure_code[2];
305 unsigned char tc_failure_code[2];
288 volatile unsigned char telecommand_pkt_id[2];
306 unsigned char telecommand_pkt_id[2];
289 volatile unsigned char pkt_seq_control[2];
307 unsigned char pkt_seq_control[2];
290 volatile unsigned char tc_service;
308 unsigned char tc_service;
291 volatile unsigned char tc_subtype;
309 unsigned char tc_subtype;
292 volatile unsigned char byte_position;
310 unsigned char byte_position;
293 volatile unsigned char rcv_value;
311 unsigned char rcv_value;
294 };
312 };
295 typedef struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str Packet_TM_LFR_TC_EXE_INCONSISTENT_t;
313 typedef struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str Packet_TM_LFR_TC_EXE_INCONSISTENT_t;
296
314
297 struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str
315 struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str
298 {
316 {
299 volatile unsigned char targetLogicalAddress;
317 unsigned char targetLogicalAddress;
300 volatile unsigned char protocolIdentifier;
318 unsigned char protocolIdentifier;
301 volatile unsigned char reserved;
319 unsigned char reserved;
302 volatile unsigned char userApplication;
320 unsigned char userApplication;
303 // PACKET HEADER
321 // PACKET HEADER
304 volatile unsigned char packetID[2];
322 unsigned char packetID[2];
305 volatile unsigned char packetSequenceControl[2];
323 unsigned char packetSequenceControl[2];
306 volatile unsigned char packetLength[2];
324 unsigned char packetLength[2];
307 // DATA FIELD HEADER
325 // DATA FIELD HEADER
308 volatile unsigned char spare1_pusVersion_spare2;
326 unsigned char spare1_pusVersion_spare2;
309 volatile unsigned char serviceType;
327 unsigned char serviceType;
310 volatile unsigned char serviceSubType;
328 unsigned char serviceSubType;
311 volatile unsigned char destinationID;
329 unsigned char destinationID;
312 volatile unsigned char time[6];
330 unsigned char time[6];
313 //
331 //
314 volatile unsigned char tc_failure_code[2];
332 unsigned char tc_failure_code[2];
315 volatile unsigned char telecommand_pkt_id[2];
333 unsigned char telecommand_pkt_id[2];
316 volatile unsigned char pkt_seq_control[2];
334 unsigned char pkt_seq_control[2];
317 volatile unsigned char tc_service;
335 unsigned char tc_service;
318 volatile unsigned char tc_subtype;
336 unsigned char tc_subtype;
319 volatile unsigned char lfr_status_word[2];
337 unsigned char lfr_status_word[2];
320 };
338 };
321 typedef struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t;
339 typedef struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t;
322
340
323 struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str
341 struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str
324 {
342 {
325 volatile unsigned char targetLogicalAddress;
343 unsigned char targetLogicalAddress;
326 volatile unsigned char protocolIdentifier;
344 unsigned char protocolIdentifier;
327 volatile unsigned char reserved;
345 unsigned char reserved;
328 volatile unsigned char userApplication;
346 unsigned char userApplication;
329 // PACKET HEADER
347 // PACKET HEADER
330 volatile unsigned char packetID[2];
348 unsigned char packetID[2];
331 volatile unsigned char packetSequenceControl[2];
349 unsigned char packetSequenceControl[2];
332 volatile unsigned char packetLength[2];
350 unsigned char packetLength[2];
333 // DATA FIELD HEADER
351 // DATA FIELD HEADER
334 volatile unsigned char spare1_pusVersion_spare2;
352 unsigned char spare1_pusVersion_spare2;
335 volatile unsigned char serviceType;
353 unsigned char serviceType;
336 volatile unsigned char serviceSubType;
354 unsigned char serviceSubType;
337 volatile unsigned char destinationID;
355 unsigned char destinationID;
338 volatile unsigned char time[6];
356 unsigned char time[6];
339 //
357 //
340 volatile unsigned char tc_failure_code[2];
358 unsigned char tc_failure_code[2];
341 volatile unsigned char telecommand_pkt_id[2];
359 unsigned char telecommand_pkt_id[2];
342 volatile unsigned char pkt_seq_control[2];
360 unsigned char pkt_seq_control[2];
343 volatile unsigned char tc_service;
361 unsigned char tc_service;
344 volatile unsigned char tc_subtype;
362 unsigned char tc_subtype;
345 };
363 };
346 typedef struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t;
364 typedef struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t;
347
365
348 struct Packet_TM_LFR_TC_EXE_ERROR_str
366 struct Packet_TM_LFR_TC_EXE_ERROR_str
349 {
367 {
350 volatile unsigned char targetLogicalAddress;
368 unsigned char targetLogicalAddress;
351 volatile unsigned char protocolIdentifier;
369 unsigned char protocolIdentifier;
352 volatile unsigned char reserved;
370 unsigned char reserved;
353 volatile unsigned char userApplication;
371 unsigned char userApplication;
354 // PACKET HEADER
372 // PACKET HEADER
355 volatile unsigned char packetID[2];
373 unsigned char packetID[2];
356 volatile unsigned char packetSequenceControl[2];
374 unsigned char packetSequenceControl[2];
357 volatile unsigned char packetLength[2];
375 unsigned char packetLength[2];
358 // DATA FIELD HEADER
376 // DATA FIELD HEADER
359 volatile unsigned char spare1_pusVersion_spare2;
377 unsigned char spare1_pusVersion_spare2;
360 volatile unsigned char serviceType;
378 unsigned char serviceType;
361 volatile unsigned char serviceSubType;
379 unsigned char serviceSubType;
362 volatile unsigned char destinationID;
380 unsigned char destinationID;
363 volatile unsigned char time[6];
381 unsigned char time[6];
364 //
382 //
365 volatile unsigned char tc_failure_code[2];
383 unsigned char tc_failure_code[2];
366 volatile unsigned char telecommand_pkt_id[2];
384 unsigned char telecommand_pkt_id[2];
367 volatile unsigned char pkt_seq_control[2];
385 unsigned char pkt_seq_control[2];
368 volatile unsigned char tc_service;
386 unsigned char tc_service;
369 volatile unsigned char tc_subtype;
387 unsigned char tc_subtype;
370 };
388 };
371 typedef struct Packet_TM_LFR_TC_EXE_ERROR_str Packet_TM_LFR_TC_EXE_ERROR_t;
389 typedef struct Packet_TM_LFR_TC_EXE_ERROR_str Packet_TM_LFR_TC_EXE_ERROR_t;
372
390
373 struct Packet_TM_LFR_TC_EXE_CORRUPTED_str
391 struct Packet_TM_LFR_TC_EXE_CORRUPTED_str
374 {
392 {
375 volatile unsigned char targetLogicalAddress;
393 unsigned char targetLogicalAddress;
376 volatile unsigned char protocolIdentifier;
394 unsigned char protocolIdentifier;
377 volatile unsigned char reserved;
395 unsigned char reserved;
378 volatile unsigned char userApplication;
396 unsigned char userApplication;
379 // PACKET HEADER
397 // PACKET HEADER
380 volatile unsigned char packetID[2];
398 unsigned char packetID[2];
381 volatile unsigned char packetSequenceControl[2];
399 unsigned char packetSequenceControl[2];
382 volatile unsigned char packetLength[2];
400 unsigned char packetLength[2];
383 // DATA FIELD HEADER
401 // DATA FIELD HEADER
384 volatile unsigned char spare1_pusVersion_spare2;
402 unsigned char spare1_pusVersion_spare2;
385 volatile unsigned char serviceType;
403 unsigned char serviceType;
386 volatile unsigned char serviceSubType;
404 unsigned char serviceSubType;
387 volatile unsigned char destinationID;
405 unsigned char destinationID;
388 volatile unsigned char time[6];
406 unsigned char time[6];
389 //
407 //
390 volatile unsigned char tc_failure_code[2];
408 unsigned char tc_failure_code[2];
391 volatile unsigned char telecommand_pkt_id[2];
409 unsigned char telecommand_pkt_id[2];
392 volatile unsigned char pkt_seq_control[2];
410 unsigned char pkt_seq_control[2];
393 volatile unsigned char tc_service;
411 unsigned char tc_service;
394 volatile unsigned char tc_subtype;
412 unsigned char tc_subtype;
395 volatile unsigned char pkt_len_rcv_value[2];
413 unsigned char pkt_len_rcv_value[2];
396 volatile unsigned char pkt_datafieldsize_cnt[2];
414 unsigned char pkt_datafieldsize_cnt[2];
397 volatile unsigned char rcv_crc[2];
415 unsigned char rcv_crc[2];
398 volatile unsigned char computed_crc[2];
416 unsigned char computed_crc[2];
399 };
417 };
400 typedef struct Packet_TM_LFR_TC_EXE_CORRUPTED_str Packet_TM_LFR_TC_EXE_CORRUPTED_t;
418 typedef struct Packet_TM_LFR_TC_EXE_CORRUPTED_str Packet_TM_LFR_TC_EXE_CORRUPTED_t;
401
419
402 struct Header_TM_LFR_SCIENCE_SWF_str
420 struct Header_TM_LFR_SCIENCE_SWF_str
403 {
421 {
404 volatile unsigned char targetLogicalAddress;
422 unsigned char targetLogicalAddress;
405 volatile unsigned char protocolIdentifier;
423 unsigned char protocolIdentifier;
406 volatile unsigned char reserved;
424 unsigned char reserved;
407 volatile unsigned char userApplication;
425 unsigned char userApplication;
408 volatile unsigned char packetID[2];
426 unsigned char packetID[2];
409 volatile unsigned char packetSequenceControl[2];
427 unsigned char packetSequenceControl[2];
410 volatile unsigned char packetLength[2];
428 unsigned char packetLength[2];
411 // DATA FIELD HEADER
429 // DATA FIELD HEADER
412 volatile unsigned char spare1_pusVersion_spare2;
430 unsigned char spare1_pusVersion_spare2;
413 volatile unsigned char serviceType;
431 unsigned char serviceType;
414 volatile unsigned char serviceSubType;
432 unsigned char serviceSubType;
415 volatile unsigned char destinationID;
433 unsigned char destinationID;
416 volatile unsigned char time[6];
434 unsigned char time[6];
417 // AUXILIARY HEADER
435 // AUXILIARY HEADER
418 volatile unsigned char sid;
436 unsigned char sid;
419 volatile unsigned char hkBIA;
437 unsigned char hkBIA;
420 volatile unsigned char pktCnt;
438 unsigned char pktCnt;
421 volatile unsigned char pktNr;
439 unsigned char pktNr;
422 volatile unsigned char acquisitionTime[6];
440 unsigned char acquisitionTime[6];
423 volatile unsigned char blkNr[2];
441 unsigned char blkNr[2];
424 };
442 };
425 typedef struct Header_TM_LFR_SCIENCE_SWF_str Header_TM_LFR_SCIENCE_SWF_t;
443 typedef struct Header_TM_LFR_SCIENCE_SWF_str Header_TM_LFR_SCIENCE_SWF_t;
426
444
427 struct Header_TM_LFR_SCIENCE_CWF_str
445 struct Header_TM_LFR_SCIENCE_CWF_str
428 {
446 {
429 volatile unsigned char targetLogicalAddress;
447 unsigned char targetLogicalAddress;
430 volatile unsigned char protocolIdentifier;
448 unsigned char protocolIdentifier;
431 volatile unsigned char reserved;
449 unsigned char reserved;
432 volatile unsigned char userApplication;
450 unsigned char userApplication;
433 volatile unsigned char packetID[2];
451 unsigned char packetID[2];
434 volatile unsigned char packetSequenceControl[2];
452 unsigned char packetSequenceControl[2];
435 volatile unsigned char packetLength[2];
453 unsigned char packetLength[2];
436 // DATA FIELD HEADER
454 // DATA FIELD HEADER
437 volatile unsigned char spare1_pusVersion_spare2;
455 unsigned char spare1_pusVersion_spare2;
438 volatile unsigned char serviceType;
456 unsigned char serviceType;
439 volatile unsigned char serviceSubType;
457 unsigned char serviceSubType;
440 volatile unsigned char destinationID;
458 unsigned char destinationID;
441 volatile unsigned char time[6];
459 unsigned char time[6];
442 // AUXILIARY DATA HEADER
460 // AUXILIARY DATA HEADER
443 volatile unsigned char sid;
461 unsigned char sid;
444 volatile unsigned char hkBIA;
462 unsigned char hkBIA;
445 volatile unsigned char acquisitionTime[6];
463 unsigned char acquisitionTime[6];
446 volatile unsigned char blkNr[2];
464 unsigned char blkNr[2];
447 };
465 };
448 typedef struct Header_TM_LFR_SCIENCE_CWF_str Header_TM_LFR_SCIENCE_CWF_t;
466 typedef struct Header_TM_LFR_SCIENCE_CWF_str Header_TM_LFR_SCIENCE_CWF_t;
449
467
450 struct Header_TM_LFR_SCIENCE_ASM_str
468 struct Header_TM_LFR_SCIENCE_ASM_str
451 {
469 {
452 volatile unsigned char targetLogicalAddress;
470 unsigned char targetLogicalAddress;
453 volatile unsigned char protocolIdentifier;
471 unsigned char protocolIdentifier;
454 volatile unsigned char reserved;
472 unsigned char reserved;
455 volatile unsigned char userApplication;
473 unsigned char userApplication;
456 volatile unsigned char packetID[2];
474 unsigned char packetID[2];
457 volatile unsigned char packetSequenceControl[2];
475 unsigned char packetSequenceControl[2];
458 volatile unsigned char packetLength[2];
476 unsigned char packetLength[2];
459 // DATA FIELD HEADER
477 // DATA FIELD HEADER
460 volatile unsigned char spare1_pusVersion_spare2;
478 unsigned char spare1_pusVersion_spare2;
461 volatile unsigned char serviceType;
479 unsigned char serviceType;
462 volatile unsigned char serviceSubType;
480 unsigned char serviceSubType;
463 volatile unsigned char destinationID;
481 unsigned char destinationID;
464 volatile unsigned char time[6];
482 unsigned char time[6];
465 // AUXILIARY HEADER
483 // AUXILIARY HEADER
466 volatile unsigned char sid;
484 unsigned char sid;
467 volatile unsigned char biaStatusInfo;
485 unsigned char biaStatusInfo;
468 volatile unsigned char cntASM;
486 unsigned char cntASM;
469 volatile unsigned char nrASM;
487 unsigned char nrASM;
470 volatile unsigned char acquisitionTime[6];
488 unsigned char acquisitionTime[6];
471 volatile unsigned char blkNr[2];
489 unsigned char blkNr[2];
472 };
490 };
473 typedef struct Header_TM_LFR_SCIENCE_ASM_str Header_TM_LFR_SCIENCE_ASM_t;
491 typedef struct Header_TM_LFR_SCIENCE_ASM_str Header_TM_LFR_SCIENCE_ASM_t;
474
492
475 struct ccsdsTelecommandPacket_str
493 struct ccsdsTelecommandPacket_str
476 {
494 {
477 //unsigned char targetLogicalAddress; // removed by the grspw module
495 //unsigned char targetLogicalAddress; // removed by the grspw module
478 volatile unsigned char protocolIdentifier;
496 unsigned char protocolIdentifier;
479 volatile unsigned char reserved;
497 unsigned char reserved;
480 volatile unsigned char userApplication;
498 unsigned char userApplication;
481 volatile unsigned char packetID[2];
499 unsigned char packetID[2];
482 volatile unsigned char packetSequenceControl[2];
500 unsigned char packetSequenceControl[2];
483 volatile unsigned char packetLength[2];
501 unsigned char packetLength[2];
484 // DATA FIELD HEADER
502 // DATA FIELD HEADER
485 volatile unsigned char headerFlag_pusVersion_Ack;
503 unsigned char headerFlag_pusVersion_Ack;
486 volatile unsigned char serviceType;
504 unsigned char serviceType;
487 volatile unsigned char serviceSubType;
505 unsigned char serviceSubType;
488 volatile unsigned char sourceID;
506 unsigned char sourceID;
489 volatile unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10];
507 unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10];
490 };
508 };
491 typedef struct ccsdsTelecommandPacket_str ccsdsTelecommandPacket_t;
509 typedef struct ccsdsTelecommandPacket_str ccsdsTelecommandPacket_t;
492
510
493 struct Packet_TM_LFR_HK_str
511 struct Packet_TM_LFR_HK_str
494 {
512 {
495 volatile unsigned char targetLogicalAddress;
513 unsigned char targetLogicalAddress;
496 volatile unsigned char protocolIdentifier;
514 unsigned char protocolIdentifier;
497 volatile unsigned char reserved;
515 unsigned char reserved;
498 volatile unsigned char userApplication;
516 unsigned char userApplication;
499 volatile unsigned char packetID[2];
517 unsigned char packetID[2];
500 volatile unsigned char packetSequenceControl[2];
518 unsigned char packetSequenceControl[2];
501 volatile unsigned char packetLength[2];
519 unsigned char packetLength[2];
502 volatile unsigned char spare1_pusVersion_spare2;
520 unsigned char spare1_pusVersion_spare2;
503 volatile unsigned char serviceType;
521 unsigned char serviceType;
504 volatile unsigned char serviceSubType;
522 unsigned char serviceSubType;
505 volatile unsigned char destinationID;
523 unsigned char destinationID;
506 volatile unsigned char time[6];
524 unsigned char time[6];
507 volatile unsigned char sid;
525 unsigned char sid;
508
526
509 //**************
527 //**************
510 // HK PARAMETERS
528 // HK PARAMETERS
511 unsigned char lfr_status_word[2];
529 unsigned char lfr_status_word[2];
512 unsigned char lfr_sw_version[4];
530 unsigned char lfr_sw_version[4];
513 // tc statistics
531 // tc statistics
514 unsigned char hk_lfr_update_info_tc_cnt[2];
532 unsigned char hk_lfr_update_info_tc_cnt[2];
515 unsigned char hk_lfr_update_time_tc_cnt[2];
533 unsigned char hk_lfr_update_time_tc_cnt[2];
516 unsigned char hk_dpu_exe_tc_lfr_cnt[2];
534 unsigned char hk_dpu_exe_tc_lfr_cnt[2];
517 unsigned char hk_dpu_rej_tc_lfr_cnt[2];
535 unsigned char hk_dpu_rej_tc_lfr_cnt[2];
518 unsigned char hk_lfr_last_exe_tc_id[2];
536 unsigned char hk_lfr_last_exe_tc_id[2];
519 unsigned char hk_lfr_last_exe_tc_type[2];
537 unsigned char hk_lfr_last_exe_tc_type[2];
520 unsigned char hk_lfr_last_exe_tc_subtype[2];
538 unsigned char hk_lfr_last_exe_tc_subtype[2];
521 unsigned char hk_lfr_last_exe_tc_time[6];
539 unsigned char hk_lfr_last_exe_tc_time[6];
522 unsigned char hk_lfr_last_rej_tc_id[2];
540 unsigned char hk_lfr_last_rej_tc_id[2];
523 unsigned char hk_lfr_last_rej_tc_type[2];
541 unsigned char hk_lfr_last_rej_tc_type[2];
524 unsigned char hk_lfr_last_rej_tc_subtype[2];
542 unsigned char hk_lfr_last_rej_tc_subtype[2];
525 unsigned char hk_lfr_last_rej_tc_time[6];
543 unsigned char hk_lfr_last_rej_tc_time[6];
526 // anomaly statistics
544 // anomaly statistics
527 unsigned char hk_lfr_le_cnt[2];
545 unsigned char hk_lfr_le_cnt[2];
528 unsigned char hk_lfr_me_cnt[2];
546 unsigned char hk_lfr_me_cnt[2];
529 unsigned char hk_lfr_he_cnt[2];
547 unsigned char hk_lfr_he_cnt[2];
530 unsigned char hk_lfr_last_er_rid[2];
548 unsigned char hk_lfr_last_er_rid[2];
531 unsigned char hk_lfr_last_er_code;
549 unsigned char hk_lfr_last_er_code;
532 unsigned char hk_lfr_last_er_time[6];
550 unsigned char hk_lfr_last_er_time[6];
533 // vhdl_blk_status
551 // vhdl_blk_status
534 unsigned char hk_lfr_vhdl_aa_sm;
552 unsigned char hk_lfr_vhdl_aa_sm;
535 unsigned char hk_lfr_vhdl_fft_sr;
553 unsigned char hk_lfr_vhdl_fft_sr;
536 unsigned char hk_lfr_vhdl_cic_hk;
554 unsigned char hk_lfr_vhdl_cic_hk;
537 unsigned char hk_lfr_vhdl_iir_cal;
555 unsigned char hk_lfr_vhdl_iir_cal;
538 // spacewire_if_statistics
556 // spacewire_if_statistics
539 unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2];
557 unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2];
540 unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2];
558 unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2];
541 unsigned char hk_lfr_dpu_spw_tick_out_cnt;
559 unsigned char hk_lfr_dpu_spw_tick_out_cnt;
542 unsigned char hk_lfr_dpu_spw_last_timc;
560 unsigned char hk_lfr_dpu_spw_last_time;
543 // ahb error statistics
561 // ahb error statistics
544 unsigned int hk_lfr_last_fail_addr;
562 unsigned int hk_lfr_last_fail_addr;
545 // temperatures
563 // temperatures
546 unsigned char hk_lfr_temp_scm[2];
564 unsigned char hk_lfr_temp_scm[2];
547 unsigned char hk_lfr_temp_pcb[2];
565 unsigned char hk_lfr_temp_pcb[2];
548 unsigned char hk_lfr_temp_fpga[2];
566 unsigned char hk_lfr_temp_fpga[2];
549 // error counters
567 // error counters
550 unsigned char hk_lfr_dpu_spw_parity;
568 unsigned char hk_lfr_dpu_spw_parity;
551 unsigned char hk_lfr_dpu_spw_disconnect;
569 unsigned char hk_lfr_dpu_spw_disconnect;
552 unsigned char hk_lfr_dpu_spw_escape;
570 unsigned char hk_lfr_dpu_spw_escape;
553 unsigned char hk_lfr_dpu_spw_credit;
571 unsigned char hk_lfr_dpu_spw_credit;
554 unsigned char hk_lfr_dpu_spw_write_sync;
572 unsigned char hk_lfr_dpu_spw_write_sync;
555 unsigned char hk_lfr_dpu_spw_rx_ahb;
573 unsigned char hk_lfr_dpu_spw_rx_ahb;
556 unsigned char hk_lfr_dpu_spw_tx_ahb;
574 unsigned char hk_lfr_dpu_spw_tx_ahb;
557 unsigned char hk_lfr_dpu_spw_header_crc;
575 unsigned char hk_lfr_dpu_spw_header_crc;
558 unsigned char hk_lfr_dpu_spw_data_crc;
576 unsigned char hk_lfr_dpu_spw_data_crc;
559 unsigned char hk_lfr_dpu_spw_early_eop;
577 unsigned char hk_lfr_dpu_spw_early_eop;
560 unsigned char hk_lfr_dpu_spw_invalid_addr;
578 unsigned char hk_lfr_dpu_spw_invalid_addr;
561 unsigned char hk_lfr_dpu_spw_eep;
579 unsigned char hk_lfr_dpu_spw_eep;
562 unsigned char hk_lfr_dpu_spw_rx_too_big;
580 unsigned char hk_lfr_dpu_spw_rx_too_big;
563 // timecode
581 // timecode
564 unsigned char hk_lfr_timecode_erroneous;
582 unsigned char hk_lfr_timecode_erroneous;
565 unsigned char hk_lfr_timecode_missing;
583 unsigned char hk_lfr_timecode_missing;
566 unsigned char hk_lfr_timecode_invalid;
584 unsigned char hk_lfr_timecode_invalid;
567 // time
585 // time
568 unsigned char hk_lfr_time_timecode_it;
586 unsigned char hk_lfr_time_timecode_it;
569 unsigned char hk_lfr_time_not_synchro;
587 unsigned char hk_lfr_time_not_synchro;
570 unsigned char hk_lfr_time_timecode_ctr;
588 unsigned char hk_lfr_time_timecode_ctr;
571 // hk_lfr_buffer_dpu_
589 // hk_lfr_buffer_dpu_
572 unsigned char hk_lfr_buffer_dpu_tc_fifo;
590 unsigned char hk_lfr_buffer_dpu_tc_fifo;
573 unsigned char hk_lfr_buffer_dpu_tm_fifo;
591 unsigned char hk_lfr_buffer_dpu_tm_fifo;
574 // hk_lfr_ahb_
592 // hk_lfr_ahb_
575 unsigned char hk_lfr_ahb_correctable;
593 unsigned char hk_lfr_ahb_correctable;
576 unsigned char hk_lfr_ahb_uncorrectable;
594 unsigned char hk_lfr_ahb_uncorrectable;
577 unsigned char hk_lfr_ahb_fails_trans;
595 unsigned char hk_lfr_ahb_fails_trans;
578 // hk_lfr_adc_
596 // hk_lfr_adc_
579 unsigned char hk_lfr_adc_failure;
597 unsigned char hk_lfr_adc_failure;
580 unsigned char hk_lfr_adc_timeout;
598 unsigned char hk_lfr_adc_timeout;
581 unsigned char hk_lfr_toomany_err;
599 unsigned char hk_lfr_toomany_err;
582 // hk_lfr_cpu_
600 // hk_lfr_cpu_
583 unsigned char hk_lfr_cpu_write_err;
601 unsigned char hk_lfr_cpu_write_err;
584 unsigned char hk_lfr_cpu_ins_access_err;
602 unsigned char hk_lfr_cpu_ins_access_err;
585 unsigned char hk_lfr_cpu_illegal_ins;
603 unsigned char hk_lfr_cpu_illegal_ins;
586 unsigned char hk_lfr_cpu_privilegied_ins;
604 unsigned char hk_lfr_cpu_privilegied_ins;
587 unsigned char hk_lfr_cpu_register_hw;
605 unsigned char hk_lfr_cpu_register_hw;
588 unsigned char hk_lfr_cpu_not_aligned;
606 unsigned char hk_lfr_cpu_not_aligned;
589 unsigned char hk_lfr_cpu_data_exception;
607 unsigned char hk_lfr_cpu_data_exception;
590 unsigned char hk_lfr_cpu_div_exception;
608 unsigned char hk_lfr_cpu_div_exception;
591 unsigned char hk_lfr_cpu_arith_overflow;
609 unsigned char hk_lfr_cpu_arith_overflow;
592 };
610 };
593 typedef struct Packet_TM_LFR_HK_str Packet_TM_LFR_HK_t;
611 typedef struct Packet_TM_LFR_HK_str Packet_TM_LFR_HK_t;
594
612
595 struct Packet_TM_LFR_PARAMETER_DUMP_str
613 struct Packet_TM_LFR_PARAMETER_DUMP_str
596 {
614 {
597 volatile unsigned char targetLogicalAddress;
615 unsigned char targetLogicalAddress;
598 volatile unsigned char protocolIdentifier;
616 unsigned char protocolIdentifier;
599 volatile unsigned char reserved;
617 unsigned char reserved;
600 volatile unsigned char userApplication;
618 unsigned char userApplication;
601 volatile unsigned char packetID[2];
619 unsigned char packetID[2];
602 volatile unsigned char packetSequenceControl[2];
620 unsigned char packetSequenceControl[2];
603 volatile unsigned char packetLength[2];
621 unsigned char packetLength[2];
604 // DATA FIELD HEADER
622 // DATA FIELD HEADER
605 volatile unsigned char spare1_pusVersion_spare2;
623 unsigned char spare1_pusVersion_spare2;
606 volatile unsigned char serviceType;
624 unsigned char serviceType;
607 volatile unsigned char serviceSubType;
625 unsigned char serviceSubType;
608 volatile unsigned char destinationID;
626 unsigned char destinationID;
609 volatile unsigned char time[6];
627 unsigned char time[6];
610 volatile unsigned char sid;
628 unsigned char sid;
611
629
612 //******************
630 //******************
613 // COMMON PARAMETERS
631 // COMMON PARAMETERS
614 volatile unsigned char unused0;
632 unsigned char unused0;
615 volatile unsigned char bw_sp0_sp1_r0_r1;
633 unsigned char bw_sp0_sp1_r0_r1;
616
634
617 //******************
635 //******************
618 // NORMAL PARAMETERS
636 // NORMAL PARAMETERS
619 volatile unsigned char sy_lfr_n_swf_l[2];
637 unsigned char sy_lfr_n_swf_l[2];
620 volatile unsigned char sy_lfr_n_swf_p[2];
638 unsigned char sy_lfr_n_swf_p[2];
621 volatile unsigned char sy_lfr_n_asm_p[2];
639 unsigned char sy_lfr_n_asm_p[2];
622 volatile unsigned char sy_lfr_n_bp_p0;
640 unsigned char sy_lfr_n_bp_p0;
623 volatile unsigned char sy_lfr_n_bp_p1;
641 unsigned char sy_lfr_n_bp_p1;
624
642
625 //*****************
643 //*****************
626 // BURST PARAMETERS
644 // BURST PARAMETERS
627 volatile unsigned char sy_lfr_b_bp_p0;
645 unsigned char sy_lfr_b_bp_p0;
628 volatile unsigned char sy_lfr_b_bp_p1;
646 unsigned char sy_lfr_b_bp_p1;
629
647
630 //****************
648 //****************
631 // SBM1 PARAMETERS
649 // SBM1 PARAMETERS
632 volatile unsigned char sy_lfr_s1_bp_p0;
650 unsigned char sy_lfr_s1_bp_p0;
633 volatile unsigned char sy_lfr_s1_bp_p1;
651 unsigned char sy_lfr_s1_bp_p1;
634
652
635 //****************
653 //****************
636 // SBM2 PARAMETERS
654 // SBM2 PARAMETERS
637 volatile unsigned char sy_lfr_s2_bp_p0;
655 unsigned char sy_lfr_s2_bp_p0;
638 volatile unsigned char sy_lfr_s2_bp_p1;
656 unsigned char sy_lfr_s2_bp_p1;
639 };
657 };
640 typedef struct Packet_TM_LFR_PARAMETER_DUMP_str Packet_TM_LFR_PARAMETER_DUMP_t;
658 typedef struct Packet_TM_LFR_PARAMETER_DUMP_str Packet_TM_LFR_PARAMETER_DUMP_t;
641
659
642
660
643 #endif // CCSDS_TYPES_H_INCLUDED
661 #endif // CCSDS_TYPES_H_INCLUDED
@@ -1,48 +1,52
1 #ifndef FSW_INIT_H_INCLUDED
1 #ifndef FSW_INIT_H_INCLUDED
2 #define FSW_INIT_H_INCLUDED
2 #define FSW_INIT_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <leon.h>
5 #include <leon.h>
6
6
7 #include "fsw_params.h"
7 #include "fsw_params.h"
8 #include "fsw_misc.h"
8 #include "fsw_misc.h"
9 #include "fsw_processing.h"
9 #include "fsw_processing.h"
10 #include "tc_handler.h"
10 #include "tc_handler.h"
11 #include "wf_handler.h"
11 #include "wf_handler.h"
12
12
13 #include "fsw_spacewire.h"
13 #include "fsw_spacewire.h"
14
14
15 extern rtems_name misc_name[5];
15 extern rtems_name misc_name[5];
16 extern rtems_id misc_id[5];
16 extern rtems_id misc_id[5];
17 extern rtems_name Task_name[20]; /* array of task names */
17 extern rtems_name Task_name[20]; /* array of task names */
18 extern rtems_id Task_id[20]; /* array of task ids */
18 extern rtems_id Task_id[20]; /* array of task ids */
19 extern unsigned int maxCount;
19 extern unsigned int maxCount;
20 extern int fdSPW; // grspw file descriptor
20 extern int fdSPW; // grspw file descriptor
21 extern int fdUART; // uart file descriptor
21 extern int fdUART; // uart file descriptor
22 extern unsigned char lfrCurrentMode;
22 extern unsigned char lfrCurrentMode;
23
23
24 // MODE PARAMETERS
24 // MODE PARAMETERS
25 extern struct param_local_str param_local;
25 extern struct param_local_str param_local;
26 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
26 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
27 extern unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID];
27 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
28 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
29 extern unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
28
30
29 // RTEMS TASKS
31 // RTEMS TASKS
30 rtems_task Init( rtems_task_argument argument);
32 rtems_task Init( rtems_task_argument argument);
31
33
32 // OTHER functions
34 // OTHER functions
33 void create_names( void );
35 void create_names( void );
34 rtems_status_code create_message_queues( void );
35 int create_all_tasks( void );
36 int create_all_tasks( void );
36 int start_all_tasks( void );
37 int start_all_tasks( void );
38 //
39 rtems_status_code create_message_queues( void );
40 //
37 int start_recv_send_tasks( void );
41 int start_recv_send_tasks( void );
38 //
42 //
39 void init_local_mode_parameters( void );
43 void init_local_mode_parameters( void );
40
44
41 extern int rtems_cpu_usage_report( void );
45 extern int rtems_cpu_usage_report( void );
42 extern int rtems_cpu_usage_reset( void );
46 extern int rtems_cpu_usage_reset( void );
43 extern void rtems_stack_checker_report_usage( void );
47 extern void rtems_stack_checker_report_usage( void );
44
48
45 extern int sched_yield( void );
49 extern int sched_yield( void );
46 extern int errno;
50 extern int errno;
47
51
48 #endif // FSW_INIT_H_INCLUDED
52 #endif // FSW_INIT_H_INCLUDED
@@ -1,35 +1,37
1 #ifndef FSW_MISC_H_INCLUDED
1 #ifndef FSW_MISC_H_INCLUDED
2 #define FSW_MISC_H_INCLUDED
2 #define FSW_MISC_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <stdio.h>
5 #include <stdio.h>
6 #include <grspw.h>
6 #include <grspw.h>
7
7
8 #include "fsw_params.h"
8 #include "fsw_params.h"
9 #include "fsw_spacewire.h"
9 #include "fsw_spacewire.h"
10
10
11 rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic
11 rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic
12 rtems_id HK_id; // id of the HK rate monotonic period
12 rtems_id HK_id; // id of the HK rate monotonic period
13
13
14 extern rtems_name misc_name[5];
14 extern rtems_name misc_name[5];
15 time_management_regs_t *time_management_regs;
15 time_management_regs_t *time_management_regs;
16 extern Packet_TM_LFR_HK_t housekeeping_packet;
16 extern Packet_TM_LFR_HK_t housekeeping_packet;
17
17
18 int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
18 int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
19 unsigned char interrupt_level, rtems_isr (*timer_isr)() );
19 unsigned char interrupt_level, rtems_isr (*timer_isr)() );
20 int timer_start( gptimer_regs_t *gptimer_regs, unsigned char timer );
20 int timer_start( gptimer_regs_t *gptimer_regs, unsigned char timer );
21 int timer_stop( gptimer_regs_t *gptimer_regs, unsigned char timer );
21 int timer_stop( gptimer_regs_t *gptimer_regs, unsigned char timer );
22 int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider);
22 int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider);
23
23
24 // SERIAL LINK
24 // SERIAL LINK
25 int send_console_outputs_on_apbuart_port( void );
25 int send_console_outputs_on_apbuart_port( void );
26 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value);
26 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value);
27
27
28 // RTEMS TASKS
28 // RTEMS TASKS
29 rtems_task stat_task( rtems_task_argument argument );
29 rtems_task stat_task( rtems_task_argument argument );
30 rtems_task hous_task( rtems_task_argument argument );
30 rtems_task hous_task( rtems_task_argument argument );
31 rtems_task dumb_task( rtems_task_argument unused );
31 rtems_task dumb_task( rtems_task_argument unused );
32
32
33 void init_housekeeping_parameters( void );
33 void init_housekeeping_parameters( void );
34
34
35 void increment_seq_counter( unsigned char *packet_sequence_control);
36
35 #endif // FSW_MISC_H_INCLUDED
37 #endif // FSW_MISC_H_INCLUDED
@@ -1,235 +1,211
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 //************************
12 //************************
13 // flight software version
13 // flight software version
14 // this parameters is handled by the Qt project options
14 // this parameters is handled by the Qt project options
15
15
16 //**********
16 //**********
17 // LFR MODES
17 // LFR MODES
18 #define LFR_MODE_STANDBY 0
18 #define LFR_MODE_STANDBY 0
19 #define LFR_MODE_NORMAL 1
19 #define LFR_MODE_NORMAL 1
20 #define LFR_MODE_BURST 2
20 #define LFR_MODE_BURST 2
21 #define LFR_MODE_SBM1 3
21 #define LFR_MODE_SBM1 3
22 #define LFR_MODE_SBM2 4
22 #define LFR_MODE_SBM2 4
23 #define LFR_MODE_NORMAL_CWF_F3 5
23 #define LFR_MODE_NORMAL_CWF_F3 5
24
24
25 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
25 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
26 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
26 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
27 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
27 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
28 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
28 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
29 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
29 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
30 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
30 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
31
31
32 //****************************
32 //****************************
33 // LFR DEFAULT MODE PARAMETERS
33 // LFR DEFAULT MODE PARAMETERS
34 // COMMON
34 // COMMON
35 #define DEFAULT_SY_LFR_COMMON0 0x00
35 #define DEFAULT_SY_LFR_COMMON0 0x00
36 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
36 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
37 // NORM
37 // NORM
38 #define SY_LFR_N_SWF_L 2048 // nb sample
38 #define SY_LFR_N_SWF_L 2048 // nb sample
39 #define SY_LFR_N_SWF_P 300 // sec
39 #define SY_LFR_N_SWF_P 300 // sec
40 #define SY_LFR_N_ASM_P 3600 // sec
40 #define SY_LFR_N_ASM_P 3600 // sec
41 #define SY_LFR_N_BP_P0 4 // sec
41 #define SY_LFR_N_BP_P0 4 // sec
42 #define SY_LFR_N_BP_P1 20 // sec
42 #define SY_LFR_N_BP_P1 20 // sec
43 #define MIN_DELTA_SNAPSHOT 16 // sec
43 #define MIN_DELTA_SNAPSHOT 16 // sec
44 // BURST
44 // BURST
45 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
45 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
46 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
46 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
47 // SBM1
47 // SBM1
48 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
48 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
49 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
49 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
50 // SBM2
50 // SBM2
51 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
51 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
52 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
52 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
53 // ADDITIONAL PARAMETERS
53 // ADDITIONAL PARAMETERS
54 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
54 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
55 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
55 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
56 // STATUS WORD
56 // STATUS WORD
57 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
57 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
58 #define DEFAULT_STATUS_WORD_BYTE1 0x00
58 #define DEFAULT_STATUS_WORD_BYTE1 0x00
59 //
59 //
60 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
60 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
61 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
61 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
62 //****************************
62 //****************************
63
63
64 //*****************************
64 //*****************************
65 // APB REGISTERS BASE ADDRESSES
65 // APB REGISTERS BASE ADDRESSES
66 #define REGS_ADDR_APBUART 0x80000100
66 #define REGS_ADDR_APBUART 0x80000100
67 #define REGS_ADDR_GPTIMER 0x80000300
67 #define REGS_ADDR_GPTIMER 0x80000300
68 #define REGS_ADDR_GRSPW 0x80000500
68 #define REGS_ADDR_GRSPW 0x80000500
69 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
69 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
70 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
70 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
71
71
72 #ifdef GSA
72 #ifdef GSA
73 #else
73 #else
74 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20
74 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20
75 #endif
75 #endif
76
76
77 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
77 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
78 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
78 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
79
79
80 //**********
80 //**********
81 // IRQ LINES
81 // IRQ LINES
82 #define IRQ_SM 9
82 #define IRQ_SM 9
83 #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels
83 #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels
84 #define IRQ_WF 10
84 #define IRQ_WF 10
85 #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels
85 #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels
86 #define IRQ_TIME1 12
86 #define IRQ_TIME1 12
87 #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels
87 #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels
88 #define IRQ_TIME2 13
88 #define IRQ_TIME2 13
89 #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels
89 #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels
90 #define IRQ_WAVEFORM_PICKER 14
90 #define IRQ_WAVEFORM_PICKER 14
91 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
91 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
92 #define IRQ_SPECTRAL_MATRIX 6
92 #define IRQ_SPECTRAL_MATRIX 6
93 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
93 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
94
94
95 //*****
95 //*****
96 // TIME
96 // TIME
97 #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms
97 #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms
98 #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s
98 #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s
99 #define TIMER_SM_SIMULATOR 1
99 #define TIMER_SM_SIMULATOR 1
100 #define TIMER_WF_SIMULATOR 2
100 #define TIMER_WF_SIMULATOR 2
101 #define HK_PERIOD 100 // 100 * 10ms => 1sec
101 #define HK_PERIOD 100 // 100 * 10ms => 1sec
102
102
103 //**********
103 //**********
104 // LPP CODES
104 // LPP CODES
105 #define LFR_SUCCESSFUL 0
105 #define LFR_SUCCESSFUL 0
106 #define LFR_DEFAULT 1
106 #define LFR_DEFAULT 1
107
107
108 //******
108 //******
109 // RTEMS
109 // RTEMS
110 #define TASKID_RECV 1
110 #define TASKID_RECV 1
111 #define TASKID_ACTN 2
111 #define TASKID_ACTN 2
112 #define TASKID_SPIQ 3
112 #define TASKID_SPIQ 3
113 #define TASKID_SMIQ 4
113 #define TASKID_SMIQ 4
114 #define TASKID_STAT 5
114 #define TASKID_STAT 5
115 #define TASKID_AVF0 6
115 #define TASKID_AVF0 6
116 #define TASKID_BPF0 7
116 #define TASKID_BPF0 7
117 #define TASKID_WFRM 8
117 #define TASKID_WFRM 8
118 #define TASKID_DUMB 9
118 #define TASKID_DUMB 9
119 #define TASKID_HOUS 10
119 #define TASKID_HOUS 10
120 #define TASKID_MATR 11
120 #define TASKID_MATR 11
121 #define TASKID_CWF3 12
121 #define TASKID_CWF3 12
122 #define TASKID_CWF2 13
122 #define TASKID_CWF2 13
123 #define TASKID_CWF1 14
123 #define TASKID_CWF1 14
124 #define TASKID_SEND 15
124 #define TASKID_SEND 15
125 #define TASKID_WTDG 16
125 #define TASKID_WTDG 16
126
126
127 #define TASK_PRIORITY_SPIQ 5
127 #define TASK_PRIORITY_SPIQ 5
128 #define TASK_PRIORITY_SMIQ 10
128 #define TASK_PRIORITY_SMIQ 10
129 //
129 //
130 #define TASK_PRIORITY_WTDG 20
130 #define TASK_PRIORITY_WTDG 20
131 //
131 //
132 #define TASK_PRIORITY_HOUS 30
132 #define TASK_PRIORITY_HOUS 30
133 //
133 //
134 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
134 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
135 #define TASK_PRIORITY_CWF2 35 //
135 #define TASK_PRIORITY_CWF2 35 //
136 //
136 //
137 #define TASK_PRIORITY_WFRM 40
137 #define TASK_PRIORITY_WFRM 40
138 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
138 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
139 //
139 //
140 #define TASK_PRIORITY_SEND 45
140 #define TASK_PRIORITY_SEND 45
141 //
141 //
142 #define TASK_PRIORITY_RECV 50
142 #define TASK_PRIORITY_RECV 50
143 #define TASK_PRIORITY_ACTN 50
143 #define TASK_PRIORITY_ACTN 50
144 //
144 //
145 #define TASK_PRIORITY_AVF0 60
145 #define TASK_PRIORITY_AVF0 60
146 #define TASK_PRIORITY_BPF0 60
146 #define TASK_PRIORITY_BPF0 60
147 #define TASK_PRIORITY_MATR 100
147 #define TASK_PRIORITY_MATR 100
148 #define TASK_PRIORITY_STAT 200
148 #define TASK_PRIORITY_STAT 200
149 #define TASK_PRIORITY_DUMB 200
149 #define TASK_PRIORITY_DUMB 200
150
150
151 #define SEMQ_PRIORITY_CEILING 30
152
151 #define ACTION_MSG_QUEUE_COUNT 10
153 #define ACTION_MSG_QUEUE_COUNT 10
152 #define ACTION_MSG_PKTS_COUNT 50
154 #define ACTION_MSG_PKTS_COUNT 50
153 #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
155 #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
154 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
156 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
155
157
156 #define QUEUE_RECV 0
158 #define QUEUE_RECV 0
157 #define QUEUE_SEND 1
159 #define QUEUE_SEND 1
158
160
159 //*******
161 //*******
160 // MACROS
162 // MACROS
161 #ifdef PRINT_MESSAGES_ON_CONSOLE
163 #ifdef PRINT_MESSAGES_ON_CONSOLE
162 #define PRINTF(x) printf(x);
164 #define PRINTF(x) printf(x);
163 #define PRINTF1(x,y) printf(x,y);
165 #define PRINTF1(x,y) printf(x,y);
164 #define PRINTF2(x,y,z) printf(x,y,z);
166 #define PRINTF2(x,y,z) printf(x,y,z);
165 #else
167 #else
166 #define PRINTF(x) ;
168 #define PRINTF(x) ;
167 #define PRINTF1(x,y) ;
169 #define PRINTF1(x,y) ;
168 #define PRINTF2(x,y,z) ;
170 #define PRINTF2(x,y,z) ;
169 #endif
171 #endif
170
172
171 #ifdef BOOT_MESSAGES
173 #ifdef BOOT_MESSAGES
172 #define BOOT_PRINTF(x) printf(x);
174 #define BOOT_PRINTF(x) printf(x);
173 #define BOOT_PRINTF1(x,y) printf(x,y);
175 #define BOOT_PRINTF1(x,y) printf(x,y);
174 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
176 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
175 #else
177 #else
176 #define BOOT_PRINTF(x) ;
178 #define BOOT_PRINTF(x) ;
177 #define BOOT_PRINTF1(x,y) ;
179 #define BOOT_PRINTF1(x,y) ;
178 #define BOOT_PRINTF2(x,y,z) ;
180 #define BOOT_PRINTF2(x,y,z) ;
179 #endif
181 #endif
180
182
181 #ifdef DEBUG_MESSAGES
183 #ifdef DEBUG_MESSAGES
182 #define DEBUG_PRINTF(x) printf(x);
184 #define DEBUG_PRINTF(x) printf(x);
183 #define DEBUG_PRINTF1(x,y) printf(x,y);
185 #define DEBUG_PRINTF1(x,y) printf(x,y);
184 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
186 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
185 #else
187 #else
186 #define DEBUG_PRINTF(x) ;
188 #define DEBUG_PRINTF(x) ;
187 #define DEBUG_PRINTF1(x,y) ;
189 #define DEBUG_PRINTF1(x,y) ;
188 #define DEBUG_PRINTF2(x,y,z) ;
190 #define DEBUG_PRINTF2(x,y,z) ;
189 #endif
191 #endif
190
192
191 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
193 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
192
194
193 #define NB_SAMPLES_PER_SNAPSHOT 2048
195 #define NB_SAMPLES_PER_SNAPSHOT 2048
194 #define TIME_OFFSET 2
196 #define TIME_OFFSET 2
195 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
197 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
196 #define NB_BYTES_SWF_BLK (2 * 6)
198 #define NB_BYTES_SWF_BLK (2 * 6)
197 #define NB_WORDS_SWF_BLK 3
199 #define NB_WORDS_SWF_BLK 3
198 #define NB_BYTES_CWF3_LIGHT_BLK 6
200 #define NB_BYTES_CWF3_LIGHT_BLK 6
199 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
201 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
200
202
201 //******************
202 // SEQUENCE COUNTERS
203 #define SEQ_CNT_NB_PID 2
204 #define SEQ_CNT_NB_CAT 4
205 #define SEQ_CNT_NB_DEST_ID 11
206 // pid
207 #define SEQ_CNT_PID_76 0
208 #define SEQ_CNT_PID_79 1
209 //cat
210 #define SEQ_CNT_CAT_1 0
211 #define SEQ_CNT_CAT_4 1
212 #define SEQ_CNT_CAT_9 2
213 #define SEQ_CNT_CAT_12 3
214 // destination id
215 #define SEQ_CNT_DST_ID_GROUND 0
216 #define SEQ_CNT_DST_ID_MISSION_TIMELINE 1
217 #define SEQ_CNT_DST_ID_TC_SEQUENCES 2
218 #define SEQ_CNT_DST_ID_RECOVERY_ACTION_CMD 3
219 #define SEQ_CNT_DST_ID_BACKUP_MISSION_TIMELINE 4
220 #define SEQ_CNT_DST_ID_DIRECT_CMD 5
221 #define SEQ_CNT_DST_ID_SPARE_GRD_SRC1 6
222 #define SEQ_CNT_DST_ID_SPARE_GRD_SRC2 7
223 #define SEQ_CNT_DST_ID_OBCP 8
224 #define SEQ_CNT_DST_ID_SYSTEM_CONTROL 9
225 #define SEQ_CNT_DST_ID_AOCS 10
226
227 struct param_local_str{
203 struct param_local_str{
228 unsigned int local_sbm1_nb_cwf_sent;
204 unsigned int local_sbm1_nb_cwf_sent;
229 unsigned int local_sbm1_nb_cwf_max;
205 unsigned int local_sbm1_nb_cwf_max;
230 unsigned int local_sbm2_nb_cwf_sent;
206 unsigned int local_sbm2_nb_cwf_sent;
231 unsigned int local_sbm2_nb_cwf_max;
207 unsigned int local_sbm2_nb_cwf_max;
232 unsigned int local_nb_interrupt_f0_MAX;
208 unsigned int local_nb_interrupt_f0_MAX;
233 };
209 };
234
210
235 #endif // FSW_PARAMS_H_INCLUDED
211 #endif // FSW_PARAMS_H_INCLUDED
@@ -1,65 +1,67
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
10
10 #include "fsw_params.h"
11 #include "fsw_params.h"
12 #include "fsw_spacewire.h"
11
13
12
14
13 extern volatile int spec_mat_f0_0[ ];
15 extern volatile int spec_mat_f0_0[ ];
14 extern volatile int spec_mat_f0_1[ ];
16 extern volatile int spec_mat_f0_1[ ];
15 extern volatile int spec_mat_f0_a[ ];
17 extern volatile int spec_mat_f0_a[ ];
16 extern volatile int spec_mat_f0_b[ ];
18 extern volatile int spec_mat_f0_b[ ];
17 extern volatile int spec_mat_f0_c[ ];
19 extern volatile int spec_mat_f0_c[ ];
18 extern volatile int spec_mat_f0_d[ ];
20 extern volatile int spec_mat_f0_d[ ];
19 extern volatile int spec_mat_f0_e[ ];
21 extern volatile int spec_mat_f0_e[ ];
20 extern volatile int spec_mat_f0_f[ ];
22 extern volatile int spec_mat_f0_f[ ];
21 extern volatile int spec_mat_f0_g[ ];
23 extern volatile int spec_mat_f0_g[ ];
22 extern volatile int spec_mat_f0_h[ ];
24 extern volatile int spec_mat_f0_h[ ];
23
25
24 extern volatile int spec_mat_f1[ ];
26 extern volatile int spec_mat_f1[ ];
25 extern volatile int spec_mat_f2[ ];
27 extern volatile int spec_mat_f2[ ];
26
28
27 extern volatile int spec_mat_f1_bis[ ];
29 extern volatile int spec_mat_f1_bis[ ];
28 extern volatile int spec_mat_f2_bis[ ];
30 extern volatile int spec_mat_f2_bis[ ];
29 extern volatile int spec_mat_f0_0_bis[ ];
31 extern volatile int spec_mat_f0_0_bis[ ];
30 extern volatile int spec_mat_f0_1_bis[ ];
32 extern volatile int spec_mat_f0_1_bis[ ];
31
33
32 // parameters
34 // parameters
33 extern struct param_local_str param_local;
35 extern struct param_local_str param_local;
34
36
35 // registers
37 // registers
36 extern time_management_regs_t *time_management_regs;
38 extern time_management_regs_t *time_management_regs;
37 extern spectral_matrix_regs_t *spectral_matrix_regs;
39 extern spectral_matrix_regs_t *spectral_matrix_regs;
38
40
39 extern rtems_name misc_name[5];
41 extern rtems_name misc_name[5];
40 extern rtems_id Task_id[20]; /* array of task ids */
42 extern rtems_id Task_id[20]; /* array of task ids */
41
43
42 // ISR
44 // ISR
43 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
45 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
44 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
46 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
45
47
46 // RTEMS TASKS
48 // RTEMS TASKS
47 rtems_task spw_bppr_task(rtems_task_argument argument);
49 rtems_task spw_bppr_task(rtems_task_argument argument);
48 rtems_task avf0_task(rtems_task_argument argument);
50 rtems_task avf0_task(rtems_task_argument argument);
49 rtems_task bpf0_task(rtems_task_argument argument);
51 rtems_task bpf0_task(rtems_task_argument argument);
50 rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator
52 rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator
51 rtems_task matr_task(rtems_task_argument argument);
53 rtems_task matr_task(rtems_task_argument argument);
52
54
53 void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat);
55 void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat);
54 void matrix_reset(volatile float *averaged_spec_mat);
56 void matrix_reset(volatile float *averaged_spec_mat);
55 void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1);
57 void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1);
56 void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat);
58 void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat);
57 //
59 //
58 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header);
60 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header);
59 void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
61 void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
60 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id);
62 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id);
61 void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix);
63 void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix);
62 void fill_averaged_spectral_matrix( void );
64 void fill_averaged_spectral_matrix( void );
63 void reset_spectral_matrix_regs();
65 void reset_spectral_matrix_regs();
64
66
65 #endif // FSW_PROCESSING_H_INCLUDED
67 #endif // FSW_PROCESSING_H_INCLUDED
@@ -1,31 +1,32
1 #ifndef TC_LOAD_DUMP_PARAMETERS_H
1 #ifndef TC_LOAD_DUMP_PARAMETERS_H
2 #define TC_LOAD_DUMP_PARAMETERS_H
2 #define TC_LOAD_DUMP_PARAMETERS_H
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <stdio.h>
5 #include <stdio.h>
6
6
7 #include "fsw_params.h"
7 #include "fsw_params.h"
8 #include "wf_handler.h"
8 #include "wf_handler.h"
9 #include "tm_lfr_tc_exe.h"
9 #include "tm_lfr_tc_exe.h"
10 #include "fsw_misc.h"
10
11
11 extern int fdSPW;
12 extern int fdSPW;
12 extern unsigned char lfrCurrentMode;
13 extern unsigned char lfrCurrentMode;
13 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
14 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
14 extern Packet_TM_LFR_HK_t housekeeping_packet;
15 extern Packet_TM_LFR_HK_t housekeeping_packet;
15
16
16 int action_load_common_par( ccsdsTelecommandPacket_t *TC );
17 int action_load_common_par( ccsdsTelecommandPacket_t *TC );
17 int action_load_normal_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
18 int action_load_normal_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
18 int action_load_burst_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
19 int action_load_burst_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
19 int action_load_sbm1_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
20 int action_load_sbm1_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
20 int action_load_sbm2_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
21 int action_load_sbm2_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
21 int action_dump_par(rtems_id queue_id );
22 int action_dump_par(rtems_id queue_id );
22
23
23 int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
24 int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
24 int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
25 int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
25 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
26 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
26 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
27 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
27 int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
28 int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
28
29
29 void init_parameter_dump( void );
30 void init_parameter_dump( void );
30
31
31 #endif // TC_LOAD_DUMP_PARAMETERS_H
32 #endif // TC_LOAD_DUMP_PARAMETERS_H
@@ -1,24 +1,28
1 #ifndef TM_LFR_TC_EXE_H_INCLUDED
1 #ifndef TM_LFR_TC_EXE_H_INCLUDED
2 #define TM_LFR_TC_EXE_H_INCLUDED
2 #define TM_LFR_TC_EXE_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <stdio.h>
5 #include <stdio.h>
6
6
7 #include "fsw_params.h"
7 #include "fsw_params.h"
8 #include "fsw_spacewire.h"
8
9
9 extern time_management_regs_t *time_management_regs;
10 extern time_management_regs_t *time_management_regs;
10 extern Packet_TM_LFR_HK_t housekeeping_packet;
11 extern Packet_TM_LFR_HK_t housekeeping_packet;
12 extern unsigned short sequenceCounters_TC_EXE[];
11
13
12 int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
14 int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
13 int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
15 int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
14 unsigned char byte_position, unsigned char rcv_value);
16 unsigned char byte_position, unsigned char rcv_value);
15 int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
17 int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
16 int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
18 int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
17 int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
19 int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
18 int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
20 int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
19 unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV);
21 unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV);
20
22
23 void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id );
24
21 #endif // TM_LFR_TC_EXE_H_INCLUDED
25 #endif // TM_LFR_TC_EXE_H_INCLUDED
22
26
23
27
24
28
@@ -1,81 +1,88
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"
11 #include "fsw_misc.h"
10
12
11 #define pi 3.1415
13 #define pi 3.1415
12
14
13 extern int fdSPW;
15 extern int fdSPW;
14 extern volatile int wf_snap_f0[ ];
16 extern volatile int wf_snap_f0[ ];
15 //
17 //
16 extern volatile int wf_snap_f1[ ];
18 extern volatile int wf_snap_f1[ ];
17 extern volatile int wf_snap_f1_bis[ ];
19 extern volatile int wf_snap_f1_bis[ ];
18 extern volatile int wf_snap_f1_norm[ ];
20 extern volatile int wf_snap_f1_norm[ ];
19 //
21 //
20 extern volatile int wf_snap_f2[ ];
22 extern volatile int wf_snap_f2[ ];
21 extern volatile int wf_snap_f2_bis[ ];
23 extern volatile int wf_snap_f2_bis[ ];
22 extern volatile int wf_snap_f2_norm[ ];
24 extern volatile int wf_snap_f2_norm[ ];
23 //
25 //
24 extern volatile int wf_cont_f3[ ];
26 extern volatile int wf_cont_f3[ ];
25 extern volatile int wf_cont_f3_bis[ ];
27 extern volatile int wf_cont_f3_bis[ ];
26 extern char wf_cont_f3_light[ ];
28 extern char wf_cont_f3_light[ ];
27 extern waveform_picker_regs_t *waveform_picker_regs;
29 extern waveform_picker_regs_t *waveform_picker_regs;
28 extern waveform_picker_regs_t_alt *waveform_picker_regs_alt;
30 extern waveform_picker_regs_t_alt *waveform_picker_regs_alt;
29 extern time_management_regs_t *time_management_regs;
31 extern time_management_regs_t *time_management_regs;
30 extern Packet_TM_LFR_HK_t housekeeping_packet;
32 extern Packet_TM_LFR_HK_t housekeeping_packet;
31 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
33 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
32 extern struct param_local_str param_local;
34 extern struct param_local_str param_local;
33
35
36 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
37 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
38
34 extern rtems_name misc_name[5];
39 extern rtems_name misc_name[5];
35 extern rtems_name Task_name[20]; /* array of task ids */
40 extern rtems_name Task_name[20]; /* array of task ids */
36 extern rtems_id Task_id[20]; /* array of task ids */
41 extern rtems_id Task_id[20]; /* array of task ids */
37
42
38 extern unsigned char lfrCurrentMode;
43 extern unsigned char lfrCurrentMode;
39
44
40 rtems_isr waveforms_isr( rtems_vector_number vector );
45 rtems_isr waveforms_isr( rtems_vector_number vector );
41 rtems_isr waveforms_simulator_isr( rtems_vector_number vector );
46 rtems_isr waveforms_simulator_isr( rtems_vector_number vector );
42 rtems_task wfrm_task( rtems_task_argument argument );
47 rtems_task wfrm_task( rtems_task_argument argument );
43 rtems_task cwf3_task( rtems_task_argument argument );
48 rtems_task cwf3_task( rtems_task_argument argument );
44 rtems_task cwf2_task( rtems_task_argument argument );
49 rtems_task cwf2_task( rtems_task_argument argument );
45 rtems_task cwf1_task( rtems_task_argument argument );
50 rtems_task cwf1_task( rtems_task_argument argument );
46
51
47 //******************
52 //******************
48 // general functions
53 // general functions
49 void init_waveforms( void );
54 void init_waveforms( void );
50 //
55 //
51 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
56 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
52 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
57 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
53 int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
58 int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
54 //
59 //
55 void reset_waveforms( void );
60 void reset_waveforms( void );
56 //
61 //
57 int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
62 int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
58 int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
63 int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
59 int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
64 int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
60 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
65 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
61 //
66 //
62 rtems_id get_pkts_queue_id( void );
67 rtems_id get_pkts_queue_id( void );
63
68
64 //**************
69 //**************
65 // wfp registers
70 // wfp registers
66 void set_wfp_data_shaping();
71 void set_wfp_data_shaping();
67 char set_wfp_delta_snapshot();
72 char set_wfp_delta_snapshot();
68 void set_wfp_burst_enable_register( unsigned char mode);
73 void set_wfp_burst_enable_register( unsigned char mode);
69 void reset_wfp_burst_enable();
74 void reset_wfp_burst_enable();
70 void reset_wfp_status();
75 void reset_wfp_status();
71 void reset_waveform_picker_regs();
76 void reset_waveform_picker_regs();
72
77
73 //*****************
78 //*****************
74 // local parameters
79 // local parameters
75 void set_local_sbm1_nb_cwf_max();
80 void set_local_sbm1_nb_cwf_max();
76 void set_local_sbm2_nb_cwf_max();
81 void set_local_sbm2_nb_cwf_max();
77 void set_local_nb_interrupt_f0_MAX();
82 void set_local_nb_interrupt_f0_MAX();
78 void reset_local_sbm1_nb_cwf_sent();
83 void reset_local_sbm1_nb_cwf_sent();
79 void reset_local_sbm2_nb_cwf_sent();
84 void reset_local_sbm2_nb_cwf_sent();
80
85
86 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid );
87
81 #endif // WF_HANDLER_H_INCLUDED
88 #endif // WF_HANDLER_H_INCLUDED
@@ -1,90 +1,92
1 /** Global variables of the LFR flight software.
1 /** Global variables of the LFR flight software.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * Among global variables, there are:
6 * Among global variables, there are:
7 * - RTEMS names and id.
7 * - RTEMS names and id.
8 * - APB configuration registers.
8 * - APB configuration registers.
9 * - waveforms global buffers, used by the waveform picker hardware module to store data.
9 * - waveforms global buffers, used by the waveform picker hardware module to store data.
10 * - spectral matrices buffesr, used by the hardware module to store data.
10 * - spectral matrices buffesr, used by the hardware module to store data.
11 * - variable related to LFR modes parameters.
11 * - variable related to LFR modes parameters.
12 * - the global HK packet buffer.
12 * - the global HK packet buffer.
13 * - the global dump parameter buffer.
13 * - the global dump parameter buffer.
14 *
14 *
15 */
15 */
16
16
17 #include <rtems.h>
17 #include <rtems.h>
18 #include <grspw.h>
18 #include <grspw.h>
19
19
20 #include "ccsds_types.h"
20 #include "ccsds_types.h"
21 #include "grlib_regs.h"
21 #include "grlib_regs.h"
22 #include "fsw_params.h"
22 #include "fsw_params.h"
23
23
24 // RTEMS GLOBAL VARIABLES
24 // RTEMS GLOBAL VARIABLES
25 rtems_name misc_name[5];
25 rtems_name misc_name[5];
26 rtems_id misc_id[5];
26 rtems_id misc_id[5];
27 rtems_name Task_name[20]; /* array of task names */
27 rtems_name Task_name[20]; /* array of task names */
28 rtems_id Task_id[20]; /* array of task ids */
28 rtems_id Task_id[20]; /* array of task ids */
29 unsigned int maxCount;
29 unsigned int maxCount;
30 int fdSPW = 0;
30 int fdSPW = 0;
31 int fdUART = 0;
31 int fdUART = 0;
32 unsigned char lfrCurrentMode;
32 unsigned char lfrCurrentMode;
33
33
34 // APB CONFIGURATION REGISTERS
34 // APB CONFIGURATION REGISTERS
35 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
35 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
36 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
36 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
37 #ifdef GSA
37 #ifdef GSA
38 #else
38 #else
39 waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER;
39 waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER;
40 waveform_picker_regs_t_alt *waveform_picker_regs_alt = (waveform_picker_regs_t_alt*) REGS_ADDR_WAVEFORM_PICKER;
40 waveform_picker_regs_t_alt *waveform_picker_regs_alt = (waveform_picker_regs_t_alt*) REGS_ADDR_WAVEFORM_PICKER;
41 #endif
41 #endif
42 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
42 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
43
43
44 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes
44 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes
45 volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
45 volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
46 //
46 //
47 volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
47 volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
48 volatile int wf_snap_f1_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
48 volatile int wf_snap_f1_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
49 volatile int wf_snap_f1_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
49 volatile int wf_snap_f1_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
50 //
50 //
51 volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
51 volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
52 volatile int wf_snap_f2_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
52 volatile int wf_snap_f2_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
53 volatile int wf_snap_f2_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
53 volatile int wf_snap_f2_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
54 //
54 //
55 volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
55 volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
56 volatile int wf_cont_f3_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
56 volatile int wf_cont_f3_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
57 char wf_cont_f3_light[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_CWF3_LIGHT_BLK ];
57 char wf_cont_f3_light[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_CWF3_LIGHT_BLK ];
58
58
59 // SPECTRAL MATRICES GLOBAL VARIABLES
59 // SPECTRAL MATRICES GLOBAL VARIABLES
60 volatile int spec_mat_f0_0[ SM_HEADER + TOTAL_SIZE_SM ];
60 volatile int spec_mat_f0_0[ SM_HEADER + TOTAL_SIZE_SM ];
61 volatile int spec_mat_f0_1[ SM_HEADER + TOTAL_SIZE_SM ];
61 volatile int spec_mat_f0_1[ SM_HEADER + TOTAL_SIZE_SM ];
62 volatile int spec_mat_f0_a[ SM_HEADER + TOTAL_SIZE_SM ];
62 volatile int spec_mat_f0_a[ SM_HEADER + TOTAL_SIZE_SM ];
63 volatile int spec_mat_f0_b[ SM_HEADER + TOTAL_SIZE_SM ];
63 volatile int spec_mat_f0_b[ SM_HEADER + TOTAL_SIZE_SM ];
64 volatile int spec_mat_f0_c[ SM_HEADER + TOTAL_SIZE_SM ];
64 volatile int spec_mat_f0_c[ SM_HEADER + TOTAL_SIZE_SM ];
65 volatile int spec_mat_f0_d[ SM_HEADER + TOTAL_SIZE_SM ];
65 volatile int spec_mat_f0_d[ SM_HEADER + TOTAL_SIZE_SM ];
66 volatile int spec_mat_f0_e[ SM_HEADER + TOTAL_SIZE_SM ];
66 volatile int spec_mat_f0_e[ SM_HEADER + TOTAL_SIZE_SM ];
67 volatile int spec_mat_f0_f[ SM_HEADER + TOTAL_SIZE_SM ];
67 volatile int spec_mat_f0_f[ SM_HEADER + TOTAL_SIZE_SM ];
68 volatile int spec_mat_f0_g[ SM_HEADER + TOTAL_SIZE_SM ];
68 volatile int spec_mat_f0_g[ SM_HEADER + TOTAL_SIZE_SM ];
69 volatile int spec_mat_f0_h[ SM_HEADER + TOTAL_SIZE_SM ];
69 volatile int spec_mat_f0_h[ SM_HEADER + TOTAL_SIZE_SM ];
70 volatile int spec_mat_f0_0_bis[ SM_HEADER + TOTAL_SIZE_SM ];
70 volatile int spec_mat_f0_0_bis[ SM_HEADER + TOTAL_SIZE_SM ];
71 volatile int spec_mat_f0_1_bis[ SM_HEADER + TOTAL_SIZE_SM ];
71 volatile int spec_mat_f0_1_bis[ SM_HEADER + TOTAL_SIZE_SM ];
72 //
72 //
73 volatile int spec_mat_f1[ SM_HEADER + TOTAL_SIZE_SM ];
73 volatile int spec_mat_f1[ SM_HEADER + TOTAL_SIZE_SM ];
74 volatile int spec_mat_f1_bis[ SM_HEADER + TOTAL_SIZE_SM ];
74 volatile int spec_mat_f1_bis[ SM_HEADER + TOTAL_SIZE_SM ];
75 //
75 //
76 volatile int spec_mat_f2[ SM_HEADER + TOTAL_SIZE_SM ];
76 volatile int spec_mat_f2[ SM_HEADER + TOTAL_SIZE_SM ];
77 volatile int spec_mat_f2_bis[ SM_HEADER + TOTAL_SIZE_SM ];
77 volatile int spec_mat_f2_bis[ SM_HEADER + TOTAL_SIZE_SM ];
78
78
79 // MODE PARAMETERS
79 // MODE PARAMETERS
80 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
80 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
81 struct param_local_str param_local;
81 struct param_local_str param_local;
82
82
83 // HK PACKETS
83 // HK PACKETS
84 Packet_TM_LFR_HK_t housekeeping_packet;
84 Packet_TM_LFR_HK_t housekeeping_packet;
85 // sequence counters are incremented by APID (PID + CAT) and destination ID
85 // sequence counters are incremented by APID (PID + CAT) and destination ID
86 unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID];
86 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
87 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
88 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
87 spw_stats spacewire_stats;
89 spw_stats spacewire_stats;
88 spw_stats spacewire_stats_backup;
90 spw_stats spacewire_stats_backup;
89
91
90
92
@@ -1,592 +1,586
1 /** This is the RTEMS initialization module.
1 /** This is the RTEMS initialization module.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * This module contains two very different information:
6 * This module contains two very different information:
7 * - specific instructions to configure the compilation of the RTEMS executive
7 * - specific instructions to configure the compilation of the RTEMS executive
8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
9 *
9 *
10 */
10 */
11
11
12 //*************************
12 //*************************
13 // GPL reminder to be added
13 // GPL reminder to be added
14 //*************************
14 //*************************
15
15
16 #include <rtems.h>
16 #include <rtems.h>
17
17
18 /* configuration information */
18 /* configuration information */
19
19
20 #define CONFIGURE_INIT
20 #define CONFIGURE_INIT
21
21
22 #include <bsp.h> /* for device driver prototypes */
22 #include <bsp.h> /* for device driver prototypes */
23
23
24 /* configuration information */
24 /* configuration information */
25
25
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
28
28
29 #define CONFIGURE_MAXIMUM_TASKS 20
29 #define CONFIGURE_MAXIMUM_TASKS 20
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
35 #define CONFIGURE_MAXIMUM_DRIVERS 16
35 #define CONFIGURE_MAXIMUM_DRIVERS 16
36 #define CONFIGURE_MAXIMUM_PERIODS 5
36 #define CONFIGURE_MAXIMUM_PERIODS 5
37 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
37 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
38 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2
38 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2
39 #ifdef PRINT_STACK_REPORT
39 #ifdef PRINT_STACK_REPORT
40 #define CONFIGURE_STACK_CHECKER_ENABLED
40 #define CONFIGURE_STACK_CHECKER_ENABLED
41 #endif
41 #endif
42
42
43 #include <rtems/confdefs.h>
43 #include <rtems/confdefs.h>
44
44
45 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
45 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
46 #ifdef RTEMS_DRVMGR_STARTUP
46 #ifdef RTEMS_DRVMGR_STARTUP
47 #ifdef LEON3
47 #ifdef LEON3
48 /* Add Timer and UART Driver */
48 /* Add Timer and UART Driver */
49 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
49 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
50 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
50 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
51 #endif
51 #endif
52 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
52 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
53 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
53 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
54 #endif
54 #endif
55 #endif
55 #endif
56 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
56 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
57 #include <drvmgr/drvmgr_confdefs.h>
57 #include <drvmgr/drvmgr_confdefs.h>
58 #endif
58 #endif
59
59
60 #include "fsw_init.h"
60 #include "fsw_init.h"
61 #include "fsw_config.c"
61 #include "fsw_config.c"
62
62
63 rtems_task Init( rtems_task_argument ignored )
63 rtems_task Init( rtems_task_argument ignored )
64 {
64 {
65 /** This is the RTEMS INIT taks, it the first task launched by the system.
65 /** This is the RTEMS INIT taks, it the first task launched by the system.
66 *
66 *
67 * @param unused is the starting argument of the RTEMS task
67 * @param unused is the starting argument of the RTEMS task
68 *
68 *
69 * The INIT task create and run all other RTEMS tasks.
69 * The INIT task create and run all other RTEMS tasks.
70 *
70 *
71 */
71 */
72
72
73
73
74 rtems_status_code status;
74 rtems_status_code status;
75 rtems_status_code status_spw;
75 rtems_status_code status_spw;
76 rtems_isr_entry old_isr_handler;
76 rtems_isr_entry old_isr_handler;
77
77
78 BOOT_PRINTF("\n\n\n\n\n")
78 BOOT_PRINTF("\n\n\n\n\n")
79 BOOT_PRINTF("***************************\n")
79 BOOT_PRINTF("***************************\n")
80 BOOT_PRINTF("** START Flight Software **\n")
80 BOOT_PRINTF("** START Flight Software **\n")
81 BOOT_PRINTF("***************************\n")
81 BOOT_PRINTF("***************************\n")
82 BOOT_PRINTF("\n\n")
82 BOOT_PRINTF("\n\n")
83
83
84 //send_console_outputs_on_apbuart_port();
84 //send_console_outputs_on_apbuart_port();
85 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
85 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
86
86
87 reset_wfp_burst_enable(); // stop the waveform picker if it was running
87 reset_wfp_burst_enable(); // stop the waveform picker if it was running
88
88
89 init_parameter_dump();
89 init_parameter_dump();
90 init_local_mode_parameters();
90 init_local_mode_parameters();
91 init_housekeeping_parameters();
91 init_housekeeping_parameters();
92
92
93 updateLFRCurrentMode();
93 updateLFRCurrentMode();
94
94
95 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
95 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
96
96
97 create_names(); // create all names
97 create_names(); // create all names
98
98
99 status = create_message_queues(); // create message queues
99 status = create_message_queues(); // create message queues
100 if (status != RTEMS_SUCCESSFUL)
100 if (status != RTEMS_SUCCESSFUL)
101 {
101 {
102 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
102 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
103 }
103 }
104
104
105 status = create_all_tasks(); // create all tasks
105 status = create_all_tasks(); // create all tasks
106 if (status != RTEMS_SUCCESSFUL)
106 if (status != RTEMS_SUCCESSFUL)
107 {
107 {
108 PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status)
108 PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status)
109 }
109 }
110
110
111 // **************************
111 // **************************
112 // <SPACEWIRE INITIALIZATION>
112 // <SPACEWIRE INITIALIZATION>
113 grspw_timecode_callback = &timecode_irq_handler;
113 grspw_timecode_callback = &timecode_irq_handler;
114
114
115 status_spw = spacewire_open_link(); // (1) open the link
115 status_spw = spacewire_open_link(); // (1) open the link
116 if ( status_spw != RTEMS_SUCCESSFUL )
116 if ( status_spw != RTEMS_SUCCESSFUL )
117 {
117 {
118 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
118 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
119 }
119 }
120
120
121 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
121 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
122 {
122 {
123 status_spw = spacewire_configure_link( fdSPW );
123 status_spw = spacewire_configure_link( fdSPW );
124 if ( status_spw != RTEMS_SUCCESSFUL )
124 if ( status_spw != RTEMS_SUCCESSFUL )
125 {
125 {
126 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
126 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
127 }
127 }
128 }
128 }
129
129
130 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
130 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
131 {
131 {
132 status_spw = spacewire_start_link( fdSPW );
132 status_spw = spacewire_start_link( fdSPW );
133 if ( status_spw != RTEMS_SUCCESSFUL )
133 if ( status_spw != RTEMS_SUCCESSFUL )
134 {
134 {
135 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
135 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
136 }
136 }
137 }
137 }
138 // </SPACEWIRE INITIALIZATION>
138 // </SPACEWIRE INITIALIZATION>
139 // ***************************
139 // ***************************
140
140
141 status = start_all_tasks(); // start all tasks
141 status = start_all_tasks(); // start all tasks
142 if (status != RTEMS_SUCCESSFUL)
142 if (status != RTEMS_SUCCESSFUL)
143 {
143 {
144 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
144 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
145 }
145 }
146
146
147 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
147 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
148 status = start_recv_send_tasks();
148 status = start_recv_send_tasks();
149 if ( status != RTEMS_SUCCESSFUL )
149 if ( status != RTEMS_SUCCESSFUL )
150 {
150 {
151 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
151 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
152 }
152 }
153
153
154 // suspend science tasks. they will be restarted later depending on the mode
154 // suspend science tasks. they will be restarted later depending on the mode
155 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
155 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
156 if (status != RTEMS_SUCCESSFUL)
156 if (status != RTEMS_SUCCESSFUL)
157 {
157 {
158 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
158 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
159 }
159 }
160
160
161 #ifdef GSA
161 #ifdef GSA
162 // mask IRQ lines
162 // mask IRQ lines
163 LEON_Mask_interrupt( IRQ_SM );
163 LEON_Mask_interrupt( IRQ_SM );
164 LEON_Mask_interrupt( IRQ_WF );
164 LEON_Mask_interrupt( IRQ_WF );
165 // Spectral Matrices simulator
165 // Spectral Matrices simulator
166 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
166 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
167 IRQ_SPARC_SM, spectral_matrices_isr );
167 IRQ_SPARC_SM, spectral_matrices_isr );
168 // WaveForms
168 // WaveForms
169 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR,
169 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR,
170 IRQ_SPARC_WF, waveforms_simulator_isr );
170 IRQ_SPARC_WF, waveforms_simulator_isr );
171 #else
171 #else
172 // configure IRQ handling for the waveform picker unit
172 // configure IRQ handling for the waveform picker unit
173 status = rtems_interrupt_catch( waveforms_isr,
173 status = rtems_interrupt_catch( waveforms_isr,
174 IRQ_SPARC_WAVEFORM_PICKER,
174 IRQ_SPARC_WAVEFORM_PICKER,
175 &old_isr_handler) ;
175 &old_isr_handler) ;
176 #endif
176 #endif
177
177
178 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
178 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
179 if ( status_spw != RTEMS_SUCCESSFUL )
179 if ( status_spw != RTEMS_SUCCESSFUL )
180 {
180 {
181 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
181 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
182 if ( status != RTEMS_SUCCESSFUL ) {
182 if ( status != RTEMS_SUCCESSFUL ) {
183 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
183 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
184 }
184 }
185 }
185 }
186
186
187 BOOT_PRINTF("delete INIT\n")
187 BOOT_PRINTF("delete INIT\n")
188
188
189 status = rtems_task_delete(RTEMS_SELF);
189 status = rtems_task_delete(RTEMS_SELF);
190
190
191 }
191 }
192
192
193 void init_local_mode_parameters( void )
193 void init_local_mode_parameters( void )
194 {
194 {
195 /** This function initialize the param_local global variable with default values.
195 /** This function initialize the param_local global variable with default values.
196 *
196 *
197 */
197 */
198
198
199 unsigned int i;
199 unsigned int i;
200 unsigned int j;
201 unsigned int k;
202
200
203 // LOCAL PARAMETERS
201 // LOCAL PARAMETERS
204 set_local_sbm1_nb_cwf_max();
202 set_local_sbm1_nb_cwf_max();
205 set_local_sbm2_nb_cwf_max();
203 set_local_sbm2_nb_cwf_max();
206 set_local_nb_interrupt_f0_MAX();
204 set_local_nb_interrupt_f0_MAX();
207
205
208 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
206 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
209 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
207 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
210 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
208 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
211
209
212 reset_local_sbm1_nb_cwf_sent();
210 reset_local_sbm1_nb_cwf_sent();
213 reset_local_sbm2_nb_cwf_sent();
211 reset_local_sbm2_nb_cwf_sent();
214
212
215 // init sequence counters
213 // init sequence counters
216 for (i = 0; i<SEQ_CNT_NB_PID; i++)
214
215 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
217 {
216 {
218 for(j = 0; j<SEQ_CNT_NB_CAT; j++)
217 sequenceCounters_TC_EXE[i] = 0x00;
219 {
220 for(k = 0; k<SEQ_CNT_NB_DEST_ID; k++)
221 {
222 sequenceCounters[i][j][k] = 0x00;
223 }
224 }
225 }
218 }
219 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
220 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
226 }
221 }
227
222
228 void create_names( void ) // create all names for tasks and queues
223 void create_names( void ) // create all names for tasks and queues
229 {
224 {
230 /** 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.
231 *
226 *
232 * @return RTEMS directive status codes:
227 * @return RTEMS directive status codes:
233 * - RTEMS_SUCCESSFUL - successful completion
228 * - RTEMS_SUCCESSFUL - successful completion
234 *
229 *
235 */
230 */
236
231
237 // task names
232 // task names
238 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
233 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
239 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
234 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
240 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
235 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
241 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
236 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
242 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
237 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
243 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
238 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
244 Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' );
239 Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' );
245 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
240 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
246 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
241 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
247 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
242 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
248 Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' );
243 Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' );
249 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
244 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
250 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
245 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
251 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
246 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
252 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
247 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
253 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
248 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
254
249
255 // rate monotonic period names
250 // rate monotonic period names
256 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
251 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
257
252
258 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
253 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
259 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
254 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
260 }
255 }
261
256
262 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
263 {
258 {
264 /** This function creates all RTEMS tasks used in the software.
259 /** This function creates all RTEMS tasks used in the software.
265 *
260 *
266 * @return RTEMS directive status codes:
261 * @return RTEMS directive status codes:
267 * - RTEMS_SUCCESSFUL - task created successfully
262 * - RTEMS_SUCCESSFUL - task created successfully
268 * - RTEMS_INVALID_ADDRESS - id is NULL
263 * - RTEMS_INVALID_ADDRESS - id is NULL
269 * - RTEMS_INVALID_NAME - invalid task name
264 * - RTEMS_INVALID_NAME - invalid task name
270 * - RTEMS_INVALID_PRIORITY - invalid task priority
265 * - RTEMS_INVALID_PRIORITY - invalid task priority
271 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
266 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
272 * - RTEMS_TOO_MANY - too many tasks created
267 * - RTEMS_TOO_MANY - too many tasks created
273 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
268 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
274 * - RTEMS_TOO_MANY - too many global objects
269 * - RTEMS_TOO_MANY - too many global objects
275 *
270 *
276 */
271 */
277
272
278 rtems_status_code status;
273 rtems_status_code status;
279
274
280 // RECV
275 // RECV
281 status = rtems_task_create(
276 status = rtems_task_create(
282 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
277 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
283 RTEMS_DEFAULT_MODES,
278 RTEMS_DEFAULT_MODES,
284 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
279 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
285 );
280 );
286
281
287 if (status == RTEMS_SUCCESSFUL) // ACTN
282 if (status == RTEMS_SUCCESSFUL) // ACTN
288 {
283 {
289 status = rtems_task_create(
284 status = rtems_task_create(
290 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
285 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
291 RTEMS_DEFAULT_MODES,
286 RTEMS_DEFAULT_MODES,
292 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
287 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
293 );
288 );
294 }
289 }
295 if (status == RTEMS_SUCCESSFUL) // SPIQ
290 if (status == RTEMS_SUCCESSFUL) // SPIQ
296 {
291 {
297 status = rtems_task_create(
292 status = rtems_task_create(
298 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
293 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
299 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
294 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
300 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
295 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
301 );
296 );
302 }
297 }
303 if (status == RTEMS_SUCCESSFUL) // SMIQ
298 if (status == RTEMS_SUCCESSFUL) // SMIQ
304 {
299 {
305 status = rtems_task_create(
300 status = rtems_task_create(
306 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE,
301 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE,
307 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
302 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
308 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
303 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
309 );
304 );
310 }
305 }
311 if (status == RTEMS_SUCCESSFUL) // STAT
306 if (status == RTEMS_SUCCESSFUL) // STAT
312 {
307 {
313 status = rtems_task_create(
308 status = rtems_task_create(
314 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
309 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
315 RTEMS_DEFAULT_MODES,
310 RTEMS_DEFAULT_MODES,
316 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
311 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
317 );
312 );
318 }
313 }
319 if (status == RTEMS_SUCCESSFUL) // AVF0
314 if (status == RTEMS_SUCCESSFUL) // AVF0
320 {
315 {
321 status = rtems_task_create(
316 status = rtems_task_create(
322 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
317 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
323 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
318 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
324 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
319 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
325 );
320 );
326 }
321 }
327 if (status == RTEMS_SUCCESSFUL) // BPF0
322 if (status == RTEMS_SUCCESSFUL) // BPF0
328 {
323 {
329 status = rtems_task_create(
324 status = rtems_task_create(
330 Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE,
325 Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE,
331 RTEMS_DEFAULT_MODES,
326 RTEMS_DEFAULT_MODES,
332 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0]
327 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0]
333 );
328 );
334 }
329 }
335 if (status == RTEMS_SUCCESSFUL) // WFRM
330 if (status == RTEMS_SUCCESSFUL) // WFRM
336 {
331 {
337 status = rtems_task_create(
332 status = rtems_task_create(
338 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
333 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
339 RTEMS_DEFAULT_MODES,
334 RTEMS_DEFAULT_MODES,
340 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
335 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
341 );
336 );
342 }
337 }
343 if (status == RTEMS_SUCCESSFUL) // DUMB
338 if (status == RTEMS_SUCCESSFUL) // DUMB
344 {
339 {
345 status = rtems_task_create(
340 status = rtems_task_create(
346 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
341 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
347 RTEMS_DEFAULT_MODES,
342 RTEMS_DEFAULT_MODES,
348 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
343 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
349 );
344 );
350 }
345 }
351 if (status == RTEMS_SUCCESSFUL) // HOUS
346 if (status == RTEMS_SUCCESSFUL) // HOUS
352 {
347 {
353 status = rtems_task_create(
348 status = rtems_task_create(
354 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
349 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
355 RTEMS_DEFAULT_MODES,
350 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
356 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
351 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
357 );
352 );
358 }
353 }
359 if (status == RTEMS_SUCCESSFUL) // MATR
354 if (status == RTEMS_SUCCESSFUL) // MATR
360 {
355 {
361 status = rtems_task_create(
356 status = rtems_task_create(
362 Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE,
357 Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE,
363 RTEMS_DEFAULT_MODES,
358 RTEMS_DEFAULT_MODES,
364 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR]
359 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR]
365 );
360 );
366 }
361 }
367 if (status == RTEMS_SUCCESSFUL) // CWF3
362 if (status == RTEMS_SUCCESSFUL) // CWF3
368 {
363 {
369 status = rtems_task_create(
364 status = rtems_task_create(
370 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
365 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
371 RTEMS_DEFAULT_MODES,
366 RTEMS_DEFAULT_MODES,
372 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3]
367 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3]
373 );
368 );
374 }
369 }
375 if (status == RTEMS_SUCCESSFUL) // CWF2
370 if (status == RTEMS_SUCCESSFUL) // CWF2
376 {
371 {
377 status = rtems_task_create(
372 status = rtems_task_create(
378 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
373 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
379 RTEMS_DEFAULT_MODES,
374 RTEMS_DEFAULT_MODES,
380 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2]
375 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2]
381 );
376 );
382 }
377 }
383 if (status == RTEMS_SUCCESSFUL) // CWF1
378 if (status == RTEMS_SUCCESSFUL) // CWF1
384 {
379 {
385 status = rtems_task_create(
380 status = rtems_task_create(
386 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
381 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
387 RTEMS_DEFAULT_MODES,
382 RTEMS_DEFAULT_MODES,
388 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1]
383 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1]
389 );
384 );
390 }
385 }
391 if (status == RTEMS_SUCCESSFUL) // SEND
386 if (status == RTEMS_SUCCESSFUL) // SEND
392 {
387 {
393 status = rtems_task_create(
388 status = rtems_task_create(
394 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
389 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
395 RTEMS_DEFAULT_MODES,
390 RTEMS_DEFAULT_MODES,
396 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
391 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
397 );
392 );
398 }
393 }
399 if (status == RTEMS_SUCCESSFUL) // WTDG
394 if (status == RTEMS_SUCCESSFUL) // WTDG
400 {
395 {
401 status = rtems_task_create(
396 status = rtems_task_create(
402 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
397 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
403 RTEMS_DEFAULT_MODES,
398 RTEMS_DEFAULT_MODES,
404 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
399 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
405 );
400 );
406 }
401 }
407
402
408 return status;
403 return status;
409 }
404 }
410
405
411 int start_recv_send_tasks( void )
406 int start_recv_send_tasks( void )
412 {
407 {
413 rtems_status_code status;
408 rtems_status_code status;
414
409
415 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
410 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
416 if (status!=RTEMS_SUCCESSFUL) {
411 if (status!=RTEMS_SUCCESSFUL) {
417 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
412 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
418 }
413 }
419
414
420 if (status == RTEMS_SUCCESSFUL) // SEND
415 if (status == RTEMS_SUCCESSFUL) // SEND
421 {
416 {
422 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
417 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
423 if (status!=RTEMS_SUCCESSFUL) {
418 if (status!=RTEMS_SUCCESSFUL) {
424 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
419 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
425 }
420 }
426 }
421 }
427
422
428 return status;
423 return status;
429 }
424 }
430
425
431 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
432 {
427 {
433 /** This function starts all RTEMS tasks used in the software.
428 /** This function starts all RTEMS tasks used in the software.
434 *
429 *
435 * @return RTEMS directive status codes:
430 * @return RTEMS directive status codes:
436 * - RTEMS_SUCCESSFUL - ask started successfully
431 * - RTEMS_SUCCESSFUL - ask started successfully
437 * - RTEMS_INVALID_ADDRESS - invalid task entry point
432 * - RTEMS_INVALID_ADDRESS - invalid task entry point
438 * - RTEMS_INVALID_ID - invalid task id
433 * - RTEMS_INVALID_ID - invalid task id
439 * - RTEMS_INCORRECT_STATE - task not in the dormant state
434 * - RTEMS_INCORRECT_STATE - task not in the dormant state
440 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
435 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
441 *
436 *
442 */
437 */
443 // starts all the tasks fot eh flight software
438 // starts all the tasks fot eh flight software
444
439
445 rtems_status_code status;
440 rtems_status_code status;
446
441
447 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
442 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
448 if (status!=RTEMS_SUCCESSFUL) {
443 if (status!=RTEMS_SUCCESSFUL) {
449 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
444 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
450 }
445 }
451
446
452 if (status == RTEMS_SUCCESSFUL) // WTDG
447 if (status == RTEMS_SUCCESSFUL) // WTDG
453 {
448 {
454 status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 );
449 status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 );
455 if (status!=RTEMS_SUCCESSFUL) {
450 if (status!=RTEMS_SUCCESSFUL) {
456 BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n")
451 BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n")
457 }
452 }
458 }
453 }
459
454
460 if (status == RTEMS_SUCCESSFUL) // SMIQ
455 if (status == RTEMS_SUCCESSFUL) // SMIQ
461 {
456 {
462 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
457 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
463 if (status!=RTEMS_SUCCESSFUL) {
458 if (status!=RTEMS_SUCCESSFUL) {
464 BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n")
459 BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n")
465 }
460 }
466 }
461 }
467
462
468 if (status == RTEMS_SUCCESSFUL) // ACTN
463 if (status == RTEMS_SUCCESSFUL) // ACTN
469 {
464 {
470 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
465 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
471 if (status!=RTEMS_SUCCESSFUL) {
466 if (status!=RTEMS_SUCCESSFUL) {
472 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
467 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
473 }
468 }
474 }
469 }
475
470
476 if (status == RTEMS_SUCCESSFUL) // STAT
471 if (status == RTEMS_SUCCESSFUL) // STAT
477 {
472 {
478 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
473 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
479 if (status!=RTEMS_SUCCESSFUL) {
474 if (status!=RTEMS_SUCCESSFUL) {
480 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
475 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
481 }
476 }
482 }
477 }
483
478
484 if (status == RTEMS_SUCCESSFUL) // AVF0
479 if (status == RTEMS_SUCCESSFUL) // AVF0
485 {
480 {
486 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
481 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
487 if (status!=RTEMS_SUCCESSFUL) {
482 if (status!=RTEMS_SUCCESSFUL) {
488 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
483 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
489 }
484 }
490 }
485 }
491
486
492 if (status == RTEMS_SUCCESSFUL) // BPF0
487 if (status == RTEMS_SUCCESSFUL) // BPF0
493 {
488 {
494 status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 );
489 status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 );
495 if (status!=RTEMS_SUCCESSFUL) {
490 if (status!=RTEMS_SUCCESSFUL) {
496 BOOT_PRINTF("in INIT *** Error starting TASK_BPF0\n")
491 BOOT_PRINTF("in INIT *** Error starting TASK_BPF0\n")
497 }
492 }
498 }
493 }
499
494
500 if (status == RTEMS_SUCCESSFUL) // WFRM
495 if (status == RTEMS_SUCCESSFUL) // WFRM
501 {
496 {
502 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
497 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
503 if (status!=RTEMS_SUCCESSFUL) {
498 if (status!=RTEMS_SUCCESSFUL) {
504 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
499 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
505 }
500 }
506 }
501 }
507
502
508 if (status == RTEMS_SUCCESSFUL) // DUMB
503 if (status == RTEMS_SUCCESSFUL) // DUMB
509 {
504 {
510 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
505 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
511 if (status!=RTEMS_SUCCESSFUL) {
506 if (status!=RTEMS_SUCCESSFUL) {
512 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
507 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
513 }
508 }
514 }
509 }
515
510
516 if (status == RTEMS_SUCCESSFUL) // HOUS
511 if (status == RTEMS_SUCCESSFUL) // HOUS
517 {
512 {
518 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
513 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
519 if (status!=RTEMS_SUCCESSFUL) {
514 if (status!=RTEMS_SUCCESSFUL) {
520 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
515 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
521 }
516 }
522 }
517 }
523
518
524 if (status == RTEMS_SUCCESSFUL) // MATR
519 if (status == RTEMS_SUCCESSFUL) // MATR
525 {
520 {
526 status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 );
521 status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 );
527 if (status!=RTEMS_SUCCESSFUL) {
522 if (status!=RTEMS_SUCCESSFUL) {
528 BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n")
523 BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n")
529 }
524 }
530 }
525 }
531
526
532 if (status == RTEMS_SUCCESSFUL) // CWF3
527 if (status == RTEMS_SUCCESSFUL) // CWF3
533 {
528 {
534 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
529 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
535 if (status!=RTEMS_SUCCESSFUL) {
530 if (status!=RTEMS_SUCCESSFUL) {
536 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
531 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
537 }
532 }
538 }
533 }
539
534
540 if (status == RTEMS_SUCCESSFUL) // CWF2
535 if (status == RTEMS_SUCCESSFUL) // CWF2
541 {
536 {
542 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
537 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
543 if (status!=RTEMS_SUCCESSFUL) {
538 if (status!=RTEMS_SUCCESSFUL) {
544 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
539 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
545 }
540 }
546 }
541 }
547
542
548 if (status == RTEMS_SUCCESSFUL) // CWF1
543 if (status == RTEMS_SUCCESSFUL) // CWF1
549 {
544 {
550 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
545 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
551 if (status!=RTEMS_SUCCESSFUL) {
546 if (status!=RTEMS_SUCCESSFUL) {
552 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
547 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
553 }
548 }
554 }
549 }
555 return status;
550 return status;
556 }
551 }
557
552
558 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
559 {
554 {
560 rtems_status_code status_recv;
555 rtems_status_code status_recv;
561 rtems_status_code status_send;
556 rtems_status_code status_send;
562 rtems_status_code ret;
557 rtems_status_code ret;
563 rtems_id queue_id;
558 rtems_id queue_id;
564
559
565 // create the queue for handling valid TCs
560 // create the queue for handling valid TCs
566 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
561 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
567 ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE,
562 ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE,
568 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
563 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
569 if ( status_recv != RTEMS_SUCCESSFUL ) {
564 if ( status_recv != RTEMS_SUCCESSFUL ) {
570 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)
571 }
566 }
572
567
573 // create the queue for handling TM packet sending
568 // create the queue for handling TM packet sending
574 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
569 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
575 ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE,
570 ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE,
576 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
571 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
577 if ( status_send != RTEMS_SUCCESSFUL ) {
572 if ( status_send != RTEMS_SUCCESSFUL ) {
578 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)
579 }
574 }
580
575
581 if ( status_recv != RTEMS_SUCCESSFUL )
576 if ( status_recv != RTEMS_SUCCESSFUL )
582 {
577 {
583 ret = status_recv;
578 ret = status_recv;
584 }
579 }
585 else
580 else
586 {
581 {
587 ret = status_send;
582 ret = status_send;
588 }
583 }
589
584
590 return ret;
585 return ret;
591 }
586 }
592
@@ -1,295 +1,325
1 /** General usage functions and RTEMS tasks.
1 /** General usage functions and RTEMS tasks.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 */
6 */
7
7
8 #include "fsw_misc.h"
8 #include "fsw_misc.h"
9
9
10 char *DumbMessages[7] = {"in DUMB *** default", // RTEMS_EVENT_0
10 char *DumbMessages[7] = {"in DUMB *** default", // RTEMS_EVENT_0
11 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
11 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
12 "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
12 "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
13 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
13 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
14 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
14 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
15 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
15 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
16 "ERR HK" // RTEMS_EVENT_6
16 "ERR HK" // RTEMS_EVENT_6
17 };
17 };
18
18
19 int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
19 int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
20 unsigned char interrupt_level, rtems_isr (*timer_isr)() )
20 unsigned char interrupt_level, rtems_isr (*timer_isr)() )
21 {
21 {
22 /** This function configures a GPTIMER timer instantiated in the VHDL design.
22 /** This function configures a GPTIMER timer instantiated in the VHDL design.
23 *
23 *
24 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
24 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
25 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
25 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
26 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
26 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
27 * @param interrupt_level is the interrupt level that the timer drives.
27 * @param interrupt_level is the interrupt level that the timer drives.
28 * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer.
28 * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer.
29 *
29 *
30 * @return
30 * @return
31 *
31 *
32 * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76
32 * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76
33 *
33 *
34 */
34 */
35
35
36 rtems_status_code status;
36 rtems_status_code status;
37 rtems_isr_entry old_isr_handler;
37 rtems_isr_entry old_isr_handler;
38
38
39 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
39 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
40 if (status!=RTEMS_SUCCESSFUL)
40 if (status!=RTEMS_SUCCESSFUL)
41 {
41 {
42 PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n")
42 PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n")
43 }
43 }
44
44
45 timer_set_clock_divider( gptimer_regs, timer, clock_divider);
45 timer_set_clock_divider( gptimer_regs, timer, clock_divider);
46
46
47 return 1;
47 return 1;
48 }
48 }
49
49
50 int timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer)
50 int timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer)
51 {
51 {
52 /** This function starts a GPTIMER timer.
52 /** This function starts a GPTIMER timer.
53 *
53 *
54 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
54 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
55 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
55 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
56 *
56 *
57 * @return 1
57 * @return 1
58 *
58 *
59 */
59 */
60
60
61 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
61 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
62 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register
62 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register
63 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer
63 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer
64 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart
64 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart
65 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable
65 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable
66
66
67 return 1;
67 return 1;
68 }
68 }
69
69
70 int timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer)
70 int timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer)
71 {
71 {
72 /** This function stops a GPTIMER timer.
72 /** This function stops a GPTIMER timer.
73 *
73 *
74 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
74 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
75 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
75 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
76 *
76 *
77 * @return 1
77 * @return 1
78 *
78 *
79 */
79 */
80
80
81 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer
81 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer
82 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable
82 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable
83 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
83 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
84
84
85 return 1;
85 return 1;
86 }
86 }
87
87
88 int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider)
88 int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider)
89 {
89 {
90 /** This function sets the clock divider of a GPTIMER timer.
90 /** This function sets the clock divider of a GPTIMER timer.
91 *
91 *
92 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
92 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
93 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
93 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
94 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
94 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
95 *
95 *
96 * @return 1
96 * @return 1
97 *
97 *
98 */
98 */
99
99
100 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
100 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
101
101
102 return 1;
102 return 1;
103 }
103 }
104
104
105 int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port
105 int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port
106 {
106 {
107 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
107 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
108
108
109 apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB;
109 apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB;
110 PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
110 PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
111
111
112 return 0;
112 return 0;
113 }
113 }
114
114
115 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
115 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
116 {
116 {
117 /** This function sets the scaler reload register of the apbuart module
117 /** This function sets the scaler reload register of the apbuart module
118 *
118 *
119 * @param regs is the address of the apbuart registers in memory
119 * @param regs is the address of the apbuart registers in memory
120 * @param value is the value that will be stored in the scaler register
120 * @param value is the value that will be stored in the scaler register
121 *
121 *
122 * The value shall be set by the software to get data on the serial interface.
122 * The value shall be set by the software to get data on the serial interface.
123 *
123 *
124 */
124 */
125
125
126 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
126 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
127
127
128 apbuart_regs->scaler = value;
128 apbuart_regs->scaler = value;
129 BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value)
129 BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value)
130 }
130 }
131
131
132 //************
132 //************
133 // RTEMS TASKS
133 // RTEMS TASKS
134
134
135 rtems_task stat_task(rtems_task_argument argument)
135 rtems_task stat_task(rtems_task_argument argument)
136 {
136 {
137 int i;
137 int i;
138 int j;
138 int j;
139 i = 0;
139 i = 0;
140 j = 0;
140 j = 0;
141 BOOT_PRINTF("in STAT *** \n")
141 BOOT_PRINTF("in STAT *** \n")
142 while(1){
142 while(1){
143 rtems_task_wake_after(1000);
143 rtems_task_wake_after(1000);
144 PRINTF1("%d\n", j)
144 PRINTF1("%d\n", j)
145 if (i == CPU_USAGE_REPORT_PERIOD) {
145 if (i == CPU_USAGE_REPORT_PERIOD) {
146 // #ifdef PRINT_TASK_STATISTICS
146 // #ifdef PRINT_TASK_STATISTICS
147 // rtems_cpu_usage_report();
147 // rtems_cpu_usage_report();
148 // rtems_cpu_usage_reset();
148 // rtems_cpu_usage_reset();
149 // #endif
149 // #endif
150 i = 0;
150 i = 0;
151 }
151 }
152 else i++;
152 else i++;
153 j++;
153 j++;
154 }
154 }
155 }
155 }
156
156
157 rtems_task hous_task(rtems_task_argument argument)
157 rtems_task hous_task(rtems_task_argument argument)
158 {
158 {
159 rtems_status_code status;
159 rtems_status_code status;
160 rtems_id queue_id;
160 rtems_id queue_id;
161
161
162 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id );
162 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id );
163 if (status != RTEMS_SUCCESSFUL)
163 if (status != RTEMS_SUCCESSFUL)
164 {
164 {
165 PRINTF1("in HOUS *** ERR %d\n", status)
165 PRINTF1("in HOUS *** ERR %d\n", status)
166 }
166 }
167
167
168 BOOT_PRINTF("in HOUS ***\n")
168 BOOT_PRINTF("in HOUS ***\n")
169
169
170 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
170 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
171 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
171 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
172 if( status != RTEMS_SUCCESSFUL ) {
172 if( status != RTEMS_SUCCESSFUL ) {
173 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
173 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
174 }
174 }
175 }
175 }
176
176
177 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
177 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
178 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
178 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
179 housekeeping_packet.reserved = DEFAULT_RESERVED;
179 housekeeping_packet.reserved = DEFAULT_RESERVED;
180 housekeeping_packet.userApplication = CCSDS_USER_APP;
180 housekeeping_packet.userApplication = CCSDS_USER_APP;
181 housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8);
181 housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8);
182 housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK);
182 housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK);
183 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
183 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
184 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
184 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
185 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
185 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
186 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
186 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
187 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
187 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
188 housekeeping_packet.serviceType = TM_TYPE_HK;
188 housekeeping_packet.serviceType = TM_TYPE_HK;
189 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
189 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
190 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
190 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
191
191
192 status = rtems_rate_monotonic_cancel(HK_id);
192 status = rtems_rate_monotonic_cancel(HK_id);
193 if( status != RTEMS_SUCCESSFUL ) {
193 if( status != RTEMS_SUCCESSFUL ) {
194 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
194 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
195 }
195 }
196 else {
196 else {
197 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
197 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
198 }
198 }
199
199
200 while(1){ // launch the rate monotonic task
200 while(1){ // launch the rate monotonic task
201 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
201 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
202 if ( status != RTEMS_SUCCESSFUL ) {
202 if ( status != RTEMS_SUCCESSFUL ) {
203 PRINTF1( "in HOUS *** ERR period: %d\n", status);
203 PRINTF1( "in HOUS *** ERR period: %d\n", status);
204 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
204 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
205 }
205 }
206 else {
206 else {
207 increment_seq_counter( housekeeping_packet.packetSequenceControl );
207 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
208 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
208 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
209 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
209 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
210 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
210 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
211 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
211 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
212 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
212 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
213 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
213 housekeeping_packet.sid = SID_HK;
214 housekeeping_packet.sid = SID_HK;
214
215
215 spacewire_update_statistics();
216 spacewire_update_statistics();
216
217
217 // SEND PACKET
218 // SEND PACKET
218 status = rtems_message_queue_urgent( queue_id, &housekeeping_packet,
219 status = rtems_message_queue_send( queue_id, &housekeeping_packet,
219 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
220 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
220 if (status != RTEMS_SUCCESSFUL) {
221 if (status != RTEMS_SUCCESSFUL) {
221 PRINTF1("in HOUS *** ERR send: %d\n", status)
222 PRINTF1("in HOUS *** ERR send: %d\n", status)
222 }
223 }
223 }
224 }
224 }
225 }
225
226
226 PRINTF("in HOUS *** deleting task\n")
227 PRINTF("in HOUS *** deleting task\n")
227
228
228 status = rtems_task_delete( RTEMS_SELF ); // should not return
229 status = rtems_task_delete( RTEMS_SELF ); // should not return
229 printf( "rtems_task_delete returned with status of %d.\n", status );
230 printf( "rtems_task_delete returned with status of %d.\n", status );
230 return;
231 return;
231 }
232 }
232
233
233 rtems_task dumb_task( rtems_task_argument unused )
234 rtems_task dumb_task( rtems_task_argument unused )
234 {
235 {
235 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
236 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
236 *
237 *
237 * @param unused is the starting argument of the RTEMS task
238 * @param unused is the starting argument of the RTEMS task
238 *
239 *
239 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
240 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
240 *
241 *
241 */
242 */
242
243
243 unsigned int i;
244 unsigned int i;
244 unsigned int intEventOut;
245 unsigned int intEventOut;
245 unsigned int coarse_time = 0;
246 unsigned int coarse_time = 0;
246 unsigned int fine_time = 0;
247 unsigned int fine_time = 0;
247 rtems_event_set event_out;
248 rtems_event_set event_out;
248
249
249 BOOT_PRINTF("in DUMB *** \n")
250 BOOT_PRINTF("in DUMB *** \n")
250
251
251 while(1){
252 while(1){
252 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
253 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
253 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6,
254 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6,
254 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
255 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
255 intEventOut = (unsigned int) event_out;
256 intEventOut = (unsigned int) event_out;
256 for ( i=0; i<32; i++)
257 for ( i=0; i<32; i++)
257 {
258 {
258 if ( ((intEventOut >> i) & 0x0001) != 0)
259 if ( ((intEventOut >> i) & 0x0001) != 0)
259 {
260 {
260 coarse_time = time_management_regs->coarse_time;
261 coarse_time = time_management_regs->coarse_time;
261 fine_time = time_management_regs->fine_time;
262 fine_time = time_management_regs->fine_time;
262 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
263 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
263 }
264 }
264 }
265 }
265 }
266 }
266 }
267 }
267
268
268 //*****************************
269 //*****************************
269 // init housekeeping parameters
270 // init housekeeping parameters
270
271
271 void init_housekeeping_parameters( void )
272 void init_housekeeping_parameters( void )
272 {
273 {
273 /** This function initialize the housekeeping_packet global variable with default values.
274 /** This function initialize the housekeeping_packet global variable with default values.
274 *
275 *
275 */
276 */
276
277
277 unsigned int i = 0;
278 unsigned int i = 0;
278 char *parameters;
279 char *parameters;
279
280
280 parameters = (char*) &housekeeping_packet.lfr_status_word;
281 parameters = (char*) &housekeeping_packet.lfr_status_word;
281 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
282 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
282 {
283 {
283 parameters[i] = 0x00;
284 parameters[i] = 0x00;
284 }
285 }
285 // init status word
286 // init status word
286 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
287 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
287 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
288 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
288 // init software version
289 // init software version
289 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
290 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
290 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
291 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
291 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
292 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
292 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
293 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
293
294
294 }
295 }
295
296
297 void increment_seq_counter( unsigned char *packet_sequence_control)
298 {
299 unsigned short sequence_cnt;
300 unsigned short segmentation_grouping_flag;
301 unsigned short new_packet_sequence_control;
302
303 segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6
304 sequence_cnt = (unsigned short) (
305 ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0
306 + packet_sequence_control[1]
307 );
308
309 if ( sequence_cnt < SEQ_CNT_MAX)
310 {
311 sequence_cnt = sequence_cnt + 1;
312 }
313 else
314 {
315 sequence_cnt = 0;
316 }
317
318 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
319
320 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
321 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
322 }
323
324
325
@@ -1,678 +1,677
1 /** Functions related to data processing.
1 /** Functions related to data processing.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
7 *
7 *
8 */
8 */
9
9
10 #include <fsw_processing.h>
10 #include <fsw_processing.h>
11 #include <math.h>
12
11
13 #include "fsw_processing_globals.c"
12 #include "fsw_processing_globals.c"
14
13
15 unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_SM_F0 * 9 ];
14 unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_SM_F0 * 9 ];
16 BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ];
15 BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ];
17 float averaged_spec_mat_f0[ TOTAL_SIZE_SM ];
16 float averaged_spec_mat_f0[ TOTAL_SIZE_SM ];
18 char averaged_spec_mat_f0_char[ TOTAL_SIZE_SM * 2 ];
17 char averaged_spec_mat_f0_char[ TOTAL_SIZE_SM * 2 ];
19 float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
18 float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
20
19
21 //***********************************************************
20 //***********************************************************
22 // Interrupt Service Routine for spectral matrices processing
21 // Interrupt Service Routine for spectral matrices processing
23 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
22 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
24 {
23 {
25 unsigned char status;
24 unsigned char status;
26 unsigned char i;
25 unsigned char i;
27
26
28 status = spectral_matrix_regs->status; //[f2 f1 f0_1 f0_0]
27 status = spectral_matrix_regs->status; //[f2 f1 f0_1 f0_0]
29 for (i=0; i<4; i++)
28 for (i=0; i<4; i++)
30 {
29 {
31 if ( ( (status >> i) & 0x01) == 1) // (1) buffer rotation
30 if ( ( (status >> i) & 0x01) == 1) // (1) buffer rotation
32 {
31 {
33 switch(i)
32 switch(i)
34 {
33 {
35 case 0:
34 case 0:
36 if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0)
35 if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0)
37 {
36 {
38 spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0_bis;
37 spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0_bis;
39 }
38 }
40 else
39 else
41 {
40 {
42 spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0;
41 spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0;
43 }
42 }
44 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe;
43 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe;
45 break;
44 break;
46 case 1:
45 case 1:
47 if (spectral_matrix_regs->matrixFO_Address1 == (int) spec_mat_f0_1)
46 if (spectral_matrix_regs->matrixFO_Address1 == (int) spec_mat_f0_1)
48 {
47 {
49 spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1_bis;
48 spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1_bis;
50 }
49 }
51 else
50 else
52 {
51 {
53 spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1;
52 spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1;
54 }
53 }
55 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd;
54 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd;
56 break;
55 break;
57 case 2:
56 case 2:
58 if (spectral_matrix_regs->matrixF1_Address == (int) spec_mat_f1)
57 if (spectral_matrix_regs->matrixF1_Address == (int) spec_mat_f1)
59 {
58 {
60 spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1_bis;
59 spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1_bis;
61 }
60 }
62 else
61 else
63 {
62 {
64 spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1;
63 spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1;
65 }
64 }
66 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffb;
65 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffb;
67 break;
66 break;
68 case 3:
67 case 3:
69 if (spectral_matrix_regs->matrixF2_Address == (int) spec_mat_f2)
68 if (spectral_matrix_regs->matrixF2_Address == (int) spec_mat_f2)
70 {
69 {
71 spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2_bis;
70 spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2_bis;
72 }
71 }
73 else
72 else
74 {
73 {
75 spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2;
74 spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2;
76 }
75 }
77 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff7;
76 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff7;
78 break;
77 break;
79 default:
78 default:
80 break;
79 break;
81 }
80 }
82 }
81 }
83 }
82 }
84
83
85 // reset error codes to 0
84 // reset error codes to 0
86 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // [1100 1111]
85 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // [1100 1111]
87
86
88 if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
87 if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
89 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 );
88 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 );
90 }
89 }
91 }
90 }
92
91
93 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
92 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
94 {
93 {
95 if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
94 if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
96 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 );
95 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 );
97 }
96 }
98 }
97 }
99
98
100 //************
99 //************
101 // RTEMS TASKS
100 // RTEMS TASKS
102
101
103 rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ
102 rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ
104 {
103 {
105 rtems_event_set event_out;
104 rtems_event_set event_out;
106 unsigned int nb_interrupt_f0 = 0;
105 unsigned int nb_interrupt_f0 = 0;
107
106
108 BOOT_PRINTF("in SMIQ *** \n")
107 BOOT_PRINTF("in SMIQ *** \n")
109
108
110 while(1){
109 while(1){
111 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
110 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
112 nb_interrupt_f0 = nb_interrupt_f0 + 1;
111 nb_interrupt_f0 = nb_interrupt_f0 + 1;
113 if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){
112 if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){
114 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
113 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
115 {
114 {
116 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
115 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
117 }
116 }
118 nb_interrupt_f0 = 0;
117 nb_interrupt_f0 = 0;
119 }
118 }
120 }
119 }
121 }
120 }
122
121
123 //rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ
122 //rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ
124 //{
123 //{
125 // rtems_event_set event_out;
124 // rtems_event_set event_out;
126 // unsigned int nb_interrupt_f0 = 0;
125 // unsigned int nb_interrupt_f0 = 0;
127
126
128 // PRINTF("in SMIQ *** \n")
127 // PRINTF("in SMIQ *** \n")
129
128
130 // while(1){
129 // while(1){
131 // rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
130 // rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
132 // nb_interrupt_f0 = nb_interrupt_f0 + 1;
131 // nb_interrupt_f0 = nb_interrupt_f0 + 1;
133 // if (nb_interrupt_f0 == param_local.local_nb_interrupt_f0_MAX ){
132 // if (nb_interrupt_f0 == param_local.local_nb_interrupt_f0_MAX ){
134 // if (rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
133 // if (rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
135 // {
134 // {
136 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
135 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
137 // }
136 // }
138 // nb_interrupt_f0 = 0;
137 // nb_interrupt_f0 = 0;
139 // }
138 // }
140 // }
139 // }
141 //}
140 //}
142
141
143 rtems_task spw_bppr_task(rtems_task_argument argument)
142 rtems_task spw_bppr_task(rtems_task_argument argument)
144 {
143 {
145 rtems_status_code status;
144 rtems_status_code status;
146 rtems_event_set event_out;
145 rtems_event_set event_out;
147
146
148 BOOT_PRINTF("in BPPR ***\n");
147 BOOT_PRINTF("in BPPR ***\n");
149
148
150 while( true ){ // wait for an event to begin with the processing
149 while( true ){ // wait for an event to begin with the processing
151 status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out);
150 status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out);
152 }
151 }
153 }
152 }
154
153
155 rtems_task avf0_task(rtems_task_argument argument)
154 rtems_task avf0_task(rtems_task_argument argument)
156 {
155 {
157 int i;
156 int i;
158 static int nb_average;
157 static int nb_average;
159 rtems_event_set event_out;
158 rtems_event_set event_out;
160 rtems_status_code status;
159 rtems_status_code status;
161
160
162 nb_average = 0;
161 nb_average = 0;
163
162
164 BOOT_PRINTF("in AVFO *** \n")
163 BOOT_PRINTF("in AVFO *** \n")
165
164
166 while(1){
165 while(1){
167 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
166 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
168 for(i=0; i<TOTAL_SIZE_SM; i++){
167 for(i=0; i<TOTAL_SIZE_SM; i++){
169 averaged_spec_mat_f0[i] = averaged_spec_mat_f0[i] + spec_mat_f0_a[i]
168 averaged_spec_mat_f0[i] = averaged_spec_mat_f0[i] + spec_mat_f0_a[i]
170 + spec_mat_f0_b[i]
169 + spec_mat_f0_b[i]
171 + spec_mat_f0_c[i]
170 + spec_mat_f0_c[i]
172 + spec_mat_f0_d[i]
171 + spec_mat_f0_d[i]
173 + spec_mat_f0_e[i]
172 + spec_mat_f0_e[i]
174 + spec_mat_f0_f[i]
173 + spec_mat_f0_f[i]
175 + spec_mat_f0_g[i]
174 + spec_mat_f0_g[i]
176 + spec_mat_f0_h[i];
175 + spec_mat_f0_h[i];
177 }
176 }
178 nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0;
177 nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0;
179 if (nb_average == NB_AVERAGE_NORMAL_f0) {
178 if (nb_average == NB_AVERAGE_NORMAL_f0) {
180 nb_average = 0;
179 nb_average = 0;
181 status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0
180 status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0
182 if (status != RTEMS_SUCCESSFUL) {
181 if (status != RTEMS_SUCCESSFUL) {
183 printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status);
182 printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status);
184 }
183 }
185 }
184 }
186 }
185 }
187 }
186 }
188
187
189 rtems_task bpf0_task(rtems_task_argument argument)
188 rtems_task bpf0_task(rtems_task_argument argument)
190 {
189 {
191 rtems_event_set event_out;
190 rtems_event_set event_out;
192
191
193 BOOT_PRINTF("in BPFO *** \n")
192 BOOT_PRINTF("in BPFO *** \n")
194
193
195 while(1){
194 while(1){
196 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
195 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
197 matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0);
196 matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0);
198 BP1_set(compressed_spec_mat_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0);
197 BP1_set(compressed_spec_mat_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0);
199 //PRINTF("IN TASK BPF0 *** Matrix compressed, parameters calculated\n")
198 //PRINTF("IN TASK BPF0 *** Matrix compressed, parameters calculated\n")
200 }
199 }
201 }
200 }
202
201
203 rtems_task matr_task(rtems_task_argument argument)
202 rtems_task matr_task(rtems_task_argument argument)
204 {
203 {
205 spw_ioctl_pkt_send spw_ioctl_send_ASM;
204 spw_ioctl_pkt_send spw_ioctl_send_ASM;
206 rtems_event_set event_out;
205 rtems_event_set event_out;
207 rtems_status_code status;
206 rtems_status_code status;
208 rtems_id queue_id;
207 rtems_id queue_id;
209 Header_TM_LFR_SCIENCE_ASM_t headerASM;
208 Header_TM_LFR_SCIENCE_ASM_t headerASM;
210
209
211 init_header_asm( &headerASM );
210 init_header_asm( &headerASM );
212
211
213 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id );
212 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id );
214 if (status != RTEMS_SUCCESSFUL)
213 if (status != RTEMS_SUCCESSFUL)
215 {
214 {
216 PRINTF1("in MATR *** ERR getting queue id, %d\n", status)
215 PRINTF1("in MATR *** ERR getting queue id, %d\n", status)
217 }
216 }
218
217
219 BOOT_PRINTF("in MATR *** \n")
218 BOOT_PRINTF("in MATR *** \n")
220
219
221 fill_averaged_spectral_matrix( );
220 fill_averaged_spectral_matrix( );
222
221
223 while(1){
222 while(1){
224 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
223 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
225
224
226 #ifdef GSA
225 #ifdef GSA
227 #else
226 #else
228 fill_averaged_spectral_matrix( );
227 fill_averaged_spectral_matrix( );
229 #endif
228 #endif
230 convert_averaged_spectral_matrix( averaged_spec_mat_f0, averaged_spec_mat_f0_char);
229 convert_averaged_spectral_matrix( averaged_spec_mat_f0, averaged_spec_mat_f0_char);
231
230
232 send_spectral_matrix( &headerASM, averaged_spec_mat_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
231 send_spectral_matrix( &headerASM, averaged_spec_mat_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
233 }
232 }
234 }
233 }
235
234
236 //*****************************
235 //*****************************
237 // Spectral matrices processing
236 // Spectral matrices processing
238
237
239 void matrix_reset(volatile float *averaged_spec_mat)
238 void matrix_reset(volatile float *averaged_spec_mat)
240 {
239 {
241 // int i;
240 // int i;
242 // for(i=0; i<TOTAL_SIZE_SM; i++){
241 // for(i=0; i<TOTAL_SIZE_SM; i++){
243 // averaged_spec_mat_f0[i] = 0;
242 // averaged_spec_mat_f0[i] = 0;
244 // }
243 // }
245 }
244 }
246
245
247 void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat)
246 void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat)
248 {
247 {
249 int i;
248 int i;
250 int j;
249 int j;
251 switch (fChannel){
250 switch (fChannel){
252 case 0:
251 case 0:
253 for(i=0;i<NB_BINS_COMPRESSED_SM_F0;i++){
252 for(i=0;i<NB_BINS_COMPRESSED_SM_F0;i++){
254 j = 17 + (i * 8);
253 j = 17 + (i * 8);
255 compressed_spec_mat[i] = (averaged_spec_mat[j]
254 compressed_spec_mat[i] = (averaged_spec_mat[j]
256 + averaged_spec_mat[j+1]
255 + averaged_spec_mat[j+1]
257 + averaged_spec_mat[j+2]
256 + averaged_spec_mat[j+2]
258 + averaged_spec_mat[j+3]
257 + averaged_spec_mat[j+3]
259 + averaged_spec_mat[j+4]
258 + averaged_spec_mat[j+4]
260 + averaged_spec_mat[j+5]
259 + averaged_spec_mat[j+5]
261 + averaged_spec_mat[j+6]
260 + averaged_spec_mat[j+6]
262 + averaged_spec_mat[j+7])/(8*NB_AVERAGE_NORMAL_f0);
261 + averaged_spec_mat[j+7])/(8*NB_AVERAGE_NORMAL_f0);
263 }
262 }
264 break;
263 break;
265 case 1:
264 case 1:
266 // case fChannel = f1 to be completed later
265 // case fChannel = f1 to be completed later
267 break;
266 break;
268 case 2:
267 case 2:
269 // case fChannel = f1 to be completed later
268 // case fChannel = f1 to be completed later
270 break;
269 break;
271 default:
270 default:
272 break;
271 break;
273 }
272 }
274 }
273 }
275
274
276 void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){
275 void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){
277 int i;
276 int i;
278 int j;
277 int j;
279 unsigned char tmp_u_char;
278 unsigned char tmp_u_char;
280 unsigned char * pt_char = NULL;
279 unsigned char * pt_char = NULL;
281 float PSDB, PSDE;
280 float PSDB, PSDE;
282 float NVEC_V0;
281 float NVEC_V0;
283 float NVEC_V1;
282 float NVEC_V1;
284 float NVEC_V2;
283 float NVEC_V2;
285 //float significand;
284 //float significand;
286 //int exponent;
285 //int exponent;
287 float aux;
286 float aux;
288 float tr_SB_SB;
287 float tr_SB_SB;
289 float tmp;
288 float tmp;
290 float sx_re;
289 float sx_re;
291 float sx_im;
290 float sx_im;
292 float nebx_re = 0;
291 float nebx_re = 0;
293 float nebx_im = 0;
292 float nebx_im = 0;
294 float ny = 0;
293 float ny = 0;
295 float nz = 0;
294 float nz = 0;
296 float bx_bx_star = 0;
295 float bx_bx_star = 0;
297 for(i=0; i<nb_bins_compressed_spec_mat; i++){
296 for(i=0; i<nb_bins_compressed_spec_mat; i++){
298 //==============================================
297 //==============================================
299 // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits
298 // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits
300 PSDB = compressed_spec_mat[i*30] // S11
299 PSDB = compressed_spec_mat[i*30] // S11
301 + compressed_spec_mat[(i*30) + 10] // S22
300 + compressed_spec_mat[(i*30) + 10] // S22
302 + compressed_spec_mat[(i*30) + 18]; // S33
301 + compressed_spec_mat[(i*30) + 18]; // S33
303 //significand = frexp(PSDB, &exponent);
302 //significand = frexp(PSDB, &exponent);
304 pt_char = (unsigned char*) &PSDB;
303 pt_char = (unsigned char*) &PSDB;
305 LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float
304 LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float
306 LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float
305 LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float
307 //==============================================
306 //==============================================
308 // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits
307 // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits
309 PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44
308 PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44
310 + compressed_spec_mat[(i*30) + 28] * K55_pe // S55
309 + compressed_spec_mat[(i*30) + 28] * K55_pe // S55
311 + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45
310 + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45
312 - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45
311 - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45
313 pt_char = (unsigned char*) &PSDE;
312 pt_char = (unsigned char*) &PSDE;
314 LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float
313 LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float
315 LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float
314 LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float
316 //==============================================================================
315 //==============================================================================
317 // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits
316 // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits
318 // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits
317 // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits
319 // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits
318 // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits
320 tmp = sqrt(
319 tmp = sqrt(
321 compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12
320 compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12
322 +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13
321 +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13
323 +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23
322 +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23
324 );
323 );
325 NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23
324 NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23
326 NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13
325 NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13
327 NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12
326 NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12
328 LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127);
327 LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127);
329 LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127);
328 LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127);
330 pt_char = (unsigned char*) &NVEC_V2;
329 pt_char = (unsigned char*) &NVEC_V2;
331 LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2
330 LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2
332 //=======================================================
331 //=======================================================
333 // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits
332 // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits
334 aux = 2*tmp / PSDB; // compute the ellipticity
333 aux = 2*tmp / PSDB; // compute the ellipticity
335 tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity
334 tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity
336 LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char
335 LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char
337 //==============================================================
336 //==============================================================
338 // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits
337 // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits
339 for(j = 0; j<NB_VALUES_PER_SM;j++){
338 for(j = 0; j<NB_VALUES_PER_SM;j++){
340 tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30]
339 tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30]
341 + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10]
340 + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10]
342 + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18]
341 + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18]
343 + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2]
342 + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2]
344 + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3]
343 + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3]
345 + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4]
344 + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4]
346 + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5]
345 + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5]
347 + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12]
346 + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12]
348 + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13];
347 + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13];
349 }
348 }
350 aux = PSDB*PSDB;
349 aux = PSDB*PSDB;
351 tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) );
350 tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) );
352 tmp_u_char = (unsigned char) (NVEC_V0*(8-1));
351 tmp_u_char = (unsigned char) (NVEC_V0*(8-1));
353 LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char
352 LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char
354 //=======================================================================================
353 //=======================================================================================
355 // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1)
354 // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1)
356 sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re
355 sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re
357 + compressed_spec_mat[(i*30) + 6] * K14_sx_re
356 + compressed_spec_mat[(i*30) + 6] * K14_sx_re
358 + compressed_spec_mat[(i*30) + 8] * K15_sx_re
357 + compressed_spec_mat[(i*30) + 8] * K15_sx_re
359 + compressed_spec_mat[(i*30) + 14] * K24_sx_re
358 + compressed_spec_mat[(i*30) + 14] * K24_sx_re
360 + compressed_spec_mat[(i*30) + 16] * K25_sx_re
359 + compressed_spec_mat[(i*30) + 16] * K25_sx_re
361 + compressed_spec_mat[(i*30) + 22] * K35_sx_re;
360 + compressed_spec_mat[(i*30) + 22] * K35_sx_re;
362 sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im
361 sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im
363 + compressed_spec_mat[(i*30) + 7] * K14_sx_im
362 + compressed_spec_mat[(i*30) + 7] * K14_sx_im
364 + compressed_spec_mat[(i*30) + 9] * K15_sx_im
363 + compressed_spec_mat[(i*30) + 9] * K15_sx_im
365 + compressed_spec_mat[(i*30) + 15] * K24_sx_im
364 + compressed_spec_mat[(i*30) + 15] * K24_sx_im
366 + compressed_spec_mat[(i*30) + 17] * K25_sx_im
365 + compressed_spec_mat[(i*30) + 17] * K25_sx_im
367 + compressed_spec_mat[(i*30) + 23] * K35_sx_im;
366 + compressed_spec_mat[(i*30) + 23] * K35_sx_im;
368 LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression
367 LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression
369 if ( abs(sx_re) > abs(sx_im) ) {
368 if ( abs(sx_re) > abs(sx_im) ) {
370 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx
369 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx
371 }
370 }
372 else {
371 else {
373 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx
372 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx
374 }
373 }
375 //======================================================================
374 //======================================================================
376 // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1)
375 // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1)
377 ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2;
376 ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2;
378 nz = NVEC_V0;
377 nz = NVEC_V0;
379 bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22
378 bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22
380 + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33
379 + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33
381 - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23
380 - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23
382 nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re
381 nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re
383 +compressed_spec_mat[(i*30) + 16] * K25_ny_re
382 +compressed_spec_mat[(i*30) + 16] * K25_ny_re
384 +compressed_spec_mat[(i*30) + 20] * K34_ny_re
383 +compressed_spec_mat[(i*30) + 20] * K34_ny_re
385 +compressed_spec_mat[(i*30) + 22] * K35_ny_re)
384 +compressed_spec_mat[(i*30) + 22] * K35_ny_re)
386 + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re
385 + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re
387 +compressed_spec_mat[(i*30) + 16] * K25_nz_re
386 +compressed_spec_mat[(i*30) + 16] * K25_nz_re
388 +compressed_spec_mat[(i*30) + 20] * K34_nz_re
387 +compressed_spec_mat[(i*30) + 20] * K34_nz_re
389 +compressed_spec_mat[(i*30) + 22] * K35_nz_re);
388 +compressed_spec_mat[(i*30) + 22] * K35_nz_re);
390 nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re
389 nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re
391 +compressed_spec_mat[(i*30) + 17] * K25_ny_re
390 +compressed_spec_mat[(i*30) + 17] * K25_ny_re
392 +compressed_spec_mat[(i*30) + 21] * K34_ny_re
391 +compressed_spec_mat[(i*30) + 21] * K34_ny_re
393 +compressed_spec_mat[(i*30) + 23] * K35_ny_re)
392 +compressed_spec_mat[(i*30) + 23] * K35_ny_re)
394 + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im
393 + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im
395 +compressed_spec_mat[(i*30) + 17] * K25_nz_im
394 +compressed_spec_mat[(i*30) + 17] * K25_nz_im
396 +compressed_spec_mat[(i*30) + 21] * K34_nz_im
395 +compressed_spec_mat[(i*30) + 21] * K34_nz_im
397 +compressed_spec_mat[(i*30) + 23] * K35_nz_im);
396 +compressed_spec_mat[(i*30) + 23] * K35_nz_im);
398 tmp = nebx_re / bx_bx_star;
397 tmp = nebx_re / bx_bx_star;
399 LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression
398 LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression
400 if ( abs(nebx_re) > abs(nebx_im) ) {
399 if ( abs(nebx_re) > abs(nebx_im) ) {
401 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx
400 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx
402 }
401 }
403 else {
402 else {
404 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx
403 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx
405 }
404 }
406 }
405 }
407
406
408 }
407 }
409
408
410 void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){
409 void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){
411 // BP2 autocorrelation
410 // BP2 autocorrelation
412 int i;
411 int i;
413 int aux = 0;
412 int aux = 0;
414
413
415 for(i = 0; i<nb_bins_compressed_spec_mat; i++){
414 for(i = 0; i<nb_bins_compressed_spec_mat; i++){
416 // S12
415 // S12
417 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]);
416 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]);
418 compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux;
417 compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux;
419 compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux;
418 compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux;
420 // S13
419 // S13
421 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]);
420 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]);
422 compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux;
421 compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux;
423 compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux;
422 compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux;
424 // S23
423 // S23
425 aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]);
424 aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]);
426 compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux;
425 compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux;
427 compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux;
426 compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux;
428 // S45
427 // S45
429 aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]);
428 aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]);
430 compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux;
429 compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux;
431 compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux;
430 compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux;
432 // S14
431 // S14
433 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]);
432 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]);
434 compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux;
433 compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux;
435 compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux;
434 compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux;
436 // S15
435 // S15
437 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]);
436 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]);
438 compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux;
437 compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux;
439 compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux;
438 compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux;
440 // S24
439 // S24
441 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]);
440 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]);
442 compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux;
441 compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux;
443 compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux;
442 compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux;
444 // S25
443 // S25
445 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]);
444 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]);
446 compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux;
445 compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux;
447 compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux;
446 compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux;
448 // S34
447 // S34
449 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]);
448 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]);
450 compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux;
449 compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux;
451 compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux;
450 compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux;
452 // S35
451 // S35
453 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]);
452 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]);
454 compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux;
453 compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux;
455 compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux;
454 compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux;
456 }
455 }
457 }
456 }
458
457
459 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header)
458 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header)
460 {
459 {
461 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
460 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
462 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
461 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
463 header->reserved = 0x00;
462 header->reserved = 0x00;
464 header->userApplication = CCSDS_USER_APP;
463 header->userApplication = CCSDS_USER_APP;
465 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
464 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
466 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
465 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
467 header->packetSequenceControl[0] = 0xc0;
466 header->packetSequenceControl[0] = 0xc0;
468 header->packetSequenceControl[1] = 0x00;
467 header->packetSequenceControl[1] = 0x00;
469 header->packetLength[0] = 0x00;
468 header->packetLength[0] = 0x00;
470 header->packetLength[1] = 0x00;
469 header->packetLength[1] = 0x00;
471 // DATA FIELD HEADER
470 // DATA FIELD HEADER
472 header->spare1_pusVersion_spare2 = 0x10;
471 header->spare1_pusVersion_spare2 = 0x10;
473 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
472 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
474 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
473 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
475 header->destinationID = TM_DESTINATION_ID_GROUND;
474 header->destinationID = TM_DESTINATION_ID_GROUND;
476 // AUXILIARY DATA HEADER
475 // AUXILIARY DATA HEADER
477 header->sid = 0x00;
476 header->sid = 0x00;
478 header->biaStatusInfo = 0x00;
477 header->biaStatusInfo = 0x00;
479 header->cntASM = 0x00;
478 header->cntASM = 0x00;
480 header->nrASM = 0x00;
479 header->nrASM = 0x00;
481 header->time[0] = 0x00;
480 header->time[0] = 0x00;
482 header->time[0] = 0x00;
481 header->time[0] = 0x00;
483 header->time[0] = 0x00;
482 header->time[0] = 0x00;
484 header->time[0] = 0x00;
483 header->time[0] = 0x00;
485 header->time[0] = 0x00;
484 header->time[0] = 0x00;
486 header->time[0] = 0x00;
485 header->time[0] = 0x00;
487 header->blkNr[0] = 0x00; // BLK_NR MSB
486 header->blkNr[0] = 0x00; // BLK_NR MSB
488 header->blkNr[1] = 0x00; // BLK_NR LSB
487 header->blkNr[1] = 0x00; // BLK_NR LSB
489 }
488 }
490
489
491 void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
490 void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
492 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id)
491 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id)
493 {
492 {
494 unsigned int i;
493 unsigned int i;
495 unsigned int length = 0;
494 unsigned int length = 0;
496 rtems_status_code status;
495 rtems_status_code status;
497
496
498 header->sid = (unsigned char) sid;
497 header->sid = (unsigned char) sid;
499
498
500 for (i=0; i<2; i++)
499 for (i=0; i<2; i++)
501 {
500 {
502 // BUILD THE DATA
501 // BUILD THE DATA
503 spw_ioctl_send->dlen = TOTAL_SIZE_SM;
502 spw_ioctl_send->dlen = TOTAL_SIZE_SM;
504 spw_ioctl_send->data = &spectral_matrix[ i * TOTAL_SIZE_SM];
503 spw_ioctl_send->data = &spectral_matrix[ i * TOTAL_SIZE_SM];
505 spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES;
504 spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES;
506 spw_ioctl_send->hdr = (char *) header;
505 spw_ioctl_send->hdr = (char *) header;
507 spw_ioctl_send->options = 0;
506 spw_ioctl_send->options = 0;
508
507
509 // BUILD THE HEADER
508 // BUILD THE HEADER
510 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM;
509 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM;
511 header->packetLength[0] = (unsigned char) (length>>8);
510 header->packetLength[0] = (unsigned char) (length>>8);
512 header->packetLength[1] = (unsigned char) (length);
511 header->packetLength[1] = (unsigned char) (length);
513 header->sid = (unsigned char) sid; // SID
512 header->sid = (unsigned char) sid; // SID
514 header->cntASM = 2;
513 header->cntASM = 2;
515 header->nrASM = (unsigned char) (i+1);
514 header->nrASM = (unsigned char) (i+1);
516 header->blkNr[0] =(unsigned char) ( (NB_BINS_PER_SM/2) >> 8 ); // BLK_NR MSB
515 header->blkNr[0] =(unsigned char) ( (NB_BINS_PER_SM/2) >> 8 ); // BLK_NR MSB
517 header->blkNr[1] = (unsigned char) (NB_BINS_PER_SM/2); // BLK_NR LSB
516 header->blkNr[1] = (unsigned char) (NB_BINS_PER_SM/2); // BLK_NR LSB
518 // SET PACKET TIME
517 // SET PACKET TIME
519 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
518 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
520 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
519 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
521 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
520 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
522 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
521 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
523 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
522 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
524 header->time[5] = (unsigned char) (time_management_regs->fine_time);
523 header->time[5] = (unsigned char) (time_management_regs->fine_time);
525 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
524 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
526 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
525 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
527 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
526 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
528 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
527 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
529 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
528 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
530 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
529 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
531 // SEND PACKET
530 // SEND PACKET
532 status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
531 status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
533 if (status != RTEMS_SUCCESSFUL) {
532 if (status != RTEMS_SUCCESSFUL) {
534 printf("in send_spectral_matrix *** ERR %d\n", (int) status);
533 printf("in send_spectral_matrix *** ERR %d\n", (int) status);
535 }
534 }
536 }
535 }
537 }
536 }
538
537
539 void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix)
538 void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix)
540 {
539 {
541 unsigned int i;
540 unsigned int i;
542 unsigned int j;
541 unsigned int j;
543 char * pt_char_input;
542 char * pt_char_input;
544 char * pt_char_output;
543 char * pt_char_output;
545
544
546 pt_char_input = NULL;
545 pt_char_input = NULL;
547 pt_char_output = NULL;
546 pt_char_output = NULL;
548
547
549 for( i=0; i<NB_BINS_PER_SM; i++)
548 for( i=0; i<NB_BINS_PER_SM; i++)
550 {
549 {
551 for ( j=0; j<NB_VALUES_PER_SM; j++)
550 for ( j=0; j<NB_VALUES_PER_SM; j++)
552 {
551 {
553 pt_char_input = (char*) &input_matrix[ (i*NB_VALUES_PER_SM) + j ];
552 pt_char_input = (char*) &input_matrix[ (i*NB_VALUES_PER_SM) + j ];
554 pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ];
553 pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ];
555 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
554 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
556 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
555 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
557 }
556 }
558 }
557 }
559 }
558 }
560
559
561 void fill_averaged_spectral_matrix(void)
560 void fill_averaged_spectral_matrix(void)
562 {
561 {
563 /** This function fills spectral matrices related buffers with arbitrary data.
562 /** This function fills spectral matrices related buffers with arbitrary data.
564 *
563 *
565 * This function is for testing purpose only.
564 * This function is for testing purpose only.
566 *
565 *
567 */
566 */
568
567
569 #ifdef GSA
568 #ifdef GSA
570 float offset = 10.;
569 float offset = 10.;
571 float coeff = 100000.;
570 float coeff = 100000.;
572
571
573 averaged_spec_mat_f0[ 0 + 25 * 0 ] = 0. + offset;
572 averaged_spec_mat_f0[ 0 + 25 * 0 ] = 0. + offset;
574 averaged_spec_mat_f0[ 0 + 25 * 1 ] = 1. + offset;
573 averaged_spec_mat_f0[ 0 + 25 * 1 ] = 1. + offset;
575 averaged_spec_mat_f0[ 0 + 25 * 2 ] = 2. + offset;
574 averaged_spec_mat_f0[ 0 + 25 * 2 ] = 2. + offset;
576 averaged_spec_mat_f0[ 0 + 25 * 3 ] = 3. + offset;
575 averaged_spec_mat_f0[ 0 + 25 * 3 ] = 3. + offset;
577 averaged_spec_mat_f0[ 0 + 25 * 4 ] = 4. + offset;
576 averaged_spec_mat_f0[ 0 + 25 * 4 ] = 4. + offset;
578 averaged_spec_mat_f0[ 0 + 25 * 5 ] = 5. + offset;
577 averaged_spec_mat_f0[ 0 + 25 * 5 ] = 5. + offset;
579 averaged_spec_mat_f0[ 0 + 25 * 6 ] = 6. + offset;
578 averaged_spec_mat_f0[ 0 + 25 * 6 ] = 6. + offset;
580 averaged_spec_mat_f0[ 0 + 25 * 7 ] = 7. + offset;
579 averaged_spec_mat_f0[ 0 + 25 * 7 ] = 7. + offset;
581 averaged_spec_mat_f0[ 0 + 25 * 8 ] = 8. + offset;
580 averaged_spec_mat_f0[ 0 + 25 * 8 ] = 8. + offset;
582 averaged_spec_mat_f0[ 0 + 25 * 9 ] = 9. + offset;
581 averaged_spec_mat_f0[ 0 + 25 * 9 ] = 9. + offset;
583 averaged_spec_mat_f0[ 0 + 25 * 10 ] = 10. + offset;
582 averaged_spec_mat_f0[ 0 + 25 * 10 ] = 10. + offset;
584 averaged_spec_mat_f0[ 0 + 25 * 11 ] = 11. + offset;
583 averaged_spec_mat_f0[ 0 + 25 * 11 ] = 11. + offset;
585 averaged_spec_mat_f0[ 0 + 25 * 12 ] = 12. + offset;
584 averaged_spec_mat_f0[ 0 + 25 * 12 ] = 12. + offset;
586 averaged_spec_mat_f0[ 0 + 25 * 13 ] = 13. + offset;
585 averaged_spec_mat_f0[ 0 + 25 * 13 ] = 13. + offset;
587 averaged_spec_mat_f0[ 0 + 25 * 14 ] = 14. + offset;
586 averaged_spec_mat_f0[ 0 + 25 * 14 ] = 14. + offset;
588 averaged_spec_mat_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff;
587 averaged_spec_mat_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff;
589 averaged_spec_mat_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff;
588 averaged_spec_mat_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff;
590 averaged_spec_mat_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff;
589 averaged_spec_mat_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff;
591 averaged_spec_mat_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff;
590 averaged_spec_mat_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff;
592 averaged_spec_mat_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff;
591 averaged_spec_mat_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff;
593 averaged_spec_mat_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff;
592 averaged_spec_mat_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff;
594 averaged_spec_mat_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff;
593 averaged_spec_mat_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff;
595 averaged_spec_mat_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff;
594 averaged_spec_mat_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff;
596 averaged_spec_mat_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff;
595 averaged_spec_mat_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff;
597 averaged_spec_mat_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff;
596 averaged_spec_mat_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff;
598 averaged_spec_mat_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff;
597 averaged_spec_mat_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff;
599 averaged_spec_mat_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff;
598 averaged_spec_mat_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff;
600 averaged_spec_mat_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff;
599 averaged_spec_mat_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff;
601 averaged_spec_mat_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff;
600 averaged_spec_mat_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff;
602 averaged_spec_mat_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff;
601 averaged_spec_mat_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff;
603 offset = 10000000;
602 offset = 10000000;
604 averaged_spec_mat_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff;
603 averaged_spec_mat_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff;
605 averaged_spec_mat_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff;
604 averaged_spec_mat_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff;
606 averaged_spec_mat_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff;
605 averaged_spec_mat_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff;
607 averaged_spec_mat_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff;
606 averaged_spec_mat_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff;
608 averaged_spec_mat_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff;
607 averaged_spec_mat_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff;
609 averaged_spec_mat_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff;
608 averaged_spec_mat_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff;
610 averaged_spec_mat_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff;
609 averaged_spec_mat_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff;
611 averaged_spec_mat_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff;
610 averaged_spec_mat_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff;
612 averaged_spec_mat_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff;
611 averaged_spec_mat_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff;
613 averaged_spec_mat_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff;
612 averaged_spec_mat_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff;
614 averaged_spec_mat_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff;
613 averaged_spec_mat_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff;
615 averaged_spec_mat_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff;
614 averaged_spec_mat_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff;
616 averaged_spec_mat_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff;
615 averaged_spec_mat_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff;
617 averaged_spec_mat_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff;
616 averaged_spec_mat_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff;
618 averaged_spec_mat_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff;
617 averaged_spec_mat_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff;
619
618
620 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_spec_mat_f0[ 0 ];
619 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_spec_mat_f0[ 0 ];
621 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_spec_mat_f0[ 1 ];
620 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_spec_mat_f0[ 1 ];
622 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_spec_mat_f0[ 2 ];
621 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_spec_mat_f0[ 2 ];
623 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_spec_mat_f0[ 3 ];
622 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_spec_mat_f0[ 3 ];
624 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_spec_mat_f0[ 4 ];
623 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_spec_mat_f0[ 4 ];
625 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_spec_mat_f0[ 5 ];
624 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_spec_mat_f0[ 5 ];
626 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_spec_mat_f0[ 6 ];
625 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_spec_mat_f0[ 6 ];
627 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_spec_mat_f0[ 7 ];
626 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_spec_mat_f0[ 7 ];
628 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_spec_mat_f0[ 8 ];
627 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_spec_mat_f0[ 8 ];
629 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_spec_mat_f0[ 9 ];
628 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_spec_mat_f0[ 9 ];
630 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_spec_mat_f0[ 10 ];
629 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_spec_mat_f0[ 10 ];
631 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_spec_mat_f0[ 11 ];
630 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_spec_mat_f0[ 11 ];
632 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_spec_mat_f0[ 12 ];
631 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_spec_mat_f0[ 12 ];
633 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_spec_mat_f0[ 13 ];
632 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_spec_mat_f0[ 13 ];
634 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_spec_mat_f0[ 14 ];
633 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_spec_mat_f0[ 14 ];
635 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_spec_mat_f0[ 15 ];
634 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_spec_mat_f0[ 15 ];
636 #else
635 #else
637 unsigned int i;
636 unsigned int i;
638
637
639 for(i=0; i<TOTAL_SIZE_SM; i++)
638 for(i=0; i<TOTAL_SIZE_SM; i++)
640 {
639 {
641 if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0)
640 if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0)
642 averaged_spec_mat_f0[i] = (float) spec_mat_f0_0_bis[ SM_HEADER + i ];
641 averaged_spec_mat_f0[i] = (float) spec_mat_f0_0_bis[ SM_HEADER + i ];
643 else
642 else
644 averaged_spec_mat_f0[i] = (float) spec_mat_f0_0[ SM_HEADER + i ];
643 averaged_spec_mat_f0[i] = (float) spec_mat_f0_0[ SM_HEADER + i ];
645 }
644 }
646 #endif
645 #endif
647 }
646 }
648
647
649 void reset_spectral_matrix_regs()
648 void reset_spectral_matrix_regs()
650 {
649 {
651 /** This function resets the spectral matrices module registers.
650 /** This function resets the spectral matrices module registers.
652 *
651 *
653 * The registers affected by this function are located at the following offset addresses:
652 * The registers affected by this function are located at the following offset addresses:
654 *
653 *
655 * - 0x00 config
654 * - 0x00 config
656 * - 0x04 status
655 * - 0x04 status
657 * - 0x08 matrixF0_Address0
656 * - 0x08 matrixF0_Address0
658 * - 0x10 matrixFO_Address1
657 * - 0x10 matrixFO_Address1
659 * - 0x14 matrixF1_Address
658 * - 0x14 matrixF1_Address
660 * - 0x18 matrixF2_Address
659 * - 0x18 matrixF2_Address
661 *
660 *
662 */
661 */
663
662
664 #ifdef GSA
663 #ifdef GSA
665 #else
664 #else
666 spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0;
665 spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0;
667 spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1;
666 spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1;
668 spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1;
667 spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1;
669 spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2;
668 spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2;
670 #endif
669 #endif
671 }
670 }
672
671
673 //******************
672 //******************
674 // general functions
673 // general functions
675
674
676
675
677
676
678
677
@@ -1,602 +1,623
1 /** Functions related to the SpaceWire interface.
1 /** Functions related to the SpaceWire interface.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to handle SpaceWire transmissions:
6 * A group of functions to handle SpaceWire transmissions:
7 * - configuration of the SpaceWire link
7 * - configuration of the SpaceWire link
8 * - SpaceWire related interruption requests processing
8 * - SpaceWire related interruption requests processing
9 * - transmission of TeleMetry packets by a dedicated RTEMS task
9 * - transmission of TeleMetry packets by a dedicated RTEMS task
10 * - reception of TeleCommands by a dedicated RTEMS task
10 * - reception of TeleCommands by a dedicated RTEMS task
11 *
11 *
12 */
12 */
13
13
14 #include "fsw_spacewire.h"
14 #include "fsw_spacewire.h"
15
15
16 char *lstates[6] = {"Error-reset",
16 char *lstates[6] = {"Error-reset",
17 "Error-wait",
17 "Error-wait",
18 "Ready",
18 "Ready",
19 "Started",
19 "Started",
20 "Connecting",
20 "Connecting",
21 "Run"
21 "Run"
22 };
22 };
23
23
24 rtems_name semq_name;
25 rtems_id semq_id;
26
24 //***********
27 //***********
25 // RTEMS TASK
28 // RTEMS TASK
26 rtems_task spiq_task(rtems_task_argument unused)
29 rtems_task spiq_task(rtems_task_argument unused)
27 {
30 {
28 /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver.
31 /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver.
29 *
32 *
30 * @param unused is the starting argument of the RTEMS task
33 * @param unused is the starting argument of the RTEMS task
31 *
34 *
32 */
35 */
33
36
34 rtems_event_set event_out;
37 rtems_event_set event_out;
35 rtems_status_code status;
38 rtems_status_code status;
36 int linkStatus;
39 int linkStatus;
37
40
38 BOOT_PRINTF("in SPIQ *** \n")
41 BOOT_PRINTF("in SPIQ *** \n")
39
42
40 while(true){
43 while(true){
41 rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT
44 rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT
42 PRINTF("in SPIQ *** got SPW_LINKERR_EVENT\n")
45 PRINTF("in SPIQ *** got SPW_LINKERR_EVENT\n")
43
46
44 // [0] SUSPEND RECV AND SEND TASKS
47 // [0] SUSPEND RECV AND SEND TASKS
45 rtems_task_suspend( Task_id[ TASKID_RECV ] );
48 rtems_task_suspend( Task_id[ TASKID_RECV ] );
46 rtems_task_suspend( Task_id[ TASKID_SEND ] );
49 rtems_task_suspend( Task_id[ TASKID_SEND ] );
47
50
48 // [1] CHECK THE LINK
51 // [1] CHECK THE LINK
49 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1)
52 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1)
50 if ( linkStatus != 5) {
53 if ( linkStatus != 5) {
51 PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus)
54 PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus)
52 rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms
55 rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms
53 }
56 }
54
57
55 // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT
58 // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT
56 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2)
59 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2)
57 if ( linkStatus != 5 ) // [2.a] not in run state, reset the link
60 if ( linkStatus != 5 ) // [2.a] not in run state, reset the link
58 {
61 {
59 spacewire_compute_stats_offsets();
62 spacewire_compute_stats_offsets();
60 status = spacewire_reset_link( );
63 status = spacewire_reset_link( );
61 }
64 }
62 else // [2.b] in run state, start the link
65 else // [2.b] in run state, start the link
63 {
66 {
64 status = spacewire_stop_start_link( fdSPW ); // start the link
67 status = spacewire_stop_start_link( fdSPW ); // start the link
65 if ( status != RTEMS_SUCCESSFUL)
68 if ( status != RTEMS_SUCCESSFUL)
66 {
69 {
67 PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status)
70 PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status)
68 }
71 }
69 }
72 }
70
73
71 // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS
74 // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS
72 if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully
75 if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully
73 {
76 {
74 status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 );
77 status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 );
75 if ( status != RTEMS_SUCCESSFUL ) {
78 if ( status != RTEMS_SUCCESSFUL ) {
76 PRINTF("in SPIQ *** ERR resuming SEND Task\n")
79 PRINTF("in SPIQ *** ERR resuming SEND Task\n")
77 }
80 }
78 status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 );
81 status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 );
79 if ( status != RTEMS_SUCCESSFUL ) {
82 if ( status != RTEMS_SUCCESSFUL ) {
80 PRINTF("in SPIQ *** ERR resuming RECV Task\n")
83 PRINTF("in SPIQ *** ERR resuming RECV Task\n")
81 }
84 }
82 }
85 }
83 else // [3.b] the link is not in run state, go in STANDBY mode
86 else // [3.b] the link is not in run state, go in STANDBY mode
84 {
87 {
85 status = stop_current_mode();
88 status = stop_current_mode();
86 if ( status != RTEMS_SUCCESSFUL ) {
89 if ( status != RTEMS_SUCCESSFUL ) {
87 PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status)
90 PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status)
88 }
91 }
89 status = enter_standby_mode();
92 status = enter_standby_mode();
90 if ( status != RTEMS_SUCCESSFUL ) {
93 if ( status != RTEMS_SUCCESSFUL ) {
91 PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status)
94 PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status)
92 }
95 }
93 // wake the WTDG task up to wait for the link recovery
96 // wake the WTDG task up to wait for the link recovery
94 status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 );
97 status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 );
95 rtems_task_suspend( RTEMS_SELF );
98 rtems_task_suspend( RTEMS_SELF );
96 }
99 }
97 }
100 }
98 }
101 }
99
102
100 rtems_task recv_task( rtems_task_argument unused )
103 rtems_task recv_task( rtems_task_argument unused )
101 {
104 {
102 /** This RTEMS task is dedicated to the reception of incoming TeleCommands.
105 /** This RTEMS task is dedicated to the reception of incoming TeleCommands.
103 *
106 *
104 * @param unused is the starting argument of the RTEMS task
107 * @param unused is the starting argument of the RTEMS task
105 *
108 *
106 * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked:
109 * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked:
107 * 1. It reads the incoming data.
110 * 1. It reads the incoming data.
108 * 2. Launches the acceptance procedure.
111 * 2. Launches the acceptance procedure.
109 * 3. If the Telecommand is valid, sends it to a dedicated RTEMS message queue.
112 * 3. If the Telecommand is valid, sends it to a dedicated RTEMS message queue.
110 *
113 *
111 */
114 */
112
115
113 int len;
116 int len;
114 ccsdsTelecommandPacket_t currentTC;
117 ccsdsTelecommandPacket_t currentTC;
115 unsigned char computed_CRC[ 2 ];
118 unsigned char computed_CRC[ 2 ];
116 unsigned char currentTC_LEN_RCV[ 2 ];
119 unsigned char currentTC_LEN_RCV[ 2 ];
117 unsigned int currentTC_LEN_RCV_AsUnsignedInt;
120 unsigned int currentTC_LEN_RCV_AsUnsignedInt;
118 unsigned int parserCode;
121 unsigned int parserCode;
119 rtems_status_code status;
122 rtems_status_code status;
120 rtems_id queue_recv_id;
123 rtems_id queue_recv_id;
121 rtems_id queue_send_id;
124 rtems_id queue_send_id;
122
125
123 initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes
126 initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes
124
127
125 status = rtems_message_queue_ident( misc_name[QUEUE_RECV], 0, &queue_recv_id );
128 status = rtems_message_queue_ident( misc_name[QUEUE_RECV], 0, &queue_recv_id );
126 if (status != RTEMS_SUCCESSFUL)
129 if (status != RTEMS_SUCCESSFUL)
127 {
130 {
128 PRINTF1("in RECV *** ERR getting QUEUE_RECV id, %d\n", status)
131 PRINTF1("in RECV *** ERR getting QUEUE_RECV id, %d\n", status)
129 }
132 }
130
133
131 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_send_id );
134 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_send_id );
132 if (status != RTEMS_SUCCESSFUL)
135 if (status != RTEMS_SUCCESSFUL)
133 {
136 {
134 PRINTF1("in RECV *** ERR getting QUEUE_SEND id, %d\n", status)
137 PRINTF1("in RECV *** ERR getting QUEUE_SEND id, %d\n", status)
135 }
138 }
136
139
137 BOOT_PRINTF("in RECV *** \n")
140 BOOT_PRINTF("in RECV *** \n")
138
141
139 while(1)
142 while(1)
140 {
143 {
141 len = read( fdSPW, (char*) &currentTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking
144 len = read( fdSPW, (char*) &currentTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking
142 if (len == -1){ // error during the read call
145 if (len == -1){ // error during the read call
143 PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno)
146 PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno)
144 }
147 }
145 else {
148 else {
146 if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) {
149 if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) {
147 PRINTF("in RECV *** packet lenght too short\n")
150 PRINTF("in RECV *** packet lenght too short\n")
148 }
151 }
149 else {
152 else {
150 currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes
153 currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes
151 currentTC_LEN_RCV[ 0 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt >> 8);
154 currentTC_LEN_RCV[ 0 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt >> 8);
152 currentTC_LEN_RCV[ 1 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt );
155 currentTC_LEN_RCV[ 1 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt );
153 // CHECK THE TC
156 // CHECK THE TC
154 parserCode = tc_parser( &currentTC, currentTC_LEN_RCV_AsUnsignedInt, computed_CRC ) ;
157 parserCode = tc_parser( &currentTC, currentTC_LEN_RCV_AsUnsignedInt, computed_CRC ) ;
155 if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT)
158 if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT)
156 || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE)
159 || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE)
157 || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA)
160 || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA)
158 || (parserCode == WRONG_SRC_ID) )
161 || (parserCode == WRONG_SRC_ID) )
159 { // send TM_LFR_TC_EXE_CORRUPTED
162 { // send TM_LFR_TC_EXE_CORRUPTED
160 if ( !( (currentTC.serviceType==TC_TYPE_TIME) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_TIME) )
163 if ( !( (currentTC.serviceType==TC_TYPE_TIME) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_TIME) )
161 &&
164 &&
162 !( (currentTC.serviceType==TC_TYPE_GEN) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_INFO))
165 !( (currentTC.serviceType==TC_TYPE_GEN) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_INFO))
163 )
166 )
164 {
167 {
165 send_tm_lfr_tc_exe_corrupted( &currentTC, queue_send_id, computed_CRC, currentTC_LEN_RCV );
168 send_tm_lfr_tc_exe_corrupted( &currentTC, queue_send_id, computed_CRC, currentTC_LEN_RCV );
166 }
169 }
167 }
170 }
168 else
171 else
169 { // send valid TC to the action launcher
172 { // send valid TC to the action launcher
170 status = rtems_message_queue_send( queue_recv_id, &currentTC,
173 status = rtems_message_queue_send( queue_recv_id, &currentTC,
171 currentTC_LEN_RCV_AsUnsignedInt + CCSDS_TC_TM_PACKET_OFFSET + 3);
174 currentTC_LEN_RCV_AsUnsignedInt + CCSDS_TC_TM_PACKET_OFFSET + 3);
172 }
175 }
173 }
176 }
174 }
177 }
175 }
178 }
176 }
179 }
177
180
178 rtems_task send_task( rtems_task_argument argument)
181 rtems_task send_task( rtems_task_argument argument)
179 {
182 {
180 /** This RTEMS task is dedicated to the transmission of TeleMetry packets.
183 /** This RTEMS task is dedicated to the transmission of TeleMetry packets.
181 *
184 *
182 * @param unused is the starting argument of the RTEMS task
185 * @param unused is the starting argument of the RTEMS task
183 *
186 *
184 * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives:
187 * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives:
185 * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call.
188 * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call.
186 * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After
189 * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After
187 * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the
190 * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the
188 * data it contains.
191 * data it contains.
189 *
192 *
190 */
193 */
191
194
192 rtems_status_code status; // RTEMS status code
195 rtems_status_code status; // RTEMS status code
193 char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer
196 char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer
194 spw_ioctl_pkt_send *spw_ioctl_send;
197 spw_ioctl_pkt_send *spw_ioctl_send;
195 size_t size; // size of the incoming TC packet
198 size_t size; // size of the incoming TC packet
196 u_int32_t count;
199 u_int32_t count;
197 rtems_id queue_id;
200 rtems_id queue_id;
198
201
199 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id );
202 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id );
200 if (status != RTEMS_SUCCESSFUL)
203 if (status != RTEMS_SUCCESSFUL)
201 {
204 {
202 PRINTF1("in SEND *** ERR getting queue id, %d\n", status)
205 PRINTF1("in SEND *** ERR getting queue id, %d\n", status)
203 }
206 }
204
207
205 BOOT_PRINTF("in SEND *** \n")
208 BOOT_PRINTF("in SEND *** \n")
206
209
207 while(1)
210 while(1)
208 {
211 {
209 status = rtems_message_queue_receive( queue_id, incomingData, &size,
212 status = rtems_message_queue_receive( queue_id, incomingData, &size,
210 RTEMS_WAIT, RTEMS_NO_TIMEOUT );
213 RTEMS_WAIT, RTEMS_NO_TIMEOUT );
211
214
212 if (status!=RTEMS_SUCCESSFUL)
215 if (status!=RTEMS_SUCCESSFUL)
213 {
216 {
214 PRINTF1("in SEND *** (1) ERR = %d\n", status)
217 PRINTF1("in SEND *** (1) ERR = %d\n", status)
215 }
218 }
216 else
219 else
217 {
220 {
218 if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet
221 if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet
219 {
222 {
220 status = write( fdSPW, incomingData, size );
223 status = write( fdSPW, incomingData, size );
221 if (status == -1){
224 if (status == -1){
222 PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size)
225 PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size)
223 }
226 }
224 }
227 }
225 else // the incoming message is a spw_ioctl_pkt_send structure
228 else // the incoming message is a spw_ioctl_pkt_send structure
226 {
229 {
227 spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData;
230 spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData;
228 if (spw_ioctl_send->hlen == 0)
231 if (spw_ioctl_send->hlen == 0)
229 {
232 {
230 status = write( fdSPW, spw_ioctl_send->data, spw_ioctl_send->dlen );
233 status = write( fdSPW, spw_ioctl_send->data, spw_ioctl_send->dlen );
231 if (status == -1){
234 if (status == -1){
232 PRINTF2("in SEND *** (2.b) ERRNO = %d, dlen = %d\n", errno, spw_ioctl_send->dlen)
235 PRINTF2("in SEND *** (2.b) ERRNO = %d, dlen = %d\n", errno, spw_ioctl_send->dlen)
233 }
236 }
234 }
237 }
235 else
238 else
236 {
239 {
237 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send );
240 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send );
238 if (status == -1){
241 if (status == -1){
239 PRINTF2("in SEND *** (2.c) ERRNO = %d, dlen = %d\n", errno, spw_ioctl_send->dlen)
242 PRINTF2("in SEND *** (2.c) ERRNO = %d, dlen = %d\n", errno, spw_ioctl_send->dlen)
240 PRINTF1(" hlen = %d\n", spw_ioctl_send->hlen)
243 PRINTF1(" hlen = %d\n", spw_ioctl_send->hlen)
241 }
244 }
242 }
245 }
243 }
246 }
244 }
247 }
245
248
246 status = rtems_message_queue_get_number_pending( queue_id, &count );
249 status = rtems_message_queue_get_number_pending( queue_id, &count );
247 if (status != RTEMS_SUCCESSFUL)
250 if (status != RTEMS_SUCCESSFUL)
248 {
251 {
249 PRINTF1("in SEND *** (3) ERR = %d\n", status)
252 PRINTF1("in SEND *** (3) ERR = %d\n", status)
250 }
253 }
251 else
254 else
252 {
255 {
253 if (count > maxCount)
256 if (count > maxCount)
254 {
257 {
255 maxCount = count;
258 maxCount = count;
256 }
259 }
257 }
260 }
258 }
261 }
259 }
262 }
260
263
261 rtems_task wtdg_task( rtems_task_argument argument )
264 rtems_task wtdg_task( rtems_task_argument argument )
262 {
265 {
263 rtems_event_set event_out;
266 rtems_event_set event_out;
264 rtems_status_code status;
267 rtems_status_code status;
265 int linkStatus;
268 int linkStatus;
266
269
267 BOOT_PRINTF("in WTDG ***\n")
270 BOOT_PRINTF("in WTDG ***\n")
268
271
269 while(1)
272 while(1)
270 {
273 {
271 // wait for an RTEMS_EVENT
274 // wait for an RTEMS_EVENT
272 rtems_event_receive( RTEMS_EVENT_0,
275 rtems_event_receive( RTEMS_EVENT_0,
273 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
276 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
274 PRINTF("in WTDG *** wait for the link\n")
277 PRINTF("in WTDG *** wait for the link\n")
275 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
278 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
276 while( linkStatus != 5) // wait for the link
279 while( linkStatus != 5) // wait for the link
277 {
280 {
278 rtems_task_wake_after( 10 );
281 rtems_task_wake_after( 10 );
279 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
282 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
280 }
283 }
281
284
282 status = spacewire_stop_start_link( fdSPW );
285 status = spacewire_stop_start_link( fdSPW );
283
286
284 if (status != RTEMS_SUCCESSFUL)
287 if (status != RTEMS_SUCCESSFUL)
285 {
288 {
286 PRINTF1("in WTDG *** ERR link not started %d\n", status)
289 PRINTF1("in WTDG *** ERR link not started %d\n", status)
287 }
290 }
288 else
291 else
289 {
292 {
290 PRINTF("in WTDG *** OK link started\n")
293 PRINTF("in WTDG *** OK link started\n")
291 }
294 }
292
295
293 // restart the SPIQ task
296 // restart the SPIQ task
294 status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 );
297 status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 );
295 if ( status != RTEMS_SUCCESSFUL ) {
298 if ( status != RTEMS_SUCCESSFUL ) {
296 PRINTF("in SPIQ *** ERR restarting SPIQ Task\n")
299 PRINTF("in SPIQ *** ERR restarting SPIQ Task\n")
297 }
300 }
298
301
299 // restart RECV and SEND
302 // restart RECV and SEND
300 status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 );
303 status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 );
301 if ( status != RTEMS_SUCCESSFUL ) {
304 if ( status != RTEMS_SUCCESSFUL ) {
302 PRINTF("in SPIQ *** ERR restarting SEND Task\n")
305 PRINTF("in SPIQ *** ERR restarting SEND Task\n")
303 }
306 }
304 status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 );
307 status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 );
305 if ( status != RTEMS_SUCCESSFUL ) {
308 if ( status != RTEMS_SUCCESSFUL ) {
306 PRINTF("in SPIQ *** ERR restarting RECV Task\n")
309 PRINTF("in SPIQ *** ERR restarting RECV Task\n")
307 }
310 }
308 }
311 }
309 }
312 }
310
313
311 //****************
314 //****************
312 // OTHER FUNCTIONS
315 // OTHER FUNCTIONS
313 int spacewire_open_link( void )
316 int spacewire_open_link( void )
314 {
317 {
315 /** This function opens the SpaceWire link.
318 /** This function opens the SpaceWire link.
316 *
319 *
317 * @return a valid file descriptor in case of success, -1 in case of a failure
320 * @return a valid file descriptor in case of success, -1 in case of a failure
318 *
321 *
319 */
322 */
320 rtems_status_code status;
323 rtems_status_code status;
321
324
322 fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware
325 fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware
323 if ( fdSPW < 0 ) {
326 if ( fdSPW < 0 ) {
324 PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno)
327 PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno)
325 }
328 }
326 else
329 else
327 {
330 {
328 status = RTEMS_SUCCESSFUL;
331 status = RTEMS_SUCCESSFUL;
329 }
332 }
330
333
331 return status;
334 return status;
332 }
335 }
333
336
334 int spacewire_start_link( int fd )
337 int spacewire_start_link( int fd )
335 {
338 {
336 rtems_status_code status;
339 rtems_status_code status;
337
340
338 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
341 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
339 // -1 default hardcoded driver timeout
342 // -1 default hardcoded driver timeout
340
343
341 return status;
344 return status;
342 }
345 }
343
346
344 int spacewire_stop_start_link( int fd )
347 int spacewire_stop_start_link( int fd )
345 {
348 {
346 rtems_status_code status;
349 rtems_status_code status;
347
350
348 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0
351 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0
349 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
352 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
350 // -1 default hardcoded driver timeout
353 // -1 default hardcoded driver timeout
351
354
352 return status;
355 return status;
353 }
356 }
354
357
355 int spacewire_configure_link( int fd )
358 int spacewire_configure_link( int fd )
356 {
359 {
357 /** This function configures the SpaceWire link.
360 /** This function configures the SpaceWire link.
358 *
361 *
359 * @return GR-RTEMS-DRIVER directive status codes:
362 * @return GR-RTEMS-DRIVER directive status codes:
360 * - 22 EINVAL - Null pointer or an out of range value was given as the argument.
363 * - 22 EINVAL - Null pointer or an out of range value was given as the argument.
361 * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode.
364 * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode.
362 * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used.
365 * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used.
363 * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up.
366 * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up.
364 * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers.
367 * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers.
365 * - 5 EIO - Error when writing to grswp hardware registers.
368 * - 5 EIO - Error when writing to grswp hardware registers.
366 * - 2 ENOENT - No such file or directory
369 * - 2 ENOENT - No such file or directory
367 */
370 */
368
371
369 rtems_status_code status;
372 rtems_status_code status;
370
373
371 spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force
374 spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force
372 spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration
375 spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration
373
376
374 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception
377 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception
375 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n")
378 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n")
376 //
379 //
377 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a
380 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a
378 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs
381 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs
379 //
382 //
380 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts
383 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts
381 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n")
384 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n")
382 //
385 //
383 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit
386 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit
384 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
387 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
385 //
388 //
386 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks
389 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks
387 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n")
390 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n")
388 //
391 //
389 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available
392 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available
390 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n")
393 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n")
391 //
394 //
392 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ]
395 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ]
393 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n")
396 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n")
394
397
395 return status;
398 return status;
396 }
399 }
397
400
398 int spacewire_reset_link( void )
401 int spacewire_reset_link( void )
399 {
402 {
400 /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver.
403 /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver.
401 *
404 *
402 * @return RTEMS directive status code:
405 * @return RTEMS directive status code:
403 * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s.
406 * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s.
404 * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout.
407 * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout.
405 *
408 *
406 */
409 */
407
410
408 rtems_status_code status_spw;
411 rtems_status_code status_spw;
409 int i;
412 int i;
410
413
411 for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ )
414 for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ )
412 {
415 {
413 PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i);
416 PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i);
414
417
415 // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM
418 // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM
416
419
417 status_spw = spacewire_stop_start_link( fdSPW );
420 status_spw = spacewire_stop_start_link( fdSPW );
418 if ( status_spw != RTEMS_SUCCESSFUL )
421 if ( status_spw != RTEMS_SUCCESSFUL )
419 {
422 {
420 PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw)
423 PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw)
421 }
424 }
422
425
423 if ( status_spw == RTEMS_SUCCESSFUL)
426 if ( status_spw == RTEMS_SUCCESSFUL)
424 {
427 {
425 break;
428 break;
426 }
429 }
427 }
430 }
428
431
429 return status_spw;
432 return status_spw;
430 }
433 }
431
434
432 void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force
435 void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force
433 {
436 {
434 /** This function sets the [N]o [P]ort force bit of the GRSPW control register.
437 /** This function sets the [N]o [P]ort force bit of the GRSPW control register.
435 *
438 *
436 * @param val is the value, 0 or 1, used to set the value of the NP bit.
439 * @param val is the value, 0 or 1, used to set the value of the NP bit.
437 * @param regAddr is the address of the GRSPW control register.
440 * @param regAddr is the address of the GRSPW control register.
438 *
441 *
439 * NP is the bit 20 of the GRSPW control register.
442 * NP is the bit 20 of the GRSPW control register.
440 *
443 *
441 */
444 */
442
445
443 unsigned int *spwptr = (unsigned int*) regAddr;
446 unsigned int *spwptr = (unsigned int*) regAddr;
444
447
445 if (val == 1) {
448 if (val == 1) {
446 *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit
449 *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit
447 }
450 }
448 if (val== 0) {
451 if (val== 0) {
449 *spwptr = *spwptr & 0xffdfffff;
452 *spwptr = *spwptr & 0xffdfffff;
450 }
453 }
451 }
454 }
452
455
453 void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable
456 void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable
454 {
457 {
455 /** This function sets the [R]MAP [E]nable bit of the GRSPW control register.
458 /** This function sets the [R]MAP [E]nable bit of the GRSPW control register.
456 *
459 *
457 * @param val is the value, 0 or 1, used to set the value of the RE bit.
460 * @param val is the value, 0 or 1, used to set the value of the RE bit.
458 * @param regAddr is the address of the GRSPW control register.
461 * @param regAddr is the address of the GRSPW control register.
459 *
462 *
460 * RE is the bit 16 of the GRSPW control register.
463 * RE is the bit 16 of the GRSPW control register.
461 *
464 *
462 */
465 */
463
466
464 unsigned int *spwptr = (unsigned int*) regAddr;
467 unsigned int *spwptr = (unsigned int*) regAddr;
465
468
466 if (val == 1)
469 if (val == 1)
467 {
470 {
468 *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit
471 *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit
469 }
472 }
470 if (val== 0)
473 if (val== 0)
471 {
474 {
472 *spwptr = *spwptr & 0xfffdffff;
475 *spwptr = *spwptr & 0xfffdffff;
473 }
476 }
474 }
477 }
475
478
476 void spacewire_compute_stats_offsets( void )
479 void spacewire_compute_stats_offsets( void )
477 {
480 {
478 /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising.
481 /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising.
479 *
482 *
480 * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics
483 * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics
481 * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it
484 * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it
482 * during the open systel call).
485 * during the open systel call).
483 *
486 *
484 */
487 */
485
488
486 spw_stats spacewire_stats_grspw;
489 spw_stats spacewire_stats_grspw;
487 rtems_status_code status;
490 rtems_status_code status;
488
491
489 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
492 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
490
493
491 spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received
494 spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received
492 + spacewire_stats.packets_received;
495 + spacewire_stats.packets_received;
493 spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent
496 spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent
494 + spacewire_stats.packets_sent;
497 + spacewire_stats.packets_sent;
495 spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err
498 spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err
496 + spacewire_stats.parity_err;
499 + spacewire_stats.parity_err;
497 spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err
500 spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err
498 + spacewire_stats.disconnect_err;
501 + spacewire_stats.disconnect_err;
499 spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err
502 spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err
500 + spacewire_stats.escape_err;
503 + spacewire_stats.escape_err;
501 spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err
504 spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err
502 + spacewire_stats.credit_err;
505 + spacewire_stats.credit_err;
503 spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err
506 spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err
504 + spacewire_stats.write_sync_err;
507 + spacewire_stats.write_sync_err;
505 spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err
508 spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err
506 + spacewire_stats.rx_rmap_header_crc_err;
509 + spacewire_stats.rx_rmap_header_crc_err;
507 spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err
510 spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err
508 + spacewire_stats.rx_rmap_data_crc_err;
511 + spacewire_stats.rx_rmap_data_crc_err;
509 spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep
512 spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep
510 + spacewire_stats.early_ep;
513 + spacewire_stats.early_ep;
511 spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address
514 spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address
512 + spacewire_stats.invalid_address;
515 + spacewire_stats.invalid_address;
513 spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err
516 spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err
514 + spacewire_stats.rx_eep_err;
517 + spacewire_stats.rx_eep_err;
515 spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated
518 spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated
516 + spacewire_stats.rx_truncated;
519 + spacewire_stats.rx_truncated;
517 }
520 }
518
521
519 void spacewire_update_statistics( void )
522 void spacewire_update_statistics( void )
520 {
523 {
521 rtems_status_code status;
524 rtems_status_code status;
522 spw_stats spacewire_stats_grspw;
525 spw_stats spacewire_stats_grspw;
523
526
524 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
527 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
525
528
526 spacewire_stats.packets_received = spacewire_stats_backup.packets_received
529 spacewire_stats.packets_received = spacewire_stats_backup.packets_received
527 + spacewire_stats_grspw.packets_received;
530 + spacewire_stats_grspw.packets_received;
528 spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent
531 spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent
529 + spacewire_stats_grspw.packets_sent;
532 + spacewire_stats_grspw.packets_sent;
530 spacewire_stats.parity_err = spacewire_stats_backup.parity_err
533 spacewire_stats.parity_err = spacewire_stats_backup.parity_err
531 + spacewire_stats_grspw.parity_err;
534 + spacewire_stats_grspw.parity_err;
532 spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err
535 spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err
533 + spacewire_stats_grspw.disconnect_err;
536 + spacewire_stats_grspw.disconnect_err;
534 spacewire_stats.escape_err = spacewire_stats_backup.escape_err
537 spacewire_stats.escape_err = spacewire_stats_backup.escape_err
535 + spacewire_stats_grspw.escape_err;
538 + spacewire_stats_grspw.escape_err;
536 spacewire_stats.credit_err = spacewire_stats_backup.credit_err
539 spacewire_stats.credit_err = spacewire_stats_backup.credit_err
537 + spacewire_stats_grspw.credit_err;
540 + spacewire_stats_grspw.credit_err;
538 spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err
541 spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err
539 + spacewire_stats_grspw.write_sync_err;
542 + spacewire_stats_grspw.write_sync_err;
540 spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err
543 spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err
541 + spacewire_stats_grspw.rx_rmap_header_crc_err;
544 + spacewire_stats_grspw.rx_rmap_header_crc_err;
542 spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err
545 spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err
543 + spacewire_stats_grspw.rx_rmap_data_crc_err;
546 + spacewire_stats_grspw.rx_rmap_data_crc_err;
544 spacewire_stats.early_ep = spacewire_stats_backup.early_ep
547 spacewire_stats.early_ep = spacewire_stats_backup.early_ep
545 + spacewire_stats_grspw.early_ep;
548 + spacewire_stats_grspw.early_ep;
546 spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address
549 spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address
547 + spacewire_stats_grspw.invalid_address;
550 + spacewire_stats_grspw.invalid_address;
548 spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err
551 spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err
549 + spacewire_stats_grspw.rx_eep_err;
552 + spacewire_stats_grspw.rx_eep_err;
550 spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated
553 spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated
551 + spacewire_stats_grspw.rx_truncated;
554 + spacewire_stats_grspw.rx_truncated;
552 //spacewire_stats.tx_link_err;
555 //spacewire_stats.tx_link_err;
553
556
554 //****************************
557 //****************************
555 // DPU_SPACEWIRE_IF_STATISTICS
558 // DPU_SPACEWIRE_IF_STATISTICS
556 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8);
559 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8);
557 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received);
560 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received);
558 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8);
561 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8);
559 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent);
562 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent);
560 //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt;
563 //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt;
561 //housekeeping_packet.hk_lfr_dpu_spw_last_timc;
564 //housekeeping_packet.hk_lfr_dpu_spw_last_timc;
562
565
563 //******************************************
566 //******************************************
564 // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY
567 // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY
565 housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err;
568 housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err;
566 housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err;
569 housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err;
567 housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err;
570 housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err;
568 housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err;
571 housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err;
569 housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err;
572 housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err;
570 // housekeeping_packet.hk_lfr_dpu_spw_rx_ahb;
573 // housekeeping_packet.hk_lfr_dpu_spw_rx_ahb;
571 // housekeeping_packet.hk_lfr_dpu_spw_tx_ahb;
574 // housekeeping_packet.hk_lfr_dpu_spw_tx_ahb;
572 housekeeping_packet.hk_lfr_dpu_spw_header_crc = (unsigned char) spacewire_stats.rx_rmap_header_crc_err;
575 housekeeping_packet.hk_lfr_dpu_spw_header_crc = (unsigned char) spacewire_stats.rx_rmap_header_crc_err;
573 housekeeping_packet.hk_lfr_dpu_spw_data_crc = (unsigned char) spacewire_stats.rx_rmap_data_crc_err;
576 housekeeping_packet.hk_lfr_dpu_spw_data_crc = (unsigned char) spacewire_stats.rx_rmap_data_crc_err;
574
577
575 //*********************************************
578 //*********************************************
576 // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY
579 // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY
577 housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep;
580 housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep;
578 housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address;
581 housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address;
579 housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err;
582 housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err;
580 housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated;
583 housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated;
581
584
582 }
585 }
583
586
584 void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc )
587 void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc )
585 {
588 {
586 //if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) {
589 //if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) {
587 // printf("In timecode_irq_handler *** Error sending event to DUMB\n");
590 // printf("In timecode_irq_handler *** Error sending event to DUMB\n");
588 //}
591 //}
589 }
592 }
590
593
591 rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data )
594 rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data )
592 {
595 {
593 int linkStatus;
596 int linkStatus;
594 rtems_status_code status;
597 rtems_status_code status;
595
598
596 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
599 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
597
600
598 if ( linkStatus == 5) {
601 if ( linkStatus == 5) {
599 PRINTF("in spacewire_reset_link *** link is running\n")
602 PRINTF("in spacewire_reset_link *** link is running\n")
600 status = RTEMS_SUCCESSFUL;
603 status = RTEMS_SUCCESSFUL;
601 }
604 }
602 }
605 }
606
607 rtems_status_code rtems_message_queue_send_lfr( rtems_id id, const void *buffer, size_t size )
608 {
609 rtems_status_code status;
610 rtems_mode previous_mode_set;
611
612 // set the preemption OFF
613 status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &previous_mode_set );
614
615 // use the message queue
616 status = rtems_message_queue_send_lfr( id, buffer, size );
617
618 // set the preemption ON
619 status = rtems_task_mode( RTEMS_PREEMPT , RTEMS_PREEMPT_MASK, &previous_mode_set );
620
621 return status;
622 }
623
@@ -1,448 +1,449
1 /** Functions to load and dump parameters in the LFR registers.
1 /** Functions to load and dump parameters in the LFR registers.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to handle TC related to parameter loading and dumping.\n
6 * A group of functions to handle TC related to parameter loading and dumping.\n
7 * TC_LFR_LOAD_COMMON_PAR\n
7 * TC_LFR_LOAD_COMMON_PAR\n
8 * TC_LFR_LOAD_NORMAL_PAR\n
8 * TC_LFR_LOAD_NORMAL_PAR\n
9 * TC_LFR_LOAD_BURST_PAR\n
9 * TC_LFR_LOAD_BURST_PAR\n
10 * TC_LFR_LOAD_SBM1_PAR\n
10 * TC_LFR_LOAD_SBM1_PAR\n
11 * TC_LFR_LOAD_SBM2_PAR\n
11 * TC_LFR_LOAD_SBM2_PAR\n
12 *
12 *
13 */
13 */
14
14
15 #include "tc_load_dump_parameters.h"
15 #include "tc_load_dump_parameters.h"
16
16
17 int action_load_common_par(ccsdsTelecommandPacket_t *TC)
17 int action_load_common_par(ccsdsTelecommandPacket_t *TC)
18 {
18 {
19 /** This function updates the LFR registers with the incoming common parameters.
19 /** This function updates the LFR registers with the incoming common parameters.
20 *
20 *
21 * @param TC points to the TeleCommand packet that is being processed
21 * @param TC points to the TeleCommand packet that is being processed
22 *
22 *
23 *
23 *
24 */
24 */
25
25
26 parameter_dump_packet.unused0 = TC->dataAndCRC[0];
26 parameter_dump_packet.unused0 = TC->dataAndCRC[0];
27 parameter_dump_packet.bw_sp0_sp1_r0_r1 = TC->dataAndCRC[1];
27 parameter_dump_packet.bw_sp0_sp1_r0_r1 = TC->dataAndCRC[1];
28 set_wfp_data_shaping(parameter_dump_packet.bw_sp0_sp1_r0_r1);
28 set_wfp_data_shaping(parameter_dump_packet.bw_sp0_sp1_r0_r1);
29 return LFR_SUCCESSFUL;
29 return LFR_SUCCESSFUL;
30 }
30 }
31
31
32 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
32 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
33 {
33 {
34 /** This function updates the LFR registers with the incoming normal parameters.
34 /** This function updates the LFR registers with the incoming normal parameters.
35 *
35 *
36 * @param TC points to the TeleCommand packet that is being processed
36 * @param TC points to the TeleCommand packet that is being processed
37 * @param queue_id is the id of the queue which handles TM related to this execution step
37 * @param queue_id is the id of the queue which handles TM related to this execution step
38 *
38 *
39 */
39 */
40
40
41 int result;
41 int result;
42 int flag;
42 int flag;
43
43
44 flag = LFR_SUCCESSFUL;
44 flag = LFR_SUCCESSFUL;
45 result = LFR_SUCCESSFUL;
45 result = LFR_SUCCESSFUL;
46
46
47 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
47 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
48 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
48 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
49 flag = LFR_DEFAULT;
49 flag = LFR_DEFAULT;
50 }
50 }
51
51
52 //***************
52 //***************
53 // sy_lfr_n_swf_l
53 // sy_lfr_n_swf_l
54 if (flag == LFR_SUCCESSFUL)
54 if (flag == LFR_SUCCESSFUL)
55 {
55 {
56 result = set_sy_lfr_n_swf_l( TC, queue_id );
56 result = set_sy_lfr_n_swf_l( TC, queue_id );
57 if (result != LFR_SUCCESSFUL)
57 if (result != LFR_SUCCESSFUL)
58 {
58 {
59 flag = LFR_DEFAULT;
59 flag = LFR_DEFAULT;
60 }
60 }
61 }
61 }
62
62
63 //***************
63 //***************
64 // sy_lfr_n_swf_p
64 // sy_lfr_n_swf_p
65 if (flag == LFR_SUCCESSFUL)
65 if (flag == LFR_SUCCESSFUL)
66 {
66 {
67 result = set_sy_lfr_n_swf_p( TC, queue_id );
67 result = set_sy_lfr_n_swf_p( TC, queue_id );
68 if (result != LFR_SUCCESSFUL)
68 if (result != LFR_SUCCESSFUL)
69 {
69 {
70 flag = LFR_DEFAULT;
70 flag = LFR_DEFAULT;
71 }
71 }
72 }
72 }
73
73
74 //***************
74 //***************
75 // SY_LFR_N_ASM_P
75 // SY_LFR_N_ASM_P
76 if (flag == LFR_SUCCESSFUL)
76 if (flag == LFR_SUCCESSFUL)
77 {
77 {
78 result = set_sy_lfr_n_asm_p( TC, queue_id );
78 result = set_sy_lfr_n_asm_p( TC, queue_id );
79 if (result != LFR_SUCCESSFUL)
79 if (result != LFR_SUCCESSFUL)
80 {
80 {
81 flag = LFR_DEFAULT;
81 flag = LFR_DEFAULT;
82 }
82 }
83 }
83 }
84
84
85 //***************
85 //***************
86 // SY_LFR_N_BP_P0
86 // SY_LFR_N_BP_P0
87 if (flag == LFR_SUCCESSFUL)
87 if (flag == LFR_SUCCESSFUL)
88 {
88 {
89 result = set_sy_lfr_n_bp_p0( TC, queue_id );
89 result = set_sy_lfr_n_bp_p0( TC, queue_id );
90 if (result != LFR_SUCCESSFUL)
90 if (result != LFR_SUCCESSFUL)
91 {
91 {
92 flag = LFR_DEFAULT;
92 flag = LFR_DEFAULT;
93 }
93 }
94 }
94 }
95
95
96 //***************
96 //***************
97 // sy_lfr_n_bp_p1
97 // sy_lfr_n_bp_p1
98 if (flag == LFR_SUCCESSFUL)
98 if (flag == LFR_SUCCESSFUL)
99 {
99 {
100 result = set_sy_lfr_n_bp_p1( TC, queue_id );
100 result = set_sy_lfr_n_bp_p1( TC, queue_id );
101 if (result != LFR_SUCCESSFUL)
101 if (result != LFR_SUCCESSFUL)
102 {
102 {
103 flag = LFR_DEFAULT;
103 flag = LFR_DEFAULT;
104 }
104 }
105 }
105 }
106
106
107 return result;
107 return result;
108 }
108 }
109
109
110 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
110 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
111 {
111 {
112 /** This function updates the LFR registers with the incoming burst parameters.
112 /** This function updates the LFR registers with the incoming burst parameters.
113 *
113 *
114 * @param TC points to the TeleCommand packet that is being processed
114 * @param TC points to the TeleCommand packet that is being processed
115 * @param queue_id is the id of the queue which handles TM related to this execution step
115 * @param queue_id is the id of the queue which handles TM related to this execution step
116 *
116 *
117 */
117 */
118
118
119 int result;
119 int result;
120 unsigned char lfrMode;
120 unsigned char lfrMode;
121
121
122 result = LFR_DEFAULT;
122 result = LFR_DEFAULT;
123 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
123 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
124
124
125 if ( lfrMode == LFR_MODE_BURST ) {
125 if ( lfrMode == LFR_MODE_BURST ) {
126 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
126 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
127 result = LFR_DEFAULT;
127 result = LFR_DEFAULT;
128 }
128 }
129 else {
129 else {
130 parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[0];
130 parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[0];
131 parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[1];
131 parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[1];
132
132
133 result = LFR_SUCCESSFUL;
133 result = LFR_SUCCESSFUL;
134 }
134 }
135
135
136 return result;
136 return result;
137 }
137 }
138
138
139 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
139 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
140 {
140 {
141 /** This function updates the LFR registers with the incoming sbm1 parameters.
141 /** This function updates the LFR registers with the incoming sbm1 parameters.
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 related to this execution step
144 * @param queue_id is the id of the queue which handles TM related to this execution step
145 *
145 *
146 */
146 */
147 int result;
147 int result;
148 unsigned char lfrMode;
148 unsigned char lfrMode;
149
149
150 result = LFR_DEFAULT;
150 result = LFR_DEFAULT;
151 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
151 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
152
152
153 if ( (lfrMode == LFR_MODE_SBM1) || (lfrMode == LFR_MODE_SBM2) ) {
153 if ( (lfrMode == LFR_MODE_SBM1) || (lfrMode == LFR_MODE_SBM2) ) {
154 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
154 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
155 result = LFR_DEFAULT;
155 result = LFR_DEFAULT;
156 }
156 }
157 else {
157 else {
158 parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[0];
158 parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[0];
159 parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[1];
159 parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[1];
160
160
161 result = LFR_SUCCESSFUL;
161 result = LFR_SUCCESSFUL;
162 }
162 }
163
163
164 return result;
164 return result;
165 }
165 }
166
166
167 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
167 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
168 {
168 {
169 /** This function updates the LFR registers with the incoming sbm2 parameters.
169 /** This function updates the LFR registers with the incoming sbm2 parameters.
170 *
170 *
171 * @param TC points to the TeleCommand packet that is being processed
171 * @param TC points to the TeleCommand packet that is being processed
172 * @param queue_id is the id of the queue which handles TM related to this execution step
172 * @param queue_id is the id of the queue which handles TM related to this execution step
173 *
173 *
174 */
174 */
175
175
176 int result;
176 int result;
177 unsigned char lfrMode;
177 unsigned char lfrMode;
178
178
179 result = LFR_DEFAULT;
179 result = LFR_DEFAULT;
180 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
180 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
181
181
182 if ( (lfrMode == LFR_MODE_SBM2) || (lfrMode == LFR_MODE_SBM2) ) {
182 if ( (lfrMode == LFR_MODE_SBM2) || (lfrMode == LFR_MODE_SBM2) ) {
183 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
183 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
184 result = LFR_DEFAULT;
184 result = LFR_DEFAULT;
185 }
185 }
186 else {
186 else {
187 parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[0];
187 parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[0];
188 parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[1];
188 parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[1];
189
189
190 result = LFR_SUCCESSFUL;
190 result = LFR_SUCCESSFUL;
191 }
191 }
192
192
193 return result;
193 return result;
194 }
194 }
195
195
196 int action_dump_par( rtems_id queue_id )
196 int action_dump_par( rtems_id queue_id )
197 {
197 {
198 /** This function dumps the LFR parameters by sending the appropriate TM packet to the dedicated RTEMS message queue.
198 /** This function dumps the LFR parameters by sending the appropriate TM packet to the dedicated RTEMS message queue.
199 *
199 *
200 * @param queue_id is the id of the queue which handles TM related to this execution step.
200 * @param queue_id is the id of the queue which handles TM related to this execution step.
201 *
201 *
202 * @return RTEMS directive status codes:
202 * @return RTEMS directive status codes:
203 * - RTEMS_SUCCESSFUL - message sent successfully
203 * - RTEMS_SUCCESSFUL - message sent successfully
204 * - RTEMS_INVALID_ID - invalid queue id
204 * - RTEMS_INVALID_ID - invalid queue id
205 * - RTEMS_INVALID_SIZE - invalid message size
205 * - RTEMS_INVALID_SIZE - invalid message size
206 * - RTEMS_INVALID_ADDRESS - buffer is NULL
206 * - RTEMS_INVALID_ADDRESS - buffer is NULL
207 * - RTEMS_UNSATISFIED - out of message buffers
207 * - RTEMS_UNSATISFIED - out of message buffers
208 * - RTEMS_TOO_MANY - queue s limit has been reached
208 * - RTEMS_TOO_MANY - queue s limit has been reached
209 *
209 *
210 */
210 */
211
211
212 int status;
212 int status;
213
213
214 // UPDATE TIME
214 // UPDATE TIME
215 increment_seq_counter( parameter_dump_packet.packetSequenceControl );
215 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
216 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
216 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
217 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
217 parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
218 parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
218 parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
219 parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
219 parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
220 parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
220 parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
221 parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
221 // SEND DATA
222 // SEND DATA
222 status = rtems_message_queue_send( queue_id, &parameter_dump_packet,
223 status = rtems_message_queue_send( queue_id, &parameter_dump_packet,
223 PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
224 PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
224 if (status != RTEMS_SUCCESSFUL) {
225 if (status != RTEMS_SUCCESSFUL) {
225 PRINTF1("in action_dump *** ERR sending packet, code %d", status)
226 PRINTF1("in action_dump *** ERR sending packet, code %d", status)
226 }
227 }
227
228
228 return status;
229 return status;
229 }
230 }
230
231
231 //***********************
232 //***********************
232 // NORMAL MODE PARAMETERS
233 // NORMAL MODE PARAMETERS
233
234
234 int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
235 int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
235 {
236 {
236 /** This function sets the number of points of a snapshot (sy_lfr_n_swf_l).
237 /** This function sets the number of points of a snapshot (sy_lfr_n_swf_l).
237 *
238 *
238 * @param TC points to the TeleCommand packet that is being processed
239 * @param TC points to the TeleCommand packet that is being processed
239 * @param queue_id is the id of the queue which handles TM related to this execution step
240 * @param queue_id is the id of the queue which handles TM related to this execution step
240 *
241 *
241 */
242 */
242
243
243 unsigned int tmp;
244 unsigned int tmp;
244 int result;
245 int result;
245 unsigned char msb;
246 unsigned char msb;
246 unsigned char lsb;
247 unsigned char lsb;
247
248
248 msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L ];
249 msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L ];
249 lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L+1 ];
250 lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L+1 ];
250
251
251 tmp = ( unsigned int ) floor(
252 tmp = ( unsigned int ) floor(
252 ( ( msb*256 ) + lsb ) / 16
253 ( ( msb*256 ) + lsb ) / 16
253 ) * 16;
254 ) * 16;
254
255
255 if ( (tmp < 16) || (tmp > 2048) ) // the snapshot period is a multiple of 16
256 if ( (tmp < 16) || (tmp > 2048) ) // the snapshot period is a multiple of 16
256 { // 2048 is the maximum limit due to the size of the buffers
257 { // 2048 is the maximum limit due to the size of the buffers
257 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_L+10, lsb );
258 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_L+10, lsb );
258 result = WRONG_APP_DATA;
259 result = WRONG_APP_DATA;
259 }
260 }
260 else if (tmp != 2048)
261 else if (tmp != 2048)
261 {
262 {
262 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
263 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
263 result = FUNCT_NOT_IMPL;
264 result = FUNCT_NOT_IMPL;
264 }
265 }
265 else
266 else
266 {
267 {
267 parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (tmp >> 8);
268 parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (tmp >> 8);
268 parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (tmp );
269 parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (tmp );
269 result = LFR_SUCCESSFUL;
270 result = LFR_SUCCESSFUL;
270 }
271 }
271
272
272 return result;
273 return result;
273 }
274 }
274
275
275 int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
276 int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
276 {
277 {
277 /** This function sets the time between two snapshots, in s (sy_lfr_n_swf_p).
278 /** This function sets the time between two snapshots, in s (sy_lfr_n_swf_p).
278 *
279 *
279 * @param TC points to the TeleCommand packet that is being processed
280 * @param TC points to the TeleCommand packet that is being processed
280 * @param queue_id is the id of the queue which handles TM related to this execution step
281 * @param queue_id is the id of the queue which handles TM related to this execution step
281 *
282 *
282 */
283 */
283
284
284 unsigned int tmp;
285 unsigned int tmp;
285 int result;
286 int result;
286 unsigned char msb;
287 unsigned char msb;
287 unsigned char lsb;
288 unsigned char lsb;
288
289
289 msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P ];
290 msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P ];
290 lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P+1 ];
291 lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P+1 ];
291
292
292 tmp = ( unsigned int ) floor(
293 tmp = ( unsigned int ) floor(
293 ( ( msb*256 ) + lsb ) / 8
294 ( ( msb*256 ) + lsb ) / 8
294 ) * 8;
295 ) * 8;
295
296
296 if ( (tmp < 16) || (tmp > 65528) )
297 if ( (tmp < 16) || (tmp > 65528) )
297 {
298 {
298 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_P+10, lsb );
299 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_P+10, lsb );
299 result = WRONG_APP_DATA;
300 result = WRONG_APP_DATA;
300 }
301 }
301 else
302 else
302 {
303 {
303 parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8);
304 parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8);
304 parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp );
305 parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp );
305 result = LFR_SUCCESSFUL;
306 result = LFR_SUCCESSFUL;
306 }
307 }
307
308
308 return result;
309 return result;
309 }
310 }
310
311
311 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
312 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
312 {
313 {
313 /** This function sets the time between two full spectral matrices transmission, in s (SY_LFR_N_ASM_P).
314 /** This function sets the time between two full spectral matrices transmission, in s (SY_LFR_N_ASM_P).
314 *
315 *
315 * @param TC points to the TeleCommand packet that is being processed
316 * @param TC points to the TeleCommand packet that is being processed
316 * @param queue_id is the id of the queue which handles TM related to this execution step
317 * @param queue_id is the id of the queue which handles TM related to this execution step
317 *
318 *
318 */
319 */
319
320
320 int result;
321 int result;
321 unsigned char msb;
322 unsigned char msb;
322 unsigned char lsb;
323 unsigned char lsb;
323
324
324 msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P ];
325 msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P ];
325 lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P+1 ];
326 lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P+1 ];
326
327
327 parameter_dump_packet.sy_lfr_n_asm_p[0] = msb;
328 parameter_dump_packet.sy_lfr_n_asm_p[0] = msb;
328 parameter_dump_packet.sy_lfr_n_asm_p[1] = lsb;
329 parameter_dump_packet.sy_lfr_n_asm_p[1] = lsb;
329 result = LFR_SUCCESSFUL;
330 result = LFR_SUCCESSFUL;
330
331
331 return result;
332 return result;
332 }
333 }
333
334
334 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
335 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
335 {
336 {
336 /** This function sets the time between two basic parameter sets, in s (SY_LFR_N_BP_P0).
337 /** This function sets the time between two basic parameter sets, in s (SY_LFR_N_BP_P0).
337 *
338 *
338 * @param TC points to the TeleCommand packet that is being processed
339 * @param TC points to the TeleCommand packet that is being processed
339 * @param queue_id is the id of the queue which handles TM related to this execution step
340 * @param queue_id is the id of the queue which handles TM related to this execution step
340 *
341 *
341 */
342 */
342
343
343 int status;
344 int status;
344
345
345 status = LFR_SUCCESSFUL;
346 status = LFR_SUCCESSFUL;
346
347
347 parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P0 ];
348 parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P0 ];
348
349
349 return status;
350 return status;
350 }
351 }
351
352
352 int set_sy_lfr_n_bp_p1(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
353 int set_sy_lfr_n_bp_p1(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
353 {
354 {
354 /** This function sets the time between two basic parameter sets (autocorrelation + crosscorrelation), in s (sy_lfr_n_bp_p1).
355 /** This function sets the time between two basic parameter sets (autocorrelation + crosscorrelation), in s (sy_lfr_n_bp_p1).
355 *
356 *
356 * @param TC points to the TeleCommand packet that is being processed
357 * @param TC points to the TeleCommand packet that is being processed
357 * @param queue_id is the id of the queue which handles TM related to this execution step
358 * @param queue_id is the id of the queue which handles TM related to this execution step
358 *
359 *
359 */
360 */
360
361
361 int status;
362 int status;
362
363
363 status = LFR_SUCCESSFUL;
364 status = LFR_SUCCESSFUL;
364
365
365 parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P1 ];
366 parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P1 ];
366
367
367 return status;
368 return status;
368 }
369 }
369
370
370 //**********************
371 //**********************
371 // BURST MODE PARAMETERS
372 // BURST MODE PARAMETERS
372
373
373 //*********************
374 //*********************
374 // SBM1 MODE PARAMETERS
375 // SBM1 MODE PARAMETERS
375
376
376 //*********************
377 //*********************
377 // SBM2 MODE PARAMETERS
378 // SBM2 MODE PARAMETERS
378
379
379 //**********
380 //**********
380 // init dump
381 // init dump
381
382
382 void init_parameter_dump( void )
383 void init_parameter_dump( void )
383 {
384 {
384 /** This function initialize the parameter_dump_packet global variable with default values.
385 /** This function initialize the parameter_dump_packet global variable with default values.
385 *
386 *
386 */
387 */
387
388
388 parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
389 parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
389 parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
390 parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
390 parameter_dump_packet.reserved = CCSDS_RESERVED;
391 parameter_dump_packet.reserved = CCSDS_RESERVED;
391 parameter_dump_packet.userApplication = CCSDS_USER_APP;
392 parameter_dump_packet.userApplication = CCSDS_USER_APP;
392 parameter_dump_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_PARAMETER_DUMP >> 8);
393 parameter_dump_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_PARAMETER_DUMP >> 8);
393 parameter_dump_packet.packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP;
394 parameter_dump_packet.packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP;
394 parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
395 parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
395 parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
396 parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
396 parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8);
397 parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8);
397 parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP;
398 parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP;
398 // DATA FIELD HEADER
399 // DATA FIELD HEADER
399 parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2;
400 parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2;
400 parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP;
401 parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP;
401 parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP;
402 parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP;
402 parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND;
403 parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND;
403 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
404 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
404 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
405 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
405 parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
406 parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
406 parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
407 parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
407 parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
408 parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
408 parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
409 parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
409 parameter_dump_packet.sid = SID_PARAMETER_DUMP;
410 parameter_dump_packet.sid = SID_PARAMETER_DUMP;
410
411
411 //******************
412 //******************
412 // COMMON PARAMETERS
413 // COMMON PARAMETERS
413 parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0;
414 parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0;
414 parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1;
415 parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1;
415
416
416 //******************
417 //******************
417 // NORMAL PARAMETERS
418 // NORMAL PARAMETERS
418 parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (SY_LFR_N_SWF_L >> 8);
419 parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (SY_LFR_N_SWF_L >> 8);
419 parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (SY_LFR_N_SWF_L );
420 parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (SY_LFR_N_SWF_L );
420 parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (SY_LFR_N_SWF_P >> 8);
421 parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (SY_LFR_N_SWF_P >> 8);
421 parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (SY_LFR_N_SWF_P );
422 parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (SY_LFR_N_SWF_P );
422 parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (SY_LFR_N_ASM_P >> 8);
423 parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (SY_LFR_N_ASM_P >> 8);
423 parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (SY_LFR_N_ASM_P );
424 parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (SY_LFR_N_ASM_P );
424 parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) SY_LFR_N_BP_P0;
425 parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) SY_LFR_N_BP_P0;
425 parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) SY_LFR_N_BP_P1;
426 parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) SY_LFR_N_BP_P1;
426
427
427 //*****************
428 //*****************
428 // BURST PARAMETERS
429 // BURST PARAMETERS
429 parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0;
430 parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0;
430 parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1;
431 parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1;
431
432
432 //****************
433 //****************
433 // SBM1 PARAMETERS
434 // SBM1 PARAMETERS
434 parameter_dump_packet.sy_lfr_s1_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P0; // min value is 0.25 s for the period
435 parameter_dump_packet.sy_lfr_s1_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P0; // min value is 0.25 s for the period
435 parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1;
436 parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1;
436
437
437 //****************
438 //****************
438 // SBM2 PARAMETERS
439 // SBM2 PARAMETERS
439 parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0;
440 parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0;
440 parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1;
441 parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1;
441 }
442 }
442
443
443
444
444
445
445
446
446
447
447
448
448
449
@@ -1,419 +1,490
1 /** Functions to send TM packets related to TC parsing and execution.
1 /** Functions to send TM packets related to TC parsing and execution.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to send appropriate TM packets after parsing and execution:
6 * A group of functions to send appropriate TM packets after parsing and execution:
7 * - TM_LFR_TC_EXE_SUCCESS
7 * - TM_LFR_TC_EXE_SUCCESS
8 * - TM_LFR_TC_EXE_INCONSISTENT
8 * - TM_LFR_TC_EXE_INCONSISTENT
9 * - TM_LFR_TC_EXE_NOT_EXECUTABLE
9 * - TM_LFR_TC_EXE_NOT_EXECUTABLE
10 * - TM_LFR_TC_EXE_NOT_IMPLEMENTED
10 * - TM_LFR_TC_EXE_NOT_IMPLEMENTED
11 * - TM_LFR_TC_EXE_ERROR
11 * - TM_LFR_TC_EXE_ERROR
12 * - TM_LFR_TC_EXE_CORRUPTED
12 * - TM_LFR_TC_EXE_CORRUPTED
13 *
13 *
14 */
14 */
15
15
16 #include "tm_lfr_tc_exe.h"
16 #include "tm_lfr_tc_exe.h"
17
17
18 int send_tm_lfr_tc_exe_success( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
18 int send_tm_lfr_tc_exe_success( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
19 {
19 {
20 /** This function sends a TM_LFR_TC_EXE_SUCCESS packet in the dedicated RTEMS message queue.
20 /** This function sends a TM_LFR_TC_EXE_SUCCESS packet in the dedicated RTEMS message queue.
21 *
21 *
22 * @param TC points to the TeleCommand packet that is being processed
22 * @param TC points to the TeleCommand packet that is being processed
23 * @param queue_id is the id of the queue which handles TM
23 * @param queue_id is the id of the queue which handles TM
24 *
24 *
25 * @return RTEMS directive status code:
25 * @return RTEMS directive status code:
26 * - RTEMS_SUCCESSFUL - message sent successfully
26 * - RTEMS_SUCCESSFUL - message sent successfully
27 * - RTEMS_INVALID_ID - invalid queue id
27 * - RTEMS_INVALID_ID - invalid queue id
28 * - RTEMS_INVALID_SIZE - invalid message size
28 * - RTEMS_INVALID_SIZE - invalid message size
29 * - RTEMS_INVALID_ADDRESS - buffer is NULL
29 * - RTEMS_INVALID_ADDRESS - buffer is NULL
30 * - RTEMS_UNSATISFIED - out of message buffers
30 * - RTEMS_UNSATISFIED - out of message buffers
31 * - RTEMS_TOO_MANY - queue s limit has been reached
31 * - RTEMS_TOO_MANY - queue s limit has been reached
32 *
32 *
33 */
33 */
34
34
35 rtems_status_code status;
35 rtems_status_code status;
36 Packet_TM_LFR_TC_EXE_SUCCESS_t TM;
36 Packet_TM_LFR_TC_EXE_SUCCESS_t TM;
37 unsigned char messageSize;
37 unsigned char messageSize;
38
38
39 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
39 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
40 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
40 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
41 TM.reserved = DEFAULT_RESERVED;
41 TM.reserved = DEFAULT_RESERVED;
42 TM.userApplication = CCSDS_USER_APP;
42 TM.userApplication = CCSDS_USER_APP;
43 // PACKET HEADER
43 // PACKET HEADER
44 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
44 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
45 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
45 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
46 TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
46 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
47 TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
48 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8);
47 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8);
49 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS );
48 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS );
50 // DATA FIELD HEADER
49 // DATA FIELD HEADER
51 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
50 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
52 TM.serviceType = TM_TYPE_TC_EXE;
51 TM.serviceType = TM_TYPE_TC_EXE;
53 TM.serviceSubType = TM_SUBTYPE_EXE_OK;
52 TM.serviceSubType = TM_SUBTYPE_EXE_OK;
54 TM.destinationID = TC->sourceID;
53 TM.destinationID = TC->sourceID;
55 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
54 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
56 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
55 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
57 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
56 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
58 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
57 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
59 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
58 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
60 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
59 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
61 //
60 //
62 TM.telecommand_pkt_id[0] = TC->packetID[0];
61 TM.telecommand_pkt_id[0] = TC->packetID[0];
63 TM.telecommand_pkt_id[1] = TC->packetID[1];
62 TM.telecommand_pkt_id[1] = TC->packetID[1];
64 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
63 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
65 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
64 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
66
65
67 messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
66 messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
68
67
69 // SEND DATA
68 // SEND DATA
70 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
69 status = rtems_message_queue_send( queue_id, &TM, messageSize);
71 if (status != RTEMS_SUCCESSFUL) {
70 if (status != RTEMS_SUCCESSFUL) {
72 PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n")
71 PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n")
73 }
72 }
74
73
75 return status;
74 return status;
76 }
75 }
77
76
78 int send_tm_lfr_tc_exe_inconsistent( ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
77 int send_tm_lfr_tc_exe_inconsistent( ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
79 unsigned char byte_position, unsigned char rcv_value )
78 unsigned char byte_position, unsigned char rcv_value )
80 {
79 {
81 /** This function sends a TM_LFR_TC_EXE_INCONSISTENT packet in the dedicated RTEMS message queue.
80 /** This function sends a TM_LFR_TC_EXE_INCONSISTENT packet in the dedicated RTEMS message queue.
82 *
81 *
83 * @param TC points to the TeleCommand packet that is being processed
82 * @param TC points to the TeleCommand packet that is being processed
84 * @param queue_id is the id of the queue which handles TM
83 * @param queue_id is the id of the queue which handles TM
85 * @param byte_position is the byte position of the MSB of the parameter that has been seen as inconsistent
84 * @param byte_position is the byte position of the MSB of the parameter that has been seen as inconsistent
86 * @param rcv_value is the value of the LSB of the parameter that has been deteced as inconsistent
85 * @param rcv_value is the value of the LSB of the parameter that has been deteced as inconsistent
87 *
86 *
88 * @return RTEMS directive status code:
87 * @return RTEMS directive status code:
89 * - RTEMS_SUCCESSFUL - message sent successfully
88 * - RTEMS_SUCCESSFUL - message sent successfully
90 * - RTEMS_INVALID_ID - invalid queue id
89 * - RTEMS_INVALID_ID - invalid queue id
91 * - RTEMS_INVALID_SIZE - invalid message size
90 * - RTEMS_INVALID_SIZE - invalid message size
92 * - RTEMS_INVALID_ADDRESS - buffer is NULL
91 * - RTEMS_INVALID_ADDRESS - buffer is NULL
93 * - RTEMS_UNSATISFIED - out of message buffers
92 * - RTEMS_UNSATISFIED - out of message buffers
94 * - RTEMS_TOO_MANY - queue s limit has been reached
93 * - RTEMS_TOO_MANY - queue s limit has been reached
95 *
94 *
96 */
95 */
97
96
98 rtems_status_code status;
97 rtems_status_code status;
99 Packet_TM_LFR_TC_EXE_INCONSISTENT_t TM;
98 Packet_TM_LFR_TC_EXE_INCONSISTENT_t TM;
100 unsigned char messageSize;
99 unsigned char messageSize;
101
100
102 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
101 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
103 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
102 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
104 TM.reserved = DEFAULT_RESERVED;
103 TM.reserved = DEFAULT_RESERVED;
105 TM.userApplication = CCSDS_USER_APP;
104 TM.userApplication = CCSDS_USER_APP;
106 // PACKET HEADER
105 // PACKET HEADER
107 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
106 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
108 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
107 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
109 TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
108 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
110 TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
111 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8);
109 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8);
112 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT );
110 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT );
113 // DATA FIELD HEADER
111 // DATA FIELD HEADER
114 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
112 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
115 TM.serviceType = TM_TYPE_TC_EXE;
113 TM.serviceType = TM_TYPE_TC_EXE;
116 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
114 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
117 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
115 TM.destinationID = TC->sourceID;
118 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
116 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
119 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
117 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
120 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
118 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
121 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
119 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
122 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
120 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
123 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
121 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
124 //
122 //
125 TM.tc_failure_code[0] = (char) (WRONG_APP_DATA >> 8);
123 TM.tc_failure_code[0] = (char) (WRONG_APP_DATA >> 8);
126 TM.tc_failure_code[1] = (char) (WRONG_APP_DATA );
124 TM.tc_failure_code[1] = (char) (WRONG_APP_DATA );
127 TM.telecommand_pkt_id[0] = TC->packetID[0];
125 TM.telecommand_pkt_id[0] = TC->packetID[0];
128 TM.telecommand_pkt_id[1] = TC->packetID[1];
126 TM.telecommand_pkt_id[1] = TC->packetID[1];
129 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
127 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
130 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
128 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
131 TM.tc_service = TC->serviceType; // type of the rejected TC
129 TM.tc_service = TC->serviceType; // type of the rejected TC
132 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
130 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
133 TM.byte_position = byte_position;
131 TM.byte_position = byte_position;
134 TM.rcv_value = rcv_value;
132 TM.rcv_value = rcv_value;
135
133
136 messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
134 messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
137
135
138 // SEND DATA
136 // SEND DATA
139 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
137 status = rtems_message_queue_send( queue_id, &TM, messageSize);
140 if (status != RTEMS_SUCCESSFUL) {
138 if (status != RTEMS_SUCCESSFUL) {
141 PRINTF("in send_tm_lfr_tc_exe_inconsistent *** ERR\n")
139 PRINTF("in send_tm_lfr_tc_exe_inconsistent *** ERR\n")
142 }
140 }
143
141
144 return status;
142 return status;
145 }
143 }
146
144
147 int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
145 int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
148 {
146 {
149 /** This function sends a TM_LFR_TC_EXE_NOT_EXECUTABLE packet in the dedicated RTEMS message queue.
147 /** This function sends a TM_LFR_TC_EXE_NOT_EXECUTABLE packet in the dedicated RTEMS message queue.
150 *
148 *
151 * @param TC points to the TeleCommand packet that is being processed
149 * @param TC points to the TeleCommand packet that is being processed
152 * @param queue_id is the id of the queue which handles TM
150 * @param queue_id is the id of the queue which handles TM
153 *
151 *
154 * @return RTEMS directive status code:
152 * @return RTEMS directive status code:
155 * - RTEMS_SUCCESSFUL - message sent successfully
153 * - RTEMS_SUCCESSFUL - message sent successfully
156 * - RTEMS_INVALID_ID - invalid queue id
154 * - RTEMS_INVALID_ID - invalid queue id
157 * - RTEMS_INVALID_SIZE - invalid message size
155 * - RTEMS_INVALID_SIZE - invalid message size
158 * - RTEMS_INVALID_ADDRESS - buffer is NULL
156 * - RTEMS_INVALID_ADDRESS - buffer is NULL
159 * - RTEMS_UNSATISFIED - out of message buffers
157 * - RTEMS_UNSATISFIED - out of message buffers
160 * - RTEMS_TOO_MANY - queue s limit has been reached
158 * - RTEMS_TOO_MANY - queue s limit has been reached
161 *
159 *
162 */
160 */
163
161
164 rtems_status_code status;
162 rtems_status_code status;
165 Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t TM;
163 Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t TM;
166 unsigned char messageSize;
164 unsigned char messageSize;
167
165
168 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
166 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
169 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
167 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
170 TM.reserved = DEFAULT_RESERVED;
168 TM.reserved = DEFAULT_RESERVED;
171 TM.userApplication = CCSDS_USER_APP;
169 TM.userApplication = CCSDS_USER_APP;
172 // PACKET HEADER
170 // PACKET HEADER
173 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
171 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
174 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
172 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
175 TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
173 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
176 TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
177 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8);
174 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8);
178 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE );
175 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE );
179 // DATA FIELD HEADER
176 // DATA FIELD HEADER
180 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
177 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
181 TM.serviceType = TM_TYPE_TC_EXE;
178 TM.serviceType = TM_TYPE_TC_EXE;
182 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
179 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
183 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
180 TM.destinationID = TC->sourceID; // default destination id
184 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
181 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
185 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
182 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
186 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
183 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
187 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
184 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
188 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
185 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
189 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
186 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
190 //
187 //
191 TM.tc_failure_code[0] = (char) (TC_NOT_EXE >> 8);
188 TM.tc_failure_code[0] = (char) (TC_NOT_EXE >> 8);
192 TM.tc_failure_code[1] = (char) (TC_NOT_EXE );
189 TM.tc_failure_code[1] = (char) (TC_NOT_EXE );
193 TM.telecommand_pkt_id[0] = TC->packetID[0];
190 TM.telecommand_pkt_id[0] = TC->packetID[0];
194 TM.telecommand_pkt_id[1] = TC->packetID[1];
191 TM.telecommand_pkt_id[1] = TC->packetID[1];
195 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
192 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
196 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
193 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
197 TM.tc_service = TC->serviceType; // type of the rejected TC
194 TM.tc_service = TC->serviceType; // type of the rejected TC
198 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
195 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
199 TM.lfr_status_word[0] = housekeeping_packet.lfr_status_word[0];
196 TM.lfr_status_word[0] = housekeeping_packet.lfr_status_word[0];
200 TM.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1];
197 TM.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1];
201
198
202 messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
199 messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
203
200
204 // SEND DATA
201 // SEND DATA
205 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
202 status = rtems_message_queue_send( queue_id, &TM, messageSize);
206 if (status != RTEMS_SUCCESSFUL) {
203 if (status != RTEMS_SUCCESSFUL) {
207 PRINTF("in send_tm_lfr_tc_exe_not_executable *** ERR\n")
204 PRINTF("in send_tm_lfr_tc_exe_not_executable *** ERR\n")
208 }
205 }
209
206
210 return status;
207 return status;
211 }
208 }
212
209
213 int send_tm_lfr_tc_exe_not_implemented( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
210 int send_tm_lfr_tc_exe_not_implemented( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
214 {
211 {
215 /** This function sends a TM_LFR_TC_EXE_NOT_IMPLEMENTED packet in the dedicated RTEMS message queue.
212 /** This function sends a TM_LFR_TC_EXE_NOT_IMPLEMENTED packet in the dedicated RTEMS message queue.
216 *
213 *
217 * @param TC points to the TeleCommand packet that is being processed
214 * @param TC points to the TeleCommand packet that is being processed
218 * @param queue_id is the id of the queue which handles TM
215 * @param queue_id is the id of the queue which handles TM
219 *
216 *
220 * @return RTEMS directive status code:
217 * @return RTEMS directive status code:
221 * - RTEMS_SUCCESSFUL - message sent successfully
218 * - RTEMS_SUCCESSFUL - message sent successfully
222 * - RTEMS_INVALID_ID - invalid queue id
219 * - RTEMS_INVALID_ID - invalid queue id
223 * - RTEMS_INVALID_SIZE - invalid message size
220 * - RTEMS_INVALID_SIZE - invalid message size
224 * - RTEMS_INVALID_ADDRESS - buffer is NULL
221 * - RTEMS_INVALID_ADDRESS - buffer is NULL
225 * - RTEMS_UNSATISFIED - out of message buffers
222 * - RTEMS_UNSATISFIED - out of message buffers
226 * - RTEMS_TOO_MANY - queue s limit has been reached
223 * - RTEMS_TOO_MANY - queue s limit has been reached
227 *
224 *
228 */
225 */
229
226
230 rtems_status_code status;
227 rtems_status_code status;
231 Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t TM;
228 Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t TM;
232 unsigned char messageSize;
229 unsigned char messageSize;
233
230
234 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
231 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
235 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
232 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
236 TM.reserved = DEFAULT_RESERVED;
233 TM.reserved = DEFAULT_RESERVED;
237 TM.userApplication = CCSDS_USER_APP;
234 TM.userApplication = CCSDS_USER_APP;
238 // PACKET HEADER
235 // PACKET HEADER
239 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
236 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
240 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
237 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
241 TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
238 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
242 TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
243 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8);
239 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8);
244 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED );
240 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED );
245 // DATA FIELD HEADER
241 // DATA FIELD HEADER
246 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
242 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
247 TM.serviceType = TM_TYPE_TC_EXE;
243 TM.serviceType = TM_TYPE_TC_EXE;
248 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
244 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
249 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
245 TM.destinationID = TC->sourceID; // default destination id
250 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
246 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
251 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
247 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
252 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
248 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
253 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
249 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
254 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
250 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
255 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
251 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
256 //
252 //
257 TM.tc_failure_code[0] = (char) (FUNCT_NOT_IMPL >> 8);
253 TM.tc_failure_code[0] = (char) (FUNCT_NOT_IMPL >> 8);
258 TM.tc_failure_code[1] = (char) (FUNCT_NOT_IMPL );
254 TM.tc_failure_code[1] = (char) (FUNCT_NOT_IMPL );
259 TM.telecommand_pkt_id[0] = TC->packetID[0];
255 TM.telecommand_pkt_id[0] = TC->packetID[0];
260 TM.telecommand_pkt_id[1] = TC->packetID[1];
256 TM.telecommand_pkt_id[1] = TC->packetID[1];
261 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
257 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
262 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
258 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
263 TM.tc_service = TC->serviceType; // type of the rejected TC
259 TM.tc_service = TC->serviceType; // type of the rejected TC
264 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
260 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
265
261
266 messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
262 messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
267
263
268 // SEND DATA
264 // SEND DATA
269 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
265 status = rtems_message_queue_send( queue_id, &TM, messageSize);
270 if (status != RTEMS_SUCCESSFUL) {
266 if (status != RTEMS_SUCCESSFUL) {
271 PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n")
267 PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n")
272 }
268 }
273
269
274 return status;
270 return status;
275 }
271 }
276
272
277 int send_tm_lfr_tc_exe_error( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
273 int send_tm_lfr_tc_exe_error( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
278 {
274 {
279 /** This function sends a TM_LFR_TC_EXE_ERROR packet in the dedicated RTEMS message queue.
275 /** This function sends a TM_LFR_TC_EXE_ERROR packet in the dedicated RTEMS message queue.
280 *
276 *
281 * @param TC points to the TeleCommand packet that is being processed
277 * @param TC points to the TeleCommand packet that is being processed
282 * @param queue_id is the id of the queue which handles TM
278 * @param queue_id is the id of the queue which handles TM
283 *
279 *
284 * @return RTEMS directive status code:
280 * @return RTEMS directive status code:
285 * - RTEMS_SUCCESSFUL - message sent successfully
281 * - RTEMS_SUCCESSFUL - message sent successfully
286 * - RTEMS_INVALID_ID - invalid queue id
282 * - RTEMS_INVALID_ID - invalid queue id
287 * - RTEMS_INVALID_SIZE - invalid message size
283 * - RTEMS_INVALID_SIZE - invalid message size
288 * - RTEMS_INVALID_ADDRESS - buffer is NULL
284 * - RTEMS_INVALID_ADDRESS - buffer is NULL
289 * - RTEMS_UNSATISFIED - out of message buffers
285 * - RTEMS_UNSATISFIED - out of message buffers
290 * - RTEMS_TOO_MANY - queue s limit has been reached
286 * - RTEMS_TOO_MANY - queue s limit has been reached
291 *
287 *
292 */
288 */
293
289
294 rtems_status_code status;
290 rtems_status_code status;
295 Packet_TM_LFR_TC_EXE_ERROR_t TM;
291 Packet_TM_LFR_TC_EXE_ERROR_t TM;
296 unsigned char messageSize;
292 unsigned char messageSize;
297
293
298 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
294 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
299 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
295 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
300 TM.reserved = DEFAULT_RESERVED;
296 TM.reserved = DEFAULT_RESERVED;
301 TM.userApplication = CCSDS_USER_APP;
297 TM.userApplication = CCSDS_USER_APP;
302 // PACKET HEADER
298 // PACKET HEADER
303 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
299 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
304 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
300 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
305 TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
301 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
306 TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
307 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8);
302 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8);
308 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR );
303 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR );
309 // DATA FIELD HEADER
304 // DATA FIELD HEADER
310 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
305 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
311 TM.serviceType = TM_TYPE_TC_EXE;
306 TM.serviceType = TM_TYPE_TC_EXE;
312 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
307 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
313 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
308 TM.destinationID = TC->sourceID; // default destination id
314 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
309 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
315 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
310 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
316 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
311 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
317 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
312 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
318 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
313 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
319 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
314 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
320 //
315 //
321 TM.tc_failure_code[0] = (char) (FAIL_DETECTED >> 8);
316 TM.tc_failure_code[0] = (char) (FAIL_DETECTED >> 8);
322 TM.tc_failure_code[1] = (char) (FAIL_DETECTED );
317 TM.tc_failure_code[1] = (char) (FAIL_DETECTED );
323 TM.telecommand_pkt_id[0] = TC->packetID[0];
318 TM.telecommand_pkt_id[0] = TC->packetID[0];
324 TM.telecommand_pkt_id[1] = TC->packetID[1];
319 TM.telecommand_pkt_id[1] = TC->packetID[1];
325 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
320 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
326 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
321 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
327 TM.tc_service = TC->serviceType; // type of the rejected TC
322 TM.tc_service = TC->serviceType; // type of the rejected TC
328 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
323 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
329
324
330 messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
325 messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
331
326
332 // SEND DATA
327 // SEND DATA
333 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
328 status = rtems_message_queue_send( queue_id, &TM, messageSize);
334 if (status != RTEMS_SUCCESSFUL) {
329 if (status != RTEMS_SUCCESSFUL) {
335 PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n")
330 PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n")
336 }
331 }
337
332
338 return status;
333 return status;
339 }
334 }
340
335
341 int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
336 int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
342 unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV )
337 unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV )
343 {
338 {
344 /** This function sends a TM_LFR_TC_EXE_CORRUPTED packet in the dedicated RTEMS message queue.
339 /** This function sends a TM_LFR_TC_EXE_CORRUPTED packet in the dedicated RTEMS message queue.
345 *
340 *
346 * @param TC points to the TeleCommand packet that is being processed
341 * @param TC points to the TeleCommand packet that is being processed
347 * @param queue_id is the id of the queue which handles TM
342 * @param queue_id is the id of the queue which handles TM
348 * @param computed_CRC points to a buffer of two bytes containing the CRC computed during the parsing of the TeleCommand
343 * @param computed_CRC points to a buffer of two bytes containing the CRC computed during the parsing of the TeleCommand
349 * @param currentTC_LEN_RCV points to a buffer of two bytes containing a packet size field computed on the received data
344 * @param currentTC_LEN_RCV points to a buffer of two bytes containing a packet size field computed on the received data
350 *
345 *
351 * @return RTEMS directive status code:
346 * @return RTEMS directive status code:
352 * - RTEMS_SUCCESSFUL - message sent successfully
347 * - RTEMS_SUCCESSFUL - message sent successfully
353 * - RTEMS_INVALID_ID - invalid queue id
348 * - RTEMS_INVALID_ID - invalid queue id
354 * - RTEMS_INVALID_SIZE - invalid message size
349 * - RTEMS_INVALID_SIZE - invalid message size
355 * - RTEMS_INVALID_ADDRESS - buffer is NULL
350 * - RTEMS_INVALID_ADDRESS - buffer is NULL
356 * - RTEMS_UNSATISFIED - out of message buffers
351 * - RTEMS_UNSATISFIED - out of message buffers
357 * - RTEMS_TOO_MANY - queue s limit has been reached
352 * - RTEMS_TOO_MANY - queue s limit has been reached
358 *
353 *
359 */
354 */
360
355
361 rtems_status_code status;
356 rtems_status_code status;
362 Packet_TM_LFR_TC_EXE_CORRUPTED_t TM;
357 Packet_TM_LFR_TC_EXE_CORRUPTED_t TM;
363 unsigned char messageSize;
358 unsigned char messageSize;
364 unsigned int packetLength;
359 unsigned int packetLength;
365 unsigned char *packetDataField;
360 unsigned char *packetDataField;
366
361
367 packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1]; // compute the packet length parameter
362 packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1]; // compute the packet length parameter
368 packetDataField = (unsigned char *) &TC->headerFlag_pusVersion_Ack; // get the beginning of the data field
363 packetDataField = (unsigned char *) &TC->headerFlag_pusVersion_Ack; // get the beginning of the data field
369
364
370 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
365 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
371 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
366 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
372 TM.reserved = DEFAULT_RESERVED;
367 TM.reserved = DEFAULT_RESERVED;
373 TM.userApplication = CCSDS_USER_APP;
368 TM.userApplication = CCSDS_USER_APP;
374 // PACKET HEADER
369 // PACKET HEADER
375 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
370 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
376 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
371 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
377 TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
372 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
378 TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
379 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8);
373 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8);
380 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED );
374 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED );
381 // DATA FIELD HEADER
375 // DATA FIELD HEADER
382 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
376 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
383 TM.serviceType = TM_TYPE_TC_EXE;
377 TM.serviceType = TM_TYPE_TC_EXE;
384 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
378 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
385 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
379 TM.destinationID = TC->sourceID; // default destination id
386 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
380 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
387 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
381 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
388 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
382 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
389 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
383 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
390 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
384 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
391 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
385 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
392 //
386 //
393 TM.tc_failure_code[0] = (unsigned char) (CORRUPTED >> 8);
387 TM.tc_failure_code[0] = (unsigned char) (CORRUPTED >> 8);
394 TM.tc_failure_code[1] = (unsigned char) (CORRUPTED );
388 TM.tc_failure_code[1] = (unsigned char) (CORRUPTED );
395 TM.telecommand_pkt_id[0] = TC->packetID[0];
389 TM.telecommand_pkt_id[0] = TC->packetID[0];
396 TM.telecommand_pkt_id[1] = TC->packetID[1];
390 TM.telecommand_pkt_id[1] = TC->packetID[1];
397 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
391 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
398 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
392 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
399 TM.tc_service = TC->serviceType; // type of the rejected TC
393 TM.tc_service = TC->serviceType; // type of the rejected TC
400 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
394 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
401 TM.pkt_len_rcv_value[0] = TC->packetLength[0];
395 TM.pkt_len_rcv_value[0] = TC->packetLength[0];
402 TM.pkt_len_rcv_value[1] = TC->packetLength[1];
396 TM.pkt_len_rcv_value[1] = TC->packetLength[1];
403 TM.pkt_datafieldsize_cnt[0] = currentTC_LEN_RCV[0];
397 TM.pkt_datafieldsize_cnt[0] = currentTC_LEN_RCV[0];
404 TM.pkt_datafieldsize_cnt[1] = currentTC_LEN_RCV[1];
398 TM.pkt_datafieldsize_cnt[1] = currentTC_LEN_RCV[1];
405 TM.rcv_crc[0] = packetDataField[ packetLength - 1 ];
399 TM.rcv_crc[0] = packetDataField[ packetLength - 1 ];
406 TM.rcv_crc[1] = packetDataField[ packetLength ];
400 TM.rcv_crc[1] = packetDataField[ packetLength ];
407 TM.computed_crc[0] = computed_CRC[0];
401 TM.computed_crc[0] = computed_CRC[0];
408 TM.computed_crc[1] = computed_CRC[1];
402 TM.computed_crc[1] = computed_CRC[1];
409
403
410 messageSize = PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
404 messageSize = PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
411
405
412 // SEND DATA
406 // SEND DATA
413 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
407 status = rtems_message_queue_send( queue_id, &TM, messageSize);
414 if (status != RTEMS_SUCCESSFUL) {
408 if (status != RTEMS_SUCCESSFUL) {
415 PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n")
409 PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n")
416 }
410 }
417
411
418 return status;
412 return status;
419 }
413 }
414
415 void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id )
416 {
417 unsigned short sequence_cnt;
418 unsigned short segmentation_grouping_flag;
419 unsigned short new_packet_sequence_control;
420 unsigned char i;
421
422 switch (destination_id)
423 {
424 case SID_TC_GROUND:
425 i = GROUND;
426 break;
427 case SID_TC_MISSION_TIMELINE:
428 i = MISSION_TIMELINE;
429 break;
430 case SID_TC_TC_SEQUENCES:
431 i = TC_SEQUENCES;
432 break;
433 case SID_TC_RECOVERY_ACTION_CMD:
434 i = RECOVERY_ACTION_CMD;
435 break;
436 case SID_TC_BACKUP_MISSION_TIMELINE:
437 i = BACKUP_MISSION_TIMELINE;
438 break;
439 case SID_TC_DIRECT_CMD:
440 i = DIRECT_CMD;
441 break;
442 case SID_TC_SPARE_GRD_SRC1:
443 i = SPARE_GRD_SRC1;
444 break;
445 case SID_TC_SPARE_GRD_SRC2:
446 i = SPARE_GRD_SRC2;
447 break;
448 case SID_TC_OBCP:
449 i = OBCP;
450 break;
451 case SID_TC_SYSTEM_CONTROL:
452 i = SYSTEM_CONTROL;
453 break;
454 case SID_TC_AOCS:
455 i = AOCS;
456 break;
457 case SID_TC_RPW_INTERNAL:
458 i = RPW_INTERNAL;
459 break;
460 default:
461 i = UNKNOWN;
462 break;
463 }
464
465 if (i != UNKNOWN)
466 {
467 segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
468 sequence_cnt = sequenceCounters_TC_EXE[ i ] & 0x3fff;
469
470 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
471
472 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
473 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
474
475 // increment the seuqence counter for the next packet
476 if ( sequenceCounters_TC_EXE[ i ] < SEQ_CNT_MAX)
477 {
478 sequenceCounters_TC_EXE[ i ] = sequenceCounters_TC_EXE[ i ] + 1;
479 }
480 else
481 {
482 sequenceCounters_TC_EXE[ i ] = 0;
483 }
484 }
485 else
486 {
487 PRINTF1("in increment_seq_counter_destination_id *** ERR destination ID %d not known\n", destination_id)
488 }
489
490 }
@@ -1,1172 +1,1219
1 /** Functions and tasks related to waveform packet generation.
1 /** Functions and tasks related to waveform packet generation.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to handle waveforms, in snapshot or continuous format.\n
6 * A group of functions to handle waveforms, in snapshot or continuous format.\n
7 *
7 *
8 */
8 */
9
9
10 #include "wf_handler.h"
10 #include "wf_handler.h"
11
11
12 // SWF
12 // SWF
13 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7];
13 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7];
14 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
14 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
15 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
15 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
16 // CWF
16 // CWF
17 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7];
17 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7];
18 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7];
18 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7];
19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7];
19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7];
20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7];
20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7];
21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[7];
21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[7];
22
22
23 unsigned char doubleSendCWF1 = 0;
23 unsigned char doubleSendCWF1 = 0;
24 unsigned char doubleSendCWF2 = 0;
24 unsigned char doubleSendCWF2 = 0;
25
25
26 rtems_isr waveforms_isr( rtems_vector_number vector )
26 rtems_isr waveforms_isr( rtems_vector_number vector )
27 {
27 {
28 /** This is the interrupt sub routine called by the waveform picker core.
28 /** This is the interrupt sub routine called by the waveform picker core.
29 *
29 *
30 * This ISR launch different actions depending mainly on two pieces of information:
30 * This ISR launch different actions depending mainly on two pieces of information:
31 * 1. the values read in the registers of the waveform picker.
31 * 1. the values read in the registers of the waveform picker.
32 * 2. the current LFR mode.
32 * 2. the current LFR mode.
33 *
33 *
34 */
34 */
35
35
36 #ifdef GSA
36 #ifdef GSA
37 #else
37 #else
38 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
38 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
39 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
39 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
40 { // in modes other than STANDBY and BURST, send the CWF_F3 data
40 { // in modes other than STANDBY and BURST, send the CWF_F3 data
41 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
41 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
42 // (1) change the receiving buffer for the waveform picker
42 // (1) change the receiving buffer for the waveform picker
43 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) {
43 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) {
44 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_bis);
44 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_bis);
45 }
45 }
46 else {
46 else {
47 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3);
47 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3);
48 }
48 }
49 // (2) send an event for the waveforms transmission
49 // (2) send an event for the waveforms transmission
50 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
50 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
51 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
51 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
52 }
52 }
53 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
53 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
54 }
54 }
55 }
55 }
56 #endif
56 #endif
57
57
58 switch(lfrCurrentMode)
58 switch(lfrCurrentMode)
59 {
59 {
60 //********
60 //********
61 // STANDBY
61 // STANDBY
62 case(LFR_MODE_STANDBY):
62 case(LFR_MODE_STANDBY):
63 break;
63 break;
64
64
65 //******
65 //******
66 // NORMAL
66 // NORMAL
67 case(LFR_MODE_NORMAL):
67 case(LFR_MODE_NORMAL):
68 #ifdef GSA
68 #ifdef GSA
69 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
69 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
70 #else
70 #else
71 if ( (waveform_picker_regs->burst_enable & 0x7) == 0x0 ){ // if no channel is enable
71 if ( (waveform_picker_regs->burst_enable & 0x7) == 0x0 ){ // if no channel is enable
72 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
72 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
73 }
73 }
74 else {
74 else {
75 if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full
75 if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full
76 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable & 0x08;
76 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable & 0x08;
77 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
77 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
78 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
78 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
79 }
79 }
80 // waveform_picker_regs->status = waveform_picker_regs->status & 0x00;
80 // waveform_picker_regs->status = waveform_picker_regs->status & 0x00;
81 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888;
81 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888;
82 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x07; // [0111] enable f2 f1 f0
82 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x07; // [0111] enable f2 f1 f0
83 }
83 }
84 }
84 }
85 #endif
85 #endif
86 break;
86 break;
87
87
88 //******
88 //******
89 // BURST
89 // BURST
90 case(LFR_MODE_BURST):
90 case(LFR_MODE_BURST):
91 #ifdef GSA
91 #ifdef GSA
92 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
92 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
93 #else
93 #else
94 if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit
94 if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit
95 // (1) change the receiving buffer for the waveform picker
95 // (1) change the receiving buffer for the waveform picker
96 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
96 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
97 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
97 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
98 }
98 }
99 else {
99 else {
100 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
100 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
101 }
101 }
102 // (2) send an event for the waveforms transmission
102 // (2) send an event for the waveforms transmission
103 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
103 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
104 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
104 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
105 }
105 }
106 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0
106 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0
107 }
107 }
108 #endif
108 #endif
109 break;
109 break;
110
110
111 //*****
111 //*****
112 // SBM1
112 // SBM1
113 case(LFR_MODE_SBM1):
113 case(LFR_MODE_SBM1):
114 #ifdef GSA
114 #ifdef GSA
115 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
115 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
116 #else
116 #else
117 if ((waveform_picker_regs->status & 0x02) == 0x02){ // [0010] check the f1 full bit
117 if ((waveform_picker_regs->status & 0x02) == 0x02){ // [0010] check the f1 full bit
118 // (1) change the receiving buffer for the waveform picker
118 // (1) change the receiving buffer for the waveform picker
119 if ( param_local.local_sbm1_nb_cwf_sent == (param_local.local_sbm1_nb_cwf_max-1) )
119 if ( param_local.local_sbm1_nb_cwf_sent == (param_local.local_sbm1_nb_cwf_max-1) )
120 {
120 {
121 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_norm);
121 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_norm);
122 }
122 }
123 else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1_norm )
123 else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1_norm )
124 {
124 {
125 doubleSendCWF1 = 1;
125 doubleSendCWF1 = 1;
126 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
126 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
127 }
127 }
128 else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1 ) {
128 else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1 ) {
129 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis);
129 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis);
130 }
130 }
131 else {
131 else {
132 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
132 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
133 }
133 }
134 // (2) send an event for the waveforms transmission
134 // (2) send an event for the waveforms transmission
135 if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
135 if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
136 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
136 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
137 }
137 }
138 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0
138 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0
139 }
139 }
140 if ( ( (waveform_picker_regs->status & 0x05) == 0x05 ) ) { // [0101] check the f2 and f0 full bit
140 if ( ( (waveform_picker_regs->status & 0x05) == 0x05 ) ) { // [0101] check the f2 and f0 full bit
141 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
141 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
142 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
142 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
143 }
143 }
144 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0
144 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0
145 reset_local_sbm1_nb_cwf_sent();
145 reset_local_sbm1_nb_cwf_sent();
146 }
146 }
147
147
148 #endif
148 #endif
149 break;
149 break;
150
150
151 //*****
151 //*****
152 // SBM2
152 // SBM2
153 case(LFR_MODE_SBM2):
153 case(LFR_MODE_SBM2):
154 #ifdef GSA
154 #ifdef GSA
155 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
155 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
156 #else
156 #else
157 if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit
157 if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit
158 // (1) change the receiving buffer for the waveform picker
158 // (1) change the receiving buffer for the waveform picker
159 if ( param_local.local_sbm2_nb_cwf_sent == (param_local.local_sbm2_nb_cwf_max-1) )
159 if ( param_local.local_sbm2_nb_cwf_sent == (param_local.local_sbm2_nb_cwf_max-1) )
160 {
160 {
161 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_norm);
161 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_norm);
162 }
162 }
163 else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2_norm ) {
163 else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2_norm ) {
164 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
164 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
165 doubleSendCWF2 = 1;
165 doubleSendCWF2 = 1;
166 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2_WFRM ) != RTEMS_SUCCESSFUL) {
166 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2_WFRM ) != RTEMS_SUCCESSFUL) {
167 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
167 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
168 }
168 }
169 reset_local_sbm2_nb_cwf_sent();
169 reset_local_sbm2_nb_cwf_sent();
170 }
170 }
171 else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2 ) {
171 else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2 ) {
172 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
172 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
173 }
173 }
174 else {
174 else {
175 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
175 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
176 }
176 }
177 // (2) send an event for the waveforms transmission
177 // (2) send an event for the waveforms transmission
178 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
178 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
179 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
179 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
180 }
180 }
181 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
181 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
182 }
182 }
183 if ( ( (waveform_picker_regs->status & 0x03) == 0x03 ) ) { // [0011] f3 f2 f1 f0, f1 and f0 are full
183 if ( ( (waveform_picker_regs->status & 0x03) == 0x03 ) ) { // [0011] f3 f2 f1 f0, f1 and f0 are full
184 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
184 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
185 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
185 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
186 }
186 }
187 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
187 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
188 }
188 }
189 #endif
189 #endif
190 break;
190 break;
191
191
192 //********
192 //********
193 // DEFAULT
193 // DEFAULT
194 default:
194 default:
195 break;
195 break;
196 }
196 }
197 }
197 }
198
198
199 rtems_isr waveforms_simulator_isr( rtems_vector_number vector )
199 rtems_isr waveforms_simulator_isr( rtems_vector_number vector )
200 {
200 {
201 /** This is the interrupt sub routine called by the waveform picker simulator.
201 /** This is the interrupt sub routine called by the waveform picker simulator.
202 *
202 *
203 * This ISR is for debug purpose only.
203 * This ISR is for debug purpose only.
204 *
204 *
205 */
205 */
206
206
207 unsigned char lfrMode;
207 unsigned char lfrMode;
208 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
208 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
209
209
210 switch(lfrMode) {
210 switch(lfrMode) {
211 case (LFR_MODE_STANDBY):
211 case (LFR_MODE_STANDBY):
212 break;
212 break;
213 case (LFR_MODE_NORMAL):
213 case (LFR_MODE_NORMAL):
214 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
214 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
215 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_5 );
215 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_5 );
216 }
216 }
217 break;
217 break;
218 case (LFR_MODE_BURST):
218 case (LFR_MODE_BURST):
219 break;
219 break;
220 case (LFR_MODE_SBM1):
220 case (LFR_MODE_SBM1):
221 break;
221 break;
222 case (LFR_MODE_SBM2):
222 case (LFR_MODE_SBM2):
223 break;
223 break;
224 }
224 }
225 }
225 }
226
226
227 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
227 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
228 {
228 {
229 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
229 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
230 *
230 *
231 * @param unused is the starting argument of the RTEMS task
231 * @param unused is the starting argument of the RTEMS task
232 *
232 *
233 * The following data packets are sent by this task:
233 * The following data packets are sent by this task:
234 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
234 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
235 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
235 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
236 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
236 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
237 *
237 *
238 */
238 */
239
239
240 rtems_event_set event_out;
240 rtems_event_set event_out;
241 rtems_id queue_id;
241 rtems_id queue_id;
242
242
243 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
243 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
244 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
244 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
245 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
245 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
246
246
247 init_waveforms();
247 init_waveforms();
248
248
249 queue_id = get_pkts_queue_id();
249 queue_id = get_pkts_queue_id();
250
250
251 BOOT_PRINTF("in WFRM ***\n")
251 BOOT_PRINTF("in WFRM ***\n")
252
252
253 while(1){
253 while(1){
254 // wait for an RTEMS_EVENT
254 // wait for an RTEMS_EVENT
255 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
255 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
256 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
256 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
257 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
257 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
258
258
259 if (event_out == RTEMS_EVENT_MODE_NORMAL)
259 if (event_out == RTEMS_EVENT_MODE_NORMAL)
260 {
260 {
261 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
261 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
262 send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
262 send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
263 send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
263 send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
264 #ifdef GSA
264 #ifdef GSA
265 waveform_picker_regs->status = waveform_picker_regs->status & 0xf888; // [1111 1000 1000 1000] f2, f1, f0 bits =0
265 waveform_picker_regs->status = waveform_picker_regs->status & 0xf888; // [1111 1000 1000 1000] f2, f1, f0 bits =0
266 #endif
266 #endif
267 }
267 }
268 else if (event_out == RTEMS_EVENT_MODE_SBM1)
268 else if (event_out == RTEMS_EVENT_MODE_SBM1)
269 {
269 {
270 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
270 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
271 send_waveform_SWF(wf_snap_f1_norm, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
271 send_waveform_SWF(wf_snap_f1_norm, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
272 send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
272 send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
273 #ifdef GSA
273 #ifdef GSA
274 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2, f0 bits = 0
274 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2, f0 bits = 0
275 #endif
275 #endif
276 }
276 }
277 else if (event_out == RTEMS_EVENT_MODE_SBM2)
277 else if (event_out == RTEMS_EVENT_MODE_SBM2)
278 {
278 {
279 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
279 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
280 send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
280 send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
281 #ifdef GSA
281 #ifdef GSA
282 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
282 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
283 #endif
283 #endif
284 }
284 }
285 else if (event_out == RTEMS_EVENT_MODE_SBM2_WFRM)
285 else if (event_out == RTEMS_EVENT_MODE_SBM2_WFRM)
286 {
286 {
287 send_waveform_SWF(wf_snap_f2_norm, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
287 send_waveform_SWF(wf_snap_f2_norm, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
288 }
288 }
289 else
289 else
290 {
290 {
291 PRINTF("in WFRM *** unexpected event")
291 PRINTF("in WFRM *** unexpected event")
292 }
292 }
293
293
294
294
295 #ifdef GSA
295 #ifdef GSA
296 // irq processed, reset the related register of the timer unit
296 // irq processed, reset the related register of the timer unit
297 gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl = gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl | 0x00000010;
297 gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl = gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl | 0x00000010;
298 // clear the interruption
298 // clear the interruption
299 LEON_Unmask_interrupt( IRQ_WF );
299 LEON_Unmask_interrupt( IRQ_WF );
300 #endif
300 #endif
301 }
301 }
302 }
302 }
303
303
304 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
304 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
305 {
305 {
306 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
306 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
307 *
307 *
308 * @param unused is the starting argument of the RTEMS task
308 * @param unused is the starting argument of the RTEMS task
309 *
309 *
310 * The following data packet is sent by this task:
310 * The following data packet is sent by this task:
311 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
311 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
312 *
312 *
313 */
313 */
314
314
315 rtems_event_set event_out;
315 rtems_event_set event_out;
316 rtems_id queue_id;
316 rtems_id queue_id;
317
317
318 init_header_continuous_wf_table( SID_NORM_CWF_F3, headerCWF_F3 );
318 init_header_continuous_wf_table( SID_NORM_CWF_F3, headerCWF_F3 );
319 init_header_continuous_wf3_light_table( headerCWF_F3_light );
319 init_header_continuous_wf3_light_table( headerCWF_F3_light );
320
320
321 queue_id = get_pkts_queue_id();
321 queue_id = get_pkts_queue_id();
322
322
323 BOOT_PRINTF("in CWF3 ***\n")
323 BOOT_PRINTF("in CWF3 ***\n")
324
324
325 while(1){
325 while(1){
326 // wait for an RTEMS_EVENT
326 // wait for an RTEMS_EVENT
327 rtems_event_receive( RTEMS_EVENT_0,
327 rtems_event_receive( RTEMS_EVENT_0,
328 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
328 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
329 PRINTF("send CWF F3 \n")
329 PRINTF("send CWF F3 \n")
330 #ifdef GSA
330 #ifdef GSA
331 #else
331 #else
332 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) {
332 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) {
333 send_waveform_CWF3_light( wf_cont_f3_bis, headerCWF_F3_light, queue_id );
333 send_waveform_CWF3_light( wf_cont_f3_bis, headerCWF_F3_light, queue_id );
334 }
334 }
335 else {
335 else {
336 send_waveform_CWF3_light( wf_cont_f3, headerCWF_F3_light, queue_id );
336 send_waveform_CWF3_light( wf_cont_f3, headerCWF_F3_light, queue_id );
337 }
337 }
338 #endif
338 #endif
339 }
339 }
340 }
340 }
341
341
342 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
342 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
343 {
343 {
344 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
344 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
345 *
345 *
346 * @param unused is the starting argument of the RTEMS task
346 * @param unused is the starting argument of the RTEMS task
347 *
347 *
348 * The following data packet is sent by this function:
348 * The following data packet is sent by this function:
349 * - TM_LFR_SCIENCE_BURST_CWF_F2
349 * - TM_LFR_SCIENCE_BURST_CWF_F2
350 * - TM_LFR_SCIENCE_SBM2_CWF_F2
350 * - TM_LFR_SCIENCE_SBM2_CWF_F2
351 *
351 *
352 */
352 */
353
353
354 rtems_event_set event_out;
354 rtems_event_set event_out;
355 rtems_id queue_id;
355 rtems_id queue_id;
356
356
357 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
357 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
358 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
358 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
359
359
360 queue_id = get_pkts_queue_id();
360 queue_id = get_pkts_queue_id();
361
361
362 BOOT_PRINTF("in CWF2 ***\n")
362 BOOT_PRINTF("in CWF2 ***\n")
363
363
364 while(1){
364 while(1){
365 // wait for an RTEMS_EVENT
365 // wait for an RTEMS_EVENT
366 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
366 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
367 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
367 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
368
368
369 if (event_out == RTEMS_EVENT_MODE_BURST)
369 if (event_out == RTEMS_EVENT_MODE_BURST)
370 {
370 {
371 // F2
371 // F2
372 #ifdef GSA
372 #ifdef GSA
373 #else
373 #else
374 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
374 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
375 send_waveform_CWF( wf_snap_f2_bis, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
375 send_waveform_CWF( wf_snap_f2_bis, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
376 }
376 }
377 else {
377 else {
378 send_waveform_CWF( wf_snap_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
378 send_waveform_CWF( wf_snap_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
379 }
379 }
380 #endif
380 #endif
381 }
381 }
382
382
383 else if (event_out == RTEMS_EVENT_MODE_SBM2)
383 else if (event_out == RTEMS_EVENT_MODE_SBM2)
384 {
384 {
385 #ifdef GSA
385 #ifdef GSA
386 #else
386 #else
387 if (doubleSendCWF2 == 1)
387 if (doubleSendCWF2 == 1)
388 {
388 {
389 doubleSendCWF2 = 0;
389 doubleSendCWF2 = 0;
390 send_waveform_CWF( wf_snap_f2_norm, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
390 send_waveform_CWF( wf_snap_f2_norm, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
391 }
391 }
392 else if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
392 else if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
393 send_waveform_CWF( wf_snap_f2_bis, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
393 send_waveform_CWF( wf_snap_f2_bis, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
394 }
394 }
395 else {
395 else {
396 send_waveform_CWF( wf_snap_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
396 send_waveform_CWF( wf_snap_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
397 }
397 }
398 param_local.local_sbm2_nb_cwf_sent ++;
398 param_local.local_sbm2_nb_cwf_sent ++;
399 #endif
399 #endif
400 }
400 }
401 else
401 else
402 {
402 {
403 PRINTF1("in CWF2 *** ERR mode = %d\n", lfrCurrentMode)
403 PRINTF1("in CWF2 *** ERR mode = %d\n", lfrCurrentMode)
404 }
404 }
405 }
405 }
406 }
406 }
407
407
408 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
408 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
409 {
409 {
410 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
410 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
411 *
411 *
412 * @param unused is the starting argument of the RTEMS task
412 * @param unused is the starting argument of the RTEMS task
413 *
413 *
414 * The following data packet is sent by this function:
414 * The following data packet is sent by this function:
415 * - TM_LFR_SCIENCE_SBM1_CWF_F1
415 * - TM_LFR_SCIENCE_SBM1_CWF_F1
416 *
416 *
417 */
417 */
418
418
419 rtems_event_set event_out;
419 rtems_event_set event_out;
420 rtems_id queue_id;
420 rtems_id queue_id;
421
421
422 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
422 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
423
423
424 queue_id = get_pkts_queue_id();
424 queue_id = get_pkts_queue_id();
425
425
426 BOOT_PRINTF("in CWF1 ***\n")
426 BOOT_PRINTF("in CWF1 ***\n")
427
427
428 while(1){
428 while(1){
429 // wait for an RTEMS_EVENT
429 // wait for an RTEMS_EVENT
430 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
430 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
431 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
431 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
432 if (event_out == RTEMS_EVENT_MODE_SBM1)
432 if (event_out == RTEMS_EVENT_MODE_SBM1)
433 {
433 {
434 #ifdef GSA
434 #ifdef GSA
435 #else
435 #else
436 if (doubleSendCWF1 == 1)
436 if (doubleSendCWF1 == 1)
437 {
437 {
438 doubleSendCWF1 = 0;
438 doubleSendCWF1 = 0;
439 send_waveform_CWF( wf_snap_f1_norm, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
439 send_waveform_CWF( wf_snap_f1_norm, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
440 }
440 }
441 else if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
441 else if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
442 send_waveform_CWF( wf_snap_f1_bis, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
442 send_waveform_CWF( wf_snap_f1_bis, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
443 }
443 }
444 else {
444 else {
445 send_waveform_CWF( wf_snap_f1, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
445 send_waveform_CWF( wf_snap_f1, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
446 }
446 }
447 param_local.local_sbm1_nb_cwf_sent ++;
447 param_local.local_sbm1_nb_cwf_sent ++;
448 #endif
448 #endif
449 }
449 }
450 else
450 else
451 {
451 {
452 PRINTF1("in CWF1 *** ERR mode = %d\n", lfrCurrentMode)
452 PRINTF1("in CWF1 *** ERR mode = %d\n", lfrCurrentMode)
453 }
453 }
454 }
454 }
455 }
455 }
456
456
457 //******************
457 //******************
458 // general functions
458 // general functions
459 void init_waveforms( void )
459 void init_waveforms( void )
460 {
460 {
461 int i = 0;
461 int i = 0;
462
462
463 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
463 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
464 {
464 {
465 //***
465 //***
466 // F0
466 // F0
467 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
467 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
468 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
468 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
469 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
469 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
470
470
471 //***
471 //***
472 // F1
472 // F1
473 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
473 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
474 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
474 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
475 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
475 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
476
476
477 //***
477 //***
478 // F2
478 // F2
479 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
479 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
480 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
480 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
481 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
481 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
482
482
483 //***
483 //***
484 // F3
484 // F3
485 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
485 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
486 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
486 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
487 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
487 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
488 }
488 }
489 }
489 }
490
490
491 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
491 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
492 {
492 {
493 unsigned char i;
493 unsigned char i;
494
494
495 for (i=0; i<7; i++)
495 for (i=0; i<7; i++)
496 {
496 {
497 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
497 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
498 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
498 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
499 headerSWF[ i ].reserved = DEFAULT_RESERVED;
499 headerSWF[ i ].reserved = DEFAULT_RESERVED;
500 headerSWF[ i ].userApplication = CCSDS_USER_APP;
500 headerSWF[ i ].userApplication = CCSDS_USER_APP;
501 headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
501 headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
502 headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
502 headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
503 if (i == 0)
503 if (i == 0)
504 {
504 {
505 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
505 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
506 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
506 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
507 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
507 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
508 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
508 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
509 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
509 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
510 }
510 }
511 else if (i == 6)
511 else if (i == 6)
512 {
512 {
513 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
513 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
514 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_8 >> 8);
514 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_8 >> 8);
515 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_8 );
515 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_8 );
516 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
516 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
517 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
517 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
518 }
518 }
519 else
519 else
520 {
520 {
521 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
521 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
522 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
522 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
523 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
523 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
524 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
524 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
525 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
525 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
526 }
526 }
527 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
527 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
528 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
528 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
529 headerSWF[ i ].pktNr = i+1; // PKT_NR
529 headerSWF[ i ].pktNr = i+1; // PKT_NR
530 // DATA FIELD HEADER
530 // DATA FIELD HEADER
531 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
531 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
532 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
532 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
533 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
533 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
534 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
534 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
535 // AUXILIARY DATA HEADER
535 // AUXILIARY DATA HEADER
536 headerSWF[ i ].sid = sid;
537 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
538 headerSWF[ i ].time[0] = 0x00;
536 headerSWF[ i ].time[0] = 0x00;
539 headerSWF[ i ].time[0] = 0x00;
537 headerSWF[ i ].time[0] = 0x00;
540 headerSWF[ i ].time[0] = 0x00;
538 headerSWF[ i ].time[0] = 0x00;
541 headerSWF[ i ].time[0] = 0x00;
539 headerSWF[ i ].time[0] = 0x00;
542 headerSWF[ i ].time[0] = 0x00;
540 headerSWF[ i ].time[0] = 0x00;
543 headerSWF[ i ].time[0] = 0x00;
541 headerSWF[ i ].time[0] = 0x00;
542 headerSWF[ i ].sid = sid;
543 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
544 }
544 }
545 return LFR_SUCCESSFUL;
545 return LFR_SUCCESSFUL;
546 }
546 }
547
547
548 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
548 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
549 {
549 {
550 unsigned int i;
550 unsigned int i;
551
551
552 for (i=0; i<7; i++)
552 for (i=0; i<7; i++)
553 {
553 {
554 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
554 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
555 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
555 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
556 headerCWF[ i ].reserved = DEFAULT_RESERVED;
556 headerCWF[ i ].reserved = DEFAULT_RESERVED;
557 headerCWF[ i ].userApplication = CCSDS_USER_APP;
557 headerCWF[ i ].userApplication = CCSDS_USER_APP;
558 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
558 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
559 {
559 {
560 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8);
560 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8);
561 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2);
561 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2);
562 }
562 }
563 else
563 else
564 {
564 {
565 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
565 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
566 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
566 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
567 }
567 }
568 if (i == 0)
568 if (i == 0)
569 {
569 {
570 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
570 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
571 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
571 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
572 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
572 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
573 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
573 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
574 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
574 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
575 }
575 }
576 else if (i == 6)
576 else if (i == 6)
577 {
577 {
578 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
578 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
579 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8);
579 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8);
580 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 );
580 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 );
581 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
581 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
582 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
582 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
583 }
583 }
584 else
584 else
585 {
585 {
586 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
586 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
587 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
587 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
588 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
588 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
589 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
589 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
590 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
590 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
591 }
591 }
592 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
592 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
593 // PKT_CNT
593 // PKT_CNT
594 // PKT_NR
594 // PKT_NR
595 // DATA FIELD HEADER
595 // DATA FIELD HEADER
596 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
596 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
597 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
597 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
598 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
598 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
599 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
599 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
600 // AUXILIARY DATA HEADER
600 // AUXILIARY DATA HEADER
601 headerCWF[ i ].sid = sid;
601 headerCWF[ i ].sid = sid;
602 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
602 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
603 headerCWF[ i ].time[0] = 0x00;
603 headerCWF[ i ].time[0] = 0x00;
604 headerCWF[ i ].time[0] = 0x00;
604 headerCWF[ i ].time[0] = 0x00;
605 headerCWF[ i ].time[0] = 0x00;
605 headerCWF[ i ].time[0] = 0x00;
606 headerCWF[ i ].time[0] = 0x00;
606 headerCWF[ i ].time[0] = 0x00;
607 headerCWF[ i ].time[0] = 0x00;
607 headerCWF[ i ].time[0] = 0x00;
608 headerCWF[ i ].time[0] = 0x00;
608 headerCWF[ i ].time[0] = 0x00;
609 }
609 }
610 return LFR_SUCCESSFUL;
610 return LFR_SUCCESSFUL;
611 }
611 }
612
612
613 int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
613 int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
614 {
614 {
615 unsigned int i;
615 unsigned int i;
616
616
617 for (i=0; i<7; i++)
617 for (i=0; i<7; i++)
618 {
618 {
619 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
619 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
620 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
620 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
621 headerCWF[ i ].reserved = DEFAULT_RESERVED;
621 headerCWF[ i ].reserved = DEFAULT_RESERVED;
622 headerCWF[ i ].userApplication = CCSDS_USER_APP;
622 headerCWF[ i ].userApplication = CCSDS_USER_APP;
623
623
624 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
624 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
625 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
625 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
626 if (i == 0)
626 if (i == 0)
627 {
627 {
628 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
628 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
629 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
629 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
630 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
630 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
631 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
631 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
632 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
632 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
633 }
633 }
634 else if (i == 6)
634 else if (i == 6)
635 {
635 {
636 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
636 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
637 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 >> 8);
637 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 >> 8);
638 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 );
638 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 );
639 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
639 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
640 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
640 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
641 }
641 }
642 else
642 else
643 {
643 {
644 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
644 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
645 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
645 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
646 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
646 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
647 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
647 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
648 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
648 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
649 }
649 }
650 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
650 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
651 // DATA FIELD HEADER
651 // DATA FIELD HEADER
652 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
652 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
653 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
653 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
654 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
654 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
655 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
655 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
656 // AUXILIARY DATA HEADER
656 // AUXILIARY DATA HEADER
657 headerCWF[ i ].sid = SID_NORM_CWF_F3;
657 headerCWF[ i ].sid = SID_NORM_CWF_F3;
658 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
658 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
659 headerCWF[ i ].time[0] = 0x00;
659 headerCWF[ i ].time[0] = 0x00;
660 headerCWF[ i ].time[0] = 0x00;
660 headerCWF[ i ].time[0] = 0x00;
661 headerCWF[ i ].time[0] = 0x00;
661 headerCWF[ i ].time[0] = 0x00;
662 headerCWF[ i ].time[0] = 0x00;
662 headerCWF[ i ].time[0] = 0x00;
663 headerCWF[ i ].time[0] = 0x00;
663 headerCWF[ i ].time[0] = 0x00;
664 headerCWF[ i ].time[0] = 0x00;
664 headerCWF[ i ].time[0] = 0x00;
665 }
665 }
666 return LFR_SUCCESSFUL;
666 return LFR_SUCCESSFUL;
667 }
667 }
668
668
669 void reset_waveforms( void )
669 void reset_waveforms( void )
670 {
670 {
671 int i = 0;
671 int i = 0;
672
672
673 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
673 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
674 {
674 {
675 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000;
675 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000;
676 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
676 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
677 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
677 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
678
678
679 //***
679 //***
680 // F1
680 // F1
681 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000;
681 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000;
682 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000;
682 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000;
683 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
683 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
684
684
685 //***
685 //***
686 // F2
686 // F2
687 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000;
687 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000;
688 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
688 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
689 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000;
689 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000;
690
690
691 //***
691 //***
692 // F3
692 // F3
693 /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1
693 /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1
694 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1
694 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1
695 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/
695 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/
696 }
696 }
697 }
697 }
698
698
699 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
699 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
700 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
700 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
701 {
701 {
702 /** This function sends SWF CCSDS packets (F2, F1 or F0).
702 /** This function sends SWF CCSDS packets (F2, F1 or F0).
703 *
703 *
704 * @param waveform points to the buffer containing the data that will be send.
704 * @param waveform points to the buffer containing the data that will be send.
705 * @param sid is the source identifier of the data that will be sent.
705 * @param sid is the source identifier of the data that will be sent.
706 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
706 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
707 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
707 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
708 * contain information to setup the transmission of the data packets.
708 * contain information to setup the transmission of the data packets.
709 *
709 *
710 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
710 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
711 *
711 *
712 */
712 */
713
713
714 unsigned int i;
714 unsigned int i;
715 int ret;
715 int ret;
716 rtems_status_code status;
716 rtems_status_code status;
717 spw_ioctl_pkt_send spw_ioctl_send_SWF;
717 spw_ioctl_pkt_send spw_ioctl_send_SWF;
718
718
719 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
719 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
720 spw_ioctl_send_SWF.options = 0;
720 spw_ioctl_send_SWF.options = 0;
721
721
722 ret = LFR_DEFAULT;
722 ret = LFR_DEFAULT;
723
723
724 for (i=0; i<7; i++) // send waveform
724 for (i=0; i<7; i++) // send waveform
725 {
725 {
726 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
726 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
727 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
727 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
728 // BUILD THE DATA
728 // BUILD THE DATA
729 if (i==6) {
729 if (i==6) {
730 spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK;
730 spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK;
731 }
731 }
732 else {
732 else {
733 spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK;
733 spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK;
734 }
734 }
735 // SET PACKET SEQUENCE COUNTER
736 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
735 // SET PACKET TIME
737 // SET PACKET TIME
736 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
738 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
737 headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
739 headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
738 headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
740 headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
739 headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
741 headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
740 headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
742 headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
741 headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
743 headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
742 headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
744 headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
743 headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
745 headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
744 headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
746 headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
745 headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time);
747 headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time);
746 headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8);
748 headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8);
747 headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time);
749 headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time);
748 // SEND PACKET
750 // SEND PACKET
749 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
751 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
750 if (status != RTEMS_SUCCESSFUL) {
752 if (status != RTEMS_SUCCESSFUL) {
751 printf("%d-%d, ERR %d\n", sid, i, (int) status);
753 printf("%d-%d, ERR %d\n", sid, i, (int) status);
752 ret = LFR_DEFAULT;
754 ret = LFR_DEFAULT;
753 }
755 }
754 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
756 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
755 }
757 }
756
758
757 return ret;
759 return ret;
758 }
760 }
759
761
760 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
762 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
761 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
763 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
762 {
764 {
763 /** This function sends CWF CCSDS packets (F2, F1 or F0).
765 /** This function sends CWF CCSDS packets (F2, F1 or F0).
764 *
766 *
765 * @param waveform points to the buffer containing the data that will be send.
767 * @param waveform points to the buffer containing the data that will be send.
766 * @param sid is the source identifier of the data that will be sent.
768 * @param sid is the source identifier of the data that will be sent.
767 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
769 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
768 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
770 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
769 * contain information to setup the transmission of the data packets.
771 * contain information to setup the transmission of the data packets.
770 *
772 *
771 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
773 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
772 *
774 *
773 */
775 */
774
776
775 unsigned int i;
777 unsigned int i;
776 int ret;
778 int ret;
777 rtems_status_code status;
779 rtems_status_code status;
778 spw_ioctl_pkt_send spw_ioctl_send_CWF;
780 spw_ioctl_pkt_send spw_ioctl_send_CWF;
779
781
780 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
782 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
781 spw_ioctl_send_CWF.options = 0;
783 spw_ioctl_send_CWF.options = 0;
782
784
783 ret = LFR_DEFAULT;
785 ret = LFR_DEFAULT;
784
786
785 for (i=0; i<7; i++) // send waveform
787 for (i=0; i<7; i++) // send waveform
786 {
788 {
787 int coarseTime = 0x00;
789 int coarseTime = 0x00;
788 int fineTime = 0x00;
790 int fineTime = 0x00;
789 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
791 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
790 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
792 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
791 // BUILD THE DATA
793 // BUILD THE DATA
792 if (i==6) {
794 if (i==6) {
793 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK;
795 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK;
794 }
796 }
795 else {
797 else {
796 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK;
798 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK;
797 }
799 }
800 // SET PACKET SEQUENCE COUNTER
801 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
798 // SET PACKET TIME
802 // SET PACKET TIME
799 coarseTime = time_management_regs->coarse_time;
803 coarseTime = time_management_regs->coarse_time;
800 fineTime = time_management_regs->fine_time;
804 fineTime = time_management_regs->fine_time;
801 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
805 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
802 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
806 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
803 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
807 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
804 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
808 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
805 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
809 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
806 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
810 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
807 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
811 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
808 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
812 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
809 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
813 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
810 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
814 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
811 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
815 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
812 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
816 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
813 // SEND PACKET
817 // SEND PACKET
814 if (sid == SID_NORM_CWF_F3)
818 if (sid == SID_NORM_CWF_F3)
815 {
819 {
816 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
820 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
817 if (status != RTEMS_SUCCESSFUL) {
821 if (status != RTEMS_SUCCESSFUL) {
818 printf("%d-%d, ERR %d\n", sid, i, (int) status);
822 printf("%d-%d, ERR %d\n", sid, i, (int) status);
819 ret = LFR_DEFAULT;
823 ret = LFR_DEFAULT;
820 }
824 }
821 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
825 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
822 }
826 }
823 else
827 else
824 {
828 {
825 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
829 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
826 if (status != RTEMS_SUCCESSFUL) {
830 if (status != RTEMS_SUCCESSFUL) {
827 printf("%d-%d, ERR %d\n", sid, i, (int) status);
831 printf("%d-%d, ERR %d\n", sid, i, (int) status);
828 ret = LFR_DEFAULT;
832 ret = LFR_DEFAULT;
829 }
833 }
830 }
834 }
831 }
835 }
832
836
833 return ret;
837 return ret;
834 }
838 }
835
839
836 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
840 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
837 {
841 {
838 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
842 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
839 *
843 *
840 * @param waveform points to the buffer containing the data that will be send.
844 * @param waveform points to the buffer containing the data that will be send.
841 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
845 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
842 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
846 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
843 * contain information to setup the transmission of the data packets.
847 * contain information to setup the transmission of the data packets.
844 *
848 *
845 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
849 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
846 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
850 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
847 *
851 *
848 */
852 */
849
853
850 unsigned int i;
854 unsigned int i;
851 int ret;
855 int ret;
852 rtems_status_code status;
856 rtems_status_code status;
853 spw_ioctl_pkt_send spw_ioctl_send_CWF;
857 spw_ioctl_pkt_send spw_ioctl_send_CWF;
854 char *sample;
858 char *sample;
855
859
856 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
860 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
857 spw_ioctl_send_CWF.options = 0;
861 spw_ioctl_send_CWF.options = 0;
858
862
859 ret = LFR_DEFAULT;
863 ret = LFR_DEFAULT;
860
864
861 //**********************
865 //**********************
862 // BUILD CWF3_light DATA
866 // BUILD CWF3_light DATA
863 for ( i=0; i< 2048; i++)
867 for ( i=0; i< 2048; i++)
864 {
868 {
865 sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ];
869 sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ];
866 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ];
870 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ];
867 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ];
871 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ];
868 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ];
872 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ];
869 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ];
873 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ];
870 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ];
874 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ];
871 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ];
875 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ];
872 }
876 }
873
877
874 //*********************
878 //*********************
875 // SEND CWF3_light DATA
879 // SEND CWF3_light DATA
876
880
877 for (i=0; i<7; i++) // send waveform
881 for (i=0; i<7; i++) // send waveform
878 {
882 {
879 int coarseTime = 0x00;
883 int coarseTime = 0x00;
880 int fineTime = 0x00;
884 int fineTime = 0x00;
881 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * 340 * NB_BYTES_CWF3_LIGHT_BLK) ];
885 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * 340 * NB_BYTES_CWF3_LIGHT_BLK) ];
882 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
886 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
883 // BUILD THE DATA
887 // BUILD THE DATA
884 if ( i == WFRM_INDEX_OF_LAST_PACKET ) {
888 if ( i == WFRM_INDEX_OF_LAST_PACKET ) {
885 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_CWF3_LIGHT_BLK;
889 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_CWF3_LIGHT_BLK;
886 }
890 }
887 else {
891 else {
888 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK;
892 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK;
889 }
893 }
894 // SET PACKET SEQUENCE COUNTER
895 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
890 // SET PACKET TIME
896 // SET PACKET TIME
891 coarseTime = time_management_regs->coarse_time;
897 coarseTime = time_management_regs->coarse_time;
892 fineTime = time_management_regs->fine_time;
898 fineTime = time_management_regs->fine_time;
893 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
899 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
894 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
900 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
895 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
901 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
896 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
902 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
897 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
903 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
898 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
904 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
899 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
905 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
900 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
906 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
901 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
907 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
902 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
908 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
903 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
909 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
904 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
910 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
905 // SEND PACKET
911 // SEND PACKET
906 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
912 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
907 if (status != RTEMS_SUCCESSFUL) {
913 if (status != RTEMS_SUCCESSFUL) {
908 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
914 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
909 ret = LFR_DEFAULT;
915 ret = LFR_DEFAULT;
910 }
916 }
911 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
917 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
912 }
918 }
913
919
914 return ret;
920 return ret;
915 }
921 }
916
922
917
923
918 //**************
924 //**************
919 // wfp registers
925 // wfp registers
920 void set_wfp_data_shaping()
926 void set_wfp_data_shaping()
921 {
927 {
922 /** This function sets the data_shaping register of the waveform picker module.
928 /** This function sets the data_shaping register of the waveform picker module.
923 *
929 *
924 * The value is read from one field of the parameter_dump_packet structure:\n
930 * The value is read from one field of the parameter_dump_packet structure:\n
925 * bw_sp0_sp1_r0_r1
931 * bw_sp0_sp1_r0_r1
926 *
932 *
927 */
933 */
928
934
929 unsigned char data_shaping;
935 unsigned char data_shaping;
930
936
931 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
937 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
932 // waveform picker : [R1 R0 SP1 SP0 BW]
938 // waveform picker : [R1 R0 SP1 SP0 BW]
933
939
934 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
940 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
935
941
936 #ifdef GSA
942 #ifdef GSA
937 #else
943 #else
938 waveform_picker_regs->data_shaping =
944 waveform_picker_regs->data_shaping =
939 ( (data_shaping & 0x10) >> 4 ) // BW
945 ( (data_shaping & 0x10) >> 4 ) // BW
940 + ( (data_shaping & 0x08) >> 2 ) // SP0
946 + ( (data_shaping & 0x08) >> 2 ) // SP0
941 + ( (data_shaping & 0x04) ) // SP1
947 + ( (data_shaping & 0x04) ) // SP1
942 + ( (data_shaping & 0x02) << 2 ) // R0
948 + ( (data_shaping & 0x02) << 2 ) // R0
943 + ( (data_shaping & 0x01) << 4 ); // R1
949 + ( (data_shaping & 0x01) << 4 ); // R1
944 #endif
950 #endif
945 }
951 }
946
952
947 char set_wfp_delta_snapshot()
953 char set_wfp_delta_snapshot()
948 {
954 {
949 /** This function sets the delta_snapshot register of the waveform picker module.
955 /** This function sets the delta_snapshot register of the waveform picker module.
950 *
956 *
951 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
957 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
952 * - sy_lfr_n_swf_p[0]
958 * - sy_lfr_n_swf_p[0]
953 * - sy_lfr_n_swf_p[1]
959 * - sy_lfr_n_swf_p[1]
954 *
960 *
955 */
961 */
956
962
957 char ret;
963 char ret;
958 unsigned int delta_snapshot;
964 unsigned int delta_snapshot;
959 unsigned int aux;
965 unsigned int aux;
960
966
961 aux = 0;
967 aux = 0;
962 ret = LFR_DEFAULT;
968 ret = LFR_DEFAULT;
963
969
964 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
970 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
965 + parameter_dump_packet.sy_lfr_n_swf_p[1];
971 + parameter_dump_packet.sy_lfr_n_swf_p[1];
966
972
967 #ifdef GSA
973 #ifdef GSA
968 #else
974 #else
969 if ( delta_snapshot < MIN_DELTA_SNAPSHOT )
975 if ( delta_snapshot < MIN_DELTA_SNAPSHOT )
970 {
976 {
971 aux = MIN_DELTA_SNAPSHOT;
977 aux = MIN_DELTA_SNAPSHOT;
972 ret = LFR_DEFAULT;
978 ret = LFR_DEFAULT;
973 }
979 }
974 else
980 else
975 {
981 {
976 aux = delta_snapshot ;
982 aux = delta_snapshot ;
977 ret = LFR_SUCCESSFUL;
983 ret = LFR_SUCCESSFUL;
978 }
984 }
979 waveform_picker_regs->delta_snapshot = aux - 1; // max 2 bytes
985 waveform_picker_regs->delta_snapshot = aux - 1; // max 2 bytes
980 #endif
986 #endif
981
987
982 return ret;
988 return ret;
983 }
989 }
984
990
985 void set_wfp_burst_enable_register( unsigned char mode)
991 void set_wfp_burst_enable_register( unsigned char mode)
986 {
992 {
987 /** This function sets the waveform picker burst_enable register depending on the mode.
993 /** This function sets the waveform picker burst_enable register depending on the mode.
988 *
994 *
989 * @param mode is the LFR mode to launch.
995 * @param mode is the LFR mode to launch.
990 *
996 *
991 * The burst bits shall be before the enable bits.
997 * The burst bits shall be before the enable bits.
992 *
998 *
993 */
999 */
994
1000
995 #ifdef GSA
1001 #ifdef GSA
996 #else
1002 #else
997 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1003 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
998 // the burst bits shall be set first, before the enable bits
1004 // the burst bits shall be set first, before the enable bits
999 switch(mode) {
1005 switch(mode) {
1000 case(LFR_MODE_NORMAL):
1006 case(LFR_MODE_NORMAL):
1001 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enable
1007 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enable
1002 waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1008 waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1003 break;
1009 break;
1004 case(LFR_MODE_BURST):
1010 case(LFR_MODE_BURST):
1005 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
1011 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
1006 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2
1012 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2
1007 break;
1013 break;
1008 case(LFR_MODE_SBM1):
1014 case(LFR_MODE_SBM1):
1009 waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled
1015 waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled
1010 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1016 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1011 break;
1017 break;
1012 case(LFR_MODE_SBM2):
1018 case(LFR_MODE_SBM2):
1013 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
1019 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
1014 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1020 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1015 break;
1021 break;
1016 default:
1022 default:
1017 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1023 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1018 break;
1024 break;
1019 }
1025 }
1020 #endif
1026 #endif
1021 }
1027 }
1022
1028
1023 void reset_wfp_burst_enable()
1029 void reset_wfp_burst_enable()
1024 {
1030 {
1025 /** This function resets the waveform picker burst_enable register.
1031 /** This function resets the waveform picker burst_enable register.
1026 *
1032 *
1027 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
1033 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
1028 *
1034 *
1029 */
1035 */
1030
1036
1031 #ifdef GSA
1037 #ifdef GSA
1032 #else
1038 #else
1033 waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1039 waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1034 #endif
1040 #endif
1035 }
1041 }
1036
1042
1037 void reset_wfp_status()
1043 void reset_wfp_status()
1038 {
1044 {
1039 /** This function resets the waveform picker status register.
1045 /** This function resets the waveform picker status register.
1040 *
1046 *
1041 * All status bits are set to 0 [new_err full_err full].
1047 * All status bits are set to 0 [new_err full_err full].
1042 *
1048 *
1043 */
1049 */
1044
1050
1045 #ifdef GSA
1051 #ifdef GSA
1046 #else
1052 #else
1047 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1053 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1048 #endif
1054 #endif
1049 }
1055 }
1050
1056
1051 void reset_waveform_picker_regs()
1057 void reset_waveform_picker_regs()
1052 {
1058 {
1053 /** This function resets the waveform picker module registers.
1059 /** This function resets the waveform picker module registers.
1054 *
1060 *
1055 * The registers affected by this function are located at the following offset addresses:
1061 * The registers affected by this function are located at the following offset addresses:
1056 * - 0x00 data_shaping
1062 * - 0x00 data_shaping
1057 * - 0x04 burst_enable
1063 * - 0x04 burst_enable
1058 * - 0x08 addr_data_f0
1064 * - 0x08 addr_data_f0
1059 * - 0x0C addr_data_f1
1065 * - 0x0C addr_data_f1
1060 * - 0x10 addr_data_f2
1066 * - 0x10 addr_data_f2
1061 * - 0x14 addr_data_f3
1067 * - 0x14 addr_data_f3
1062 * - 0x18 status
1068 * - 0x18 status
1063 * - 0x1C delta_snapshot
1069 * - 0x1C delta_snapshot
1064 * - 0x20 delta_f2_f1
1070 * - 0x20 delta_f2_f1
1065 * - 0x24 delta_f2_f0
1071 * - 0x24 delta_f2_f0
1066 * - 0x28 nb_burst
1072 * - 0x28 nb_burst
1067 * - 0x2C nb_snapshot
1073 * - 0x2C nb_snapshot
1068 *
1074 *
1069 */
1075 */
1070
1076
1071 #ifdef GSA
1077 #ifdef GSA
1072 #else
1078 #else
1073 reset_wfp_burst_enable();
1079 reset_wfp_burst_enable();
1074 reset_wfp_status();
1080 reset_wfp_status();
1075 // set buffer addresses
1081 // set buffer addresses
1076 waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); //
1082 waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); //
1077 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); //
1083 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); //
1078 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); //
1084 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); //
1079 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); //
1085 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); //
1080 // set other parameters
1086 // set other parameters
1081 set_wfp_data_shaping();
1087 set_wfp_data_shaping();
1082 set_wfp_delta_snapshot(); // time in seconds between two snapshots
1088 set_wfp_delta_snapshot(); // time in seconds between two snapshots
1083 waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes)
1089 waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes)
1084 waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes)
1090 waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes)
1085 waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
1091 waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
1086 waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1
1092 waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1
1087 #endif
1093 #endif
1088 }
1094 }
1089
1095
1090 //*****************
1096 //*****************
1091 // local parameters
1097 // local parameters
1092 void set_local_sbm1_nb_cwf_max()
1098 void set_local_sbm1_nb_cwf_max()
1093 {
1099 {
1094 /** This function sets the value of the sbm1_nb_cwf_max local parameter.
1100 /** This function sets the value of the sbm1_nb_cwf_max local parameter.
1095 *
1101 *
1096 * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n
1102 * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n
1097 * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.\n\n
1103 * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.\n\n
1098 * (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot)
1104 * (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot)
1099 *
1105 *
1100 */
1106 */
1101 param_local.local_sbm1_nb_cwf_max = 2 *
1107 param_local.local_sbm1_nb_cwf_max = 2 *
1102 (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256
1108 (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256
1103 + parameter_dump_packet.sy_lfr_n_swf_p[1]) - 8; // 16 CWF1 parts during 1 SWF2
1109 + parameter_dump_packet.sy_lfr_n_swf_p[1]) - 8; // 16 CWF1 parts during 1 SWF2
1104 }
1110 }
1105
1111
1106 void set_local_sbm2_nb_cwf_max()
1112 void set_local_sbm2_nb_cwf_max()
1107 {
1113 {
1108 /** This function sets the value of the sbm1_nb_cwf_max local parameter.
1114 /** This function sets the value of the sbm1_nb_cwf_max local parameter.
1109 *
1115 *
1110 * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n
1116 * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n
1111 * This parameter is used to send CWF_F2 data as normal data when the SBM2 is active.\n\n
1117 * This parameter is used to send CWF_F2 data as normal data when the SBM2 is active.\n\n
1112 * (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz)
1118 * (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz)
1113 *
1119 *
1114 */
1120 */
1115
1121
1116 param_local.local_sbm2_nb_cwf_max = (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256
1122 param_local.local_sbm2_nb_cwf_max = (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256
1117 + parameter_dump_packet.sy_lfr_n_swf_p[1]) / 8;
1123 + parameter_dump_packet.sy_lfr_n_swf_p[1]) / 8;
1118 }
1124 }
1119
1125
1120 void set_local_nb_interrupt_f0_MAX()
1126 void set_local_nb_interrupt_f0_MAX()
1121 {
1127 {
1122 /** This function sets the value of the nb_interrupt_f0_MAX local parameter.
1128 /** This function sets the value of the nb_interrupt_f0_MAX local parameter.
1123 *
1129 *
1124 * This parameter is used for the SM validation only.\n
1130 * This parameter is used for the SM validation only.\n
1125 * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices
1131 * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices
1126 * module before launching a basic processing.
1132 * module before launching a basic processing.
1127 *
1133 *
1128 */
1134 */
1129
1135
1130 param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256
1136 param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256
1131 + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100;
1137 + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100;
1132 }
1138 }
1133
1139
1134 void reset_local_sbm1_nb_cwf_sent()
1140 void reset_local_sbm1_nb_cwf_sent()
1135 {
1141 {
1136 /** This function resets the value of the sbm1_nb_cwf_sent local parameter.
1142 /** This function resets the value of the sbm1_nb_cwf_sent local parameter.
1137 *
1143 *
1138 * The sbm1_nb_cwf_sent parameter counts the number of CWF_F1 records that have been sent.\n
1144 * The sbm1_nb_cwf_sent parameter counts the number of CWF_F1 records that have been sent.\n
1139 * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.
1145 * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.
1140 *
1146 *
1141 */
1147 */
1142
1148
1143 param_local.local_sbm1_nb_cwf_sent = 0;
1149 param_local.local_sbm1_nb_cwf_sent = 0;
1144 }
1150 }
1145
1151
1146 void reset_local_sbm2_nb_cwf_sent()
1152 void reset_local_sbm2_nb_cwf_sent()
1147 {
1153 {
1148 /** This function resets the value of the sbm2_nb_cwf_sent local parameter.
1154 /** This function resets the value of the sbm2_nb_cwf_sent local parameter.
1149 *
1155 *
1150 * The sbm2_nb_cwf_sent parameter counts the number of CWF_F2 records that have been sent.\n
1156 * The sbm2_nb_cwf_sent parameter counts the number of CWF_F2 records that have been sent.\n
1151 * This parameter is used to send CWF_F2 data as normal data when the SBM2 mode is active.
1157 * This parameter is used to send CWF_F2 data as normal data when the SBM2 mode is active.
1152 *
1158 *
1153 */
1159 */
1154
1160
1155 param_local.local_sbm2_nb_cwf_sent = 0;
1161 param_local.local_sbm2_nb_cwf_sent = 0;
1156 }
1162 }
1157
1163
1158 rtems_id get_pkts_queue_id( void )
1164 rtems_id get_pkts_queue_id( void )
1159 {
1165 {
1160 rtems_id queue_id;
1166 rtems_id queue_id;
1161 rtems_status_code status;
1167 rtems_status_code status;
1162 rtems_name queue_send_name;
1168 rtems_name queue_send_name;
1163
1169
1164 queue_send_name = rtems_build_name( 'Q', '_', 'S', 'D' );
1170 queue_send_name = rtems_build_name( 'Q', '_', 'S', 'D' );
1165
1171
1166 status = rtems_message_queue_ident( queue_send_name, 0, &queue_id );
1172 status = rtems_message_queue_ident( queue_send_name, 0, &queue_id );
1167 if (status != RTEMS_SUCCESSFUL)
1173 if (status != RTEMS_SUCCESSFUL)
1168 {
1174 {
1169 PRINTF1("in get_pkts_queue_id *** ERR %d\n", status)
1175 PRINTF1("in get_pkts_queue_id *** ERR %d\n", status)
1170 }
1176 }
1171 return queue_id;
1177 return queue_id;
1172 }
1178 }
1179
1180 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1181 {
1182 unsigned short *sequence_cnt;
1183 unsigned short segmentation_grouping_flag;
1184 unsigned short new_packet_sequence_control;
1185
1186 if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2)
1187 || (sid ==SID_BURST_CWF_F2) )
1188 {
1189 sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST;
1190 }
1191 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) )
1192 {
1193 sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2;
1194 }
1195 else
1196 {
1197 sequence_cnt = &sequenceCounters_TC_EXE[ UNKNOWN ];
1198 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1199 }
1200
1201 segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8;
1202 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1203
1204 new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ;
1205
1206 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1207 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1208
1209 // increment the seuqence counter for the next packet
1210 if ( *sequence_cnt < SEQ_CNT_MAX)
1211 {
1212 *sequence_cnt = *sequence_cnt + 1;
1213 }
1214 else
1215 {
1216 *sequence_cnt = 0;
1217 }
1218
1219 }
General Comments 0
You need to be logged in to leave comments. Login now