##// END OF EJS Templates
ICD 2.0...
paul -
r92:7c50b5fd63ee VHDLib206
parent child
Show More
@@ -1,248 +1,248
1 #############################################################################
1 #############################################################################
2 # Makefile for building: bin/fsw-vhdl-dev
2 # Makefile for building: bin/fsw-vhdl-dev
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Jan 23 13:51:15 2014
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Mon Jan 27 07:11:41 2014
4 # Project: fsw-qt.pro
4 # Project: fsw-qt.pro
5 # Template: app
5 # Template: app
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
7 #############################################################################
7 #############################################################################
8
8
9 ####### Compiler, tools and options
9 ####### Compiler, tools and options
10
10
11 CC = sparc-rtems-gcc
11 CC = sparc-rtems-gcc
12 CXX = sparc-rtems-g++
12 CXX = sparc-rtems-g++
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=1 -DPRINT_MESSAGES_ON_CONSOLE -DDEBUG_MESSAGES -DVHDL_DEV
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=1 -DPRINT_MESSAGES_ON_CONSOLE -DDEBUG_MESSAGES -DVHDL_DEV
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header
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-vhdl-dev
90 QMAKE_TARGET = fsw-vhdl-dev
91 DESTDIR = bin/
91 DESTDIR = bin/
92 TARGET = bin/fsw-vhdl-dev
92 TARGET = bin/fsw-vhdl-dev
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/fsw-vhdl-dev1.0.0 || $(MKDIR) obj/fsw-vhdl-dev1.0.0
173 @$(CHK_DIR_EXISTS) obj/fsw-vhdl-dev1.0.0 || $(MKDIR) obj/fsw-vhdl-dev1.0.0
174 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw-vhdl-dev1.0.0/ && (cd `dirname obj/fsw-vhdl-dev1.0.0` && $(TAR) fsw-vhdl-dev1.0.0.tar fsw-vhdl-dev1.0.0 && $(COMPRESS) fsw-vhdl-dev1.0.0.tar) && $(MOVE) `dirname obj/fsw-vhdl-dev1.0.0`/fsw-vhdl-dev1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw-vhdl-dev1.0.0
174 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw-vhdl-dev1.0.0/ && (cd `dirname obj/fsw-vhdl-dev1.0.0` && $(TAR) fsw-vhdl-dev1.0.0.tar fsw-vhdl-dev1.0.0 && $(COMPRESS) fsw-vhdl-dev1.0.0.tar) && $(MOVE) `dirname obj/fsw-vhdl-dev1.0.0`/fsw-vhdl-dev1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw-vhdl-dev1.0.0
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,311 +1,311
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 3.0.0, 2014-01-24T06:51:07. -->
3 <!-- Written by QtCreator 3.0.0, 2014-01-28T06:58:48. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
7 <value type="int">0</value>
7 <value type="int">0</value>
8 </data>
8 </data>
9 <data>
9 <data>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
11 <valuemap type="QVariantMap">
11 <valuemap type="QVariantMap">
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
16 <value type="QString" key="language">Cpp</value>
16 <value type="QString" key="language">Cpp</value>
17 <valuemap type="QVariantMap" key="value">
17 <valuemap type="QVariantMap" key="value">
18 <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
18 <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
19 </valuemap>
19 </valuemap>
20 </valuemap>
20 </valuemap>
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
22 <value type="QString" key="language">QmlJS</value>
22 <value type="QString" key="language">QmlJS</value>
23 <valuemap type="QVariantMap" key="value">
23 <valuemap type="QVariantMap" key="value">
24 <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
24 <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
25 </valuemap>
25 </valuemap>
26 </valuemap>
26 </valuemap>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
28 <value type="QByteArray" key="EditorConfiguration.Codec">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 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
61 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
63 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
63 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
64 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
64 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
67 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
67 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
69 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
69 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
70 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
70 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
71 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
71 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
72 </valuemap>
72 </valuemap>
73 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
73 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
74 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
74 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
77 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
77 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
78 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
78 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
79 <value type="QString">-w</value>
79 <value type="QString">-w</value>
80 <value type="QString">-r</value>
80 <value type="QString">-r</value>
81 </valuelist>
81 </valuelist>
82 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
82 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w -j 4</value>
83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w -j 4</value>
84 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
84 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
85 </valuemap>
85 </valuemap>
86 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
86 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
89 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
89 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
90 </valuemap>
90 </valuemap>
91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
92 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
92 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
93 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
93 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
96 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
96 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
97 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
97 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
98 <value type="QString">-w</value>
98 <value type="QString">-w</value>
99 <value type="QString">-r</value>
99 <value type="QString">-r</value>
100 </valuelist>
100 </valuelist>
101 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
101 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value>
102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value>
103 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
103 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
104 </valuemap>
104 </valuemap>
105 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
105 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
108 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
108 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
109 </valuemap>
109 </valuemap>
110 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
110 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
111 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
111 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
112 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
112 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
115 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
115 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
116 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
116 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">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 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
120 <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
122 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
122 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
123 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
123 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
126 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
126 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
127 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
127 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
128 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
128 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
129 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
129 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
130 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
130 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
131 </valuemap>
131 </valuemap>
132 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
132 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
133 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
133 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
134 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
134 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
136 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
136 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
137 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
137 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
138 <value type="QString">-w</value>
138 <value type="QString">-w</value>
139 <value type="QString">-r</value>
139 <value type="QString">-r</value>
140 </valuelist>
140 </valuelist>
141 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
141 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
142 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w </value>
142 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w </value>
143 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
143 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
144 </valuemap>
144 </valuemap>
145 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
145 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
146 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
146 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
147 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
147 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
148 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
148 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
149 </valuemap>
149 </valuemap>
150 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
150 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
151 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
151 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
152 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
152 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
153 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
153 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
154 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
154 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
155 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
155 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
156 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
156 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
157 <value type="QString">-w</value>
157 <value type="QString">-w</value>
158 <value type="QString">-r</value>
158 <value type="QString">-r</value>
159 </valuelist>
159 </valuelist>
160 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
160 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
161 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value>
161 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value>
162 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
162 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
163 </valuemap>
163 </valuemap>
164 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
164 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
165 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
165 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
166 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
166 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
167 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
167 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
168 </valuemap>
168 </valuemap>
169 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
169 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
170 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
170 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
171 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
171 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value>
173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
174 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
174 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
175 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
175 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</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 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
194 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
195 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
195 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
196 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
196 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
197 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
197 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
198 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
198 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
199 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
199 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
200 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
200 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
201 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
201 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
202 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
202 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
203 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
203 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</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="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
206 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
207 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
207 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
208 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
208 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
209 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
209 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
210 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
210 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
211 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
211 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
212 <value type="int">0</value>
212 <value type="int">0</value>
213 <value type="int">1</value>
213 <value type="int">1</value>
214 <value type="int">2</value>
214 <value type="int">2</value>
215 <value type="int">3</value>
215 <value type="int">3</value>
216 <value type="int">4</value>
216 <value type="int">4</value>
217 <value type="int">5</value>
217 <value type="int">5</value>
218 <value type="int">6</value>
218 <value type="int">6</value>
219 <value type="int">7</value>
219 <value type="int">7</value>
220 <value type="int">8</value>
220 <value type="int">8</value>
221 <value type="int">9</value>
221 <value type="int">9</value>
222 <value type="int">10</value>
222 <value type="int">10</value>
223 <value type="int">11</value>
223 <value type="int">11</value>
224 <value type="int">12</value>
224 <value type="int">12</value>
225 <value type="int">13</value>
225 <value type="int">13</value>
226 <value type="int">14</value>
226 <value type="int">14</value>
227 </valuelist>
227 </valuelist>
228 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
228 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
229 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
229 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
230 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
230 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
231 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
231 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
232 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
232 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
233 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
233 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
234 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
234 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
235 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
235 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
236 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
236 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
237 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
237 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
238 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
238 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
239 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
239 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
240 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
240 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
241 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
241 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
242 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
242 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
243 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
243 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
244 </valuemap>
244 </valuemap>
245 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
245 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
246 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
246 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
247 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
247 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
248 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
248 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
249 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
249 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
250 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
250 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
251 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
251 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
252 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
252 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
253 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
253 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
254 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
254 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
255 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
255 <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
256 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
256 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
257 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
257 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
258 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
258 <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
259 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
259 <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
260 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
260 <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
261 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
261 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
262 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
262 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
263 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
263 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
264 <value type="int">0</value>
264 <value type="int">0</value>
265 <value type="int">1</value>
265 <value type="int">1</value>
266 <value type="int">2</value>
266 <value type="int">2</value>
267 <value type="int">3</value>
267 <value type="int">3</value>
268 <value type="int">4</value>
268 <value type="int">4</value>
269 <value type="int">5</value>
269 <value type="int">5</value>
270 <value type="int">6</value>
270 <value type="int">6</value>
271 <value type="int">7</value>
271 <value type="int">7</value>
272 <value type="int">8</value>
272 <value type="int">8</value>
273 <value type="int">9</value>
273 <value type="int">9</value>
274 <value type="int">10</value>
274 <value type="int">10</value>
275 <value type="int">11</value>
275 <value type="int">11</value>
276 <value type="int">12</value>
276 <value type="int">12</value>
277 <value type="int">13</value>
277 <value type="int">13</value>
278 <value type="int">14</value>
278 <value type="int">14</value>
279 </valuelist>
279 </valuelist>
280 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
280 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
281 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
281 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
282 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
282 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
283 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">doxygen</value>
283 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">doxygen</value>
284 <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">true</value>
284 <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">true</value>
285 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">/opt/DEV_PLE/doc</value>
285 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">/opt/DEV_PLE/doc</value>
286 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run doxygen</value>
286 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run doxygen</value>
287 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
287 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
288 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
288 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
289 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
289 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
290 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
290 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
291 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
291 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
292 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
292 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
293 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
293 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
294 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
294 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
295 </valuemap>
295 </valuemap>
296 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">2</value>
296 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">2</value>
297 </valuemap>
297 </valuemap>
298 </data>
298 </data>
299 <data>
299 <data>
300 <variable>ProjectExplorer.Project.TargetCount</variable>
300 <variable>ProjectExplorer.Project.TargetCount</variable>
301 <value type="int">1</value>
301 <value type="int">1</value>
302 </data>
302 </data>
303 <data>
303 <data>
304 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
304 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
305 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
305 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
306 </data>
306 </data>
307 <data>
307 <data>
308 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
308 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
309 <value type="int">15</value>
309 <value type="int">15</value>
310 </data>
310 </data>
311 </qtcreator>
311 </qtcreator>
@@ -1,197 +1,199
1 #ifndef TC_TYPES_H
1 #ifndef TC_TYPES_H
2 #define TC_TYPES_H
2 #define TC_TYPES_H
3
3
4 #include <ccsds_types.h>
4 #include <ccsds_types.h>
5
5
6 #define PROTOCOLE_IDENTIFIER 0x02
6 #define PROTOCOLE_IDENTIFIER 0x02
7
7
8 // PACKET ID
8 // PACKET ID
9 #define TC_LFR_PACKET_ID 0x1ccc // PID 76 CAT 12
9 #define TC_LFR_PACKET_ID 0x1ccc // PID 76 CAT 12
10
10
11 #define PACKET_LENGTH_TC_LFR_RESET (12 - CCSDS_TC_TM_PACKET_OFFSET)
11 #define PACKET_LENGTH_TC_LFR_RESET (12 - CCSDS_TC_TM_PACKET_OFFSET)
12 #define PACKET_LENGTH_TC_LFR_LOAD_COMMON_PAR (14 - CCSDS_TC_TM_PACKET_OFFSET)
12 #define PACKET_LENGTH_TC_LFR_LOAD_COMMON_PAR (14 - CCSDS_TC_TM_PACKET_OFFSET)
13 #define PACKET_LENGTH_TC_LFR_LOAD_NORMAL_PAR (20 - CCSDS_TC_TM_PACKET_OFFSET)
13 #define PACKET_LENGTH_TC_LFR_LOAD_NORMAL_PAR (22 - CCSDS_TC_TM_PACKET_OFFSET)
14 #define PACKET_LENGTH_TC_LFR_LOAD_BURST_PAR (14 - CCSDS_TC_TM_PACKET_OFFSET)
14 #define PACKET_LENGTH_TC_LFR_LOAD_BURST_PAR (14 - CCSDS_TC_TM_PACKET_OFFSET)
15 #define PACKET_LENGTH_TC_LFR_LOAD_SBM1_PAR (14 - CCSDS_TC_TM_PACKET_OFFSET)
15 #define PACKET_LENGTH_TC_LFR_LOAD_SBM1_PAR (14 - CCSDS_TC_TM_PACKET_OFFSET)
16 #define PACKET_LENGTH_TC_LFR_LOAD_SBM2_PAR (14 - CCSDS_TC_TM_PACKET_OFFSET)
16 #define PACKET_LENGTH_TC_LFR_LOAD_SBM2_PAR (14 - CCSDS_TC_TM_PACKET_OFFSET)
17 #define PACKET_LENGTH_TC_LFR_DUMP_PAR (12 - CCSDS_TC_TM_PACKET_OFFSET)
17 #define PACKET_LENGTH_TC_LFR_DUMP_PAR (12 - CCSDS_TC_TM_PACKET_OFFSET)
18 #define PACKET_LENGTH_TC_LFR_ENTER_MODE (20 - CCSDS_TC_TM_PACKET_OFFSET)
18 #define PACKET_LENGTH_TC_LFR_ENTER_MODE (20 - CCSDS_TC_TM_PACKET_OFFSET)
19 #define PACKET_LENGTH_TC_LFR_UPDATE_INFO (48 - CCSDS_TC_TM_PACKET_OFFSET)
19 #define PACKET_LENGTH_TC_LFR_UPDATE_INFO (46 - CCSDS_TC_TM_PACKET_OFFSET)
20 #define PACKET_LENGTH_TC_LFR_ENABLE_CALIBRATION (12 - CCSDS_TC_TM_PACKET_OFFSET)
20 #define PACKET_LENGTH_TC_LFR_ENABLE_CALIBRATION (12 - CCSDS_TC_TM_PACKET_OFFSET)
21 #define PACKET_LENGTH_TC_LFR_DISABLE_CALIBRATION (12 - CCSDS_TC_TM_PACKET_OFFSET)
21 #define PACKET_LENGTH_TC_LFR_DISABLE_CALIBRATION (12 - CCSDS_TC_TM_PACKET_OFFSET)
22 #define PACKET_LENGTH_TC_LFR_UPDATE_TIME (18 - CCSDS_TC_TM_PACKET_OFFSET)
22 #define PACKET_LENGTH_TC_LFR_UPDATE_TIME (18 - CCSDS_TC_TM_PACKET_OFFSET)
23
23
24 // TC TYPES
24 // TC TYPES
25 #define TC_TYPE_DEFAULT 181
25 #define TC_TYPE_DEFAULT 181
26 #define TC_TYPE_LFR_UPDATE_TIME 9
26 #define TC_TYPE_LFR_UPDATE_TIME 9
27
27
28 // TC SUBTYPES
28 // TC SUBTYPES
29 #define TC_SUBTYPE_RESET 1
29 #define TC_SUBTYPE_RESET 1
30 #define TC_SUBTYPE_LOAD_COMMON_PAR 11
30 #define TC_SUBTYPE_LOAD_COMMON_PAR 11
31 #define TC_SUBTYPE_LOAD_NORMAL_PAR 13
31 #define TC_SUBTYPE_LOAD_NORMAL_PAR 13
32 #define TC_SUBTYPE_LOAD_BURST_PAR 19
32 #define TC_SUBTYPE_LOAD_BURST_PAR 19
33 #define TC_SUBTYPE_LOAD_SBM1_PAR 25
33 #define TC_SUBTYPE_LOAD_SBM1_PAR 25
34 #define TC_SUBTYPE_LOAD_SBM2_PAR 27
34 #define TC_SUBTYPE_LOAD_SBM2_PAR 27
35 #define TC_SUBTYPE_DUMP_PAR 31
35 #define TC_SUBTYPE_DUMP_PAR 31
36 #define TC_SUBTYPE_ENTER_MODE 41
36 #define TC_SUBTYPE_ENTER_MODE 41
37 #define TC_SUBTYPE_UPDATE_INFO 51
37 #define TC_SUBTYPE_UPDATE_INFO 51
38 #define TC_SUBTYPE_ENABLE_CALIBRATION 61
38 #define TC_SUBTYPE_ENABLE_CALIBRATION 61
39 #define TC_SUBTYPE_DISABLE_CALIBRATION 63
39 #define TC_SUBTYPE_DISABLE_CALIBRATION 63
40 #define TC_SUBTYPE_UPDATE_TIME 129
40 #define TC_SUBTYPE_UPDATE_TIME 129
41
41
42 // OTHER CONSTANTS
42 // OTHER CONSTANTS
43 #define TC_LFR_PACKET_SEQUENCE_CONTROL 0xc000 // PID 76 CAT 12
43 #define TC_LFR_PACKET_SEQUENCE_CONTROL 0xc000 // PID 76 CAT 12
44 #define TC_LFR_DATA_FIELD_HEADER0 0x19
44 #define TC_LFR_DATA_FIELD_HEADER0 0x19
45 #define TC_LFR_LOAD_COMMON_PAR_SPARE 0x00
45 #define TC_LFR_LOAD_COMMON_PAR_SPARE 0x00
46
46
47 struct Packet_TC_LFR_RESET_str
47 struct Packet_TC_LFR_RESET_str
48 { // the CCSDS header is added by LPPMON
48 { // the CCSDS header is added by LPPMON
49 unsigned char packetID[2];
49 unsigned char packetID[2];
50 unsigned char packetSequenceControl[2];
50 unsigned char packetSequenceControl[2];
51 unsigned char packetLength[2];
51 unsigned char packetLength[2];
52 // DATA FIELD HEADER
52 // DATA FIELD HEADER
53 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
53 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
54 unsigned char serviceType;
54 unsigned char serviceType;
55 unsigned char serviceSubType;
55 unsigned char serviceSubType;
56 unsigned char sourceID;
56 unsigned char sourceID;
57 unsigned char crc[2];
57 unsigned char crc[2];
58 };
58 };
59 typedef struct Packet_TC_LFR_RESET_str Packet_TC_LFR_RESET_t;
59 typedef struct Packet_TC_LFR_RESET_str Packet_TC_LFR_RESET_t;
60
60
61 struct Packet_TC_LFR_ENTER_MODE_str
61 struct Packet_TC_LFR_ENTER_MODE_str
62 { // the CCSDS header is added by LPPMON
62 { // the CCSDS header is added by LPPMON
63 unsigned char packetID[2];
63 unsigned char packetID[2];
64 unsigned char packetSequenceControl[2];
64 unsigned char packetSequenceControl[2];
65 unsigned char packetLength[2];
65 unsigned char packetLength[2];
66 // DATA FIELD HEADER
66 // DATA FIELD HEADER
67 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
67 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
68 unsigned char serviceType;
68 unsigned char serviceType;
69 unsigned char serviceSubType;
69 unsigned char serviceSubType;
70 unsigned char sourceID;
70 unsigned char sourceID;
71 unsigned char spare;
71 unsigned char spare;
72 unsigned char mode;
72 unsigned char mode;
73 unsigned char enterModeTime[6];
73 unsigned char enterModeTime[6];
74 unsigned char crc[2];
74 unsigned char crc[2];
75 };
75 };
76 typedef struct Packet_TC_LFR_ENTER_MODE_str Packet_TC_LFR_ENTER_MODE_t;
76 typedef struct Packet_TC_LFR_ENTER_MODE_str Packet_TC_LFR_ENTER_MODE_t;
77
77
78 struct Packet_TC_LFR_UPDATE_INFO_str
78 struct Packet_TC_LFR_UPDATE_INFO_str
79 { // the CCSDS header is added by LPPMON
79 { // the CCSDS header is added by LPPMON
80 unsigned char packetID[2];
80 unsigned char packetID[2];
81 unsigned char packetSequenceControl[2];
81 unsigned char packetSequenceControl[2];
82 unsigned char packetLength[2];
82 unsigned char packetLength[2];
83 // DATA FIELD HEADER
83 // DATA FIELD HEADER
84 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
84 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
85 unsigned char serviceType;
85 unsigned char serviceType;
86 unsigned char serviceSubType;
86 unsigned char serviceSubType;
87 unsigned char sourceID;
87 unsigned char sourceID;
88 unsigned char set1;
88 unsigned char set1;
89 unsigned char set2;
89 unsigned char set2;
90 unsigned char set3_bias_setting_set1[6];
90 unsigned char set3_bias_setting_set1[6];
91 unsigned char set3_bias_setting_set2[6];
91 unsigned char set3_bias_setting_set2[6];
92 unsigned char set3_bias_voltage[4];
92 unsigned char set3_bias_voltage[4];
93 unsigned char set4[8];
93 unsigned char set4[8];
94 unsigned char set5;
94 unsigned char set5;
95 unsigned char set6;
95 unsigned char set6;
96 unsigned char set7[8];
96 unsigned char set7[8];
97 unsigned char crc[2];
97 unsigned char crc[2];
98 };
98 };
99 typedef struct Packet_TC_LFR_UPDATE_INFO_str Packet_TC_LFR_UPDATE_INFO_t;
99 typedef struct Packet_TC_LFR_UPDATE_INFO_str Packet_TC_LFR_UPDATE_INFO_t;
100
100
101 struct Packet_TC_LFR_DUMP_PAR_str
101 struct Packet_TC_LFR_DUMP_PAR_str
102 { // the CCSDS header is added by LPPMON
102 { // the CCSDS header is added by LPPMON
103 unsigned char packetID[2];
103 unsigned char packetID[2];
104 unsigned char packetSequenceControl[2];
104 unsigned char packetSequenceControl[2];
105 unsigned char packetLength[2];
105 unsigned char packetLength[2];
106 // DATA FIELD HEADER
106 // DATA FIELD HEADER
107 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
107 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
108 unsigned char serviceType;
108 unsigned char serviceType;
109 unsigned char serviceSubType;
109 unsigned char serviceSubType;
110 unsigned char sourceID;
110 unsigned char sourceID;
111 unsigned char crc[2];
111 unsigned char crc[2];
112
112
113 };
113 };
114 typedef struct Packet_TC_LFR_DUMP_PAR_str Packet_TC_LFR_DUMP_PAR_t;
114 typedef struct Packet_TC_LFR_DUMP_PAR_str Packet_TC_LFR_DUMP_PAR_t;
115
115
116 struct Packet_TC_LFR_LOAD_COMMON_PAR_str
116 struct Packet_TC_LFR_LOAD_COMMON_PAR_str
117 { // the CCSDS header is added by LPPMON
117 { // the CCSDS header is added by LPPMON
118 unsigned char packetID[2];
118 unsigned char packetID[2];
119 unsigned char packetSequenceControl[2];
119 unsigned char packetSequenceControl[2];
120 unsigned char packetLength[2];
120 unsigned char packetLength[2];
121 // DATA FIELD HEADER
121 // DATA FIELD HEADER
122 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
122 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
123 unsigned char serviceType;
123 unsigned char serviceType;
124 unsigned char serviceSubType;
124 unsigned char serviceSubType;
125 unsigned char sourceID;
125 unsigned char sourceID;
126 unsigned char spare;
126 unsigned char spare;
127 unsigned char bw_sp0_sp1_r0_r1;
127 unsigned char bw_sp0_sp1_r0_r1;
128 unsigned char crc[2];
128 unsigned char crc[2];
129
129
130 };
130 };
131 typedef struct Packet_TC_LFR_LOAD_COMMON_PAR_str Packet_TC_LFR_LOAD_COMMON_PAR_t;
131 typedef struct Packet_TC_LFR_LOAD_COMMON_PAR_str Packet_TC_LFR_LOAD_COMMON_PAR_t;
132
132
133 struct Packet_TC_LFR_LOAD_NORMAL_PAR_str
133 struct Packet_TC_LFR_LOAD_NORMAL_PAR_str
134 { // the CCSDS header is added by LPPMON
134 { // the CCSDS header is added by LPPMON
135 unsigned char packetID[2];
135 unsigned char packetID[2];
136 unsigned char packetSequenceControl[2];
136 unsigned char packetSequenceControl[2];
137 unsigned char packetLength[2];
137 unsigned char packetLength[2];
138 // DATA FIELD HEADER
138 // DATA FIELD HEADER
139 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
139 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
140 unsigned char serviceType;
140 unsigned char serviceType;
141 unsigned char serviceSubType;
141 unsigned char serviceSubType;
142 unsigned char sourceID;
142 unsigned char sourceID;
143 unsigned char sy_lfr_n_swf_l[2];
143 unsigned char sy_lfr_n_swf_l[2];
144 unsigned char sy_lfr_n_swf_p[2];
144 unsigned char sy_lfr_n_swf_p[2];
145 unsigned char sy_lfr_n_asm_p[2];
145 unsigned char sy_lfr_n_asm_p[2];
146 unsigned char sy_lfr_n_bp_p0;
146 unsigned char sy_lfr_n_bp_p0;
147 unsigned char sy_lfr_n_bp_p1;
147 unsigned char sy_lfr_n_bp_p1;
148 unsigned char sy_lfr_n_cwf_long_f3;
149 unsigned char lfr_normal_parameters_spare;
148 unsigned char crc[2];
150 unsigned char crc[2];
149 };
151 };
150 typedef struct Packet_TC_LFR_LOAD_NORMAL_PAR_str Packet_TC_LFR_LOAD_NORMAL_PAR_t;
152 typedef struct Packet_TC_LFR_LOAD_NORMAL_PAR_str Packet_TC_LFR_LOAD_NORMAL_PAR_t;
151
153
152 struct Packet_TC_LFR_LOAD_BURST_SBM1_SBM2_PAR_str
154 struct Packet_TC_LFR_LOAD_BURST_SBM1_SBM2_PAR_str
153 { // the CCSDS header is added by LPPMON
155 { // the CCSDS header is added by LPPMON
154 unsigned char packetID[2];
156 unsigned char packetID[2];
155 unsigned char packetSequenceControl[2];
157 unsigned char packetSequenceControl[2];
156 unsigned char packetLength[2];
158 unsigned char packetLength[2];
157 // DATA FIELD HEADER
159 // DATA FIELD HEADER
158 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
160 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
159 unsigned char serviceType;
161 unsigned char serviceType;
160 unsigned char serviceSubType;
162 unsigned char serviceSubType;
161 unsigned char sourceID;
163 unsigned char sourceID;
162 unsigned char sy_lfr_bp_p0;
164 unsigned char sy_lfr_bp_p0;
163 unsigned char sy_lfr_bp_p1;
165 unsigned char sy_lfr_bp_p1;
164 unsigned char crc[2];
166 unsigned char crc[2];
165 };
167 };
166 typedef struct Packet_TC_LFR_LOAD_BURST_SBM1_SBM2_PAR_str Packet_TC_LFR_LOAD_BURST_SBM1_SBM2_PAR_t;
168 typedef struct Packet_TC_LFR_LOAD_BURST_SBM1_SBM2_PAR_str Packet_TC_LFR_LOAD_BURST_SBM1_SBM2_PAR_t;
167
169
168 struct Packet_TC_LFR_ENABLE_DISABLE_CALIBRATION_str
170 struct Packet_TC_LFR_ENABLE_DISABLE_CALIBRATION_str
169 { // the CCSDS header is added by LPPMON
171 { // the CCSDS header is added by LPPMON
170 unsigned char packetID[2];
172 unsigned char packetID[2];
171 unsigned char packetSequenceControl[2];
173 unsigned char packetSequenceControl[2];
172 unsigned char packetLength[2];
174 unsigned char packetLength[2];
173 // DATA FIELD HEADER
175 // DATA FIELD HEADER
174 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
176 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
175 unsigned char serviceType;
177 unsigned char serviceType;
176 unsigned char serviceSubType;
178 unsigned char serviceSubType;
177 unsigned char sourceID;
179 unsigned char sourceID;
178 unsigned char crc[2];
180 unsigned char crc[2];
179 };
181 };
180 typedef struct Packet_TC_LFR_ENABLE_DISABLE_CALIBRATION_str Packet_TC_LFR_ENABLE_DISABLE_CALIBRATION_t;
182 typedef struct Packet_TC_LFR_ENABLE_DISABLE_CALIBRATION_str Packet_TC_LFR_ENABLE_DISABLE_CALIBRATION_t;
181
183
182 struct Packet_TC_LFR_UPDATE_TIME_str
184 struct Packet_TC_LFR_UPDATE_TIME_str
183 { // the CCSDS header is added by LPPMON
185 { // the CCSDS header is added by LPPMON
184 unsigned char packetID[2];
186 unsigned char packetID[2];
185 unsigned char packetSequenceControl[2];
187 unsigned char packetSequenceControl[2];
186 unsigned char packetLength[2];
188 unsigned char packetLength[2];
187 // DATA FIELD HEADER
189 // DATA FIELD HEADER
188 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
190 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
189 unsigned char serviceType;
191 unsigned char serviceType;
190 unsigned char serviceSubType;
192 unsigned char serviceSubType;
191 unsigned char sourceID;
193 unsigned char sourceID;
192 unsigned char cp_rpw_time[6];
194 unsigned char cp_rpw_time[6];
193 unsigned char crc[2];
195 unsigned char crc[2];
194 };
196 };
195 typedef struct Packet_TC_LFR_UPDATE_TIME_str Packet_TC_LFR_UPDATE_TIME_t;
197 typedef struct Packet_TC_LFR_UPDATE_TIME_str Packet_TC_LFR_UPDATE_TIME_t;
196
198
197 #endif // TC_TYPES_H
199 #endif // TC_TYPES_H
@@ -1,599 +1,603
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 22
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 46
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_GROUND 0
124 #define SID_TC_GROUND 0
125 #define SID_TC_MISSION_TIMELINE 110
125 #define SID_TC_MISSION_TIMELINE 110
126 #define SID_TC_TC_SEQUENCES 111
126 #define SID_TC_TC_SEQUENCES 111
127 #define SID_TC_RECOVERY_ACTION_CMD 112
127 #define SID_TC_RECOVERY_ACTION_CMD 112
128 #define SID_TC_BACKUP_MISSION_TIMELINE 113
128 #define SID_TC_BACKUP_MISSION_TIMELINE 113
129 #define SID_TC_DIRECT_CMD 120
129 #define SID_TC_DIRECT_CMD 120
130 #define SID_TC_SPARE_GRD_SRC1 121
130 #define SID_TC_SPARE_GRD_SRC1 121
131 #define SID_TC_SPARE_GRD_SRC2 122
131 #define SID_TC_SPARE_GRD_SRC2 122
132 #define SID_TC_OBCP 15
132 #define SID_TC_OBCP 15
133 #define SID_TC_SYSTEM_CONTROL 14
133 #define SID_TC_SYSTEM_CONTROL 14
134 #define SID_TC_AOCS 11
134 #define SID_TC_AOCS 11
135 #define SID_TC_RPW_INTERNAL 254
135 #define SID_TC_RPW_INTERNAL 254
136
136
137 enum apid_destid{
137 enum apid_destid{
138 GROUND,
138 GROUND,
139 MISSION_TIMELINE,
139 MISSION_TIMELINE,
140 TC_SEQUENCES,
140 TC_SEQUENCES,
141 RECOVERY_ACTION_CMD,
141 RECOVERY_ACTION_CMD,
142 BACKUP_MISSION_TIMELINE,
142 BACKUP_MISSION_TIMELINE,
143 DIRECT_CMD,
143 DIRECT_CMD,
144 SPARE_GRD_SRC1,
144 SPARE_GRD_SRC1,
145 SPARE_GRD_SRC2,
145 SPARE_GRD_SRC2,
146 OBCP,
146 OBCP,
147 SYSTEM_CONTROL,
147 SYSTEM_CONTROL,
148 AOCS,
148 AOCS,
149 RPW_INTERNAL
149 RPW_INTERNAL
150 };
150 };
151 // SEQUENCE COUNTERS
151 // SEQUENCE COUNTERS
152 #define SEQ_CNT_MAX 16383
152 #define SEQ_CNT_MAX 16383
153 #define SEQ_CNT_NB_DEST_ID 12
153 #define SEQ_CNT_NB_DEST_ID 12
154
154
155 // TM SID
155 // TM SID
156 #define SID_HK 1
156 #define SID_HK 1
157 #define SID_PARAMETER_DUMP 10
157 #define SID_PARAMETER_DUMP 10
158
158
159 #define SID_NORM_SWF_F0 3
159 #define SID_NORM_SWF_F0 3
160 #define SID_NORM_SWF_F1 4
160 #define SID_NORM_SWF_F1 4
161 #define SID_NORM_SWF_F2 5
161 #define SID_NORM_SWF_F2 5
162 #define SID_NORM_CWF_F3 1
162 #define SID_NORM_CWF_F3 1
163 #define SID_BURST_CWF_F2 2
163 #define SID_BURST_CWF_F2 2
164 #define SID_SBM1_CWF_F1 24
164 #define SID_SBM1_CWF_F1 24
165 #define SID_SBM2_CWF_F2 25
165 #define SID_SBM2_CWF_F2 25
166 #define SID_NORM_ASM_F0 11
166 #define SID_NORM_ASM_F0 11
167 #define SID_NORM_ASM_F1 12
167 #define SID_NORM_ASM_F1 12
168 #define SID_NORM_ASM_F2 13
168 #define SID_NORM_ASM_F2 13
169 #define SID_NORM_BP1_F0 14
169 #define SID_NORM_BP1_F0 14
170 #define SID_NORM_BP1_F1 15
170 #define SID_NORM_BP1_F1 15
171 #define SID_NORM_BP1_F2 16
171 #define SID_NORM_BP1_F2 16
172 #define SID_NORM_BP2_F0 19
172 #define SID_NORM_BP2_F0 19
173 #define SID_NORM_BP2_F1 20
173 #define SID_NORM_BP2_F1 20
174 #define SID_NORM_BP2_F2 21
174 #define SID_NORM_BP2_F2 21
175 #define SID_BURST_BP1_F0 17
175 #define SID_BURST_BP1_F0 17
176 #define SID_BURST_BP2_F0 22
176 #define SID_BURST_BP2_F0 22
177 #define SID_BURST_BP1_F1 18
177 #define SID_BURST_BP1_F1 18
178 #define SID_BURST_BP2_F1 23
178 #define SID_BURST_BP2_F1 23
179 #define SID_SBM1_BP1_F0 28
179 #define SID_SBM1_BP1_F0 28
180 #define SID_SBM1_BP2_F0 31
180 #define SID_SBM1_BP2_F0 31
181 #define SID_SBM2_BP1_F0 29
181 #define SID_SBM2_BP1_F0 29
182 #define SID_SBM2_BP2_F0 32
182 #define SID_SBM2_BP2_F0 32
183 #define SID_SBM2_BP1_F1 30
183 #define SID_SBM2_BP1_F1 30
184 #define SID_SBM2_BP2_F1 33
184 #define SID_SBM2_BP2_F1 33
185 #define SID_NORM_CWF_LONG_F3 34
185
186
186 // LENGTH (BYTES)
187 // LENGTH (BYTES)
187 #define LENGTH_TM_LFR_TC_EXE_MAX 32
188 #define LENGTH_TM_LFR_TC_EXE_MAX 32
188 #define LENGTH_TM_LFR_HK 126
189 #define LENGTH_TM_LFR_HK 126
189
190
190 // HEADER_LENGTH
191 // HEADER_LENGTH
191 #define TM_HEADER_LEN 16
192 #define TM_HEADER_LEN 16
192 #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28
193 #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28
193 // PACKET_LENGTH
194 // PACKET_LENGTH
194 #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)
195 #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)
196 #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)
197 #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)
198 #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)
199 #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)
200 #define PACKET_LENGTH_HK (126 - CCSDS_TC_TM_PACKET_OFFSET)
201 #define PACKET_LENGTH_HK (126 - CCSDS_TC_TM_PACKET_OFFSET)
201 #define PACKET_LENGTH_PARAMETER_DUMP (34 - CCSDS_TC_TM_PACKET_OFFSET)
202 #define PACKET_LENGTH_PARAMETER_DUMP (34 - CCSDS_TC_TM_PACKET_OFFSET)
202 #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)
203
204
204 #define SPARE1_PUSVERSION_SPARE2 0x10
205 #define SPARE1_PUSVERSION_SPARE2 0x10
205
206
206 #define LEN_TM_LFR_HK 130 // 126 + 4
207 #define LEN_TM_LFR_HK 130 // 126 + 4
207 #define LEN_TM_LFR_TC_EXE_NOT_IMP 28 // 24 + 4
208 #define LEN_TM_LFR_TC_EXE_NOT_IMP 28 // 24 + 4
208
209
210 // R1
209 #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1
211 #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1
210 #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1
212 #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1
213 // R2
214 #define TM_LEN_SCI_SWF_304 3669 // 304 * 12 + 10 + 12 - 1
215 #define TM_LEN_SCI_SWF_224 2709 // 224 * 12 + 10 + 12 - 1
216 //
211 #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1
217 #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1
212 #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1
218 #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1
213 #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1
219 #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1
214 #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1
220 #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1
215 #define DEFAULT_PKTCNT 0x07
221 #define DEFAULT_PKTCNT 0x07
216 #define BLK_NR_340 0x0154
222 #define BLK_NR_340 0x0154
217 #define BLK_NR_8 0x0008
223 #define BLK_NR_8 0x0008
224 #define BLK_NR_304 0x0130
225 #define BLK_NR_224 0x00e0
218
226
219 enum TM_TYPE{
227 enum TM_TYPE{
220 TM_LFR_TC_EXE_OK,
228 TM_LFR_TC_EXE_OK,
221 TM_LFR_TC_EXE_ERR,
229 TM_LFR_TC_EXE_ERR,
222 TM_LFR_HK,
230 TM_LFR_HK,
223 TM_LFR_SCI,
231 TM_LFR_SCI,
224 TM_LFR_SCI_SBM,
232 TM_LFR_SCI_SBM,
225 TM_LFR_PAR_DUMP
233 TM_LFR_PAR_DUMP
226 };
234 };
227
235
228 typedef struct {
236 typedef struct {
229 unsigned char targetLogicalAddress;
237 unsigned char targetLogicalAddress;
230 unsigned char protocolIdentifier;
238 unsigned char protocolIdentifier;
231 unsigned char reserved;
239 unsigned char reserved;
232 unsigned char userApplication;
240 unsigned char userApplication;
233 // PACKET HEADER
241 // PACKET HEADER
234 unsigned char packetID[2];
242 unsigned char packetID[2];
235 unsigned char packetSequenceControl[2];
243 unsigned char packetSequenceControl[2];
236 unsigned char packetLength[2];
244 unsigned char packetLength[2];
237 // DATA FIELD HEADER
245 // DATA FIELD HEADER
238 unsigned char spare1_pusVersion_spare2;
246 unsigned char spare1_pusVersion_spare2;
239 unsigned char serviceType;
247 unsigned char serviceType;
240 unsigned char serviceSubType;
248 unsigned char serviceSubType;
241 unsigned char destinationID;
249 unsigned char destinationID;
242 unsigned char time[6];
250 unsigned char time[6];
243 //
251 //
244 unsigned char telecommand_pkt_id[2];
252 unsigned char telecommand_pkt_id[2];
245 unsigned char pkt_seq_control[2];
253 unsigned char pkt_seq_control[2];
246 } Packet_TM_LFR_TC_EXE_SUCCESS_t;
254 } Packet_TM_LFR_TC_EXE_SUCCESS_t;
247
255
248 typedef struct {
256 typedef struct {
249 unsigned char targetLogicalAddress;
257 unsigned char targetLogicalAddress;
250 unsigned char protocolIdentifier;
258 unsigned char protocolIdentifier;
251 unsigned char reserved;
259 unsigned char reserved;
252 unsigned char userApplication;
260 unsigned char userApplication;
253 // PACKET HEADER
261 // PACKET HEADER
254 unsigned char packetID[2];
262 unsigned char packetID[2];
255 unsigned char packetSequenceControl[2];
263 unsigned char packetSequenceControl[2];
256 unsigned char packetLength[2];
264 unsigned char packetLength[2];
257 // DATA FIELD HEADER
265 // DATA FIELD HEADER
258 unsigned char spare1_pusVersion_spare2;
266 unsigned char spare1_pusVersion_spare2;
259 unsigned char serviceType;
267 unsigned char serviceType;
260 unsigned char serviceSubType;
268 unsigned char serviceSubType;
261 unsigned char destinationID;
269 unsigned char destinationID;
262 unsigned char time[6];
270 unsigned char time[6];
263 //
271 //
264 unsigned char tc_failure_code[2];
272 unsigned char tc_failure_code[2];
265 unsigned char telecommand_pkt_id[2];
273 unsigned char telecommand_pkt_id[2];
266 unsigned char pkt_seq_control[2];
274 unsigned char pkt_seq_control[2];
267 unsigned char tc_service;
275 unsigned char tc_service;
268 unsigned char tc_subtype;
276 unsigned char tc_subtype;
269 unsigned char byte_position;
277 unsigned char byte_position;
270 unsigned char rcv_value;
278 unsigned char rcv_value;
271 } Packet_TM_LFR_TC_EXE_INCONSISTENT_t;
279 } Packet_TM_LFR_TC_EXE_INCONSISTENT_t;
272
280
273 typedef struct {
281 typedef struct {
274 unsigned char targetLogicalAddress;
282 unsigned char targetLogicalAddress;
275 unsigned char protocolIdentifier;
283 unsigned char protocolIdentifier;
276 unsigned char reserved;
284 unsigned char reserved;
277 unsigned char userApplication;
285 unsigned char userApplication;
278 // PACKET HEADER
286 // PACKET HEADER
279 unsigned char packetID[2];
287 unsigned char packetID[2];
280 unsigned char packetSequenceControl[2];
288 unsigned char packetSequenceControl[2];
281 unsigned char packetLength[2];
289 unsigned char packetLength[2];
282 // DATA FIELD HEADER
290 // DATA FIELD HEADER
283 unsigned char spare1_pusVersion_spare2;
291 unsigned char spare1_pusVersion_spare2;
284 unsigned char serviceType;
292 unsigned char serviceType;
285 unsigned char serviceSubType;
293 unsigned char serviceSubType;
286 unsigned char destinationID;
294 unsigned char destinationID;
287 unsigned char time[6];
295 unsigned char time[6];
288 //
296 //
289 unsigned char tc_failure_code[2];
297 unsigned char tc_failure_code[2];
290 unsigned char telecommand_pkt_id[2];
298 unsigned char telecommand_pkt_id[2];
291 unsigned char pkt_seq_control[2];
299 unsigned char pkt_seq_control[2];
292 unsigned char tc_service;
300 unsigned char tc_service;
293 unsigned char tc_subtype;
301 unsigned char tc_subtype;
294 unsigned char lfr_status_word[2];
302 unsigned char lfr_status_word[2];
295 } Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t;
303 } Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t;
296
304
297 typedef struct {
305 typedef struct {
298 unsigned char targetLogicalAddress;
306 unsigned char targetLogicalAddress;
299 unsigned char protocolIdentifier;
307 unsigned char protocolIdentifier;
300 unsigned char reserved;
308 unsigned char reserved;
301 unsigned char userApplication;
309 unsigned char userApplication;
302 // PACKET HEADER
310 // PACKET HEADER
303 unsigned char packetID[2];
311 unsigned char packetID[2];
304 unsigned char packetSequenceControl[2];
312 unsigned char packetSequenceControl[2];
305 unsigned char packetLength[2];
313 unsigned char packetLength[2];
306 // DATA FIELD HEADER
314 // DATA FIELD HEADER
307 unsigned char spare1_pusVersion_spare2;
315 unsigned char spare1_pusVersion_spare2;
308 unsigned char serviceType;
316 unsigned char serviceType;
309 unsigned char serviceSubType;
317 unsigned char serviceSubType;
310 unsigned char destinationID;
318 unsigned char destinationID;
311 unsigned char time[6];
319 unsigned char time[6];
312 //
320 //
313 unsigned char tc_failure_code[2];
321 unsigned char tc_failure_code[2];
314 unsigned char telecommand_pkt_id[2];
322 unsigned char telecommand_pkt_id[2];
315 unsigned char pkt_seq_control[2];
323 unsigned char pkt_seq_control[2];
316 unsigned char tc_service;
324 unsigned char tc_service;
317 unsigned char tc_subtype;
325 unsigned char tc_subtype;
318 } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t;
326 } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t;
319
327
320 typedef struct {
328 typedef struct {
321 unsigned char targetLogicalAddress;
329 unsigned char targetLogicalAddress;
322 unsigned char protocolIdentifier;
330 unsigned char protocolIdentifier;
323 unsigned char reserved;
331 unsigned char reserved;
324 unsigned char userApplication;
332 unsigned char userApplication;
325 // PACKET HEADER
333 // PACKET HEADER
326 unsigned char packetID[2];
334 unsigned char packetID[2];
327 unsigned char packetSequenceControl[2];
335 unsigned char packetSequenceControl[2];
328 unsigned char packetLength[2];
336 unsigned char packetLength[2];
329 // DATA FIELD HEADER
337 // DATA FIELD HEADER
330 unsigned char spare1_pusVersion_spare2;
338 unsigned char spare1_pusVersion_spare2;
331 unsigned char serviceType;
339 unsigned char serviceType;
332 unsigned char serviceSubType;
340 unsigned char serviceSubType;
333 unsigned char destinationID;
341 unsigned char destinationID;
334 unsigned char time[6];
342 unsigned char time[6];
335 //
343 //
336 unsigned char tc_failure_code[2];
344 unsigned char tc_failure_code[2];
337 unsigned char telecommand_pkt_id[2];
345 unsigned char telecommand_pkt_id[2];
338 unsigned char pkt_seq_control[2];
346 unsigned char pkt_seq_control[2];
339 unsigned char tc_service;
347 unsigned char tc_service;
340 unsigned char tc_subtype;
348 unsigned char tc_subtype;
341 } Packet_TM_LFR_TC_EXE_ERROR_t;
349 } Packet_TM_LFR_TC_EXE_ERROR_t;
342
350
343 typedef struct {
351 typedef struct {
344 unsigned char targetLogicalAddress;
352 unsigned char targetLogicalAddress;
345 unsigned char protocolIdentifier;
353 unsigned char protocolIdentifier;
346 unsigned char reserved;
354 unsigned char reserved;
347 unsigned char userApplication;
355 unsigned char userApplication;
348 // PACKET HEADER
356 // PACKET HEADER
349 unsigned char packetID[2];
357 unsigned char packetID[2];
350 unsigned char packetSequenceControl[2];
358 unsigned char packetSequenceControl[2];
351 unsigned char packetLength[2];
359 unsigned char packetLength[2];
352 // DATA FIELD HEADER
360 // DATA FIELD HEADER
353 unsigned char spare1_pusVersion_spare2;
361 unsigned char spare1_pusVersion_spare2;
354 unsigned char serviceType;
362 unsigned char serviceType;
355 unsigned char serviceSubType;
363 unsigned char serviceSubType;
356 unsigned char destinationID;
364 unsigned char destinationID;
357 unsigned char time[6];
365 unsigned char time[6];
358 //
366 //
359 unsigned char tc_failure_code[2];
367 unsigned char tc_failure_code[2];
360 unsigned char telecommand_pkt_id[2];
368 unsigned char telecommand_pkt_id[2];
361 unsigned char pkt_seq_control[2];
369 unsigned char pkt_seq_control[2];
362 unsigned char tc_service;
370 unsigned char tc_service;
363 unsigned char tc_subtype;
371 unsigned char tc_subtype;
364 unsigned char pkt_len_rcv_value[2];
372 unsigned char pkt_len_rcv_value[2];
365 unsigned char pkt_datafieldsize_cnt[2];
373 unsigned char pkt_datafieldsize_cnt[2];
366 unsigned char rcv_crc[2];
374 unsigned char rcv_crc[2];
367 unsigned char computed_crc[2];
375 unsigned char computed_crc[2];
368 } Packet_TM_LFR_TC_EXE_CORRUPTED_t;
376 } Packet_TM_LFR_TC_EXE_CORRUPTED_t;
369
377
370 typedef struct {
378 typedef struct {
371 unsigned char targetLogicalAddress;
379 unsigned char targetLogicalAddress;
372 unsigned char protocolIdentifier;
380 unsigned char protocolIdentifier;
373 unsigned char reserved;
381 unsigned char reserved;
374 unsigned char userApplication;
382 unsigned char userApplication;
375 unsigned char packetID[2];
383 unsigned char packetID[2];
376 unsigned char packetSequenceControl[2];
384 unsigned char packetSequenceControl[2];
377 unsigned char packetLength[2];
385 unsigned char packetLength[2];
378 // DATA FIELD HEADER
386 // DATA FIELD HEADER
379 unsigned char spare1_pusVersion_spare2;
387 unsigned char spare1_pusVersion_spare2;
380 unsigned char serviceType;
388 unsigned char serviceType;
381 unsigned char serviceSubType;
389 unsigned char serviceSubType;
382 unsigned char destinationID;
390 unsigned char destinationID;
383 unsigned char time[6];
391 unsigned char time[6];
384 // AUXILIARY HEADER
392 // AUXILIARY HEADER
385 unsigned char sid;
393 unsigned char sid;
386 unsigned char hkBIA;
394 unsigned char hkBIA;
387 unsigned char pktCnt;
395 unsigned char pktCnt;
388 unsigned char pktNr;
396 unsigned char pktNr;
389 unsigned char acquisitionTime[6];
397 unsigned char acquisitionTime[6];
390 unsigned char blkNr[2];
398 unsigned char blkNr[2];
391 } Header_TM_LFR_SCIENCE_SWF_t;
399 } Header_TM_LFR_SCIENCE_SWF_t;
392
400
393 typedef struct {
401 typedef struct {
394 unsigned char targetLogicalAddress;
402 unsigned char targetLogicalAddress;
395 unsigned char protocolIdentifier;
403 unsigned char protocolIdentifier;
396 unsigned char reserved;
404 unsigned char reserved;
397 unsigned char userApplication;
405 unsigned char userApplication;
398 unsigned char packetID[2];
406 unsigned char packetID[2];
399 unsigned char packetSequenceControl[2];
407 unsigned char packetSequenceControl[2];
400 unsigned char packetLength[2];
408 unsigned char packetLength[2];
401 // DATA FIELD HEADER
409 // DATA FIELD HEADER
402 unsigned char spare1_pusVersion_spare2;
410 unsigned char spare1_pusVersion_spare2;
403 unsigned char serviceType;
411 unsigned char serviceType;
404 unsigned char serviceSubType;
412 unsigned char serviceSubType;
405 unsigned char destinationID;
413 unsigned char destinationID;
406 unsigned char time[6];
414 unsigned char time[6];
407 // AUXILIARY DATA HEADER
415 // AUXILIARY DATA HEADER
408 unsigned char sid;
416 unsigned char sid;
409 unsigned char hkBIA;
417 unsigned char hkBIA;
410 unsigned char acquisitionTime[6];
418 unsigned char acquisitionTime[6];
411 unsigned char blkNr[2];
419 unsigned char blkNr[2];
412 } Header_TM_LFR_SCIENCE_CWF_t;
420 } Header_TM_LFR_SCIENCE_CWF_t;
413
421
414 typedef struct {
422 typedef struct {
415 unsigned char targetLogicalAddress;
423 unsigned char targetLogicalAddress;
416 unsigned char protocolIdentifier;
424 unsigned char protocolIdentifier;
417 unsigned char reserved;
425 unsigned char reserved;
418 unsigned char userApplication;
426 unsigned char userApplication;
419 unsigned char packetID[2];
427 unsigned char packetID[2];
420 unsigned char packetSequenceControl[2];
428 unsigned char packetSequenceControl[2];
421 unsigned char packetLength[2];
429 unsigned char packetLength[2];
422 // DATA FIELD HEADER
430 // DATA FIELD HEADER
423 unsigned char spare1_pusVersion_spare2;
431 unsigned char spare1_pusVersion_spare2;
424 unsigned char serviceType;
432 unsigned char serviceType;
425 unsigned char serviceSubType;
433 unsigned char serviceSubType;
426 unsigned char destinationID;
434 unsigned char destinationID;
427 unsigned char time[6];
435 unsigned char time[6];
428 // AUXILIARY HEADER
436 // AUXILIARY HEADER
429 unsigned char sid;
437 unsigned char sid;
430 unsigned char biaStatusInfo;
438 unsigned char biaStatusInfo;
431 unsigned char cntASM;
439 unsigned char cntASM;
432 unsigned char nrASM;
440 unsigned char nrASM;
433 unsigned char acquisitionTime[6];
441 unsigned char acquisitionTime[6];
434 unsigned char blkNr[2];
442 unsigned char blkNr[2];
435 } Header_TM_LFR_SCIENCE_ASM_t;
443 } Header_TM_LFR_SCIENCE_ASM_t;
436
444
437 typedef struct {
445 typedef struct {
438 //targetLogicalAddress is removed by the grspw module
446 //targetLogicalAddress is removed by the grspw module
439 unsigned char protocolIdentifier;
447 unsigned char protocolIdentifier;
440 unsigned char reserved;
448 unsigned char reserved;
441 unsigned char userApplication;
449 unsigned char userApplication;
442 unsigned char packetID[2];
450 unsigned char packetID[2];
443 unsigned char packetSequenceControl[2];
451 unsigned char packetSequenceControl[2];
444 unsigned char packetLength[2];
452 unsigned char packetLength[2];
445 // DATA FIELD HEADER
453 // DATA FIELD HEADER
446 unsigned char headerFlag_pusVersion_Ack;
454 unsigned char headerFlag_pusVersion_Ack;
447 unsigned char serviceType;
455 unsigned char serviceType;
448 unsigned char serviceSubType;
456 unsigned char serviceSubType;
449 unsigned char sourceID;
457 unsigned char sourceID;
450 unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10];
458 unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10];
451 } ccsdsTelecommandPacket_t;
459 } ccsdsTelecommandPacket_t;
452
460
453 typedef struct {
461 typedef struct {
454 unsigned char targetLogicalAddress;
462 unsigned char targetLogicalAddress;
455 unsigned char protocolIdentifier;
463 unsigned char protocolIdentifier;
456 unsigned char reserved;
464 unsigned char reserved;
457 unsigned char userApplication;
465 unsigned char userApplication;
458 unsigned char packetID[2];
466 unsigned char packetID[2];
459 unsigned char packetSequenceControl[2];
467 unsigned char packetSequenceControl[2];
460 unsigned char packetLength[2];
468 unsigned char packetLength[2];
461 unsigned char spare1_pusVersion_spare2;
469 unsigned char spare1_pusVersion_spare2;
462 unsigned char serviceType;
470 unsigned char serviceType;
463 unsigned char serviceSubType;
471 unsigned char serviceSubType;
464 unsigned char destinationID;
472 unsigned char destinationID;
465 unsigned char time[6];
473 unsigned char time[6];
466 unsigned char sid;
474 unsigned char sid;
467
475
468 //**************
476 //**************
469 // HK PARAMETERS
477 // HK PARAMETERS
470 unsigned char lfr_status_word[2];
478 unsigned char lfr_status_word[2];
471 unsigned char lfr_sw_version[4];
479 unsigned char lfr_sw_version[4];
480 unsigned char lfr_fpga_version[3];
481 // ressource statistics
482 unsigned char hk_lfr_cpu_load;
483 unsigned char hk_lfr_load_max;
484 unsigned char hk_lfr_load_aver;
472 // tc statistics
485 // tc statistics
473 unsigned char hk_lfr_update_info_tc_cnt[2];
486 unsigned char hk_lfr_update_info_tc_cnt[2];
474 unsigned char hk_lfr_update_time_tc_cnt[2];
487 unsigned char hk_lfr_update_time_tc_cnt[2];
475 unsigned char hk_dpu_exe_tc_lfr_cnt[2];
488 unsigned char hk_lfr_exe_tc_cnt[2];
476 unsigned char hk_dpu_rej_tc_lfr_cnt[2];
489 unsigned char hk_lfr_rej_tc_cnt[2];
477 unsigned char hk_lfr_last_exe_tc_id[2];
490 unsigned char hk_lfr_last_exe_tc_id[2];
478 unsigned char hk_lfr_last_exe_tc_type[2];
491 unsigned char hk_lfr_last_exe_tc_type[2];
479 unsigned char hk_lfr_last_exe_tc_subtype[2];
492 unsigned char hk_lfr_last_exe_tc_subtype[2];
480 unsigned char hk_lfr_last_exe_tc_time[6];
493 unsigned char hk_lfr_last_exe_tc_time[6];
481 unsigned char hk_lfr_last_rej_tc_id[2];
494 unsigned char hk_lfr_last_rej_tc_id[2];
482 unsigned char hk_lfr_last_rej_tc_type[2];
495 unsigned char hk_lfr_last_rej_tc_type[2];
483 unsigned char hk_lfr_last_rej_tc_subtype[2];
496 unsigned char hk_lfr_last_rej_tc_subtype[2];
484 unsigned char hk_lfr_last_rej_tc_time[6];
497 unsigned char hk_lfr_last_rej_tc_time[6];
485 // anomaly statistics
498 // anomaly statistics
486 unsigned char hk_lfr_le_cnt[2];
499 unsigned char hk_lfr_le_cnt[2];
487 unsigned char hk_lfr_me_cnt[2];
500 unsigned char hk_lfr_me_cnt[2];
488 unsigned char hk_lfr_he_cnt[2];
501 unsigned char hk_lfr_he_cnt[2];
489 unsigned char hk_lfr_last_er_rid[2];
502 unsigned char hk_lfr_last_er_rid[2];
490 unsigned char hk_lfr_last_er_code;
503 unsigned char hk_lfr_last_er_code;
491 unsigned char hk_lfr_last_er_time[6];
504 unsigned char hk_lfr_last_er_time[6];
492 // vhdl_blk_status
505 // vhdl_blk_status
493 unsigned char hk_lfr_vhdl_aa_sm;
506 unsigned char hk_lfr_vhdl_aa_sm;
494 unsigned char hk_lfr_vhdl_fft_sr;
507 unsigned char hk_lfr_vhdl_fft_sr;
495 unsigned char hk_lfr_vhdl_cic_hk;
508 unsigned char hk_lfr_vhdl_cic_hk;
496 unsigned char hk_lfr_vhdl_iir_cal;
509 unsigned char hk_lfr_vhdl_iir_cal;
497 // spacewire_if_statistics
510 // spacewire_if_statistics
498 unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2];
511 unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2];
499 unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2];
512 unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2];
500 unsigned char hk_lfr_dpu_spw_tick_out_cnt;
513 unsigned char hk_lfr_dpu_spw_tick_out_cnt;
501 unsigned char hk_lfr_dpu_spw_last_time;
514 unsigned char hk_lfr_dpu_spw_last_timc;
502 // ahb error statistics
515 // ahb error statistics
503 unsigned int hk_lfr_last_fail_addr;
516 unsigned int hk_lfr_last_fail_addr;
504 // temperatures
517 // temperatures
505 unsigned char hk_lfr_temp_scm[2];
518 unsigned char hk_lfr_temp_scm[2];
506 unsigned char hk_lfr_temp_pcb[2];
519 unsigned char hk_lfr_temp_pcb[2];
507 unsigned char hk_lfr_temp_fpga[2];
520 unsigned char hk_lfr_temp_fpga[2];
521 // spacecraft potential
522 unsigned char hk_lfr_sc_v_f3[2];
523 unsigned char hk_lfr_sc_e1_f3[2];
524 unsigned char hk_lfr_sc_e2_f3[2];
508 // error counters
525 // error counters
509 unsigned char hk_lfr_dpu_spw_parity;
526 unsigned char hk_lfr_dpu_spw_parity;
510 unsigned char hk_lfr_dpu_spw_disconnect;
527 unsigned char hk_lfr_dpu_spw_disconnect;
511 unsigned char hk_lfr_dpu_spw_escape;
528 unsigned char hk_lfr_dpu_spw_escape;
512 unsigned char hk_lfr_dpu_spw_credit;
529 unsigned char hk_lfr_dpu_spw_credit;
513 unsigned char hk_lfr_dpu_spw_write_sync;
530 unsigned char hk_lfr_dpu_spw_write_sync;
514 unsigned char hk_lfr_dpu_spw_rx_ahb;
531 unsigned char hk_lfr_dpu_spw_rx_ahb;
515 unsigned char hk_lfr_dpu_spw_tx_ahb;
532 unsigned char hk_lfr_dpu_spw_tx_ahb;
516 unsigned char hk_lfr_dpu_spw_header_crc;
517 unsigned char hk_lfr_dpu_spw_data_crc;
518 unsigned char hk_lfr_dpu_spw_early_eop;
533 unsigned char hk_lfr_dpu_spw_early_eop;
519 unsigned char hk_lfr_dpu_spw_invalid_addr;
534 unsigned char hk_lfr_dpu_spw_invalid_addr;
520 unsigned char hk_lfr_dpu_spw_eep;
535 unsigned char hk_lfr_dpu_spw_eep;
521 unsigned char hk_lfr_dpu_spw_rx_too_big;
536 unsigned char hk_lfr_dpu_spw_rx_too_big;
522 // timecode
537 // timecode
523 unsigned char hk_lfr_timecode_erroneous;
538 unsigned char hk_lfr_timecode_erroneous;
524 unsigned char hk_lfr_timecode_missing;
539 unsigned char hk_lfr_timecode_missing;
525 unsigned char hk_lfr_timecode_invalid;
540 unsigned char hk_lfr_timecode_invalid;
526 // time
541 // time
527 unsigned char hk_lfr_time_timecode_it;
542 unsigned char hk_lfr_time_timecode_it;
528 unsigned char hk_lfr_time_not_synchro;
543 unsigned char hk_lfr_time_not_synchro;
529 unsigned char hk_lfr_time_timecode_ctr;
544 unsigned char hk_lfr_time_timecode_ctr;
530 // hk_lfr_buffer_dpu_
545 // hk_lfr_buffer_dpu_
531 unsigned char hk_lfr_buffer_dpu_tc_fifo;
546 unsigned char hk_lfr_buffer_dpu_tc_fifo;
532 unsigned char hk_lfr_buffer_dpu_tm_fifo;
547 unsigned char hk_lfr_buffer_dpu_tm_fifo;
533 // hk_lfr_ahb_
548 // hk_lfr_ahb_
534 unsigned char hk_lfr_ahb_correctable;
549 unsigned char hk_lfr_ahb_correctable;
535 unsigned char hk_lfr_ahb_uncorrectable;
550 unsigned char hk_lfr_ahb_uncorrectable;
536 unsigned char hk_lfr_ahb_fails_trans;
551 // spare
537 // hk_lfr_adc_
552 unsigned char parameters_spare;
538 unsigned char hk_lfr_adc_failure;
539 unsigned char hk_lfr_adc_timeout;
540 unsigned char hk_lfr_toomany_err;
541 // hk_lfr_cpu_
542 unsigned char hk_lfr_cpu_write_err;
543 unsigned char hk_lfr_cpu_ins_access_err;
544 unsigned char hk_lfr_cpu_illegal_ins;
545 unsigned char hk_lfr_cpu_privilegied_ins;
546 unsigned char hk_lfr_cpu_register_hw;
547 unsigned char hk_lfr_cpu_not_aligned;
548 unsigned char hk_lfr_cpu_data_exception;
549 unsigned char hk_lfr_cpu_div_exception;
550 unsigned char hk_lfr_cpu_arith_overflow;
551 } Packet_TM_LFR_HK_t;
553 } Packet_TM_LFR_HK_t;
552
554
553 typedef struct {
555 typedef struct {
554 unsigned char targetLogicalAddress;
556 unsigned char targetLogicalAddress;
555 unsigned char protocolIdentifier;
557 unsigned char protocolIdentifier;
556 unsigned char reserved;
558 unsigned char reserved;
557 unsigned char userApplication;
559 unsigned char userApplication;
558 unsigned char packetID[2];
560 unsigned char packetID[2];
559 unsigned char packetSequenceControl[2];
561 unsigned char packetSequenceControl[2];
560 unsigned char packetLength[2];
562 unsigned char packetLength[2];
561 // DATA FIELD HEADER
563 // DATA FIELD HEADER
562 unsigned char spare1_pusVersion_spare2;
564 unsigned char spare1_pusVersion_spare2;
563 unsigned char serviceType;
565 unsigned char serviceType;
564 unsigned char serviceSubType;
566 unsigned char serviceSubType;
565 unsigned char destinationID;
567 unsigned char destinationID;
566 unsigned char time[6];
568 unsigned char time[6];
567 unsigned char sid;
569 unsigned char sid;
568
570
569 //******************
571 //******************
570 // COMMON PARAMETERS
572 // COMMON PARAMETERS
571 unsigned char unused0;
573 unsigned char unused0;
572 unsigned char bw_sp0_sp1_r0_r1;
574 unsigned char bw_sp0_sp1_r0_r1;
573
575
574 //******************
576 //******************
575 // NORMAL PARAMETERS
577 // NORMAL PARAMETERS
576 unsigned char sy_lfr_n_swf_l[2];
578 unsigned char sy_lfr_n_swf_l[2];
577 unsigned char sy_lfr_n_swf_p[2];
579 unsigned char sy_lfr_n_swf_p[2];
578 unsigned char sy_lfr_n_asm_p[2];
580 unsigned char sy_lfr_n_asm_p[2];
579 unsigned char sy_lfr_n_bp_p0;
581 unsigned char sy_lfr_n_bp_p0;
580 unsigned char sy_lfr_n_bp_p1;
582 unsigned char sy_lfr_n_bp_p1;
583 unsigned char sy_lfr_n_cwf_long_f3;
584 unsigned char lfr_normal_parameters_spare;
581
585
582 //*****************
586 //*****************
583 // BURST PARAMETERS
587 // BURST PARAMETERS
584 unsigned char sy_lfr_b_bp_p0;
588 unsigned char sy_lfr_b_bp_p0;
585 unsigned char sy_lfr_b_bp_p1;
589 unsigned char sy_lfr_b_bp_p1;
586
590
587 //****************
591 //****************
588 // SBM1 PARAMETERS
592 // SBM1 PARAMETERS
589 unsigned char sy_lfr_s1_bp_p0;
593 unsigned char sy_lfr_s1_bp_p0;
590 unsigned char sy_lfr_s1_bp_p1;
594 unsigned char sy_lfr_s1_bp_p1;
591
595
592 //****************
596 //****************
593 // SBM2 PARAMETERS
597 // SBM2 PARAMETERS
594 unsigned char sy_lfr_s2_bp_p0;
598 unsigned char sy_lfr_s2_bp_p0;
595 unsigned char sy_lfr_s2_bp_p1;
599 unsigned char sy_lfr_s2_bp_p1;
596 } Packet_TM_LFR_PARAMETER_DUMP_t;
600 } Packet_TM_LFR_PARAMETER_DUMP_t;
597
601
598
602
599 #endif // CCSDS_TYPES_H_INCLUDED
603 #endif // CCSDS_TYPES_H_INCLUDED
@@ -1,205 +1,206
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 //#define NB_SAMPLES_PER_SNAPSHOT 2048
16 //#define NB_SAMPLES_PER_SNAPSHOT 2048
17 #define NB_SAMPLES_PER_SNAPSHOT 2352 // 336 * 7 = 2352
17 #define NB_SAMPLES_PER_SNAPSHOT 2352 // 336 * 7 = 2352
18 #define TIME_OFFSET 2
18 #define TIME_OFFSET 2
19 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
19 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
20 #define NB_BYTES_SWF_BLK (2 * 6)
20 #define NB_BYTES_SWF_BLK (2 * 6)
21 #define NB_WORDS_SWF_BLK 3
21 #define NB_WORDS_SWF_BLK 3
22 #define NB_BYTES_CWF3_LIGHT_BLK 6
22 #define NB_BYTES_CWF3_LIGHT_BLK 6
23 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
23 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
24 #define NB_RING_NODES_F0 3 // AT LEAST 3
24 #define NB_RING_NODES_F1 5 // AT LEAST 3
25 #define NB_RING_NODES_F1 5 // AT LEAST 3
25 #define NB_RING_NODES_F2 5 // AT LEAST 3
26 #define NB_RING_NODES_F2 5 // AT LEAST 3
26
27
27 //**********
28 //**********
28 // LFR MODES
29 // LFR MODES
29 #define LFR_MODE_STANDBY 0
30 #define LFR_MODE_STANDBY 0
30 #define LFR_MODE_NORMAL 1
31 #define LFR_MODE_NORMAL 1
31 #define LFR_MODE_BURST 2
32 #define LFR_MODE_BURST 2
32 #define LFR_MODE_SBM1 3
33 #define LFR_MODE_SBM1 3
33 #define LFR_MODE_SBM2 4
34 #define LFR_MODE_SBM2 4
34 #define LFR_MODE_NORMAL_CWF_F3 5
35 #define LFR_MODE_NORMAL_CWF_F3 5
35
36
36 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
37 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
37 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
38 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
38 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
39 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
39 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
40 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
40 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
41 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
41 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
42 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
42
43
43 //****************************
44 //****************************
44 // LFR DEFAULT MODE PARAMETERS
45 // LFR DEFAULT MODE PARAMETERS
45 // COMMON
46 // COMMON
46 #define DEFAULT_SY_LFR_COMMON0 0x00
47 #define DEFAULT_SY_LFR_COMMON0 0x00
47 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
48 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
48 // NORM
49 // NORM
49 #define SY_LFR_N_SWF_L 2048 // nb sample
50 #define SY_LFR_N_SWF_L 2048 // nb sample
50 #define SY_LFR_N_SWF_P 20 // sec
51 #define SY_LFR_N_SWF_P 20 // sec
51 #define SY_LFR_N_ASM_P 3600 // sec
52 #define SY_LFR_N_ASM_P 3600 // sec
52 #define SY_LFR_N_BP_P0 4 // sec
53 #define SY_LFR_N_BP_P0 4 // sec
53 #define SY_LFR_N_BP_P1 20 // sec
54 #define SY_LFR_N_BP_P1 20 // sec
54 #define MIN_DELTA_SNAPSHOT 16 // sec
55 #define MIN_DELTA_SNAPSHOT 16 // sec
55 // BURST
56 // BURST
56 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
57 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
57 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
58 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
58 // SBM1
59 // SBM1
59 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
60 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
60 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
61 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
61 // SBM2
62 // SBM2
62 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
63 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
63 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
64 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
64 // ADDITIONAL PARAMETERS
65 // ADDITIONAL PARAMETERS
65 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
66 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
66 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
67 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
67 // STATUS WORD
68 // STATUS WORD
68 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
69 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
69 #define DEFAULT_STATUS_WORD_BYTE1 0x00
70 #define DEFAULT_STATUS_WORD_BYTE1 0x00
70 //
71 //
71 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
72 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
72 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
73 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
73 //****************************
74 //****************************
74
75
75 //*****************************
76 //*****************************
76 // APB REGISTERS BASE ADDRESSES
77 // APB REGISTERS BASE ADDRESSES
77 #define REGS_ADDR_APBUART 0x80000100
78 #define REGS_ADDR_APBUART 0x80000100
78 #define REGS_ADDR_GPTIMER 0x80000300
79 #define REGS_ADDR_GPTIMER 0x80000300
79 #define REGS_ADDR_GRSPW 0x80000500
80 #define REGS_ADDR_GRSPW 0x80000500
80 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
81 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
81 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
82 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
82
83
83 #ifdef GSA
84 #ifdef GSA
84 #else
85 #else
85 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20
86 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20
86 #endif
87 #endif
87
88
88 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
89 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
89 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
90 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
90
91
91 //**********
92 //**********
92 // IRQ LINES
93 // IRQ LINES
93 #define IRQ_SM 9
94 #define IRQ_SM 9
94 #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels
95 #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels
95 #define IRQ_WF 10
96 #define IRQ_WF 10
96 #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels
97 #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels
97 #define IRQ_TIME1 12
98 #define IRQ_TIME1 12
98 #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels
99 #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels
99 #define IRQ_TIME2 13
100 #define IRQ_TIME2 13
100 #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels
101 #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels
101 #define IRQ_WAVEFORM_PICKER 14
102 #define IRQ_WAVEFORM_PICKER 14
102 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
103 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
103 #define IRQ_SPECTRAL_MATRIX 6
104 #define IRQ_SPECTRAL_MATRIX 6
104 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
105 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
105
106
106 //*****
107 //*****
107 // TIME
108 // TIME
108 #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms
109 #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms
109 #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s
110 #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s
110 #define TIMER_SM_SIMULATOR 1
111 #define TIMER_SM_SIMULATOR 1
111 #define TIMER_WF_SIMULATOR 2
112 #define TIMER_WF_SIMULATOR 2
112 #define HK_PERIOD 100 // 100 * 10ms => 1sec
113 #define HK_PERIOD 100 // 100 * 10ms => 1sec
113
114
114 //**********
115 //**********
115 // LPP CODES
116 // LPP CODES
116 #define LFR_SUCCESSFUL 0
117 #define LFR_SUCCESSFUL 0
117 #define LFR_DEFAULT 1
118 #define LFR_DEFAULT 1
118
119
119 //******
120 //******
120 // RTEMS
121 // RTEMS
121 #define TASKID_RECV 1
122 #define TASKID_RECV 1
122 #define TASKID_ACTN 2
123 #define TASKID_ACTN 2
123 #define TASKID_SPIQ 3
124 #define TASKID_SPIQ 3
124 #define TASKID_SMIQ 4
125 #define TASKID_SMIQ 4
125 #define TASKID_STAT 5
126 #define TASKID_STAT 5
126 #define TASKID_AVF0 6
127 #define TASKID_AVF0 6
127 #define TASKID_BPF0 7
128 #define TASKID_BPF0 7
128 #define TASKID_WFRM 8
129 #define TASKID_WFRM 8
129 #define TASKID_DUMB 9
130 #define TASKID_DUMB 9
130 #define TASKID_HOUS 10
131 #define TASKID_HOUS 10
131 #define TASKID_MATR 11
132 #define TASKID_MATR 11
132 #define TASKID_CWF3 12
133 #define TASKID_CWF3 12
133 #define TASKID_CWF2 13
134 #define TASKID_CWF2 13
134 #define TASKID_CWF1 14
135 #define TASKID_CWF1 14
135 #define TASKID_SEND 15
136 #define TASKID_SEND 15
136 #define TASKID_WTDG 16
137 #define TASKID_WTDG 16
137
138
138 #define TASK_PRIORITY_SPIQ 5
139 #define TASK_PRIORITY_SPIQ 5
139 #define TASK_PRIORITY_SMIQ 10
140 #define TASK_PRIORITY_SMIQ 10
140 #define TASK_PRIORITY_WTDG 20
141 #define TASK_PRIORITY_WTDG 20
141 #define TASK_PRIORITY_HOUS 30
142 #define TASK_PRIORITY_HOUS 30
142 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
143 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
143 #define TASK_PRIORITY_CWF2 35 //
144 #define TASK_PRIORITY_CWF2 35 //
144 #define TASK_PRIORITY_WFRM 40
145 #define TASK_PRIORITY_WFRM 40
145 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
146 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
146 #define TASK_PRIORITY_SEND 45
147 #define TASK_PRIORITY_SEND 45
147 #define TASK_PRIORITY_RECV 50
148 #define TASK_PRIORITY_RECV 50
148 #define TASK_PRIORITY_ACTN 50
149 #define TASK_PRIORITY_ACTN 50
149 #define TASK_PRIORITY_AVF0 60
150 #define TASK_PRIORITY_AVF0 60
150 #define TASK_PRIORITY_BPF0 60
151 #define TASK_PRIORITY_BPF0 60
151 #define TASK_PRIORITY_MATR 100
152 #define TASK_PRIORITY_MATR 100
152 #define TASK_PRIORITY_STAT 200
153 #define TASK_PRIORITY_STAT 200
153 #define TASK_PRIORITY_DUMB 200
154 #define TASK_PRIORITY_DUMB 200
154
155
155 #define ACTION_MSG_QUEUE_COUNT 10
156 #define ACTION_MSG_QUEUE_COUNT 10
156 #define ACTION_MSG_PKTS_COUNT 50
157 #define ACTION_MSG_PKTS_COUNT 50
157 #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
158 #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
158 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
159 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
159
160
160 #define QUEUE_RECV 0
161 #define QUEUE_RECV 0
161 #define QUEUE_SEND 1
162 #define QUEUE_SEND 1
162
163
163 //*******
164 //*******
164 // MACROS
165 // MACROS
165 #ifdef PRINT_MESSAGES_ON_CONSOLE
166 #ifdef PRINT_MESSAGES_ON_CONSOLE
166 #define PRINTF(x) printf(x);
167 #define PRINTF(x) printf(x);
167 #define PRINTF1(x,y) printf(x,y);
168 #define PRINTF1(x,y) printf(x,y);
168 #define PRINTF2(x,y,z) printf(x,y,z);
169 #define PRINTF2(x,y,z) printf(x,y,z);
169 #else
170 #else
170 #define PRINTF(x) ;
171 #define PRINTF(x) ;
171 #define PRINTF1(x,y) ;
172 #define PRINTF1(x,y) ;
172 #define PRINTF2(x,y,z) ;
173 #define PRINTF2(x,y,z) ;
173 #endif
174 #endif
174
175
175 #ifdef BOOT_MESSAGES
176 #ifdef BOOT_MESSAGES
176 #define BOOT_PRINTF(x) printf(x);
177 #define BOOT_PRINTF(x) printf(x);
177 #define BOOT_PRINTF1(x,y) printf(x,y);
178 #define BOOT_PRINTF1(x,y) printf(x,y);
178 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
179 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
179 #else
180 #else
180 #define BOOT_PRINTF(x) ;
181 #define BOOT_PRINTF(x) ;
181 #define BOOT_PRINTF1(x,y) ;
182 #define BOOT_PRINTF1(x,y) ;
182 #define BOOT_PRINTF2(x,y,z) ;
183 #define BOOT_PRINTF2(x,y,z) ;
183 #endif
184 #endif
184
185
185 #ifdef DEBUG_MESSAGES
186 #ifdef DEBUG_MESSAGES
186 #define DEBUG_PRINTF(x) printf(x);
187 #define DEBUG_PRINTF(x) printf(x);
187 #define DEBUG_PRINTF1(x,y) printf(x,y);
188 #define DEBUG_PRINTF1(x,y) printf(x,y);
188 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
189 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
189 #else
190 #else
190 #define DEBUG_PRINTF(x) ;
191 #define DEBUG_PRINTF(x) ;
191 #define DEBUG_PRINTF1(x,y) ;
192 #define DEBUG_PRINTF1(x,y) ;
192 #define DEBUG_PRINTF2(x,y,z) ;
193 #define DEBUG_PRINTF2(x,y,z) ;
193 #endif
194 #endif
194
195
195 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
196 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
196
197
197 struct param_local_str{
198 struct param_local_str{
198 unsigned int local_sbm1_nb_cwf_sent;
199 unsigned int local_sbm1_nb_cwf_sent;
199 unsigned int local_sbm1_nb_cwf_max;
200 unsigned int local_sbm1_nb_cwf_max;
200 unsigned int local_sbm2_nb_cwf_sent;
201 unsigned int local_sbm2_nb_cwf_sent;
201 unsigned int local_sbm2_nb_cwf_max;
202 unsigned int local_sbm2_nb_cwf_max;
202 unsigned int local_nb_interrupt_f0_MAX;
203 unsigned int local_nb_interrupt_f0_MAX;
203 };
204 };
204
205
205 #endif // FSW_PARAMS_H_INCLUDED
206 #endif // FSW_PARAMS_H_INCLUDED
@@ -1,27 +1,28
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 #include "fsw_misc.h"
11
11
12 int action_load_common_par( ccsdsTelecommandPacket_t *TC );
12 int action_load_common_par( ccsdsTelecommandPacket_t *TC );
13 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
13 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
14 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
14 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
15 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
15 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
16 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
16 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
17 int action_dump_par(rtems_id queue_id );
17 int action_dump_par(rtems_id queue_id );
18
18
19 int set_sy_lfr_n_swf_l(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
19 int set_sy_lfr_n_swf_l(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
20 int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
20 int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
21 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
21 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
22 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
22 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
23 int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
23 int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
24 int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
24
25
25 void init_parameter_dump( void );
26 void init_parameter_dump( void );
26
27
27 #endif // TC_LOAD_DUMP_PARAMETERS_H
28 #endif // TC_LOAD_DUMP_PARAMETERS_H
@@ -1,22 +1,23
1 #ifndef TM_BYTE_POSITIONS_H
1 #ifndef TM_BYTE_POSITIONS_H
2 #define TM_BYTE_POSITIONS_H
2 #define TM_BYTE_POSITIONS_H
3
3
4 #define BYTE_POS_CP_LFR_MODE 11
4 #define BYTE_POS_CP_LFR_MODE 11
5
5
6 // TC_LFR_LOAD_COMMON_PAR
6 // TC_LFR_LOAD_COMMON_PAR
7
7
8 // TC_LFR_LOAD_NORMAL_PAR
8 // TC_LFR_LOAD_NORMAL_PAR
9 #define BYTE_POS_SY_LFR_N_SWF_L 0
9 #define BYTE_POS_SY_LFR_N_SWF_L 0
10 #define BYTE_POS_SY_LFR_N_SWF_P 2
10 #define BYTE_POS_SY_LFR_N_SWF_P 2
11 #define BYTE_POS_SY_LFR_N_ASM_P 4
11 #define BYTE_POS_SY_LFR_N_ASM_P 4
12 #define BYTE_POS_SY_LFR_N_BP_P0 6
12 #define BYTE_POS_SY_LFR_N_BP_P0 6
13 #define BYTE_POS_SY_LFR_N_BP_P1 7
13 #define BYTE_POS_SY_LFR_N_BP_P1 7
14 #define BYTE_POS_SY_LFR_N_CWF_LONG_F3 8
14
15
15 // TC_LFR_LOAD_BURST_PAR
16 // TC_LFR_LOAD_BURST_PAR
16
17
17 // TC_LFR_LOAD_SBM1_PAR
18 // TC_LFR_LOAD_SBM1_PAR
18
19
19 // TC_LFR_LOAD_SBM2_PAR
20 // TC_LFR_LOAD_SBM2_PAR
20
21
21
22
22 #endif // TM_BYTE_POSITIONS_H
23 #endif // TM_BYTE_POSITIONS_H
@@ -1,93 +1,94
1 #ifndef WF_HANDLER_H_INCLUDED
1 #ifndef WF_HANDLER_H_INCLUDED
2 #define WF_HANDLER_H_INCLUDED
2 #define WF_HANDLER_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <grspw.h>
5 #include <grspw.h>
6 #include <stdio.h>
6 #include <stdio.h>
7 #include <math.h>
7 #include <math.h>
8
8
9 #include "fsw_params.h"
9 #include "fsw_params.h"
10 #include "fsw_spacewire.h"
10 #include "fsw_spacewire.h"
11 #include "fsw_misc.h"
11 #include "fsw_misc.h"
12
12
13 #define pi 3.1415
13 #define pi 3.1415
14
14
15 typedef struct ring_node
15 typedef struct ring_node
16 {
16 {
17 struct ring_node *previous;
17 struct ring_node *previous;
18 int buffer_address;
18 int buffer_address;
19 struct ring_node *next;
19 struct ring_node *next;
20 unsigned int status;
20 unsigned int status;
21 } ring_node;
21 } ring_node;
22
22
23 extern int fdSPW;
23 extern int fdSPW;
24
24
25 //*****************
25 //*****************
26 // waveform buffers
26 // waveform buffers
27 // F0
27 // F0
28 extern volatile int wf_snap_f0[ ];
28 //extern volatile int wf_snap_f0[ ];
29 // F1 F2
29 // F1 F2
30 extern volatile int wf_snap_f0[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ];
30 extern volatile int wf_snap_f1[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ];
31 extern volatile int wf_snap_f1[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ];
31 extern volatile int wf_snap_f2[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ];
32 extern volatile int wf_snap_f2[ ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ];
32 // F3
33 // F3
33 extern volatile int wf_cont_f3_a[ ];
34 extern volatile int wf_cont_f3_a[ ];
34 extern volatile int wf_cont_f3_b[ ];
35 extern volatile int wf_cont_f3_b[ ];
35 extern char wf_cont_f3_light[ ];
36 extern char wf_cont_f3_light[ ];
36
37
37 #ifdef VHDL_DEV
38 #ifdef VHDL_DEV
38 extern waveform_picker_regs_new_t *waveform_picker_regs;
39 extern waveform_picker_regs_new_t *waveform_picker_regs;
39 #else
40 #else
40 extern waveform_picker_regs_t *waveform_picker_regs;
41 extern waveform_picker_regs_t *waveform_picker_regs;
41 #endif
42 #endif
42 extern time_management_regs_t *time_management_regs;
43 extern time_management_regs_t *time_management_regs;
43 extern Packet_TM_LFR_HK_t housekeeping_packet;
44 extern Packet_TM_LFR_HK_t housekeeping_packet;
44 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
45 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
45 extern struct param_local_str param_local;
46 extern struct param_local_str param_local;
46
47
47 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
48 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
48 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
49 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
49
50
50 extern rtems_id Task_id[20]; /* array of task ids */
51 extern rtems_id Task_id[20]; /* array of task ids */
51
52
52 extern unsigned char lfrCurrentMode;
53 extern unsigned char lfrCurrentMode;
53
54
54 rtems_isr waveforms_isr( rtems_vector_number vector );
55 rtems_isr waveforms_isr( rtems_vector_number vector );
55 rtems_task wfrm_task( rtems_task_argument argument );
56 rtems_task wfrm_task( rtems_task_argument argument );
56 rtems_task cwf3_task( rtems_task_argument argument );
57 rtems_task cwf3_task( rtems_task_argument argument );
57 rtems_task cwf2_task( rtems_task_argument argument );
58 rtems_task cwf2_task( rtems_task_argument argument );
58 rtems_task cwf1_task( rtems_task_argument argument );
59 rtems_task cwf1_task( rtems_task_argument argument );
59
60
60 //******************
61 //******************
61 // general functions
62 // general functions
62 void init_waveforms( void );
63 void init_waveforms( void );
63 void init_waveform_rings( void );
64 void init_waveform_rings( void );
64 void reset_current_ring_nodes( void );
65 void reset_current_ring_nodes( void );
65 //
66 //
66 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
67 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
67 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
68 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
68 int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
69 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
69 //
70 //
70 int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
71 int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
71 int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
72 int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
72 int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
73 int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
73 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
74 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
74 //
75 //
75 rtems_id get_pkts_queue_id( void );
76 rtems_id get_pkts_queue_id( void );
76
77
77 //**************
78 //**************
78 // wfp registers
79 // wfp registers
79 void set_wfp_data_shaping();
80 void set_wfp_data_shaping();
80 char set_wfp_delta_snapshot();
81 char set_wfp_delta_snapshot();
81 void set_wfp_burst_enable_register( unsigned char mode );
82 void set_wfp_burst_enable_register( unsigned char mode );
82 void reset_wfp_burst_enable();
83 void reset_wfp_burst_enable();
83 void reset_wfp_status();
84 void reset_wfp_status();
84 void reset_waveform_picker_regs();
85 void reset_waveform_picker_regs();
85 void reset_new_waveform_picker_regs();
86 void reset_new_waveform_picker_regs();
86
87
87 //*****************
88 //*****************
88 // local parameters
89 // local parameters
89 void set_local_nb_interrupt_f0_MAX( void );
90 void set_local_nb_interrupt_f0_MAX( void );
90
91
91 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid );
92 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid );
92
93
93 #endif // WF_HANDLER_H_INCLUDED
94 #endif // WF_HANDLER_H_INCLUDED
@@ -1,89 +1,90
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 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes
34 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes
35 // F0
35 // F0
36 volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
36 //volatile int wf_snap_f0 [ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ] __attribute__((aligned(0x100)));
37 volatile int wf_snap_f0[ NB_RING_NODES_F0 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ] __attribute__((aligned(0x100)));
37 // F1 F2
38 // F1 F2
38 volatile int wf_snap_f1[ NB_RING_NODES_F1 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ] __attribute__((aligned(0x100)));
39 volatile int wf_snap_f1[ NB_RING_NODES_F1 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ] __attribute__((aligned(0x100)));
39 volatile int wf_snap_f2[ NB_RING_NODES_F2 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ] __attribute__((aligned(0x100)));
40 volatile int wf_snap_f2[ NB_RING_NODES_F2 ][ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET + 46 ] __attribute__((aligned(0x100)));
40 // F3
41 // F3
41 volatile int wf_cont_f3_a[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
42 volatile int wf_cont_f3_a[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
42 volatile int wf_cont_f3_b[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
43 volatile int wf_cont_f3_b[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ] __attribute__((aligned(0x100)));
43 char wf_cont_f3_light[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_CWF3_LIGHT_BLK ] __attribute__((aligned(0x100)));
44 char wf_cont_f3_light[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_CWF3_LIGHT_BLK ] __attribute__((aligned(0x100)));
44
45
45 // SPECTRAL MATRICES GLOBAL VARIABLES
46 // SPECTRAL MATRICES GLOBAL VARIABLES
46 volatile int spec_mat_f0_0[ SM_HEADER + TOTAL_SIZE_SM ];
47 volatile int spec_mat_f0_0[ SM_HEADER + TOTAL_SIZE_SM ];
47 volatile int spec_mat_f0_1[ SM_HEADER + TOTAL_SIZE_SM ];
48 volatile int spec_mat_f0_1[ SM_HEADER + TOTAL_SIZE_SM ];
48 volatile int spec_mat_f0_a[ SM_HEADER + TOTAL_SIZE_SM ];
49 volatile int spec_mat_f0_a[ SM_HEADER + TOTAL_SIZE_SM ];
49 volatile int spec_mat_f0_b[ SM_HEADER + TOTAL_SIZE_SM ];
50 volatile int spec_mat_f0_b[ SM_HEADER + TOTAL_SIZE_SM ];
50 volatile int spec_mat_f0_c[ SM_HEADER + TOTAL_SIZE_SM ];
51 volatile int spec_mat_f0_c[ SM_HEADER + TOTAL_SIZE_SM ];
51 volatile int spec_mat_f0_d[ SM_HEADER + TOTAL_SIZE_SM ];
52 volatile int spec_mat_f0_d[ SM_HEADER + TOTAL_SIZE_SM ];
52 volatile int spec_mat_f0_e[ SM_HEADER + TOTAL_SIZE_SM ];
53 volatile int spec_mat_f0_e[ SM_HEADER + TOTAL_SIZE_SM ];
53 volatile int spec_mat_f0_f[ SM_HEADER + TOTAL_SIZE_SM ];
54 volatile int spec_mat_f0_f[ SM_HEADER + TOTAL_SIZE_SM ];
54 volatile int spec_mat_f0_g[ SM_HEADER + TOTAL_SIZE_SM ];
55 volatile int spec_mat_f0_g[ SM_HEADER + TOTAL_SIZE_SM ];
55 volatile int spec_mat_f0_h[ SM_HEADER + TOTAL_SIZE_SM ];
56 volatile int spec_mat_f0_h[ SM_HEADER + TOTAL_SIZE_SM ];
56 volatile int spec_mat_f0_0_bis[ SM_HEADER + TOTAL_SIZE_SM ];
57 volatile int spec_mat_f0_0_bis[ SM_HEADER + TOTAL_SIZE_SM ];
57 volatile int spec_mat_f0_1_bis[ SM_HEADER + TOTAL_SIZE_SM ];
58 volatile int spec_mat_f0_1_bis[ SM_HEADER + TOTAL_SIZE_SM ];
58 //
59 //
59 volatile int spec_mat_f1[ SM_HEADER + TOTAL_SIZE_SM ];
60 volatile int spec_mat_f1[ SM_HEADER + TOTAL_SIZE_SM ];
60 volatile int spec_mat_f1_bis[ SM_HEADER + TOTAL_SIZE_SM ];
61 volatile int spec_mat_f1_bis[ SM_HEADER + TOTAL_SIZE_SM ];
61 //
62 //
62 volatile int spec_mat_f2[ SM_HEADER + TOTAL_SIZE_SM ];
63 volatile int spec_mat_f2[ SM_HEADER + TOTAL_SIZE_SM ];
63 volatile int spec_mat_f2_bis[ SM_HEADER + TOTAL_SIZE_SM ];
64 volatile int spec_mat_f2_bis[ SM_HEADER + TOTAL_SIZE_SM ];
64
65
65 // APB CONFIGURATION REGISTERS
66 // APB CONFIGURATION REGISTERS
66 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
67 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
67 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
68 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
68
69
69 #ifdef VHDL_DEV
70 #ifdef VHDL_DEV
70 waveform_picker_regs_new_t *waveform_picker_regs = (waveform_picker_regs_new_t*) REGS_ADDR_WAVEFORM_PICKER;
71 waveform_picker_regs_new_t *waveform_picker_regs = (waveform_picker_regs_new_t*) REGS_ADDR_WAVEFORM_PICKER;
71 #else
72 #else
72 waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER;
73 waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER;
73 #endif
74 #endif
74 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
75 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
75
76
76 // MODE PARAMETERS
77 // MODE PARAMETERS
77 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
78 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
78 struct param_local_str param_local;
79 struct param_local_str param_local;
79
80
80 // HK PACKETS
81 // HK PACKETS
81 Packet_TM_LFR_HK_t housekeeping_packet;
82 Packet_TM_LFR_HK_t housekeeping_packet;
82 // sequence counters are incremented by APID (PID + CAT) and destination ID
83 // sequence counters are incremented by APID (PID + CAT) and destination ID
83 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
84 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
84 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
85 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
85 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
86 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
86 spw_stats spacewire_stats;
87 spw_stats spacewire_stats;
87 spw_stats spacewire_stats_backup;
88 spw_stats spacewire_stats_backup;
88
89
89
90
@@ -1,609 +1,607
1 /** This is the RTEMS initialization module.
1 /** This is the RTEMS initialization module.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * This module contains two very different information:
6 * This module contains two very different information:
7 * - specific instructions to configure the compilation of the RTEMS executive
7 * - specific instructions to configure the compilation of the RTEMS executive
8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
9 *
9 *
10 */
10 */
11
11
12 //*************************
12 //*************************
13 // GPL reminder to be added
13 // GPL reminder to be added
14 //*************************
14 //*************************
15
15
16 #include <rtems.h>
16 #include <rtems.h>
17
17
18 /* configuration information */
18 /* configuration information */
19
19
20 #define CONFIGURE_INIT
20 #define CONFIGURE_INIT
21
21
22 #include <bsp.h> /* for device driver prototypes */
22 #include <bsp.h> /* for device driver prototypes */
23
23
24 /* configuration information */
24 /* configuration information */
25
25
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
28
28
29 #define CONFIGURE_MAXIMUM_TASKS 20
29 #define CONFIGURE_MAXIMUM_TASKS 20
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
35 #define CONFIGURE_MAXIMUM_DRIVERS 16
35 #define CONFIGURE_MAXIMUM_DRIVERS 16
36 #define CONFIGURE_MAXIMUM_PERIODS 5
36 #define CONFIGURE_MAXIMUM_PERIODS 5
37 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
37 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
38 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2
38 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2
39 #ifdef PRINT_STACK_REPORT
39 #ifdef PRINT_STACK_REPORT
40 #define CONFIGURE_STACK_CHECKER_ENABLED
40 #define CONFIGURE_STACK_CHECKER_ENABLED
41 #endif
41 #endif
42
42
43 #include <rtems/confdefs.h>
43 #include <rtems/confdefs.h>
44
44
45 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
45 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
46 #ifdef RTEMS_DRVMGR_STARTUP
46 #ifdef RTEMS_DRVMGR_STARTUP
47 #ifdef LEON3
47 #ifdef LEON3
48 /* Add Timer and UART Driver */
48 /* Add Timer and UART Driver */
49 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
49 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
50 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
50 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
51 #endif
51 #endif
52 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
52 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
53 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
53 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
54 #endif
54 #endif
55 #endif
55 #endif
56 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
56 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
57 #include <drvmgr/drvmgr_confdefs.h>
57 #include <drvmgr/drvmgr_confdefs.h>
58 #endif
58 #endif
59
59
60 #include "fsw_init.h"
60 #include "fsw_init.h"
61 #include "fsw_config.c"
61 #include "fsw_config.c"
62
62
63 rtems_task Init( rtems_task_argument ignored )
63 rtems_task Init( rtems_task_argument ignored )
64 {
64 {
65 /** This is the RTEMS INIT taks, it the first task launched by the system.
65 /** This is the RTEMS INIT taks, it the first task launched by the system.
66 *
66 *
67 * @param unused is the starting argument of the RTEMS task
67 * @param unused is the starting argument of the RTEMS task
68 *
68 *
69 * The INIT task create and run all other RTEMS tasks.
69 * The INIT task create and run all other RTEMS tasks.
70 *
70 *
71 */
71 */
72
72
73
73
74 rtems_status_code status;
74 rtems_status_code status;
75 rtems_status_code status_spw;
75 rtems_status_code status_spw;
76 rtems_isr_entry old_isr_handler;
76 rtems_isr_entry old_isr_handler;
77
77
78 // UART settings
79 send_console_outputs_on_apbuart_port();
80 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
81
78 BOOT_PRINTF("\n\n\n\n\n")
82 BOOT_PRINTF("\n\n\n\n\n")
79 BOOT_PRINTF("***************************\n")
83 BOOT_PRINTF("***************************\n")
80 BOOT_PRINTF("** START Flight Software **\n")
84 BOOT_PRINTF("** START Flight Software **\n")
81 #ifdef VHDL_DEV
85 #ifdef VHDL_DEV
82 PRINTF("/!\\ this is the VHDL_DEV flight software /!\\ \n")
86 PRINTF("/!\\ this is the VHDL_DEV flight software /!\\ \n")
83 #endif
87 #endif
84 BOOT_PRINTF("***************************\n")
88 BOOT_PRINTF("***************************\n")
85 BOOT_PRINTF("\n\n")
89 BOOT_PRINTF("\n\n")
86
90
87 //send_console_outputs_on_apbuart_port();
88 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
89
90 reset_wfp_burst_enable(); // stop the waveform picker if it was running
91 reset_wfp_burst_enable(); // stop the waveform picker if it was running
91 init_waveform_rings(); // initialize the waveform rings
92 init_waveform_rings(); // initialize the waveform rings
92
93
93 init_parameter_dump();
94 init_parameter_dump();
94 init_local_mode_parameters();
95 init_local_mode_parameters();
95 init_housekeeping_parameters();
96 init_housekeeping_parameters();
96
97
97 updateLFRCurrentMode();
98 updateLFRCurrentMode();
98
99
99 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
100 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
100
101
101 create_names(); // create all names
102 create_names(); // create all names
102
103
103 status = create_message_queues(); // create message queues
104 status = create_message_queues(); // create message queues
104 if (status != RTEMS_SUCCESSFUL)
105 if (status != RTEMS_SUCCESSFUL)
105 {
106 {
106 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
107 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
107 }
108 }
108
109
109 status = create_all_tasks(); // create all tasks
110 status = create_all_tasks(); // create all tasks
110 if (status != RTEMS_SUCCESSFUL)
111 if (status != RTEMS_SUCCESSFUL)
111 {
112 {
112 PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status)
113 PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status)
113 }
114 }
114
115
115 // **************************
116 // **************************
116 // <SPACEWIRE INITIALIZATION>
117 // <SPACEWIRE INITIALIZATION>
117 grspw_timecode_callback = &timecode_irq_handler;
118 grspw_timecode_callback = &timecode_irq_handler;
118
119
119 status_spw = spacewire_open_link(); // (1) open the link
120 status_spw = spacewire_open_link(); // (1) open the link
120 if ( status_spw != RTEMS_SUCCESSFUL )
121 if ( status_spw != RTEMS_SUCCESSFUL )
121 {
122 {
122 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
123 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
123 }
124 }
124
125
125 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
126 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
126 {
127 {
127 status_spw = spacewire_configure_link( fdSPW );
128 status_spw = spacewire_configure_link( fdSPW );
128 if ( status_spw != RTEMS_SUCCESSFUL )
129 if ( status_spw != RTEMS_SUCCESSFUL )
129 {
130 {
130 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
131 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
131 }
132 }
132 }
133 }
133
134
134 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
135 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
135 {
136 {
136 status_spw = spacewire_start_link( fdSPW );
137 status_spw = spacewire_start_link( fdSPW );
137 if ( status_spw != RTEMS_SUCCESSFUL )
138 if ( status_spw != RTEMS_SUCCESSFUL )
138 {
139 {
139 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
140 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
140 }
141 }
141 }
142 }
142 // </SPACEWIRE INITIALIZATION>
143 // </SPACEWIRE INITIALIZATION>
143 // ***************************
144 // ***************************
144
145
145 status = start_all_tasks(); // start all tasks
146 status = start_all_tasks(); // start all tasks
146 if (status != RTEMS_SUCCESSFUL)
147 if (status != RTEMS_SUCCESSFUL)
147 {
148 {
148 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
149 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
149 }
150 }
150
151
151 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
152 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
152 status = start_recv_send_tasks();
153 status = start_recv_send_tasks();
153 if ( status != RTEMS_SUCCESSFUL )
154 if ( status != RTEMS_SUCCESSFUL )
154 {
155 {
155 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
156 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
156 }
157 }
157
158
158 // suspend science tasks. they will be restarted later depending on the mode
159 // suspend science tasks. they will be restarted later depending on the mode
159 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
160 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
160 if (status != RTEMS_SUCCESSFUL)
161 if (status != RTEMS_SUCCESSFUL)
161 {
162 {
162 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
163 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
163 }
164 }
164
165
165 #ifdef GSA
166
166 // mask IRQ lines
167 //******************************
168 // <SPECTRAL MATRICES SIMULATOR>
167 LEON_Mask_interrupt( IRQ_SM );
169 LEON_Mask_interrupt( IRQ_SM );
168 LEON_Mask_interrupt( IRQ_WF );
169 // Spectral Matrices simulator
170 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
170 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
171 IRQ_SPARC_SM, spectral_matrices_isr );
171 IRQ_SPARC_SM, spectral_matrices_isr_simu );
172 // WaveForms
172 // </SPECTRAL MATRICES SIMULATOR>
173 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR,
173 //*******************************
174 IRQ_SPARC_WF, waveforms_simulator_isr );
174
175 #else
176 // configure IRQ handling for the waveform picker unit
175 // configure IRQ handling for the waveform picker unit
177 status = rtems_interrupt_catch( waveforms_isr,
176 status = rtems_interrupt_catch( waveforms_isr,
178 IRQ_SPARC_WAVEFORM_PICKER,
177 IRQ_SPARC_WAVEFORM_PICKER,
179 &old_isr_handler) ;
178 &old_isr_handler) ;
180 #endif
181
179
182 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
180 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
183 if ( status_spw != RTEMS_SUCCESSFUL )
181 if ( status_spw != RTEMS_SUCCESSFUL )
184 {
182 {
185 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
183 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
186 if ( status != RTEMS_SUCCESSFUL ) {
184 if ( status != RTEMS_SUCCESSFUL ) {
187 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
185 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
188 }
186 }
189 }
187 }
190
188
191 BOOT_PRINTF("delete INIT\n")
189 BOOT_PRINTF("delete INIT\n")
192
190
193 status = rtems_task_delete(RTEMS_SELF);
191 status = rtems_task_delete(RTEMS_SELF);
194
192
195 }
193 }
196
194
197 void init_local_mode_parameters( void )
195 void init_local_mode_parameters( void )
198 {
196 {
199 /** This function initialize the param_local global variable with default values.
197 /** This function initialize the param_local global variable with default values.
200 *
198 *
201 */
199 */
202
200
203 unsigned int i;
201 unsigned int i;
204
202
205 // LOCAL PARAMETERS
203 // LOCAL PARAMETERS
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 // init sequence counters
210 // init sequence counters
213
211
214 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
212 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
215 {
213 {
216 sequenceCounters_TC_EXE[i] = 0x00;
214 sequenceCounters_TC_EXE[i] = 0x00;
217 }
215 }
218 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
216 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
219 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
217 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
220 }
218 }
221
219
222 void create_names( void ) // create all names for tasks and queues
220 void create_names( void ) // create all names for tasks and queues
223 {
221 {
224 /** This function creates all RTEMS names used in the software for tasks and queues.
222 /** This function creates all RTEMS names used in the software for tasks and queues.
225 *
223 *
226 * @return RTEMS directive status codes:
224 * @return RTEMS directive status codes:
227 * - RTEMS_SUCCESSFUL - successful completion
225 * - RTEMS_SUCCESSFUL - successful completion
228 *
226 *
229 */
227 */
230
228
231 // task names
229 // task names
232 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
230 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
233 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
231 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
234 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
232 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
235 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
233 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
236 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
234 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
237 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
235 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
238 Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' );
236 Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' );
239 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
237 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
240 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
238 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
241 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
239 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
242 Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' );
240 Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' );
243 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
241 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
244 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
242 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
245 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
243 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
246 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
244 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
247 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
245 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
248
246
249 // rate monotonic period names
247 // rate monotonic period names
250 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
248 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
251
249
252 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
250 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
253 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
251 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
254 }
252 }
255
253
256 int create_all_tasks( void ) // create all tasks which run in the software
254 int create_all_tasks( void ) // create all tasks which run in the software
257 {
255 {
258 /** This function creates all RTEMS tasks used in the software.
256 /** This function creates all RTEMS tasks used in the software.
259 *
257 *
260 * @return RTEMS directive status codes:
258 * @return RTEMS directive status codes:
261 * - RTEMS_SUCCESSFUL - task created successfully
259 * - RTEMS_SUCCESSFUL - task created successfully
262 * - RTEMS_INVALID_ADDRESS - id is NULL
260 * - RTEMS_INVALID_ADDRESS - id is NULL
263 * - RTEMS_INVALID_NAME - invalid task name
261 * - RTEMS_INVALID_NAME - invalid task name
264 * - RTEMS_INVALID_PRIORITY - invalid task priority
262 * - RTEMS_INVALID_PRIORITY - invalid task priority
265 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
263 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
266 * - RTEMS_TOO_MANY - too many tasks created
264 * - RTEMS_TOO_MANY - too many tasks created
267 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
265 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
268 * - RTEMS_TOO_MANY - too many global objects
266 * - RTEMS_TOO_MANY - too many global objects
269 *
267 *
270 */
268 */
271
269
272 rtems_status_code status;
270 rtems_status_code status;
273
271
274 // RECV
272 // RECV
275 status = rtems_task_create(
273 status = rtems_task_create(
276 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
274 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
277 RTEMS_DEFAULT_MODES,
275 RTEMS_DEFAULT_MODES,
278 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
276 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
279 );
277 );
280
278
281 if (status == RTEMS_SUCCESSFUL) // ACTN
279 if (status == RTEMS_SUCCESSFUL) // ACTN
282 {
280 {
283 status = rtems_task_create(
281 status = rtems_task_create(
284 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
282 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
285 RTEMS_DEFAULT_MODES,
283 RTEMS_DEFAULT_MODES,
286 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
284 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
287 );
285 );
288 }
286 }
289 if (status == RTEMS_SUCCESSFUL) // SPIQ
287 if (status == RTEMS_SUCCESSFUL) // SPIQ
290 {
288 {
291 status = rtems_task_create(
289 status = rtems_task_create(
292 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
290 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
293 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
291 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
294 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
292 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
295 );
293 );
296 }
294 }
297 if (status == RTEMS_SUCCESSFUL) // SMIQ
295 if (status == RTEMS_SUCCESSFUL) // SMIQ
298 {
296 {
299 status = rtems_task_create(
297 status = rtems_task_create(
300 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE,
298 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE,
301 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
299 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
302 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
300 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
303 );
301 );
304 }
302 }
305 if (status == RTEMS_SUCCESSFUL) // STAT
303 if (status == RTEMS_SUCCESSFUL) // STAT
306 {
304 {
307 status = rtems_task_create(
305 status = rtems_task_create(
308 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
306 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
309 RTEMS_DEFAULT_MODES,
307 RTEMS_DEFAULT_MODES,
310 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
308 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
311 );
309 );
312 }
310 }
313 if (status == RTEMS_SUCCESSFUL) // AVF0
311 if (status == RTEMS_SUCCESSFUL) // AVF0
314 {
312 {
315 status = rtems_task_create(
313 status = rtems_task_create(
316 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
314 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
317 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
315 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
318 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
316 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
319 );
317 );
320 }
318 }
321 if (status == RTEMS_SUCCESSFUL) // BPF0
319 if (status == RTEMS_SUCCESSFUL) // BPF0
322 {
320 {
323 status = rtems_task_create(
321 status = rtems_task_create(
324 Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE,
322 Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE,
325 RTEMS_DEFAULT_MODES,
323 RTEMS_DEFAULT_MODES,
326 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0]
324 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0]
327 );
325 );
328 }
326 }
329 if (status == RTEMS_SUCCESSFUL) // WFRM
327 if (status == RTEMS_SUCCESSFUL) // WFRM
330 {
328 {
331 status = rtems_task_create(
329 status = rtems_task_create(
332 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
330 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
333 RTEMS_DEFAULT_MODES,
331 RTEMS_DEFAULT_MODES,
334 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
332 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
335 );
333 );
336 }
334 }
337 if (status == RTEMS_SUCCESSFUL) // DUMB
335 if (status == RTEMS_SUCCESSFUL) // DUMB
338 {
336 {
339 status = rtems_task_create(
337 status = rtems_task_create(
340 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
338 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
341 RTEMS_DEFAULT_MODES,
339 RTEMS_DEFAULT_MODES,
342 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
340 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
343 );
341 );
344 }
342 }
345 if (status == RTEMS_SUCCESSFUL) // HOUS
343 if (status == RTEMS_SUCCESSFUL) // HOUS
346 {
344 {
347 status = rtems_task_create(
345 status = rtems_task_create(
348 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
346 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
349 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
347 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
350 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
348 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
351 );
349 );
352 }
350 }
353 if (status == RTEMS_SUCCESSFUL) // MATR
351 if (status == RTEMS_SUCCESSFUL) // MATR
354 {
352 {
355 status = rtems_task_create(
353 status = rtems_task_create(
356 Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE,
354 Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE,
357 RTEMS_DEFAULT_MODES,
355 RTEMS_DEFAULT_MODES,
358 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR]
356 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR]
359 );
357 );
360 }
358 }
361 if (status == RTEMS_SUCCESSFUL) // CWF3
359 if (status == RTEMS_SUCCESSFUL) // CWF3
362 {
360 {
363 status = rtems_task_create(
361 status = rtems_task_create(
364 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
362 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
365 RTEMS_DEFAULT_MODES,
363 RTEMS_DEFAULT_MODES,
366 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3]
364 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3]
367 );
365 );
368 }
366 }
369 if (status == RTEMS_SUCCESSFUL) // CWF2
367 if (status == RTEMS_SUCCESSFUL) // CWF2
370 {
368 {
371 status = rtems_task_create(
369 status = rtems_task_create(
372 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
370 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
373 RTEMS_DEFAULT_MODES,
371 RTEMS_DEFAULT_MODES,
374 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2]
372 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2]
375 );
373 );
376 }
374 }
377 if (status == RTEMS_SUCCESSFUL) // CWF1
375 if (status == RTEMS_SUCCESSFUL) // CWF1
378 {
376 {
379 status = rtems_task_create(
377 status = rtems_task_create(
380 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
378 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
381 RTEMS_DEFAULT_MODES,
379 RTEMS_DEFAULT_MODES,
382 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1]
380 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1]
383 );
381 );
384 }
382 }
385 if (status == RTEMS_SUCCESSFUL) // SEND
383 if (status == RTEMS_SUCCESSFUL) // SEND
386 {
384 {
387 status = rtems_task_create(
385 status = rtems_task_create(
388 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
386 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
389 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
387 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
390 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
388 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
391 );
389 );
392 }
390 }
393 if (status == RTEMS_SUCCESSFUL) // WTDG
391 if (status == RTEMS_SUCCESSFUL) // WTDG
394 {
392 {
395 status = rtems_task_create(
393 status = rtems_task_create(
396 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
394 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
397 RTEMS_DEFAULT_MODES,
395 RTEMS_DEFAULT_MODES,
398 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
396 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
399 );
397 );
400 }
398 }
401
399
402 return status;
400 return status;
403 }
401 }
404
402
405 int start_recv_send_tasks( void )
403 int start_recv_send_tasks( void )
406 {
404 {
407 rtems_status_code status;
405 rtems_status_code status;
408
406
409 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
407 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
410 if (status!=RTEMS_SUCCESSFUL) {
408 if (status!=RTEMS_SUCCESSFUL) {
411 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
409 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
412 }
410 }
413
411
414 if (status == RTEMS_SUCCESSFUL) // SEND
412 if (status == RTEMS_SUCCESSFUL) // SEND
415 {
413 {
416 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
414 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
417 if (status!=RTEMS_SUCCESSFUL) {
415 if (status!=RTEMS_SUCCESSFUL) {
418 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
416 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
419 }
417 }
420 }
418 }
421
419
422 return status;
420 return status;
423 }
421 }
424
422
425 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
423 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
426 {
424 {
427 /** This function starts all RTEMS tasks used in the software.
425 /** This function starts all RTEMS tasks used in the software.
428 *
426 *
429 * @return RTEMS directive status codes:
427 * @return RTEMS directive status codes:
430 * - RTEMS_SUCCESSFUL - ask started successfully
428 * - RTEMS_SUCCESSFUL - ask started successfully
431 * - RTEMS_INVALID_ADDRESS - invalid task entry point
429 * - RTEMS_INVALID_ADDRESS - invalid task entry point
432 * - RTEMS_INVALID_ID - invalid task id
430 * - RTEMS_INVALID_ID - invalid task id
433 * - RTEMS_INCORRECT_STATE - task not in the dormant state
431 * - RTEMS_INCORRECT_STATE - task not in the dormant state
434 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
432 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
435 *
433 *
436 */
434 */
437 // starts all the tasks fot eh flight software
435 // starts all the tasks fot eh flight software
438
436
439 rtems_status_code status;
437 rtems_status_code status;
440
438
441 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
439 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
442 if (status!=RTEMS_SUCCESSFUL) {
440 if (status!=RTEMS_SUCCESSFUL) {
443 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
441 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
444 }
442 }
445
443
446 if (status == RTEMS_SUCCESSFUL) // WTDG
444 if (status == RTEMS_SUCCESSFUL) // WTDG
447 {
445 {
448 status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 );
446 status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 );
449 if (status!=RTEMS_SUCCESSFUL) {
447 if (status!=RTEMS_SUCCESSFUL) {
450 BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n")
448 BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n")
451 }
449 }
452 }
450 }
453
451
454 if (status == RTEMS_SUCCESSFUL) // SMIQ
452 if (status == RTEMS_SUCCESSFUL) // SMIQ
455 {
453 {
456 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
454 status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 );
457 if (status!=RTEMS_SUCCESSFUL) {
455 if (status!=RTEMS_SUCCESSFUL) {
458 BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n")
456 BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n")
459 }
457 }
460 }
458 }
461
459
462 if (status == RTEMS_SUCCESSFUL) // ACTN
460 if (status == RTEMS_SUCCESSFUL) // ACTN
463 {
461 {
464 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
462 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
465 if (status!=RTEMS_SUCCESSFUL) {
463 if (status!=RTEMS_SUCCESSFUL) {
466 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
464 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
467 }
465 }
468 }
466 }
469
467
470 if (status == RTEMS_SUCCESSFUL) // STAT
468 if (status == RTEMS_SUCCESSFUL) // STAT
471 {
469 {
472 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
470 status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 );
473 if (status!=RTEMS_SUCCESSFUL) {
471 if (status!=RTEMS_SUCCESSFUL) {
474 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
472 BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n")
475 }
473 }
476 }
474 }
477
475
478 if (status == RTEMS_SUCCESSFUL) // AVF0
476 if (status == RTEMS_SUCCESSFUL) // AVF0
479 {
477 {
480 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
478 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 );
481 if (status!=RTEMS_SUCCESSFUL) {
479 if (status!=RTEMS_SUCCESSFUL) {
482 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
480 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
483 }
481 }
484 }
482 }
485
483
486 if (status == RTEMS_SUCCESSFUL) // BPF0
484 if (status == RTEMS_SUCCESSFUL) // BPF0
487 {
485 {
488 status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 );
486 status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 );
489 if (status!=RTEMS_SUCCESSFUL) {
487 if (status!=RTEMS_SUCCESSFUL) {
490 BOOT_PRINTF("in INIT *** Error starting TASK_BPF0\n")
488 BOOT_PRINTF("in INIT *** Error starting TASK_BPF0\n")
491 }
489 }
492 }
490 }
493
491
494 if (status == RTEMS_SUCCESSFUL) // WFRM
492 if (status == RTEMS_SUCCESSFUL) // WFRM
495 {
493 {
496 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
494 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
497 if (status!=RTEMS_SUCCESSFUL) {
495 if (status!=RTEMS_SUCCESSFUL) {
498 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
496 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
499 }
497 }
500 }
498 }
501
499
502 if (status == RTEMS_SUCCESSFUL) // DUMB
500 if (status == RTEMS_SUCCESSFUL) // DUMB
503 {
501 {
504 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
502 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
505 if (status!=RTEMS_SUCCESSFUL) {
503 if (status!=RTEMS_SUCCESSFUL) {
506 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
504 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
507 }
505 }
508 }
506 }
509
507
510 if (status == RTEMS_SUCCESSFUL) // HOUS
508 if (status == RTEMS_SUCCESSFUL) // HOUS
511 {
509 {
512 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
510 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
513 if (status!=RTEMS_SUCCESSFUL) {
511 if (status!=RTEMS_SUCCESSFUL) {
514 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
512 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
515 }
513 }
516 }
514 }
517
515
518 if (status == RTEMS_SUCCESSFUL) // MATR
516 if (status == RTEMS_SUCCESSFUL) // MATR
519 {
517 {
520 status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 );
518 status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 );
521 if (status!=RTEMS_SUCCESSFUL) {
519 if (status!=RTEMS_SUCCESSFUL) {
522 BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n")
520 BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n")
523 }
521 }
524 }
522 }
525
523
526 if (status == RTEMS_SUCCESSFUL) // CWF3
524 if (status == RTEMS_SUCCESSFUL) // CWF3
527 {
525 {
528 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
526 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
529 if (status!=RTEMS_SUCCESSFUL) {
527 if (status!=RTEMS_SUCCESSFUL) {
530 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
528 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
531 }
529 }
532 }
530 }
533
531
534 if (status == RTEMS_SUCCESSFUL) // CWF2
532 if (status == RTEMS_SUCCESSFUL) // CWF2
535 {
533 {
536 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
534 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
537 if (status!=RTEMS_SUCCESSFUL) {
535 if (status!=RTEMS_SUCCESSFUL) {
538 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
536 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
539 }
537 }
540 }
538 }
541
539
542 if (status == RTEMS_SUCCESSFUL) // CWF1
540 if (status == RTEMS_SUCCESSFUL) // CWF1
543 {
541 {
544 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
542 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
545 if (status!=RTEMS_SUCCESSFUL) {
543 if (status!=RTEMS_SUCCESSFUL) {
546 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
544 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
547 }
545 }
548 }
546 }
549 return status;
547 return status;
550 }
548 }
551
549
552 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
550 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
553 {
551 {
554 rtems_status_code status_recv;
552 rtems_status_code status_recv;
555 rtems_status_code status_send;
553 rtems_status_code status_send;
556 rtems_status_code ret;
554 rtems_status_code ret;
557 rtems_id queue_id;
555 rtems_id queue_id;
558
556
559 // create the queue for handling valid TCs
557 // create the queue for handling valid TCs
560 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
558 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
561 ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE,
559 ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE,
562 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
560 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
563 if ( status_recv != RTEMS_SUCCESSFUL ) {
561 if ( status_recv != RTEMS_SUCCESSFUL ) {
564 PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv)
562 PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv)
565 }
563 }
566
564
567 // create the queue for handling TM packet sending
565 // create the queue for handling TM packet sending
568 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
566 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
569 ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE,
567 ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE,
570 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
568 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
571 if ( status_send != RTEMS_SUCCESSFUL ) {
569 if ( status_send != RTEMS_SUCCESSFUL ) {
572 PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send)
570 PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send)
573 }
571 }
574
572
575 if ( status_recv != RTEMS_SUCCESSFUL )
573 if ( status_recv != RTEMS_SUCCESSFUL )
576 {
574 {
577 ret = status_recv;
575 ret = status_recv;
578 }
576 }
579 else
577 else
580 {
578 {
581 ret = status_send;
579 ret = status_send;
582 }
580 }
583
581
584 return ret;
582 return ret;
585 }
583 }
586
584
587 rtems_status_code get_message_queue_id_send( rtems_id *queue_id )
585 rtems_status_code get_message_queue_id_send( rtems_id *queue_id )
588 {
586 {
589 rtems_status_code status;
587 rtems_status_code status;
590 rtems_name queue_name;
588 rtems_name queue_name;
591
589
592 queue_name = rtems_build_name( 'Q', '_', 'S', 'D' );
590 queue_name = rtems_build_name( 'Q', '_', 'S', 'D' );
593
591
594 status = rtems_message_queue_ident( queue_name, 0, queue_id );
592 status = rtems_message_queue_ident( queue_name, 0, queue_id );
595
593
596 return status;
594 return status;
597 }
595 }
598
596
599 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id )
597 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id )
600 {
598 {
601 rtems_status_code status;
599 rtems_status_code status;
602 rtems_name queue_name;
600 rtems_name queue_name;
603
601
604 queue_name = rtems_build_name( 'Q', '_', 'R', 'V' );
602 queue_name = rtems_build_name( 'Q', '_', 'R', 'V' );
605
603
606 status = rtems_message_queue_ident( queue_name, 0, queue_id );
604 status = rtems_message_queue_ident( queue_name, 0, queue_id );
607
605
608 return status;
606 return status;
609 }
607 }
@@ -1,336 +1,341
1 /** General usage functions and RTEMS tasks.
1 /** General usage functions and RTEMS tasks.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 */
6 */
7
7
8 #include "fsw_misc.h"
8 #include "fsw_misc.h"
9
9
10 //char *DumbMessages[7] = {"in DUMB *** default", // RTEMS_EVENT_0
10 //char *DumbMessages[7] = {"in DUMB *** default", // RTEMS_EVENT_0
11 // "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
11 // "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
12 // "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
12 // "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
13 // "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
13 // "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
14 // "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
14 // "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
15 // "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
15 // "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
16 // "ERR HK" // RTEMS_EVENT_6
16 // "ERR HK" // RTEMS_EVENT_6
17 //};
17 //};
18
18
19 void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
19 void configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
20 unsigned char interrupt_level, rtems_isr (*timer_isr)() )
20 unsigned char interrupt_level, rtems_isr (*timer_isr)() )
21 {
21 {
22 /** This function configures a GPTIMER timer instantiated in the VHDL design.
22 /** This function configures a GPTIMER timer instantiated in the VHDL design.
23 *
23 *
24 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
24 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
25 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
25 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
26 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
26 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
27 * @param interrupt_level is the interrupt level that the timer drives.
27 * @param interrupt_level is the interrupt level that the timer drives.
28 * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer.
28 * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer.
29 *
29 *
30 * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76
30 * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76
31 *
31 *
32 */
32 */
33
33
34 rtems_status_code status;
34 rtems_status_code status;
35 rtems_isr_entry old_isr_handler;
35 rtems_isr_entry old_isr_handler;
36
36
37 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
37 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
38 if (status!=RTEMS_SUCCESSFUL)
38 if (status!=RTEMS_SUCCESSFUL)
39 {
39 {
40 PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n")
40 PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n")
41 }
41 }
42
42
43 timer_set_clock_divider( gptimer_regs, timer, clock_divider);
43 timer_set_clock_divider( gptimer_regs, timer, clock_divider);
44 }
44 }
45
45
46 void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer)
46 void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer)
47 {
47 {
48 /** This function starts a GPTIMER timer.
48 /** This function starts a GPTIMER timer.
49 *
49 *
50 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
50 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
51 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
51 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
52 *
52 *
53 */
53 */
54
54
55 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
55 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
56 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register
56 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register
57 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer
57 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer
58 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart
58 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart
59 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable
59 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable
60 }
60 }
61
61
62 void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer)
62 void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer)
63 {
63 {
64 /** This function stops a GPTIMER timer.
64 /** This function stops a GPTIMER timer.
65 *
65 *
66 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
66 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
67 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
67 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
68 *
68 *
69 */
69 */
70
70
71 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer
71 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer
72 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable
72 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable
73 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
73 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
74 }
74 }
75
75
76 void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider)
76 void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider)
77 {
77 {
78 /** This function sets the clock divider of a GPTIMER timer.
78 /** This function sets the clock divider of a GPTIMER timer.
79 *
79 *
80 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
80 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
81 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
81 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
82 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
82 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
83 *
83 *
84 */
84 */
85
85
86 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
86 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
87 }
87 }
88
88
89 int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port
89 int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port
90 {
90 {
91 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
91 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
92
92
93 apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB;
93 apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB;
94 PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
94 PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
95
95
96 return 0;
96 return 0;
97 }
97 }
98
98
99 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
99 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
100 {
100 {
101 /** This function sets the scaler reload register of the apbuart module
101 /** This function sets the scaler reload register of the apbuart module
102 *
102 *
103 * @param regs is the address of the apbuart registers in memory
103 * @param regs is the address of the apbuart registers in memory
104 * @param value is the value that will be stored in the scaler register
104 * @param value is the value that will be stored in the scaler register
105 *
105 *
106 * The value shall be set by the software to get data on the serial interface.
106 * The value shall be set by the software to get data on the serial interface.
107 *
107 *
108 */
108 */
109
109
110 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
110 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
111
111
112 apbuart_regs->scaler = value;
112 apbuart_regs->scaler = value;
113 BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value)
113 BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value)
114 }
114 }
115
115
116 //************
116 //************
117 // RTEMS TASKS
117 // RTEMS TASKS
118
118
119 rtems_task stat_task(rtems_task_argument argument)
119 rtems_task stat_task(rtems_task_argument argument)
120 {
120 {
121 int i;
121 int i;
122 int j;
122 int j;
123 i = 0;
123 i = 0;
124 j = 0;
124 j = 0;
125 BOOT_PRINTF("in STAT *** \n")
125 BOOT_PRINTF("in STAT *** \n")
126 while(1){
126 while(1){
127 rtems_task_wake_after(1000);
127 rtems_task_wake_after(1000);
128 PRINTF1("%d\n", j)
128 PRINTF1("%d\n", j)
129 if (i == CPU_USAGE_REPORT_PERIOD) {
129 if (i == CPU_USAGE_REPORT_PERIOD) {
130 // #ifdef PRINT_TASK_STATISTICS
130 // #ifdef PRINT_TASK_STATISTICS
131 // rtems_cpu_usage_report();
131 // rtems_cpu_usage_report();
132 // rtems_cpu_usage_reset();
132 // rtems_cpu_usage_reset();
133 // #endif
133 // #endif
134 i = 0;
134 i = 0;
135 }
135 }
136 else i++;
136 else i++;
137 j++;
137 j++;
138 }
138 }
139 }
139 }
140
140
141 rtems_task hous_task(rtems_task_argument argument)
141 rtems_task hous_task(rtems_task_argument argument)
142 {
142 {
143 rtems_status_code status;
143 rtems_status_code status;
144 rtems_id queue_id;
144 rtems_id queue_id;
145
145
146 status = get_message_queue_id_send( &queue_id );
146 status = get_message_queue_id_send( &queue_id );
147 if (status != RTEMS_SUCCESSFUL)
147 if (status != RTEMS_SUCCESSFUL)
148 {
148 {
149 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
149 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
150 }
150 }
151
151
152 BOOT_PRINTF("in HOUS ***\n")
152 BOOT_PRINTF("in HOUS ***\n")
153
153
154 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
154 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
155 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
155 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
156 if( status != RTEMS_SUCCESSFUL ) {
156 if( status != RTEMS_SUCCESSFUL ) {
157 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
157 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
158 }
158 }
159 }
159 }
160
160
161 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
161 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
162 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
162 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
163 housekeeping_packet.reserved = DEFAULT_RESERVED;
163 housekeeping_packet.reserved = DEFAULT_RESERVED;
164 housekeeping_packet.userApplication = CCSDS_USER_APP;
164 housekeeping_packet.userApplication = CCSDS_USER_APP;
165 housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8);
165 housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8);
166 housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK);
166 housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK);
167 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
167 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
168 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
168 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
169 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
169 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
170 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
170 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
171 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
171 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
172 housekeeping_packet.serviceType = TM_TYPE_HK;
172 housekeeping_packet.serviceType = TM_TYPE_HK;
173 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
173 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
174 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
174 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
175 housekeeping_packet.sid = SID_HK;
175 housekeeping_packet.sid = SID_HK;
176
176
177 status = rtems_rate_monotonic_cancel(HK_id);
177 status = rtems_rate_monotonic_cancel(HK_id);
178 if( status != RTEMS_SUCCESSFUL ) {
178 if( status != RTEMS_SUCCESSFUL ) {
179 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
179 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
180 }
180 }
181 else {
181 else {
182 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
182 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
183 }
183 }
184
184
185 while(1){ // launch the rate monotonic task
185 while(1){ // launch the rate monotonic task
186 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
186 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
187 if ( status != RTEMS_SUCCESSFUL ) {
187 if ( status != RTEMS_SUCCESSFUL ) {
188 PRINTF1( "in HOUS *** ERR period: %d\n", status);
188 PRINTF1( "in HOUS *** ERR period: %d\n", status);
189 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
189 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
190 }
190 }
191 else {
191 else {
192 increment_seq_counter( housekeeping_packet.packetSequenceControl );
192 increment_seq_counter( housekeeping_packet.packetSequenceControl );
193 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
193 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
194 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
194 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
195 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
195 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
196 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
196 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
197 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
197 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
198 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
198 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
199
199
200 spacewire_update_statistics();
200 spacewire_update_statistics();
201
201
202 // SEND PACKET
202 // SEND PACKET
203 status = rtems_message_queue_send( queue_id, &housekeeping_packet,
203 status = rtems_message_queue_send( queue_id, &housekeeping_packet,
204 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
204 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
205 if (status != RTEMS_SUCCESSFUL) {
205 if (status != RTEMS_SUCCESSFUL) {
206 PRINTF1("in HOUS *** ERR send: %d\n", status)
206 PRINTF1("in HOUS *** ERR send: %d\n", status)
207 }
207 }
208 }
208 }
209 }
209 }
210
210
211 PRINTF("in HOUS *** deleting task\n")
211 PRINTF("in HOUS *** deleting task\n")
212
212
213 status = rtems_task_delete( RTEMS_SELF ); // should not return
213 status = rtems_task_delete( RTEMS_SELF ); // should not return
214 printf( "rtems_task_delete returned with status of %d.\n", status );
214 printf( "rtems_task_delete returned with status of %d.\n", status );
215 return;
215 return;
216 }
216 }
217
217
218 rtems_task dumb_task( rtems_task_argument unused )
218 rtems_task dumb_task( rtems_task_argument unused )
219 {
219 {
220 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
220 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
221 *
221 *
222 * @param unused is the starting argument of the RTEMS task
222 * @param unused is the starting argument of the RTEMS task
223 *
223 *
224 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
224 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
225 *
225 *
226 */
226 */
227
227
228 unsigned int i;
228 unsigned int i;
229 unsigned int intEventOut;
229 unsigned int intEventOut;
230 unsigned int coarse_time = 0;
230 unsigned int coarse_time = 0;
231 unsigned int fine_time = 0;
231 unsigned int fine_time = 0;
232 rtems_event_set event_out;
232 rtems_event_set event_out;
233
233
234 char *DumbMessages[7] = {"in DUMB *** default", // RTEMS_EVENT_0
234 char *DumbMessages[8] = {"in DUMB *** default", // RTEMS_EVENT_0
235 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
235 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
236 "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
236 "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
237 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
237 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
238 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
238 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
239 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
239 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
240 "ERR HK" // RTEMS_EVENT_6
240 "ERR HK", // RTEMS_EVENT_6
241 "ready for dump" // RTEMS_EVENT_7
241 };
242 };
242
243
243 BOOT_PRINTF("in DUMB *** \n")
244 BOOT_PRINTF("in DUMB *** \n")
244
245
245 while(1){
246 while(1){
246 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
247 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
247 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6,
248 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7,
248 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
249 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
249 intEventOut = (unsigned int) event_out;
250 intEventOut = (unsigned int) event_out;
250 for ( i=0; i<32; i++)
251 for ( i=0; i<32; i++)
251 {
252 {
252 if ( ((intEventOut >> i) & 0x0001) != 0)
253 if ( ((intEventOut >> i) & 0x0001) != 0)
253 {
254 {
254 coarse_time = time_management_regs->coarse_time;
255 coarse_time = time_management_regs->coarse_time;
255 fine_time = time_management_regs->fine_time;
256 fine_time = time_management_regs->fine_time;
256 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
257 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
257 }
258 }
258 }
259 }
259 }
260 }
260 }
261 }
261
262
262 //*****************************
263 //*****************************
263 // init housekeeping parameters
264 // init housekeeping parameters
264
265
265 void init_housekeeping_parameters( void )
266 void init_housekeeping_parameters( void )
266 {
267 {
267 /** This function initialize the housekeeping_packet global variable with default values.
268 /** This function initialize the housekeeping_packet global variable with default values.
268 *
269 *
269 */
270 */
270
271
271 unsigned int i = 0;
272 unsigned int i = 0;
272 char *parameters;
273 unsigned char *parameters;
273
274
274 parameters = (char*) &housekeeping_packet.lfr_status_word;
275 parameters = (unsigned char*) &housekeeping_packet.lfr_status_word;
275 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
276 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
276 {
277 {
277 parameters[i] = 0x00;
278 parameters[i] = 0x00;
278 }
279 }
279 // init status word
280 // init status word
280 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
281 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
281 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
282 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
282 // init software version
283 // init software version
283 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
284 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
284 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
285 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
285 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
286 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
286 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
287 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
287
288 // init fpga version
289 parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xd0);
290 housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1
291 housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2
292 housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3
288 }
293 }
289
294
290 void increment_seq_counter( unsigned char *packet_sequence_control)
295 void increment_seq_counter( unsigned char *packet_sequence_control)
291 {
296 {
292 /** This function increment the sequence counter psased in argument.
297 /** This function increment the sequence counter psased in argument.
293 *
298 *
294 * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0.
299 * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0.
295 *
300 *
296 */
301 */
297
302
298 unsigned short sequence_cnt;
303 unsigned short sequence_cnt;
299 unsigned short segmentation_grouping_flag;
304 unsigned short segmentation_grouping_flag;
300 unsigned short new_packet_sequence_control;
305 unsigned short new_packet_sequence_control;
301
306
302 segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6
307 segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6
303 sequence_cnt = (unsigned short) (
308 sequence_cnt = (unsigned short) (
304 ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0
309 ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0
305 + packet_sequence_control[1]
310 + packet_sequence_control[1]
306 );
311 );
307
312
308 if ( sequence_cnt < SEQ_CNT_MAX)
313 if ( sequence_cnt < SEQ_CNT_MAX)
309 {
314 {
310 sequence_cnt = sequence_cnt + 1;
315 sequence_cnt = sequence_cnt + 1;
311 }
316 }
312 else
317 else
313 {
318 {
314 sequence_cnt = 0;
319 sequence_cnt = 0;
315 }
320 }
316
321
317 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
322 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
318
323
319 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
324 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
320 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
325 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
321 }
326 }
322
327
323 void getTime( unsigned char *time)
328 void getTime( unsigned char *time)
324 {
329 {
325 /** This function write the current local time in the time buffer passed in argument.
330 /** This function write the current local time in the time buffer passed in argument.
326 *
331 *
327 */
332 */
328
333
329 time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
334 time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
330 time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
335 time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
331 time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
336 time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
332 time[3] = (unsigned char) (time_management_regs->coarse_time);
337 time[3] = (unsigned char) (time_management_regs->coarse_time);
333 time[4] = (unsigned char) (time_management_regs->fine_time>>8);
338 time[4] = (unsigned char) (time_management_regs->fine_time>>8);
334 time[5] = (unsigned char) (time_management_regs->fine_time);
339 time[5] = (unsigned char) (time_management_regs->fine_time);
335 }
340 }
336
341
@@ -1,656 +1,643
1 /** Functions related to data processing.
1 /** Functions related to data processing.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
6 * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation.
7 *
7 *
8 */
8 */
9
9
10 #include <fsw_processing.h>
10 #include <fsw_processing.h>
11
11
12 #include "fsw_processing_globals.c"
12 #include "fsw_processing_globals.c"
13
13
14 BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ];
14 BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ];
15 float averaged_spec_mat_f0[ TOTAL_SIZE_SM ];
15 float averaged_spec_mat_f0[ TOTAL_SIZE_SM ];
16 char averaged_spec_mat_f0_char[ TOTAL_SIZE_SM * 2 ];
16 char averaged_spec_mat_f0_char[ TOTAL_SIZE_SM * 2 ];
17 float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
17 float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
18
18
19 //***********************************************************
19 //***********************************************************
20 // Interrupt Service Routine for spectral matrices processing
20 // Interrupt Service Routine for spectral matrices processing
21 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
21 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
22 {
22 {
23 unsigned char status;
23 unsigned char status;
24 unsigned char i;
24 unsigned char i;
25
25
26 status = spectral_matrix_regs->status; //[f2 f1 f0_1 f0_0]
26 status = spectral_matrix_regs->status; //[f2 f1 f0_1 f0_0]
27 for (i=0; i<4; i++)
27 for (i=0; i<4; i++)
28 {
28 {
29 if ( ( (status >> i) & 0x01) == 1) // (1) buffer rotation
29 if ( ( (status >> i) & 0x01) == 1) // (1) buffer rotation
30 {
30 {
31 switch(i)
31 switch(i)
32 {
32 {
33 case 0:
33 case 0:
34 if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0)
34 if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0)
35 {
35 {
36 spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0_bis;
36 spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0_bis;
37 }
37 }
38 else
38 else
39 {
39 {
40 spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0;
40 spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0;
41 }
41 }
42 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe;
42 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe;
43 break;
43 break;
44 case 1:
44 case 1:
45 if (spectral_matrix_regs->matrixFO_Address1 == (int) spec_mat_f0_1)
45 if (spectral_matrix_regs->matrixFO_Address1 == (int) spec_mat_f0_1)
46 {
46 {
47 spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1_bis;
47 spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1_bis;
48 }
48 }
49 else
49 else
50 {
50 {
51 spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1;
51 spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1;
52 }
52 }
53 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd;
53 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd;
54 break;
54 break;
55 case 2:
55 case 2:
56 if (spectral_matrix_regs->matrixF1_Address == (int) spec_mat_f1)
56 if (spectral_matrix_regs->matrixF1_Address == (int) spec_mat_f1)
57 {
57 {
58 spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1_bis;
58 spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1_bis;
59 }
59 }
60 else
60 else
61 {
61 {
62 spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1;
62 spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1;
63 }
63 }
64 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffb;
64 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffb;
65 break;
65 break;
66 case 3:
66 case 3:
67 if (spectral_matrix_regs->matrixF2_Address == (int) spec_mat_f2)
67 if (spectral_matrix_regs->matrixF2_Address == (int) spec_mat_f2)
68 {
68 {
69 spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2_bis;
69 spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2_bis;
70 }
70 }
71 else
71 else
72 {
72 {
73 spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2;
73 spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2;
74 }
74 }
75 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff7;
75 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff7;
76 break;
76 break;
77 default:
77 default:
78 break;
78 break;
79 }
79 }
80 }
80 }
81 }
81 }
82
82
83 // reset error codes to 0
83 // reset error codes to 0
84 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // [1100 1111]
84 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // [1100 1111]
85
85
86 if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
86 if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
87 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 );
87 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 );
88 }
88 }
89 }
89 }
90
90
91 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
91 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
92 {
92 {
93 if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
93 if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
94 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 );
94 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 );
95 }
95 }
96 }
96 }
97
97
98 //************
98 //************
99 // RTEMS TASKS
99 // RTEMS TASKS
100
100
101 rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ
101 rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ
102 {
102 {
103 rtems_event_set event_out;
103 rtems_event_set event_out;
104 unsigned int nb_interrupt_f0 = 0;
104 unsigned int nb_interrupt_f0 = 0;
105
105
106 BOOT_PRINTF("in SMIQ *** \n")
106 BOOT_PRINTF("in SMIQ *** \n")
107
107
108 while(1){
108 while(1){
109 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
109 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
110 nb_interrupt_f0 = nb_interrupt_f0 + 1;
110 nb_interrupt_f0 = nb_interrupt_f0 + 1;
111 if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){
111 if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){
112 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
112 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
113 {
113 {
114 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
114 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
115 }
115 }
116 nb_interrupt_f0 = 0;
116 nb_interrupt_f0 = 0;
117 }
117 }
118 }
118 }
119 }
119 }
120
120
121 rtems_task spw_bppr_task(rtems_task_argument argument)
121 rtems_task spw_bppr_task(rtems_task_argument argument)
122 {
122 {
123 rtems_status_code status;
123 rtems_status_code status;
124 rtems_event_set event_out;
124 rtems_event_set event_out;
125
125
126 BOOT_PRINTF("in BPPR ***\n");
126 BOOT_PRINTF("in BPPR ***\n");
127
127
128 while( true ){ // wait for an event to begin with the processing
128 while( true ){ // wait for an event to begin with the processing
129 status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out);
129 status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out);
130 }
130 }
131 }
131 }
132
132
133 rtems_task avf0_task(rtems_task_argument argument)
133 rtems_task avf0_task(rtems_task_argument argument)
134 {
134 {
135 int i;
135 int i;
136 static int nb_average;
136 static int nb_average;
137 rtems_event_set event_out;
137 rtems_event_set event_out;
138 rtems_status_code status;
138 rtems_status_code status;
139
139
140 nb_average = 0;
140 nb_average = 0;
141
141
142 BOOT_PRINTF("in AVFO *** \n")
142 BOOT_PRINTF("in AVFO *** \n")
143
143
144 while(1){
144 while(1){
145 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
145 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
146 for(i=0; i<TOTAL_SIZE_SM; i++){
146 for(i=0; i<TOTAL_SIZE_SM; i++){
147 averaged_spec_mat_f0[i] = averaged_spec_mat_f0[i] + spec_mat_f0_a[i]
147 averaged_spec_mat_f0[i] = averaged_spec_mat_f0[i] + spec_mat_f0_a[i]
148 + spec_mat_f0_b[i]
148 + spec_mat_f0_b[i]
149 + spec_mat_f0_c[i]
149 + spec_mat_f0_c[i]
150 + spec_mat_f0_d[i]
150 + spec_mat_f0_d[i]
151 + spec_mat_f0_e[i]
151 + spec_mat_f0_e[i]
152 + spec_mat_f0_f[i]
152 + spec_mat_f0_f[i]
153 + spec_mat_f0_g[i]
153 + spec_mat_f0_g[i]
154 + spec_mat_f0_h[i];
154 + spec_mat_f0_h[i];
155 }
155 }
156 nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0;
156 nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0;
157 if (nb_average == NB_AVERAGE_NORMAL_f0) {
157 if (nb_average == NB_AVERAGE_NORMAL_f0) {
158 nb_average = 0;
158 nb_average = 0;
159 status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0
159 status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0
160 if (status != RTEMS_SUCCESSFUL) {
160 if (status != RTEMS_SUCCESSFUL) {
161 printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status);
161 printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status);
162 }
162 }
163 }
163 }
164 }
164 }
165 }
165 }
166
166
167 rtems_task bpf0_task(rtems_task_argument argument)
167 rtems_task bpf0_task(rtems_task_argument argument)
168 {
168 {
169 rtems_event_set event_out;
169 rtems_event_set event_out;
170 static unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_SM_F0 * 9 ];
170 static unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_SM_F0 * 9 ];
171
171
172 BOOT_PRINTF("in BPFO *** \n")
172 BOOT_PRINTF("in BPFO *** \n")
173
173
174 while(1){
174 while(1){
175 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
175 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
176 matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0);
176 matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0);
177 BP1_set(compressed_spec_mat_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0);
177 BP1_set(compressed_spec_mat_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0);
178 }
178 }
179 }
179 }
180
180
181 rtems_task matr_task(rtems_task_argument argument)
181 rtems_task matr_task(rtems_task_argument argument)
182 {
182 {
183 spw_ioctl_pkt_send spw_ioctl_send_ASM;
183 spw_ioctl_pkt_send spw_ioctl_send_ASM;
184 rtems_event_set event_out;
184 rtems_event_set event_out;
185 rtems_status_code status;
185 rtems_status_code status;
186 rtems_id queue_id;
186 rtems_id queue_id;
187 Header_TM_LFR_SCIENCE_ASM_t headerASM;
187 Header_TM_LFR_SCIENCE_ASM_t headerASM;
188
188
189 init_header_asm( &headerASM );
189 init_header_asm( &headerASM );
190
190
191 status = get_message_queue_id_send( &queue_id );
191 status = get_message_queue_id_send( &queue_id );
192 if (status != RTEMS_SUCCESSFUL)
192 if (status != RTEMS_SUCCESSFUL)
193 {
193 {
194 PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status)
194 PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status)
195 }
195 }
196
196
197 BOOT_PRINTF("in MATR *** \n")
197 BOOT_PRINTF("in MATR *** \n")
198
198
199 fill_averaged_spectral_matrix( );
199 fill_averaged_spectral_matrix( );
200
200
201 while(1){
201 while(1){
202 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
202 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
203
203 // 1) convert the float array in a char array
204 #ifdef GSA
205 #else
206 fill_averaged_spectral_matrix( );
207 #endif
208 convert_averaged_spectral_matrix( averaged_spec_mat_f0, averaged_spec_mat_f0_char);
204 convert_averaged_spectral_matrix( averaged_spec_mat_f0, averaged_spec_mat_f0_char);
209
205 // 2) send the spectral matrix packets
210 send_spectral_matrix( &headerASM, averaged_spec_mat_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
206 send_spectral_matrix( &headerASM, averaged_spec_mat_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id);
211 }
207 }
212 }
208 }
213
209
214 //*****************************
210 //*****************************
215 // Spectral matrices processing
211 // Spectral matrices processing
216
212
217 void matrix_reset(volatile float *averaged_spec_mat)
213 void matrix_reset(volatile float *averaged_spec_mat)
218 {
214 {
219 int i;
215 int i;
220 for(i=0; i<TOTAL_SIZE_SM; i++){
216 for(i=0; i<TOTAL_SIZE_SM; i++){
221 averaged_spec_mat[i] = 0;
217 averaged_spec_mat[i] = 0;
222 }
218 }
223 }
219 }
224
220
225 void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat)
221 void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat)
226 {
222 {
227 int i;
223 int i;
228 int j;
224 int j;
229 switch (fChannel){
225 switch (fChannel){
230 case 0:
226 case 0:
231 for(i=0;i<NB_BINS_COMPRESSED_SM_F0;i++){
227 for(i=0;i<NB_BINS_COMPRESSED_SM_F0;i++){
232 j = 17 + (i * 8);
228 j = 17 + (i * 8);
233 compressed_spec_mat[i] = (averaged_spec_mat[j]
229 compressed_spec_mat[i] = (averaged_spec_mat[j]
234 + averaged_spec_mat[j+1]
230 + averaged_spec_mat[j+1]
235 + averaged_spec_mat[j+2]
231 + averaged_spec_mat[j+2]
236 + averaged_spec_mat[j+3]
232 + averaged_spec_mat[j+3]
237 + averaged_spec_mat[j+4]
233 + averaged_spec_mat[j+4]
238 + averaged_spec_mat[j+5]
234 + averaged_spec_mat[j+5]
239 + averaged_spec_mat[j+6]
235 + averaged_spec_mat[j+6]
240 + averaged_spec_mat[j+7])/(8*NB_AVERAGE_NORMAL_f0);
236 + averaged_spec_mat[j+7])/(8*NB_AVERAGE_NORMAL_f0);
241 }
237 }
242 break;
238 break;
243 case 1:
239 case 1:
244 // case fChannel = f1 to be completed later
240 // case fChannel = f1 to be completed later
245 break;
241 break;
246 case 2:
242 case 2:
247 // case fChannel = f1 to be completed later
243 // case fChannel = f1 to be completed later
248 break;
244 break;
249 default:
245 default:
250 break;
246 break;
251 }
247 }
252 }
248 }
253
249
254 void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){
250 void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){
255 int i;
251 int i;
256 int j;
252 int j;
257 unsigned char tmp_u_char;
253 unsigned char tmp_u_char;
258 unsigned char * pt_char = NULL;
254 unsigned char * pt_char = NULL;
259 float PSDB, PSDE;
255 float PSDB, PSDE;
260 float NVEC_V0;
256 float NVEC_V0;
261 float NVEC_V1;
257 float NVEC_V1;
262 float NVEC_V2;
258 float NVEC_V2;
263 //float significand;
259 //float significand;
264 //int exponent;
260 //int exponent;
265 float aux;
261 float aux;
266 float tr_SB_SB;
262 float tr_SB_SB;
267 float tmp;
263 float tmp;
268 float sx_re;
264 float sx_re;
269 float sx_im;
265 float sx_im;
270 float nebx_re = 0;
266 float nebx_re = 0;
271 float nebx_im = 0;
267 float nebx_im = 0;
272 float ny = 0;
268 float ny = 0;
273 float nz = 0;
269 float nz = 0;
274 float bx_bx_star = 0;
270 float bx_bx_star = 0;
275 for(i=0; i<nb_bins_compressed_spec_mat; i++){
271 for(i=0; i<nb_bins_compressed_spec_mat; i++){
276 //==============================================
272 //==============================================
277 // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits
273 // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits
278 PSDB = compressed_spec_mat[i*30] // S11
274 PSDB = compressed_spec_mat[i*30] // S11
279 + compressed_spec_mat[(i*30) + 10] // S22
275 + compressed_spec_mat[(i*30) + 10] // S22
280 + compressed_spec_mat[(i*30) + 18]; // S33
276 + compressed_spec_mat[(i*30) + 18]; // S33
281 //significand = frexp(PSDB, &exponent);
277 //significand = frexp(PSDB, &exponent);
282 pt_char = (unsigned char*) &PSDB;
278 pt_char = (unsigned char*) &PSDB;
283 LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float
279 LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float
284 LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float
280 LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float
285 //==============================================
281 //==============================================
286 // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits
282 // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits
287 PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44
283 PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44
288 + compressed_spec_mat[(i*30) + 28] * K55_pe // S55
284 + compressed_spec_mat[(i*30) + 28] * K55_pe // S55
289 + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45
285 + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45
290 - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45
286 - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45
291 pt_char = (unsigned char*) &PSDE;
287 pt_char = (unsigned char*) &PSDE;
292 LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float
288 LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float
293 LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float
289 LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float
294 //==============================================================================
290 //==============================================================================
295 // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits
291 // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits
296 // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits
292 // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits
297 // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits
293 // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits
298 tmp = sqrt(
294 tmp = sqrt(
299 compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12
295 compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12
300 +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13
296 +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13
301 +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23
297 +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23
302 );
298 );
303 NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23
299 NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23
304 NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13
300 NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13
305 NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12
301 NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12
306 LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127);
302 LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127);
307 LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127);
303 LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127);
308 pt_char = (unsigned char*) &NVEC_V2;
304 pt_char = (unsigned char*) &NVEC_V2;
309 LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2
305 LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2
310 //=======================================================
306 //=======================================================
311 // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits
307 // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits
312 aux = 2*tmp / PSDB; // compute the ellipticity
308 aux = 2*tmp / PSDB; // compute the ellipticity
313 tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity
309 tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity
314 LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char
310 LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char
315 //==============================================================
311 //==============================================================
316 // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits
312 // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits
317 for(j = 0; j<NB_VALUES_PER_SM;j++){
313 for(j = 0; j<NB_VALUES_PER_SM;j++){
318 tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30]
314 tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30]
319 + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10]
315 + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10]
320 + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18]
316 + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18]
321 + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2]
317 + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2]
322 + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3]
318 + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3]
323 + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4]
319 + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4]
324 + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5]
320 + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5]
325 + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12]
321 + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12]
326 + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13];
322 + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13];
327 }
323 }
328 aux = PSDB*PSDB;
324 aux = PSDB*PSDB;
329 tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) );
325 tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) );
330 tmp_u_char = (unsigned char) (NVEC_V0*(8-1));
326 tmp_u_char = (unsigned char) (NVEC_V0*(8-1));
331 LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char
327 LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char
332 //=======================================================================================
328 //=======================================================================================
333 // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1)
329 // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1)
334 sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re
330 sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re
335 + compressed_spec_mat[(i*30) + 6] * K14_sx_re
331 + compressed_spec_mat[(i*30) + 6] * K14_sx_re
336 + compressed_spec_mat[(i*30) + 8] * K15_sx_re
332 + compressed_spec_mat[(i*30) + 8] * K15_sx_re
337 + compressed_spec_mat[(i*30) + 14] * K24_sx_re
333 + compressed_spec_mat[(i*30) + 14] * K24_sx_re
338 + compressed_spec_mat[(i*30) + 16] * K25_sx_re
334 + compressed_spec_mat[(i*30) + 16] * K25_sx_re
339 + compressed_spec_mat[(i*30) + 22] * K35_sx_re;
335 + compressed_spec_mat[(i*30) + 22] * K35_sx_re;
340 sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im
336 sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im
341 + compressed_spec_mat[(i*30) + 7] * K14_sx_im
337 + compressed_spec_mat[(i*30) + 7] * K14_sx_im
342 + compressed_spec_mat[(i*30) + 9] * K15_sx_im
338 + compressed_spec_mat[(i*30) + 9] * K15_sx_im
343 + compressed_spec_mat[(i*30) + 15] * K24_sx_im
339 + compressed_spec_mat[(i*30) + 15] * K24_sx_im
344 + compressed_spec_mat[(i*30) + 17] * K25_sx_im
340 + compressed_spec_mat[(i*30) + 17] * K25_sx_im
345 + compressed_spec_mat[(i*30) + 23] * K35_sx_im;
341 + compressed_spec_mat[(i*30) + 23] * K35_sx_im;
346 LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression
342 LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression
347 if ( abs(sx_re) > abs(sx_im) ) {
343 if ( abs(sx_re) > abs(sx_im) ) {
348 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx
344 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx
349 }
345 }
350 else {
346 else {
351 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx
347 LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx
352 }
348 }
353 //======================================================================
349 //======================================================================
354 // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1)
350 // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1)
355 ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2;
351 ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2;
356 nz = NVEC_V0;
352 nz = NVEC_V0;
357 bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22
353 bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22
358 + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33
354 + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33
359 - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23
355 - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23
360 nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re
356 nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re
361 +compressed_spec_mat[(i*30) + 16] * K25_ny_re
357 +compressed_spec_mat[(i*30) + 16] * K25_ny_re
362 +compressed_spec_mat[(i*30) + 20] * K34_ny_re
358 +compressed_spec_mat[(i*30) + 20] * K34_ny_re
363 +compressed_spec_mat[(i*30) + 22] * K35_ny_re)
359 +compressed_spec_mat[(i*30) + 22] * K35_ny_re)
364 + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re
360 + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re
365 +compressed_spec_mat[(i*30) + 16] * K25_nz_re
361 +compressed_spec_mat[(i*30) + 16] * K25_nz_re
366 +compressed_spec_mat[(i*30) + 20] * K34_nz_re
362 +compressed_spec_mat[(i*30) + 20] * K34_nz_re
367 +compressed_spec_mat[(i*30) + 22] * K35_nz_re);
363 +compressed_spec_mat[(i*30) + 22] * K35_nz_re);
368 nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re
364 nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re
369 +compressed_spec_mat[(i*30) + 17] * K25_ny_re
365 +compressed_spec_mat[(i*30) + 17] * K25_ny_re
370 +compressed_spec_mat[(i*30) + 21] * K34_ny_re
366 +compressed_spec_mat[(i*30) + 21] * K34_ny_re
371 +compressed_spec_mat[(i*30) + 23] * K35_ny_re)
367 +compressed_spec_mat[(i*30) + 23] * K35_ny_re)
372 + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im
368 + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im
373 +compressed_spec_mat[(i*30) + 17] * K25_nz_im
369 +compressed_spec_mat[(i*30) + 17] * K25_nz_im
374 +compressed_spec_mat[(i*30) + 21] * K34_nz_im
370 +compressed_spec_mat[(i*30) + 21] * K34_nz_im
375 +compressed_spec_mat[(i*30) + 23] * K35_nz_im);
371 +compressed_spec_mat[(i*30) + 23] * K35_nz_im);
376 tmp = nebx_re / bx_bx_star;
372 tmp = nebx_re / bx_bx_star;
377 LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression
373 LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression
378 if ( abs(nebx_re) > abs(nebx_im) ) {
374 if ( abs(nebx_re) > abs(nebx_im) ) {
379 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx
375 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx
380 }
376 }
381 else {
377 else {
382 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx
378 LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx
383 }
379 }
384 }
380 }
385
381
386 }
382 }
387
383
388 void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){
384 void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){
389 // BP2 autocorrelation
385 // BP2 autocorrelation
390 int i;
386 int i;
391 int aux = 0;
387 int aux = 0;
392
388
393 for(i = 0; i<nb_bins_compressed_spec_mat; i++){
389 for(i = 0; i<nb_bins_compressed_spec_mat; i++){
394 // S12
390 // S12
395 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]);
391 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]);
396 compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux;
392 compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux;
397 compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux;
393 compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux;
398 // S13
394 // S13
399 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]);
395 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]);
400 compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux;
396 compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux;
401 compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux;
397 compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux;
402 // S23
398 // S23
403 aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]);
399 aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]);
404 compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux;
400 compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux;
405 compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux;
401 compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux;
406 // S45
402 // S45
407 aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]);
403 aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]);
408 compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux;
404 compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux;
409 compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux;
405 compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux;
410 // S14
406 // S14
411 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]);
407 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]);
412 compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux;
408 compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux;
413 compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux;
409 compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux;
414 // S15
410 // S15
415 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]);
411 aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]);
416 compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux;
412 compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux;
417 compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux;
413 compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux;
418 // S24
414 // S24
419 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]);
415 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]);
420 compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux;
416 compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux;
421 compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux;
417 compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux;
422 // S25
418 // S25
423 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]);
419 aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]);
424 compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux;
420 compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux;
425 compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux;
421 compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux;
426 // S34
422 // S34
427 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]);
423 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]);
428 compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux;
424 compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux;
429 compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux;
425 compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux;
430 // S35
426 // S35
431 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]);
427 aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]);
432 compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux;
428 compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux;
433 compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux;
429 compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux;
434 }
430 }
435 }
431 }
436
432
437 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header)
433 void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header)
438 {
434 {
439 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
435 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
440 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
436 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
441 header->reserved = 0x00;
437 header->reserved = 0x00;
442 header->userApplication = CCSDS_USER_APP;
438 header->userApplication = CCSDS_USER_APP;
443 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
439 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
444 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
440 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
445 header->packetSequenceControl[0] = 0xc0;
441 header->packetSequenceControl[0] = 0xc0;
446 header->packetSequenceControl[1] = 0x00;
442 header->packetSequenceControl[1] = 0x00;
447 header->packetLength[0] = 0x00;
443 header->packetLength[0] = 0x00;
448 header->packetLength[1] = 0x00;
444 header->packetLength[1] = 0x00;
449 // DATA FIELD HEADER
445 // DATA FIELD HEADER
450 header->spare1_pusVersion_spare2 = 0x10;
446 header->spare1_pusVersion_spare2 = 0x10;
451 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
447 header->serviceType = TM_TYPE_LFR_SCIENCE; // service type
452 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
448 header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
453 header->destinationID = TM_DESTINATION_ID_GROUND;
449 header->destinationID = TM_DESTINATION_ID_GROUND;
454 // AUXILIARY DATA HEADER
450 // AUXILIARY DATA HEADER
455 header->sid = 0x00;
451 header->sid = 0x00;
456 header->biaStatusInfo = 0x00;
452 header->biaStatusInfo = 0x00;
457 header->cntASM = 0x00;
453 header->cntASM = 0x00;
458 header->nrASM = 0x00;
454 header->nrASM = 0x00;
459 header->time[0] = 0x00;
455 header->time[0] = 0x00;
460 header->time[0] = 0x00;
456 header->time[0] = 0x00;
461 header->time[0] = 0x00;
457 header->time[0] = 0x00;
462 header->time[0] = 0x00;
458 header->time[0] = 0x00;
463 header->time[0] = 0x00;
459 header->time[0] = 0x00;
464 header->time[0] = 0x00;
460 header->time[0] = 0x00;
465 header->blkNr[0] = 0x00; // BLK_NR MSB
461 header->blkNr[0] = 0x00; // BLK_NR MSB
466 header->blkNr[1] = 0x00; // BLK_NR LSB
462 header->blkNr[1] = 0x00; // BLK_NR LSB
467 }
463 }
468
464
469 void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
465 void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix,
470 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id)
466 unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id)
471 {
467 {
472 unsigned int i;
468 unsigned int i;
473 unsigned int length = 0;
469 unsigned int length = 0;
474 rtems_status_code status;
470 rtems_status_code status;
475
471
476 header->sid = (unsigned char) sid;
472 header->sid = (unsigned char) sid;
477
473
478 for (i=0; i<2; i++)
474 for (i=0; i<2; i++)
479 {
475 {
480 // BUILD THE DATA
476 // BUILD THE DATA
481 spw_ioctl_send->dlen = TOTAL_SIZE_SM;
477 spw_ioctl_send->dlen = TOTAL_SIZE_SM;
482 spw_ioctl_send->data = &spectral_matrix[ i * TOTAL_SIZE_SM];
478 spw_ioctl_send->data = &spectral_matrix[ i * TOTAL_SIZE_SM];
483 spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES;
479 spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES;
484 spw_ioctl_send->hdr = (char *) header;
480 spw_ioctl_send->hdr = (char *) header;
485 spw_ioctl_send->options = 0;
481 spw_ioctl_send->options = 0;
486
482
487 // BUILD THE HEADER
483 // BUILD THE HEADER
488 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM;
484 length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM;
489 header->packetLength[0] = (unsigned char) (length>>8);
485 header->packetLength[0] = (unsigned char) (length>>8);
490 header->packetLength[1] = (unsigned char) (length);
486 header->packetLength[1] = (unsigned char) (length);
491 header->sid = (unsigned char) sid; // SID
487 header->sid = (unsigned char) sid; // SID
492 header->cntASM = 2;
488 header->cntASM = 2;
493 header->nrASM = (unsigned char) (i+1);
489 header->nrASM = (unsigned char) (i+1);
494 header->blkNr[0] =(unsigned char) ( (NB_BINS_PER_SM/2) >> 8 ); // BLK_NR MSB
490 header->blkNr[0] =(unsigned char) ( (NB_BINS_PER_SM/2) >> 8 ); // BLK_NR MSB
495 header->blkNr[1] = (unsigned char) (NB_BINS_PER_SM/2); // BLK_NR LSB
491 header->blkNr[1] = (unsigned char) (NB_BINS_PER_SM/2); // BLK_NR LSB
496 // SET PACKET TIME
492 // SET PACKET TIME
497 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
493 header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
498 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
494 header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
499 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
495 header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
500 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
496 header->time[3] = (unsigned char) (time_management_regs->coarse_time);
501 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
497 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
502 header->time[5] = (unsigned char) (time_management_regs->fine_time);
498 header->time[5] = (unsigned char) (time_management_regs->fine_time);
503 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
499 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
504 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
500 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
505 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
501 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
506 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
502 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
507 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
503 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
508 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
504 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
509 // SEND PACKET
505 // SEND PACKET
510 status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
506 status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
511 if (status != RTEMS_SUCCESSFUL) {
507 if (status != RTEMS_SUCCESSFUL) {
512 printf("in send_spectral_matrix *** ERR %d\n", (int) status);
508 printf("in send_spectral_matrix *** ERR %d\n", (int) status);
513 }
509 }
514 }
510 }
515 }
511 }
516
512
517 void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix)
513 void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix)
518 {
514 {
519 unsigned int i;
515 unsigned int i;
520 unsigned int j;
516 unsigned int j;
521 char * pt_char_input;
517 char * pt_char_input;
522 char * pt_char_output;
518 char * pt_char_output;
523
519
524 pt_char_input = NULL;
520 pt_char_input = NULL;
525 pt_char_output = NULL;
521 pt_char_output = NULL;
526
522
527 for( i=0; i<NB_BINS_PER_SM; i++)
523 for( i=0; i<NB_BINS_PER_SM; i++)
528 {
524 {
529 for ( j=0; j<NB_VALUES_PER_SM; j++)
525 for ( j=0; j<NB_VALUES_PER_SM; j++)
530 {
526 {
531 pt_char_input = (char*) &input_matrix[ (i*NB_VALUES_PER_SM) + j ];
527 pt_char_input = (char*) &input_matrix [ (i*NB_VALUES_PER_SM) + j ];
532 pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ];
528 pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ];
533 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
529 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
534 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
530 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
535 }
531 }
536 }
532 }
537 }
533 }
538
534
539 void fill_averaged_spectral_matrix(void)
535 void fill_averaged_spectral_matrix(void)
540 {
536 {
541 /** This function fills spectral matrices related buffers with arbitrary data.
537 /** This function fills spectral matrices related buffers with arbitrary data.
542 *
538 *
543 * This function is for testing purpose only.
539 * This function is for testing purpose only.
544 *
540 *
545 */
541 */
546
542
547 #ifdef GSA
543 float offset;
548 float offset = 10.;
544 float coeff;
549 float coeff = 100000.;
550
545
546 offset = 10.;
547 coeff = 100000.;
551 averaged_spec_mat_f0[ 0 + 25 * 0 ] = 0. + offset;
548 averaged_spec_mat_f0[ 0 + 25 * 0 ] = 0. + offset;
552 averaged_spec_mat_f0[ 0 + 25 * 1 ] = 1. + offset;
549 averaged_spec_mat_f0[ 0 + 25 * 1 ] = 1. + offset;
553 averaged_spec_mat_f0[ 0 + 25 * 2 ] = 2. + offset;
550 averaged_spec_mat_f0[ 0 + 25 * 2 ] = 2. + offset;
554 averaged_spec_mat_f0[ 0 + 25 * 3 ] = 3. + offset;
551 averaged_spec_mat_f0[ 0 + 25 * 3 ] = 3. + offset;
555 averaged_spec_mat_f0[ 0 + 25 * 4 ] = 4. + offset;
552 averaged_spec_mat_f0[ 0 + 25 * 4 ] = 4. + offset;
556 averaged_spec_mat_f0[ 0 + 25 * 5 ] = 5. + offset;
553 averaged_spec_mat_f0[ 0 + 25 * 5 ] = 5. + offset;
557 averaged_spec_mat_f0[ 0 + 25 * 6 ] = 6. + offset;
554 averaged_spec_mat_f0[ 0 + 25 * 6 ] = 6. + offset;
558 averaged_spec_mat_f0[ 0 + 25 * 7 ] = 7. + offset;
555 averaged_spec_mat_f0[ 0 + 25 * 7 ] = 7. + offset;
559 averaged_spec_mat_f0[ 0 + 25 * 8 ] = 8. + offset;
556 averaged_spec_mat_f0[ 0 + 25 * 8 ] = 8. + offset;
560 averaged_spec_mat_f0[ 0 + 25 * 9 ] = 9. + offset;
557 averaged_spec_mat_f0[ 0 + 25 * 9 ] = 9. + offset;
561 averaged_spec_mat_f0[ 0 + 25 * 10 ] = 10. + offset;
558 averaged_spec_mat_f0[ 0 + 25 * 10 ] = 10. + offset;
562 averaged_spec_mat_f0[ 0 + 25 * 11 ] = 11. + offset;
559 averaged_spec_mat_f0[ 0 + 25 * 11 ] = 11. + offset;
563 averaged_spec_mat_f0[ 0 + 25 * 12 ] = 12. + offset;
560 averaged_spec_mat_f0[ 0 + 25 * 12 ] = 12. + offset;
564 averaged_spec_mat_f0[ 0 + 25 * 13 ] = 13. + offset;
561 averaged_spec_mat_f0[ 0 + 25 * 13 ] = 13. + offset;
565 averaged_spec_mat_f0[ 0 + 25 * 14 ] = 14. + offset;
562 averaged_spec_mat_f0[ 0 + 25 * 14 ] = 14. + offset;
566 averaged_spec_mat_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff;
563 averaged_spec_mat_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff;
567 averaged_spec_mat_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff;
564 averaged_spec_mat_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff;
568 averaged_spec_mat_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff;
565 averaged_spec_mat_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff;
569 averaged_spec_mat_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff;
566 averaged_spec_mat_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff;
570 averaged_spec_mat_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff;
567 averaged_spec_mat_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff;
571 averaged_spec_mat_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff;
568 averaged_spec_mat_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff;
572 averaged_spec_mat_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff;
569 averaged_spec_mat_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff;
573 averaged_spec_mat_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff;
570 averaged_spec_mat_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff;
574 averaged_spec_mat_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff;
571 averaged_spec_mat_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff;
575 averaged_spec_mat_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff;
572 averaged_spec_mat_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff;
576 averaged_spec_mat_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff;
573 averaged_spec_mat_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff;
577 averaged_spec_mat_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff;
574 averaged_spec_mat_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff;
578 averaged_spec_mat_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff;
575 averaged_spec_mat_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff;
579 averaged_spec_mat_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff;
576 averaged_spec_mat_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff;
580 averaged_spec_mat_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff;
577 averaged_spec_mat_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff;
578
581 offset = 10000000;
579 offset = 10000000;
582 averaged_spec_mat_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff;
580 averaged_spec_mat_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff;
583 averaged_spec_mat_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff;
581 averaged_spec_mat_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff;
584 averaged_spec_mat_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff;
582 averaged_spec_mat_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff;
585 averaged_spec_mat_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff;
583 averaged_spec_mat_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff;
586 averaged_spec_mat_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff;
584 averaged_spec_mat_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff;
587 averaged_spec_mat_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff;
585 averaged_spec_mat_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff;
588 averaged_spec_mat_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff;
586 averaged_spec_mat_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff;
589 averaged_spec_mat_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff;
587 averaged_spec_mat_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff;
590 averaged_spec_mat_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff;
588 averaged_spec_mat_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff;
591 averaged_spec_mat_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff;
589 averaged_spec_mat_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff;
592 averaged_spec_mat_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff;
590 averaged_spec_mat_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff;
593 averaged_spec_mat_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff;
591 averaged_spec_mat_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff;
594 averaged_spec_mat_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff;
592 averaged_spec_mat_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff;
595 averaged_spec_mat_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff;
593 averaged_spec_mat_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff;
596 averaged_spec_mat_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff;
594 averaged_spec_mat_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff;
597
595
598 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_spec_mat_f0[ 0 ];
596 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_spec_mat_f0[ 0 ];
599 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_spec_mat_f0[ 1 ];
597 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_spec_mat_f0[ 1 ];
600 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_spec_mat_f0[ 2 ];
598 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_spec_mat_f0[ 2 ];
601 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_spec_mat_f0[ 3 ];
599 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_spec_mat_f0[ 3 ];
602 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_spec_mat_f0[ 4 ];
600 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_spec_mat_f0[ 4 ];
603 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_spec_mat_f0[ 5 ];
601 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_spec_mat_f0[ 5 ];
604 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_spec_mat_f0[ 6 ];
602 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_spec_mat_f0[ 6 ];
605 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_spec_mat_f0[ 7 ];
603 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_spec_mat_f0[ 7 ];
606 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_spec_mat_f0[ 8 ];
604 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_spec_mat_f0[ 8 ];
607 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_spec_mat_f0[ 9 ];
605 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_spec_mat_f0[ 9 ];
608 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_spec_mat_f0[ 10 ];
606 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_spec_mat_f0[ 10 ];
609 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_spec_mat_f0[ 11 ];
607 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_spec_mat_f0[ 11 ];
610 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_spec_mat_f0[ 12 ];
608 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_spec_mat_f0[ 12 ];
611 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_spec_mat_f0[ 13 ];
609 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_spec_mat_f0[ 13 ];
612 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_spec_mat_f0[ 14 ];
610 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_spec_mat_f0[ 14 ];
613 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_spec_mat_f0[ 15 ];
611 averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_spec_mat_f0[ 15 ];
614 #else
615 unsigned int i;
616
617 for(i=0; i<TOTAL_SIZE_SM; i++)
618 {
619 if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0)
620 averaged_spec_mat_f0[i] = (float) spec_mat_f0_0_bis[ SM_HEADER + i ];
621 else
622 averaged_spec_mat_f0[i] = (float) spec_mat_f0_0[ SM_HEADER + i ];
623 }
624 #endif
625 }
612 }
626
613
627 void reset_spectral_matrix_regs()
614 void reset_spectral_matrix_regs()
628 {
615 {
629 /** This function resets the spectral matrices module registers.
616 /** This function resets the spectral matrices module registers.
630 *
617 *
631 * The registers affected by this function are located at the following offset addresses:
618 * The registers affected by this function are located at the following offset addresses:
632 *
619 *
633 * - 0x00 config
620 * - 0x00 config
634 * - 0x04 status
621 * - 0x04 status
635 * - 0x08 matrixF0_Address0
622 * - 0x08 matrixF0_Address0
636 * - 0x10 matrixFO_Address1
623 * - 0x10 matrixFO_Address1
637 * - 0x14 matrixF1_Address
624 * - 0x14 matrixF1_Address
638 * - 0x18 matrixF2_Address
625 * - 0x18 matrixF2_Address
639 *
626 *
640 */
627 */
641
628
642 #ifdef GSA
629 #ifdef GSA
643 #else
630 #else
644 spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0;
631 spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0;
645 spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1;
632 spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1;
646 spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1;
633 spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1;
647 spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2;
634 spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2;
648 #endif
635 #endif
649 }
636 }
650
637
651 //******************
638 //******************
652 // general functions
639 // general functions
653
640
654
641
655
642
656
643
@@ -1,606 +1,601
1 /** Functions related to the SpaceWire interface.
1 /** Functions related to the SpaceWire interface.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to handle SpaceWire transmissions:
6 * A group of functions to handle SpaceWire transmissions:
7 * - configuration of the SpaceWire link
7 * - configuration of the SpaceWire link
8 * - SpaceWire related interruption requests processing
8 * - SpaceWire related interruption requests processing
9 * - transmission of TeleMetry packets by a dedicated RTEMS task
9 * - transmission of TeleMetry packets by a dedicated RTEMS task
10 * - reception of TeleCommands by a dedicated RTEMS task
10 * - reception of TeleCommands by a dedicated RTEMS task
11 *
11 *
12 */
12 */
13
13
14 #include "fsw_spacewire.h"
14 #include "fsw_spacewire.h"
15
15
16 rtems_name semq_name;
16 rtems_name semq_name;
17 rtems_id semq_id;
17 rtems_id semq_id;
18
18
19 //***********
19 //***********
20 // RTEMS TASK
20 // RTEMS TASK
21 rtems_task spiq_task(rtems_task_argument unused)
21 rtems_task spiq_task(rtems_task_argument unused)
22 {
22 {
23 /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver.
23 /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver.
24 *
24 *
25 * @param unused is the starting argument of the RTEMS task
25 * @param unused is the starting argument of the RTEMS task
26 *
26 *
27 */
27 */
28
28
29 rtems_event_set event_out;
29 rtems_event_set event_out;
30 rtems_status_code status;
30 rtems_status_code status;
31 int linkStatus;
31 int linkStatus;
32
32
33 BOOT_PRINTF("in SPIQ *** \n")
33 BOOT_PRINTF("in SPIQ *** \n")
34
34
35 while(true){
35 while(true){
36 rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT
36 rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT
37 PRINTF("in SPIQ *** got SPW_LINKERR_EVENT\n")
37 PRINTF("in SPIQ *** got SPW_LINKERR_EVENT\n")
38
38
39 // [0] SUSPEND RECV AND SEND TASKS
39 // [0] SUSPEND RECV AND SEND TASKS
40 status = rtems_task_suspend( Task_id[ TASKID_RECV ] );
40 status = rtems_task_suspend( Task_id[ TASKID_RECV ] );
41 if ( status != RTEMS_SUCCESSFUL ) {
41 if ( status != RTEMS_SUCCESSFUL ) {
42 PRINTF("in SPIQ *** ERR suspending RECV Task\n")
42 PRINTF("in SPIQ *** ERR suspending RECV Task\n")
43 }
43 }
44 status = rtems_task_suspend( Task_id[ TASKID_SEND ] );
44 status = rtems_task_suspend( Task_id[ TASKID_SEND ] );
45 if ( status != RTEMS_SUCCESSFUL ) {
45 if ( status != RTEMS_SUCCESSFUL ) {
46 PRINTF("in SPIQ *** ERR suspending SEND Task\n")
46 PRINTF("in SPIQ *** ERR suspending SEND Task\n")
47 }
47 }
48
48
49 // [1] CHECK THE LINK
49 // [1] CHECK THE LINK
50 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1)
50 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1)
51 if ( linkStatus != 5) {
51 if ( linkStatus != 5) {
52 PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus)
52 PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus)
53 status = rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms
53 status = rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms
54 }
54 }
55
55
56 // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT
56 // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT
57 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2)
57 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2)
58 if ( linkStatus != 5 ) // [2.a] not in run state, reset the link
58 if ( linkStatus != 5 ) // [2.a] not in run state, reset the link
59 {
59 {
60 spacewire_compute_stats_offsets();
60 spacewire_compute_stats_offsets();
61 status = spacewire_reset_link( );
61 status = spacewire_reset_link( );
62 }
62 }
63 else // [2.b] in run state, start the link
63 else // [2.b] in run state, start the link
64 {
64 {
65 status = spacewire_stop_start_link( fdSPW ); // start the link
65 status = spacewire_stop_start_link( fdSPW ); // start the link
66 if ( status != RTEMS_SUCCESSFUL)
66 if ( status != RTEMS_SUCCESSFUL)
67 {
67 {
68 PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status)
68 PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status)
69 }
69 }
70 }
70 }
71
71
72 // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS
72 // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS
73 if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully
73 if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully
74 {
74 {
75 status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 );
75 status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 );
76 if ( status != RTEMS_SUCCESSFUL ) {
76 if ( status != RTEMS_SUCCESSFUL ) {
77 PRINTF("in SPIQ *** ERR resuming SEND Task\n")
77 PRINTF("in SPIQ *** ERR resuming SEND Task\n")
78 }
78 }
79 status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 );
79 status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 );
80 if ( status != RTEMS_SUCCESSFUL ) {
80 if ( status != RTEMS_SUCCESSFUL ) {
81 PRINTF("in SPIQ *** ERR resuming RECV Task\n")
81 PRINTF("in SPIQ *** ERR resuming RECV Task\n")
82 }
82 }
83 }
83 }
84 else // [3.b] the link is not in run state, go in STANDBY mode
84 else // [3.b] the link is not in run state, go in STANDBY mode
85 {
85 {
86 status = stop_current_mode();
86 status = stop_current_mode();
87 if ( status != RTEMS_SUCCESSFUL ) {
87 if ( status != RTEMS_SUCCESSFUL ) {
88 PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status)
88 PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status)
89 }
89 }
90 status = enter_standby_mode();
90 status = enter_standby_mode();
91 if ( status != RTEMS_SUCCESSFUL ) {
91 if ( status != RTEMS_SUCCESSFUL ) {
92 PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status)
92 PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status)
93 }
93 }
94 // wake the WTDG task up to wait for the link recovery
94 // wake the WTDG task up to wait for the link recovery
95 status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 );
95 status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 );
96 status = rtems_task_suspend( RTEMS_SELF );
96 status = rtems_task_suspend( RTEMS_SELF );
97 }
97 }
98 }
98 }
99 }
99 }
100
100
101 rtems_task recv_task( rtems_task_argument unused )
101 rtems_task recv_task( rtems_task_argument unused )
102 {
102 {
103 /** This RTEMS task is dedicated to the reception of incoming TeleCommands.
103 /** This RTEMS task is dedicated to the reception of incoming TeleCommands.
104 *
104 *
105 * @param unused is the starting argument of the RTEMS task
105 * @param unused is the starting argument of the RTEMS task
106 *
106 *
107 * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked:
107 * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked:
108 * 1. It reads the incoming data.
108 * 1. It reads the incoming data.
109 * 2. Launches the acceptance procedure.
109 * 2. Launches the acceptance procedure.
110 * 3. If the Telecommand is valid, sends it to a dedicated RTEMS message queue.
110 * 3. If the Telecommand is valid, sends it to a dedicated RTEMS message queue.
111 *
111 *
112 */
112 */
113
113
114 int len;
114 int len;
115 ccsdsTelecommandPacket_t currentTC;
115 ccsdsTelecommandPacket_t currentTC;
116 unsigned char computed_CRC[ 2 ];
116 unsigned char computed_CRC[ 2 ];
117 unsigned char currentTC_LEN_RCV[ 2 ];
117 unsigned char currentTC_LEN_RCV[ 2 ];
118 unsigned char destinationID;
118 unsigned char destinationID;
119 unsigned int currentTC_LEN_RCV_AsUnsignedInt;
119 unsigned int currentTC_LEN_RCV_AsUnsignedInt;
120 unsigned int parserCode;
120 unsigned int parserCode;
121 unsigned char time[6];
121 unsigned char time[6];
122 rtems_status_code status;
122 rtems_status_code status;
123 rtems_id queue_recv_id;
123 rtems_id queue_recv_id;
124 rtems_id queue_send_id;
124 rtems_id queue_send_id;
125
125
126 initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes
126 initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes
127
127
128 status = get_message_queue_id_recv( &queue_recv_id );
128 status = get_message_queue_id_recv( &queue_recv_id );
129 if (status != RTEMS_SUCCESSFUL)
129 if (status != RTEMS_SUCCESSFUL)
130 {
130 {
131 PRINTF1("in RECV *** ERR get_message_queue_id_recv %d\n", status)
131 PRINTF1("in RECV *** ERR get_message_queue_id_recv %d\n", status)
132 }
132 }
133
133
134 status = get_message_queue_id_send( &queue_send_id );
134 status = get_message_queue_id_send( &queue_send_id );
135 if (status != RTEMS_SUCCESSFUL)
135 if (status != RTEMS_SUCCESSFUL)
136 {
136 {
137 PRINTF1("in RECV *** ERR get_message_queue_id_send %d\n", status)
137 PRINTF1("in RECV *** ERR get_message_queue_id_send %d\n", status)
138 }
138 }
139
139
140 BOOT_PRINTF("in RECV *** \n")
140 BOOT_PRINTF("in RECV *** \n")
141
141
142 while(1)
142 while(1)
143 {
143 {
144 len = read( fdSPW, (char*) &currentTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking
144 len = read( fdSPW, (char*) &currentTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking
145 if (len == -1){ // error during the read call
145 if (len == -1){ // error during the read call
146 PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno)
146 PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno)
147 }
147 }
148 else {
148 else {
149 if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) {
149 if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) {
150 PRINTF("in RECV *** packet lenght too short\n")
150 PRINTF("in RECV *** packet lenght too short\n")
151 }
151 }
152 else {
152 else {
153 currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes
153 currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes
154 currentTC_LEN_RCV[ 0 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt >> 8);
154 currentTC_LEN_RCV[ 0 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt >> 8);
155 currentTC_LEN_RCV[ 1 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt );
155 currentTC_LEN_RCV[ 1 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt );
156 // CHECK THE TC
156 // CHECK THE TC
157 parserCode = tc_parser( &currentTC, currentTC_LEN_RCV_AsUnsignedInt, computed_CRC ) ;
157 parserCode = tc_parser( &currentTC, currentTC_LEN_RCV_AsUnsignedInt, computed_CRC ) ;
158 if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT)
158 if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT)
159 || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE)
159 || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE)
160 || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA)
160 || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA)
161 || (parserCode == WRONG_SRC_ID) )
161 || (parserCode == WRONG_SRC_ID) )
162 { // send TM_LFR_TC_EXE_CORRUPTED
162 { // send TM_LFR_TC_EXE_CORRUPTED
163 if ( !( (currentTC.serviceType==TC_TYPE_TIME) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_TIME) )
163 if ( !( (currentTC.serviceType==TC_TYPE_TIME) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_TIME) )
164 &&
164 &&
165 !( (currentTC.serviceType==TC_TYPE_GEN) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_INFO))
165 !( (currentTC.serviceType==TC_TYPE_GEN) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_INFO))
166 )
166 )
167 {
167 {
168 if ( parserCode == WRONG_SRC_ID )
168 if ( parserCode == WRONG_SRC_ID )
169 {
169 {
170 destinationID = SID_TC_GROUND;
170 destinationID = SID_TC_GROUND;
171 }
171 }
172 else
172 else
173 {
173 {
174 destinationID = currentTC.sourceID;
174 destinationID = currentTC.sourceID;
175 }
175 }
176 getTime( time );
176 getTime( time );
177 close_action( &currentTC, LFR_DEFAULT, queue_send_id, time);
177 close_action( &currentTC, LFR_DEFAULT, queue_send_id, time);
178 send_tm_lfr_tc_exe_corrupted( &currentTC, queue_send_id,
178 send_tm_lfr_tc_exe_corrupted( &currentTC, queue_send_id,
179 computed_CRC, currentTC_LEN_RCV,
179 computed_CRC, currentTC_LEN_RCV,
180 destinationID, time );
180 destinationID, time );
181 }
181 }
182 }
182 }
183 else
183 else
184 { // send valid TC to the action launcher
184 { // send valid TC to the action launcher
185 status = rtems_message_queue_send( queue_recv_id, &currentTC,
185 status = rtems_message_queue_send( queue_recv_id, &currentTC,
186 currentTC_LEN_RCV_AsUnsignedInt + CCSDS_TC_TM_PACKET_OFFSET + 3);
186 currentTC_LEN_RCV_AsUnsignedInt + CCSDS_TC_TM_PACKET_OFFSET + 3);
187 }
187 }
188 }
188 }
189 }
189 }
190 }
190 }
191 }
191 }
192
192
193 rtems_task send_task( rtems_task_argument argument)
193 rtems_task send_task( rtems_task_argument argument)
194 {
194 {
195 /** This RTEMS task is dedicated to the transmission of TeleMetry packets.
195 /** This RTEMS task is dedicated to the transmission of TeleMetry packets.
196 *
196 *
197 * @param unused is the starting argument of the RTEMS task
197 * @param unused is the starting argument of the RTEMS task
198 *
198 *
199 * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives:
199 * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives:
200 * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call.
200 * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call.
201 * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After
201 * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After
202 * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the
202 * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the
203 * data it contains.
203 * data it contains.
204 *
204 *
205 */
205 */
206
206
207 rtems_status_code status; // RTEMS status code
207 rtems_status_code status; // RTEMS status code
208 char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer
208 char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer
209 spw_ioctl_pkt_send *spw_ioctl_send;
209 spw_ioctl_pkt_send *spw_ioctl_send;
210 size_t size; // size of the incoming TC packet
210 size_t size; // size of the incoming TC packet
211 u_int32_t count;
211 u_int32_t count;
212 rtems_id queue_id;
212 rtems_id queue_id;
213
213
214 status = get_message_queue_id_send( &queue_id );
214 status = get_message_queue_id_send( &queue_id );
215 if (status != RTEMS_SUCCESSFUL)
215 if (status != RTEMS_SUCCESSFUL)
216 {
216 {
217 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
217 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
218 }
218 }
219
219
220 BOOT_PRINTF("in SEND *** \n")
220 BOOT_PRINTF("in SEND *** \n")
221
221
222 while(1)
222 while(1)
223 {
223 {
224 status = rtems_message_queue_receive( queue_id, incomingData, &size,
224 status = rtems_message_queue_receive( queue_id, incomingData, &size,
225 RTEMS_WAIT, RTEMS_NO_TIMEOUT );
225 RTEMS_WAIT, RTEMS_NO_TIMEOUT );
226
226
227 if (status!=RTEMS_SUCCESSFUL)
227 if (status!=RTEMS_SUCCESSFUL)
228 {
228 {
229 PRINTF1("in SEND *** (1) ERR = %d\n", status)
229 PRINTF1("in SEND *** (1) ERR = %d\n", status)
230 }
230 }
231 else
231 else
232 {
232 {
233 if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet
233 if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet
234 {
234 {
235 status = write( fdSPW, incomingData, size );
235 status = write( fdSPW, incomingData, size );
236 if (status == -1){
236 if (status == -1){
237 PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size)
237 PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size)
238 }
238 }
239 }
239 }
240 else // the incoming message is a spw_ioctl_pkt_send structure
240 else // the incoming message is a spw_ioctl_pkt_send structure
241 {
241 {
242 spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData;
242 spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData;
243 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send );
243 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send );
244 if (status == -1){
244 if (status == -1){
245 PRINTF2("in SEND *** (2.b) ERRNO = %d, RTEMS = %d\n", errno, status)
245 PRINTF2("in SEND *** (2.b) ERRNO = %d, RTEMS = %d\n", errno, status)
246 }
246 }
247 }
247 }
248 }
248 }
249
249
250 status = rtems_message_queue_get_number_pending( queue_id, &count );
250 status = rtems_message_queue_get_number_pending( queue_id, &count );
251 if (status != RTEMS_SUCCESSFUL)
251 if (status != RTEMS_SUCCESSFUL)
252 {
252 {
253 PRINTF1("in SEND *** (3) ERR = %d\n", status)
253 PRINTF1("in SEND *** (3) ERR = %d\n", status)
254 }
254 }
255 else
255 else
256 {
256 {
257 if (count > maxCount)
257 if (count > maxCount)
258 {
258 {
259 maxCount = count;
259 maxCount = count;
260 }
260 }
261 }
261 }
262 }
262 }
263 }
263 }
264
264
265 rtems_task wtdg_task( rtems_task_argument argument )
265 rtems_task wtdg_task( rtems_task_argument argument )
266 {
266 {
267 rtems_event_set event_out;
267 rtems_event_set event_out;
268 rtems_status_code status;
268 rtems_status_code status;
269 int linkStatus;
269 int linkStatus;
270
270
271 BOOT_PRINTF("in WTDG ***\n")
271 BOOT_PRINTF("in WTDG ***\n")
272
272
273 while(1)
273 while(1)
274 {
274 {
275 // wait for an RTEMS_EVENT
275 // wait for an RTEMS_EVENT
276 rtems_event_receive( RTEMS_EVENT_0,
276 rtems_event_receive( RTEMS_EVENT_0,
277 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
277 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
278 PRINTF("in WTDG *** wait for the link\n")
278 PRINTF("in WTDG *** wait for the link\n")
279 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
279 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
280 while( linkStatus != 5) // wait for the link
280 while( linkStatus != 5) // wait for the link
281 {
281 {
282 rtems_task_wake_after( 10 );
282 rtems_task_wake_after( 10 );
283 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
283 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
284 }
284 }
285
285
286 status = spacewire_stop_start_link( fdSPW );
286 status = spacewire_stop_start_link( fdSPW );
287
287
288 if (status != RTEMS_SUCCESSFUL)
288 if (status != RTEMS_SUCCESSFUL)
289 {
289 {
290 PRINTF1("in WTDG *** ERR link not started %d\n", status)
290 PRINTF1("in WTDG *** ERR link not started %d\n", status)
291 }
291 }
292 else
292 else
293 {
293 {
294 PRINTF("in WTDG *** OK link started\n")
294 PRINTF("in WTDG *** OK link started\n")
295 }
295 }
296
296
297 // restart the SPIQ task
297 // restart the SPIQ task
298 status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 );
298 status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 );
299 if ( status != RTEMS_SUCCESSFUL ) {
299 if ( status != RTEMS_SUCCESSFUL ) {
300 PRINTF("in SPIQ *** ERR restarting SPIQ Task\n")
300 PRINTF("in SPIQ *** ERR restarting SPIQ Task\n")
301 }
301 }
302
302
303 // restart RECV and SEND
303 // restart RECV and SEND
304 status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 );
304 status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 );
305 if ( status != RTEMS_SUCCESSFUL ) {
305 if ( status != RTEMS_SUCCESSFUL ) {
306 PRINTF("in SPIQ *** ERR restarting SEND Task\n")
306 PRINTF("in SPIQ *** ERR restarting SEND Task\n")
307 }
307 }
308 status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 );
308 status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 );
309 if ( status != RTEMS_SUCCESSFUL ) {
309 if ( status != RTEMS_SUCCESSFUL ) {
310 PRINTF("in SPIQ *** ERR restarting RECV Task\n")
310 PRINTF("in SPIQ *** ERR restarting RECV Task\n")
311 }
311 }
312 }
312 }
313 }
313 }
314
314
315 //****************
315 //****************
316 // OTHER FUNCTIONS
316 // OTHER FUNCTIONS
317 int spacewire_open_link( void )
317 int spacewire_open_link( void )
318 {
318 {
319 /** This function opens the SpaceWire link.
319 /** This function opens the SpaceWire link.
320 *
320 *
321 * @return a valid file descriptor in case of success, -1 in case of a failure
321 * @return a valid file descriptor in case of success, -1 in case of a failure
322 *
322 *
323 */
323 */
324 rtems_status_code status;
324 rtems_status_code status;
325
325
326 fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware
326 fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware
327 if ( fdSPW < 0 ) {
327 if ( fdSPW < 0 ) {
328 PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno)
328 PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno)
329 }
329 }
330 else
330 else
331 {
331 {
332 status = RTEMS_SUCCESSFUL;
332 status = RTEMS_SUCCESSFUL;
333 }
333 }
334
334
335 return status;
335 return status;
336 }
336 }
337
337
338 int spacewire_start_link( int fd )
338 int spacewire_start_link( int fd )
339 {
339 {
340 rtems_status_code status;
340 rtems_status_code status;
341
341
342 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
342 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
343 // -1 default hardcoded driver timeout
343 // -1 default hardcoded driver timeout
344
344
345 return status;
345 return status;
346 }
346 }
347
347
348 int spacewire_stop_start_link( int fd )
348 int spacewire_stop_start_link( int fd )
349 {
349 {
350 rtems_status_code status;
350 rtems_status_code status;
351
351
352 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0
352 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0
353 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
353 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
354 // -1 default hardcoded driver timeout
354 // -1 default hardcoded driver timeout
355
355
356 return status;
356 return status;
357 }
357 }
358
358
359 int spacewire_configure_link( int fd )
359 int spacewire_configure_link( int fd )
360 {
360 {
361 /** This function configures the SpaceWire link.
361 /** This function configures the SpaceWire link.
362 *
362 *
363 * @return GR-RTEMS-DRIVER directive status codes:
363 * @return GR-RTEMS-DRIVER directive status codes:
364 * - 22 EINVAL - Null pointer or an out of range value was given as the argument.
364 * - 22 EINVAL - Null pointer or an out of range value was given as the argument.
365 * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode.
365 * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode.
366 * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used.
366 * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used.
367 * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up.
367 * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up.
368 * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers.
368 * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers.
369 * - 5 EIO - Error when writing to grswp hardware registers.
369 * - 5 EIO - Error when writing to grswp hardware registers.
370 * - 2 ENOENT - No such file or directory
370 * - 2 ENOENT - No such file or directory
371 */
371 */
372
372
373 rtems_status_code status;
373 rtems_status_code status;
374
374
375 spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force
375 spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force
376 spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration
376 spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration
377
377
378 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception
378 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception
379 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n")
379 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n")
380 //
380 //
381 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a
381 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a
382 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs
382 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs
383 //
383 //
384 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts
384 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts
385 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n")
385 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n")
386 //
386 //
387 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit
387 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit
388 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
388 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
389 //
389 //
390 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks
390 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks
391 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n")
391 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n")
392 //
392 //
393 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available
393 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available
394 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n")
394 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n")
395 //
395 //
396 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ]
396 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ]
397 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n")
397 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n")
398
398
399 return status;
399 return status;
400 }
400 }
401
401
402 int spacewire_reset_link( void )
402 int spacewire_reset_link( void )
403 {
403 {
404 /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver.
404 /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver.
405 *
405 *
406 * @return RTEMS directive status code:
406 * @return RTEMS directive status code:
407 * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s.
407 * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s.
408 * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout.
408 * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout.
409 *
409 *
410 */
410 */
411
411
412 rtems_status_code status_spw;
412 rtems_status_code status_spw;
413 int i;
413 int i;
414
414
415 for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ )
415 for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ )
416 {
416 {
417 PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i);
417 PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i);
418
418
419 // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM
419 // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM
420
420
421 status_spw = spacewire_stop_start_link( fdSPW );
421 status_spw = spacewire_stop_start_link( fdSPW );
422 if ( status_spw != RTEMS_SUCCESSFUL )
422 if ( status_spw != RTEMS_SUCCESSFUL )
423 {
423 {
424 PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw)
424 PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw)
425 }
425 }
426
426
427 if ( status_spw == RTEMS_SUCCESSFUL)
427 if ( status_spw == RTEMS_SUCCESSFUL)
428 {
428 {
429 break;
429 break;
430 }
430 }
431 }
431 }
432
432
433 return status_spw;
433 return status_spw;
434 }
434 }
435
435
436 void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force
436 void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force
437 {
437 {
438 /** This function sets the [N]o [P]ort force bit of the GRSPW control register.
438 /** This function sets the [N]o [P]ort force bit of the GRSPW control register.
439 *
439 *
440 * @param val is the value, 0 or 1, used to set the value of the NP bit.
440 * @param val is the value, 0 or 1, used to set the value of the NP bit.
441 * @param regAddr is the address of the GRSPW control register.
441 * @param regAddr is the address of the GRSPW control register.
442 *
442 *
443 * NP is the bit 20 of the GRSPW control register.
443 * NP is the bit 20 of the GRSPW control register.
444 *
444 *
445 */
445 */
446
446
447 unsigned int *spwptr = (unsigned int*) regAddr;
447 unsigned int *spwptr = (unsigned int*) regAddr;
448
448
449 if (val == 1) {
449 if (val == 1) {
450 *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit
450 *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit
451 }
451 }
452 if (val== 0) {
452 if (val== 0) {
453 *spwptr = *spwptr & 0xffdfffff;
453 *spwptr = *spwptr & 0xffdfffff;
454 }
454 }
455 }
455 }
456
456
457 void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable
457 void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable
458 {
458 {
459 /** This function sets the [R]MAP [E]nable bit of the GRSPW control register.
459 /** This function sets the [R]MAP [E]nable bit of the GRSPW control register.
460 *
460 *
461 * @param val is the value, 0 or 1, used to set the value of the RE bit.
461 * @param val is the value, 0 or 1, used to set the value of the RE bit.
462 * @param regAddr is the address of the GRSPW control register.
462 * @param regAddr is the address of the GRSPW control register.
463 *
463 *
464 * RE is the bit 16 of the GRSPW control register.
464 * RE is the bit 16 of the GRSPW control register.
465 *
465 *
466 */
466 */
467
467
468 unsigned int *spwptr = (unsigned int*) regAddr;
468 unsigned int *spwptr = (unsigned int*) regAddr;
469
469
470 if (val == 1)
470 if (val == 1)
471 {
471 {
472 *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit
472 *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit
473 }
473 }
474 if (val== 0)
474 if (val== 0)
475 {
475 {
476 *spwptr = *spwptr & 0xfffdffff;
476 *spwptr = *spwptr & 0xfffdffff;
477 }
477 }
478 }
478 }
479
479
480 void spacewire_compute_stats_offsets( void )
480 void spacewire_compute_stats_offsets( void )
481 {
481 {
482 /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising.
482 /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising.
483 *
483 *
484 * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics
484 * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics
485 * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it
485 * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it
486 * during the open systel call).
486 * during the open systel call).
487 *
487 *
488 */
488 */
489
489
490 spw_stats spacewire_stats_grspw;
490 spw_stats spacewire_stats_grspw;
491 rtems_status_code status;
491 rtems_status_code status;
492
492
493 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
493 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
494
494
495 spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received
495 spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received
496 + spacewire_stats.packets_received;
496 + spacewire_stats.packets_received;
497 spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent
497 spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent
498 + spacewire_stats.packets_sent;
498 + spacewire_stats.packets_sent;
499 spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err
499 spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err
500 + spacewire_stats.parity_err;
500 + spacewire_stats.parity_err;
501 spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err
501 spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err
502 + spacewire_stats.disconnect_err;
502 + spacewire_stats.disconnect_err;
503 spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err
503 spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err
504 + spacewire_stats.escape_err;
504 + spacewire_stats.escape_err;
505 spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err
505 spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err
506 + spacewire_stats.credit_err;
506 + spacewire_stats.credit_err;
507 spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err
507 spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err
508 + spacewire_stats.write_sync_err;
508 + spacewire_stats.write_sync_err;
509 spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err
509 spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err
510 + spacewire_stats.rx_rmap_header_crc_err;
510 + spacewire_stats.rx_rmap_header_crc_err;
511 spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err
511 spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err
512 + spacewire_stats.rx_rmap_data_crc_err;
512 + spacewire_stats.rx_rmap_data_crc_err;
513 spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep
513 spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep
514 + spacewire_stats.early_ep;
514 + spacewire_stats.early_ep;
515 spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address
515 spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address
516 + spacewire_stats.invalid_address;
516 + spacewire_stats.invalid_address;
517 spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err
517 spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err
518 + spacewire_stats.rx_eep_err;
518 + spacewire_stats.rx_eep_err;
519 spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated
519 spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated
520 + spacewire_stats.rx_truncated;
520 + spacewire_stats.rx_truncated;
521 }
521 }
522
522
523 void spacewire_update_statistics( void )
523 void spacewire_update_statistics( void )
524 {
524 {
525 rtems_status_code status;
525 rtems_status_code status;
526 spw_stats spacewire_stats_grspw;
526 spw_stats spacewire_stats_grspw;
527
527
528 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
528 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
529
529
530 spacewire_stats.packets_received = spacewire_stats_backup.packets_received
530 spacewire_stats.packets_received = spacewire_stats_backup.packets_received
531 + spacewire_stats_grspw.packets_received;
531 + spacewire_stats_grspw.packets_received;
532 spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent
532 spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent
533 + spacewire_stats_grspw.packets_sent;
533 + spacewire_stats_grspw.packets_sent;
534 spacewire_stats.parity_err = spacewire_stats_backup.parity_err
534 spacewire_stats.parity_err = spacewire_stats_backup.parity_err
535 + spacewire_stats_grspw.parity_err;
535 + spacewire_stats_grspw.parity_err;
536 spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err
536 spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err
537 + spacewire_stats_grspw.disconnect_err;
537 + spacewire_stats_grspw.disconnect_err;
538 spacewire_stats.escape_err = spacewire_stats_backup.escape_err
538 spacewire_stats.escape_err = spacewire_stats_backup.escape_err
539 + spacewire_stats_grspw.escape_err;
539 + spacewire_stats_grspw.escape_err;
540 spacewire_stats.credit_err = spacewire_stats_backup.credit_err
540 spacewire_stats.credit_err = spacewire_stats_backup.credit_err
541 + spacewire_stats_grspw.credit_err;
541 + spacewire_stats_grspw.credit_err;
542 spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err
542 spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err
543 + spacewire_stats_grspw.write_sync_err;
543 + spacewire_stats_grspw.write_sync_err;
544 spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err
544 spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err
545 + spacewire_stats_grspw.rx_rmap_header_crc_err;
545 + spacewire_stats_grspw.rx_rmap_header_crc_err;
546 spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err
546 spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err
547 + spacewire_stats_grspw.rx_rmap_data_crc_err;
547 + spacewire_stats_grspw.rx_rmap_data_crc_err;
548 spacewire_stats.early_ep = spacewire_stats_backup.early_ep
548 spacewire_stats.early_ep = spacewire_stats_backup.early_ep
549 + spacewire_stats_grspw.early_ep;
549 + spacewire_stats_grspw.early_ep;
550 spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address
550 spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address
551 + spacewire_stats_grspw.invalid_address;
551 + spacewire_stats_grspw.invalid_address;
552 spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err
552 spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err
553 + spacewire_stats_grspw.rx_eep_err;
553 + spacewire_stats_grspw.rx_eep_err;
554 spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated
554 spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated
555 + spacewire_stats_grspw.rx_truncated;
555 + spacewire_stats_grspw.rx_truncated;
556 //spacewire_stats.tx_link_err;
556 //spacewire_stats.tx_link_err;
557
557
558 //****************************
558 //****************************
559 // DPU_SPACEWIRE_IF_STATISTICS
559 // DPU_SPACEWIRE_IF_STATISTICS
560 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8);
560 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8);
561 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received);
561 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received);
562 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8);
562 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8);
563 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent);
563 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent);
564 //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt;
564 //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt;
565 //housekeeping_packet.hk_lfr_dpu_spw_last_timc;
565 //housekeeping_packet.hk_lfr_dpu_spw_last_timc;
566
566
567 //******************************************
567 //******************************************
568 // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY
568 // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY
569 housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err;
569 housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err;
570 housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err;
570 housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err;
571 housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err;
571 housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err;
572 housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err;
572 housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err;
573 housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err;
573 housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err;
574 // housekeeping_packet.hk_lfr_dpu_spw_rx_ahb;
575 // housekeeping_packet.hk_lfr_dpu_spw_tx_ahb;
576 housekeeping_packet.hk_lfr_dpu_spw_header_crc = (unsigned char) spacewire_stats.rx_rmap_header_crc_err;
577 housekeeping_packet.hk_lfr_dpu_spw_data_crc = (unsigned char) spacewire_stats.rx_rmap_data_crc_err;
578
574
579 //*********************************************
575 //*********************************************
580 // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY
576 // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY
581 housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep;
577 housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep;
582 housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address;
578 housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address;
583 housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err;
579 housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err;
584 housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated;
580 housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated;
585
586 }
581 }
587
582
588 void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc )
583 void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc )
589 {
584 {
590 //if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) {
585 //if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) {
591 // printf("In timecode_irq_handler *** Error sending event to DUMB\n");
586 // printf("In timecode_irq_handler *** Error sending event to DUMB\n");
592 //}
587 //}
593 }
588 }
594
589
595 rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data )
590 rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data )
596 {
591 {
597 int linkStatus;
592 int linkStatus;
598 rtems_status_code status;
593 rtems_status_code status;
599
594
600 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
595 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
601
596
602 if ( linkStatus == 5) {
597 if ( linkStatus == 5) {
603 PRINTF("in spacewire_reset_link *** link is running\n")
598 PRINTF("in spacewire_reset_link *** link is running\n")
604 status = RTEMS_SUCCESSFUL;
599 status = RTEMS_SUCCESSFUL;
605 }
600 }
606 }
601 }
@@ -1,833 +1,833
1 /** Functions and tasks related to TeleCommand handling.
1 /** Functions and tasks related to TeleCommand handling.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to handle TeleCommands:\n
6 * A group of functions to handle TeleCommands:\n
7 * action launching\n
7 * action launching\n
8 * TC parsing\n
8 * TC parsing\n
9 * ...
9 * ...
10 *
10 *
11 */
11 */
12
12
13 #include "tc_handler.h"
13 #include "tc_handler.h"
14
14
15 //***********
15 //***********
16 // RTEMS TASK
16 // RTEMS TASK
17
17
18 rtems_task actn_task( rtems_task_argument unused )
18 rtems_task actn_task( rtems_task_argument unused )
19 {
19 {
20 /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands.
20 /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands.
21 *
21 *
22 * @param unused is the starting argument of the RTEMS task
22 * @param unused is the starting argument of the RTEMS task
23 *
23 *
24 * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending
24 * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending
25 * on the incoming TeleCommand.
25 * on the incoming TeleCommand.
26 *
26 *
27 */
27 */
28
28
29 int result;
29 int result;
30 rtems_status_code status; // RTEMS status code
30 rtems_status_code status; // RTEMS status code
31 ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task
31 ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task
32 size_t size; // size of the incoming TC packet
32 size_t size; // size of the incoming TC packet
33 unsigned char subtype; // subtype of the current TC packet
33 unsigned char subtype; // subtype of the current TC packet
34 unsigned char time[6];
34 unsigned char time[6];
35 rtems_id queue_rcv_id;
35 rtems_id queue_rcv_id;
36 rtems_id queue_snd_id;
36 rtems_id queue_snd_id;
37
37
38 status = get_message_queue_id_recv( &queue_rcv_id );
38 status = get_message_queue_id_recv( &queue_rcv_id );
39 if (status != RTEMS_SUCCESSFUL)
39 if (status != RTEMS_SUCCESSFUL)
40 {
40 {
41 PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status)
41 PRINTF1("in ACTN *** ERR get_message_queue_id_recv %d\n", status)
42 }
42 }
43
43
44 status = get_message_queue_id_send( &queue_snd_id );
44 status = get_message_queue_id_send( &queue_snd_id );
45 if (status != RTEMS_SUCCESSFUL)
45 if (status != RTEMS_SUCCESSFUL)
46 {
46 {
47 PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status)
47 PRINTF1("in ACTN *** ERR get_message_queue_id_send %d\n", status)
48 }
48 }
49
49
50 result = LFR_SUCCESSFUL;
50 result = LFR_SUCCESSFUL;
51 subtype = 0; // subtype of the current TC packet
51 subtype = 0; // subtype of the current TC packet
52
52
53 BOOT_PRINTF("in ACTN *** \n")
53 BOOT_PRINTF("in ACTN *** \n")
54
54
55 while(1)
55 while(1)
56 {
56 {
57 status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
57 status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
58 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
58 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
59 getTime( time ); // set time to the current time
59 getTime( time ); // set time to the current time
60 if (status!=RTEMS_SUCCESSFUL)
60 if (status!=RTEMS_SUCCESSFUL)
61 {
61 {
62 PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
62 PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
63 }
63 }
64 else
64 else
65 {
65 {
66 subtype = TC.serviceSubType;
66 subtype = TC.serviceSubType;
67 switch(subtype)
67 switch(subtype)
68 {
68 {
69 case TC_SUBTYPE_RESET:
69 case TC_SUBTYPE_RESET:
70 result = action_reset( &TC, queue_snd_id, time );
70 result = action_reset( &TC, queue_snd_id, time );
71 close_action( &TC, result, queue_snd_id, time );
71 close_action( &TC, result, queue_snd_id, time );
72 break;
72 break;
73 //
73 //
74 case TC_SUBTYPE_LOAD_COMM:
74 case TC_SUBTYPE_LOAD_COMM:
75 result = action_load_common_par( &TC );
75 result = action_load_common_par( &TC );
76 close_action( &TC, result, queue_snd_id, time );
76 close_action( &TC, result, queue_snd_id, time );
77 break;
77 break;
78 //
78 //
79 case TC_SUBTYPE_LOAD_NORM:
79 case TC_SUBTYPE_LOAD_NORM:
80 result = action_load_normal_par( &TC, queue_snd_id, time );
80 result = action_load_normal_par( &TC, queue_snd_id, time );
81 close_action( &TC, result, queue_snd_id, time );
81 close_action( &TC, result, queue_snd_id, time );
82 break;
82 break;
83 //
83 //
84 case TC_SUBTYPE_LOAD_BURST:
84 case TC_SUBTYPE_LOAD_BURST:
85 result = action_load_burst_par( &TC, queue_snd_id, time );
85 result = action_load_burst_par( &TC, queue_snd_id, time );
86 close_action( &TC, result, queue_snd_id, time );
86 close_action( &TC, result, queue_snd_id, time );
87 break;
87 break;
88 //
88 //
89 case TC_SUBTYPE_LOAD_SBM1:
89 case TC_SUBTYPE_LOAD_SBM1:
90 result = action_load_sbm1_par( &TC, queue_snd_id, time );
90 result = action_load_sbm1_par( &TC, queue_snd_id, time );
91 close_action( &TC, result, queue_snd_id, time );
91 close_action( &TC, result, queue_snd_id, time );
92 break;
92 break;
93 //
93 //
94 case TC_SUBTYPE_LOAD_SBM2:
94 case TC_SUBTYPE_LOAD_SBM2:
95 result = action_load_sbm2_par( &TC, queue_snd_id, time );
95 result = action_load_sbm2_par( &TC, queue_snd_id, time );
96 close_action( &TC, result, queue_snd_id, time );
96 close_action( &TC, result, queue_snd_id, time );
97 break;
97 break;
98 //
98 //
99 case TC_SUBTYPE_DUMP:
99 case TC_SUBTYPE_DUMP:
100 result = action_dump_par( queue_snd_id );
100 result = action_dump_par( queue_snd_id );
101 close_action( &TC, result, queue_snd_id, time );
101 close_action( &TC, result, queue_snd_id, time );
102 break;
102 break;
103 //
103 //
104 case TC_SUBTYPE_ENTER:
104 case TC_SUBTYPE_ENTER:
105 result = action_enter_mode( &TC, queue_snd_id, time );
105 result = action_enter_mode( &TC, queue_snd_id, time );
106 close_action( &TC, result, queue_snd_id, time );
106 close_action( &TC, result, queue_snd_id, time );
107 break;
107 break;
108 //
108 //
109 case TC_SUBTYPE_UPDT_INFO:
109 case TC_SUBTYPE_UPDT_INFO:
110 result = action_update_info( &TC, queue_snd_id );
110 result = action_update_info( &TC, queue_snd_id );
111 close_action( &TC, result, queue_snd_id, time );
111 close_action( &TC, result, queue_snd_id, time );
112 break;
112 break;
113 //
113 //
114 case TC_SUBTYPE_EN_CAL:
114 case TC_SUBTYPE_EN_CAL:
115 result = action_enable_calibration( &TC, queue_snd_id, time );
115 result = action_enable_calibration( &TC, queue_snd_id, time );
116 close_action( &TC, result, queue_snd_id, time );
116 close_action( &TC, result, queue_snd_id, time );
117 break;
117 break;
118 //
118 //
119 case TC_SUBTYPE_DIS_CAL:
119 case TC_SUBTYPE_DIS_CAL:
120 result = action_disable_calibration( &TC, queue_snd_id, time );
120 result = action_disable_calibration( &TC, queue_snd_id, time );
121 close_action( &TC, result, queue_snd_id, time );
121 close_action( &TC, result, queue_snd_id, time );
122 break;
122 break;
123 //
123 //
124 case TC_SUBTYPE_UPDT_TIME:
124 case TC_SUBTYPE_UPDT_TIME:
125 result = action_update_time( &TC );
125 result = action_update_time( &TC );
126 close_action( &TC, result, queue_snd_id, time );
126 close_action( &TC, result, queue_snd_id, time );
127 break;
127 break;
128 //
128 //
129 default:
129 default:
130 break;
130 break;
131 }
131 }
132 }
132 }
133 }
133 }
134 }
134 }
135
135
136 //***********
136 //***********
137 // TC ACTIONS
137 // TC ACTIONS
138
138
139 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
139 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
140 {
140 {
141 /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
141 /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
142 *
142 *
143 * @param TC points to the TeleCommand packet that is being processed
143 * @param TC points to the TeleCommand packet that is being processed
144 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
144 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
145 *
145 *
146 */
146 */
147
147
148 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
148 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
149 return LFR_DEFAULT;
149 return LFR_DEFAULT;
150 }
150 }
151
151
152 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
152 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
153 {
153 {
154 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
154 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
155 *
155 *
156 * @param TC points to the TeleCommand packet that is being processed
156 * @param TC points to the TeleCommand packet that is being processed
157 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
157 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
158 *
158 *
159 */
159 */
160
160
161 rtems_status_code status;
161 rtems_status_code status;
162 unsigned char requestedMode;
162 unsigned char requestedMode;
163
163
164 requestedMode = TC->dataAndCRC[1];
164 requestedMode = TC->dataAndCRC[1];
165
165
166 if ( (requestedMode != LFR_MODE_STANDBY)
166 if ( (requestedMode != LFR_MODE_STANDBY)
167 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
167 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
168 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
168 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
169 {
169 {
170 status = RTEMS_UNSATISFIED;
170 status = RTEMS_UNSATISFIED;
171 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode, time );
171 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode, time );
172 }
172 }
173 else
173 else
174 {
174 {
175 printf("in action_enter_mode *** enter mode %d\n", requestedMode);
175 printf("in action_enter_mode *** enter mode %d\n", requestedMode);
176
176
177 #ifdef PRINT_TASK_STATISTICS
177 #ifdef PRINT_TASK_STATISTICS
178 if (requestedMode != LFR_MODE_STANDBY)
178 if (requestedMode != LFR_MODE_STANDBY)
179 {
179 {
180 rtems_cpu_usage_reset();
180 rtems_cpu_usage_reset();
181 maxCount = 0;
181 maxCount = 0;
182 }
182 }
183 #endif
183 #endif
184
184
185 status = transition_validation(requestedMode);
185 status = transition_validation(requestedMode);
186
186
187 if ( status == LFR_SUCCESSFUL ) {
187 if ( status == LFR_SUCCESSFUL ) {
188 if ( lfrCurrentMode != LFR_MODE_STANDBY)
188 if ( lfrCurrentMode != LFR_MODE_STANDBY)
189 {
189 {
190 status = stop_current_mode();
190 status = stop_current_mode();
191 }
191 }
192 if (status != RTEMS_SUCCESSFUL)
192 if (status != RTEMS_SUCCESSFUL)
193 {
193 {
194 PRINTF("ERR *** in action_enter *** stop_current_mode\n")
194 PRINTF("ERR *** in action_enter *** stop_current_mode\n")
195 }
195 }
196 status = enter_mode( requestedMode );
196 status = enter_mode( requestedMode );
197 }
197 }
198 else
198 else
199 {
199 {
200 PRINTF("ERR *** in action_enter *** transition rejected\n")
200 PRINTF("ERR *** in action_enter *** transition rejected\n")
201 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
201 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
202 }
202 }
203 }
203 }
204
204
205 return status;
205 return status;
206 }
206 }
207
207
208 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
208 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
209 {
209 {
210 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
210 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
211 *
211 *
212 * @param TC points to the TeleCommand packet that is being processed
212 * @param TC points to the TeleCommand packet that is being processed
213 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
213 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
214 *
214 *
215 * @return LFR directive status code:
215 * @return LFR directive status code:
216 * - LFR_DEFAULT
216 * - LFR_DEFAULT
217 * - LFR_SUCCESSFUL
217 * - LFR_SUCCESSFUL
218 *
218 *
219 */
219 */
220
220
221 unsigned int val;
221 unsigned int val;
222 int result;
222 int result;
223
223
224 result = LFR_SUCCESSFUL;
224 result = LFR_SUCCESSFUL;
225
225
226 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
226 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
227 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
227 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
228 val++;
228 val++;
229 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
229 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
230 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
230 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
231
231
232 return result;
232 return result;
233 }
233 }
234
234
235 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
235 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
236 {
236 {
237 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
237 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
238 *
238 *
239 * @param TC points to the TeleCommand packet that is being processed
239 * @param TC points to the TeleCommand packet that is being processed
240 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
240 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
241 *
241 *
242 */
242 */
243
243
244 int result;
244 int result;
245 unsigned char lfrMode;
245 unsigned char lfrMode;
246
246
247 result = LFR_DEFAULT;
247 result = LFR_DEFAULT;
248 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
248 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
249
249
250 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
250 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
251 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
251 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
252 result = LFR_DEFAULT;
252 result = LFR_DEFAULT;
253 }
253 }
254 else {
254 else {
255 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
255 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
256 result = LFR_DEFAULT;
256 result = LFR_DEFAULT;
257 }
257 }
258 return result;
258 return result;
259 }
259 }
260
260
261 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
261 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
262 {
262 {
263 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
263 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
264 *
264 *
265 * @param TC points to the TeleCommand packet that is being processed
265 * @param TC points to the TeleCommand packet that is being processed
266 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
266 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
267 *
267 *
268 */
268 */
269
269
270 int result;
270 int result;
271 unsigned char lfrMode;
271 unsigned char lfrMode;
272
272
273 result = LFR_DEFAULT;
273 result = LFR_DEFAULT;
274 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
274 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
275
275
276 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
276 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
277 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
277 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
278 result = LFR_DEFAULT;
278 result = LFR_DEFAULT;
279 }
279 }
280 else {
280 else {
281 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
281 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
282 result = LFR_DEFAULT;
282 result = LFR_DEFAULT;
283 }
283 }
284 return result;
284 return result;
285 }
285 }
286
286
287 int action_update_time(ccsdsTelecommandPacket_t *TC)
287 int action_update_time(ccsdsTelecommandPacket_t *TC)
288 {
288 {
289 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
289 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
290 *
290 *
291 * @param TC points to the TeleCommand packet that is being processed
291 * @param TC points to the TeleCommand packet that is being processed
292 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
292 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
293 *
293 *
294 * @return LFR_SUCCESSFUL
294 * @return LFR_SUCCESSFUL
295 *
295 *
296 */
296 */
297
297
298 unsigned int val;
298 unsigned int val;
299
299
300 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
300 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
301 + (TC->dataAndCRC[1] << 16)
301 + (TC->dataAndCRC[1] << 16)
302 + (TC->dataAndCRC[2] << 8)
302 + (TC->dataAndCRC[2] << 8)
303 + TC->dataAndCRC[3];
303 + TC->dataAndCRC[3];
304 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
304 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
305 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
305 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
306 val++;
306 val++;
307 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
307 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
308 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
308 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
309 time_management_regs->ctrl = time_management_regs->ctrl | 1;
309 time_management_regs->ctrl = time_management_regs->ctrl | 1;
310
310
311 return LFR_SUCCESSFUL;
311 return LFR_SUCCESSFUL;
312 }
312 }
313
313
314 //*******************
314 //*******************
315 // ENTERING THE MODES
315 // ENTERING THE MODES
316
316
317 int transition_validation(unsigned char requestedMode)
317 int transition_validation(unsigned char requestedMode)
318 {
318 {
319 /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
319 /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE.
320 *
320 *
321 * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
321 * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE
322 *
322 *
323 * @return LFR directive status codes:
323 * @return LFR directive status codes:
324 * - LFR_SUCCESSFUL - the transition is authorized
324 * - LFR_SUCCESSFUL - the transition is authorized
325 * - LFR_DEFAULT - the transition is not authorized
325 * - LFR_DEFAULT - the transition is not authorized
326 *
326 *
327 */
327 */
328
328
329 int status;
329 int status;
330
330
331 switch (requestedMode)
331 switch (requestedMode)
332 {
332 {
333 case LFR_MODE_STANDBY:
333 case LFR_MODE_STANDBY:
334 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
334 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
335 status = LFR_DEFAULT;
335 status = LFR_DEFAULT;
336 }
336 }
337 else
337 else
338 {
338 {
339 status = LFR_SUCCESSFUL;
339 status = LFR_SUCCESSFUL;
340 }
340 }
341 break;
341 break;
342 case LFR_MODE_NORMAL:
342 case LFR_MODE_NORMAL:
343 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
343 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
344 status = LFR_DEFAULT;
344 status = LFR_DEFAULT;
345 }
345 }
346 else {
346 else {
347 status = LFR_SUCCESSFUL;
347 status = LFR_SUCCESSFUL;
348 }
348 }
349 break;
349 break;
350 case LFR_MODE_BURST:
350 case LFR_MODE_BURST:
351 if ( lfrCurrentMode == LFR_MODE_BURST ) {
351 if ( lfrCurrentMode == LFR_MODE_BURST ) {
352 status = LFR_DEFAULT;
352 status = LFR_DEFAULT;
353 }
353 }
354 else {
354 else {
355 status = LFR_SUCCESSFUL;
355 status = LFR_SUCCESSFUL;
356 }
356 }
357 break;
357 break;
358 case LFR_MODE_SBM1:
358 case LFR_MODE_SBM1:
359 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
359 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
360 status = LFR_DEFAULT;
360 status = LFR_DEFAULT;
361 }
361 }
362 else {
362 else {
363 status = LFR_SUCCESSFUL;
363 status = LFR_SUCCESSFUL;
364 }
364 }
365 break;
365 break;
366 case LFR_MODE_SBM2:
366 case LFR_MODE_SBM2:
367 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
367 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
368 status = LFR_DEFAULT;
368 status = LFR_DEFAULT;
369 }
369 }
370 else {
370 else {
371 status = LFR_SUCCESSFUL;
371 status = LFR_SUCCESSFUL;
372 }
372 }
373 break;
373 break;
374 default:
374 default:
375 status = LFR_DEFAULT;
375 status = LFR_DEFAULT;
376 break;
376 break;
377 }
377 }
378
378
379 return status;
379 return status;
380 }
380 }
381
381
382 int stop_current_mode()
382 int stop_current_mode()
383 {
383 {
384 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
384 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
385 *
385 *
386 * @return RTEMS directive status codes:
386 * @return RTEMS directive status codes:
387 * - RTEMS_SUCCESSFUL - task restarted successfully
387 * - RTEMS_SUCCESSFUL - task restarted successfully
388 * - RTEMS_INVALID_ID - task id invalid
388 * - RTEMS_INVALID_ID - task id invalid
389 * - RTEMS_ALREADY_SUSPENDED - task already suspended
389 * - RTEMS_ALREADY_SUSPENDED - task already suspended
390 *
390 *
391 */
391 */
392
392
393 rtems_status_code status;
393 rtems_status_code status;
394
394
395 status = RTEMS_SUCCESSFUL;
395 status = RTEMS_SUCCESSFUL;
396
396
397 // mask interruptions
397 // mask interruptions
398 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
398 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
399 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt
399 //LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
400 LEON_Mask_interrupt( IRQ_SM ); // mask spectral matrix interrupt simulator
400 // reset registers
401 // reset registers
401 reset_wfp_burst_enable(); // reset burst and enable bits
402 reset_wfp_burst_enable(); // reset burst and enable bits
402 reset_wfp_status(); // reset all the status bits
403 reset_wfp_status(); // reset all the status bits
403 // clear interruptions
404 // clear interruptions
404 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
405 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
405 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectarl matrix interrupt
406 //LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
407 LEON_Clear_interrupt( IRQ_SM ); // clear spectral matrix interrupt simulator
406 //**********************
408 //**********************
407 // suspend several tasks
409 // suspend several tasks
408 if (lfrCurrentMode != LFR_MODE_STANDBY) {
410 if (lfrCurrentMode != LFR_MODE_STANDBY) {
409 status = suspend_science_tasks();
411 status = suspend_science_tasks();
410 }
412 }
411
413
412 if (status != RTEMS_SUCCESSFUL)
414 if (status != RTEMS_SUCCESSFUL)
413 {
415 {
414 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
416 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
415 }
417 }
416
418
417 return status;
419 return status;
418 }
420 }
419
421
420 int enter_mode(unsigned char mode )
422 int enter_mode(unsigned char mode )
421 {
423 {
422 /** This function is launched after a mode transition validation.
424 /** This function is launched after a mode transition validation.
423 *
425 *
424 * @param mode is the mode in which LFR will be put.
426 * @param mode is the mode in which LFR will be put.
425 *
427 *
426 * @return RTEMS directive status codes:
428 * @return RTEMS directive status codes:
427 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
429 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
428 * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully
430 * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully
429 *
431 *
430 */
432 */
431
433
432 rtems_status_code status;
434 rtems_status_code status;
433
435
434 status = RTEMS_UNSATISFIED;
436 status = RTEMS_UNSATISFIED;
435
437
436 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d);
438 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d);
437 updateLFRCurrentMode();
439 updateLFRCurrentMode();
438
440
439 switch(mode){
441 switch(mode){
440 case LFR_MODE_STANDBY:
442 case LFR_MODE_STANDBY:
441 status = enter_standby_mode( );
443 status = enter_standby_mode( );
442 break;
444 break;
443 case LFR_MODE_NORMAL:
445 case LFR_MODE_NORMAL:
444 status = enter_normal_mode( );
446 status = enter_normal_mode( );
445 break;
447 break;
446 case LFR_MODE_BURST:
448 case LFR_MODE_BURST:
447 status = enter_burst_mode( );
449 status = enter_burst_mode( );
448 break;
450 break;
449 case LFR_MODE_SBM1:
451 case LFR_MODE_SBM1:
450 status = enter_sbm1_mode( );
452 status = enter_sbm1_mode( );
451 break;
453 break;
452 case LFR_MODE_SBM2:
454 case LFR_MODE_SBM2:
453 status = enter_sbm2_mode( );
455 status = enter_sbm2_mode( );
454 break;
456 break;
455 default:
457 default:
456 status = RTEMS_UNSATISFIED;
458 status = RTEMS_UNSATISFIED;
457 }
459 }
458
460
459 if (status != RTEMS_SUCCESSFUL)
461 if (status != RTEMS_SUCCESSFUL)
460 {
462 {
461 PRINTF("in enter_mode *** ERR\n")
463 PRINTF("in enter_mode *** ERR\n")
462 status = RTEMS_UNSATISFIED;
464 status = RTEMS_UNSATISFIED;
463 }
465 }
464
466
465 return status;
467 return status;
466 }
468 }
467
469
468 int enter_standby_mode()
470 int enter_standby_mode()
469 {
471 {
470 /** This function is used to enter the STANDBY mode.
472 /** This function is used to enter the STANDBY mode.
471 *
473 *
472 * @return RTEMS directive status codes:
474 * @return RTEMS directive status codes:
473 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
475 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
474 *
476 *
475 */
477 */
476
478
477 PRINTF1("maxCount = %d\n", maxCount)
479 PRINTF1("maxCount = %d\n", maxCount)
478
480
479 #ifdef PRINT_TASK_STATISTICS
481 #ifdef PRINT_TASK_STATISTICS
480 rtems_cpu_usage_report();
482 rtems_cpu_usage_report();
481 #endif
483 #endif
482
484
483 #ifdef PRINT_STACK_REPORT
485 #ifdef PRINT_STACK_REPORT
484 rtems_stack_checker_report_usage();
486 rtems_stack_checker_report_usage();
485 #endif
487 #endif
486
488
487 return LFR_SUCCESSFUL;
489 return LFR_SUCCESSFUL;
488 }
490 }
489
491
490 int enter_normal_mode()
492 int enter_normal_mode()
491 {
493 {
492 rtems_status_code status;
494 rtems_status_code status;
493
495
494 status = restart_science_tasks();
496 status = restart_science_tasks();
495
497
496 #ifdef GSA
498 // Spectral Matrices simulator
497 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
499 // timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
498 //
500 // set_local_nb_interrupt_f0_MAX();
499 set_local_nb_interrupt_f0_MAX();
501 // LEON_Clear_interrupt( IRQ_SM );
500 LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board
502 // LEON_Unmask_interrupt( IRQ_SM );
501 LEON_Unmask_interrupt( IRQ_SM );
503
502 #else
504 launch_waveform_picker( LFR_MODE_NORMAL );
503 launch_waveform_picker( LFR_MODE_SBM1 );
504 #endif
505
505
506 return status;
506 return status;
507 }
507 }
508
508
509 int enter_burst_mode()
509 int enter_burst_mode()
510 {
510 {
511 /** This function is used to enter the STANDBY mode.
511 /** This function is used to enter the STANDBY mode.
512 *
512 *
513 * @return RTEMS directive status codes:
513 * @return RTEMS directive status codes:
514 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
514 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
515 * - RTEMS_INVALID_ID - task id invalid
515 * - RTEMS_INVALID_ID - task id invalid
516 * - RTEMS_INCORRECT_STATE - task never started
516 * - RTEMS_INCORRECT_STATE - task never started
517 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
517 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
518 *
518 *
519 */
519 */
520
520
521 rtems_status_code status;
521 rtems_status_code status;
522
522
523 status = restart_science_tasks();
523 status = restart_science_tasks();
524
524
525 launch_waveform_picker( LFR_MODE_BURST );
525 launch_waveform_picker( LFR_MODE_BURST );
526
526
527 return status;
527 return status;
528 }
528 }
529
529
530 int enter_sbm1_mode()
530 int enter_sbm1_mode()
531 {
531 {
532 /** This function is used to enter the SBM1 mode.
532 /** This function is used to enter the SBM1 mode.
533 *
533 *
534 * @return RTEMS directive status codes:
534 * @return RTEMS directive status codes:
535 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
535 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
536 * - RTEMS_INVALID_ID - task id invalid
536 * - RTEMS_INVALID_ID - task id invalid
537 * - RTEMS_INCORRECT_STATE - task never started
537 * - RTEMS_INCORRECT_STATE - task never started
538 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
538 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
539 *
539 *
540 */
540 */
541
541
542 rtems_status_code status;
542 rtems_status_code status;
543
543
544 status = restart_science_tasks();
544 status = restart_science_tasks();
545
545
546 launch_waveform_picker( LFR_MODE_SBM1 );
546 launch_waveform_picker( LFR_MODE_SBM1 );
547
547
548 return status;
548 return status;
549 }
549 }
550
550
551 int enter_sbm2_mode()
551 int enter_sbm2_mode()
552 {
552 {
553 /** This function is used to enter the SBM2 mode.
553 /** This function is used to enter the SBM2 mode.
554 *
554 *
555 * @return RTEMS directive status codes:
555 * @return RTEMS directive status codes:
556 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
556 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
557 * - RTEMS_INVALID_ID - task id invalid
557 * - RTEMS_INVALID_ID - task id invalid
558 * - RTEMS_INCORRECT_STATE - task never started
558 * - RTEMS_INCORRECT_STATE - task never started
559 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
559 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
560 *
560 *
561 */
561 */
562
562
563 rtems_status_code status;
563 rtems_status_code status;
564
564
565 status = restart_science_tasks();
565 status = restart_science_tasks();
566
566
567 launch_waveform_picker( LFR_MODE_SBM2 );
567 launch_waveform_picker( LFR_MODE_SBM2 );
568
568
569 return status;
569 return status;
570 }
570 }
571
571
572 int restart_science_tasks()
572 int restart_science_tasks()
573 {
573 {
574 /** This function is used to restart all science tasks.
574 /** This function is used to restart all science tasks.
575 *
575 *
576 * @return RTEMS directive status codes:
576 * @return RTEMS directive status codes:
577 * - RTEMS_SUCCESSFUL - task restarted successfully
577 * - RTEMS_SUCCESSFUL - task restarted successfully
578 * - RTEMS_INVALID_ID - task id invalid
578 * - RTEMS_INVALID_ID - task id invalid
579 * - RTEMS_INCORRECT_STATE - task never started
579 * - RTEMS_INCORRECT_STATE - task never started
580 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
580 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
581 *
581 *
582 * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1
582 * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1
583 *
583 *
584 */
584 */
585
585
586 rtems_status_code status[6];
586 rtems_status_code status[6];
587 rtems_status_code ret;
587 rtems_status_code ret;
588
588
589 ret = RTEMS_SUCCESSFUL;
589 ret = RTEMS_SUCCESSFUL;
590
590
591 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 );
591 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 );
592 if (status[0] != RTEMS_SUCCESSFUL)
592 if (status[0] != RTEMS_SUCCESSFUL)
593 {
593 {
594 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
594 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
595 }
595 }
596
596
597 status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 );
597 status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 );
598 if (status[1] != RTEMS_SUCCESSFUL)
598 if (status[1] != RTEMS_SUCCESSFUL)
599 {
599 {
600 PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1])
600 PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1])
601 }
601 }
602
602
603 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
603 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
604 if (status[2] != RTEMS_SUCCESSFUL)
604 if (status[2] != RTEMS_SUCCESSFUL)
605 {
605 {
606 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
606 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
607 }
607 }
608
608
609 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
609 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
610 if (status[3] != RTEMS_SUCCESSFUL)
610 if (status[3] != RTEMS_SUCCESSFUL)
611 {
611 {
612 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
612 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
613 }
613 }
614
614
615 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
615 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
616 if (status[4] != RTEMS_SUCCESSFUL)
616 if (status[4] != RTEMS_SUCCESSFUL)
617 {
617 {
618 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
618 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
619 }
619 }
620
620
621 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
621 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
622 if (status[5] != RTEMS_SUCCESSFUL)
622 if (status[5] != RTEMS_SUCCESSFUL)
623 {
623 {
624 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
624 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
625 }
625 }
626
626
627 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
627 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
628 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
628 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
629 {
629 {
630 ret = RTEMS_UNSATISFIED;
630 ret = RTEMS_UNSATISFIED;
631 }
631 }
632
632
633 return ret;
633 return ret;
634 }
634 }
635
635
636 int suspend_science_tasks()
636 int suspend_science_tasks()
637 {
637 {
638 /** This function suspends the science tasks.
638 /** This function suspends the science tasks.
639 *
639 *
640 * @return RTEMS directive status codes:
640 * @return RTEMS directive status codes:
641 * - RTEMS_SUCCESSFUL - task restarted successfully
641 * - RTEMS_SUCCESSFUL - task restarted successfully
642 * - RTEMS_INVALID_ID - task id invalid
642 * - RTEMS_INVALID_ID - task id invalid
643 * - RTEMS_ALREADY_SUSPENDED - task already suspended
643 * - RTEMS_ALREADY_SUSPENDED - task already suspended
644 *
644 *
645 */
645 */
646
646
647 rtems_status_code status;
647 rtems_status_code status;
648
648
649 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
649 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
650 if (status != RTEMS_SUCCESSFUL)
650 if (status != RTEMS_SUCCESSFUL)
651 {
651 {
652 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
652 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
653 }
653 }
654
654
655 if (status == RTEMS_SUCCESSFUL) // suspend BPF0
655 if (status == RTEMS_SUCCESSFUL) // suspend BPF0
656 {
656 {
657 status = rtems_task_suspend( Task_id[TASKID_BPF0] );
657 status = rtems_task_suspend( Task_id[TASKID_BPF0] );
658 if (status != RTEMS_SUCCESSFUL)
658 if (status != RTEMS_SUCCESSFUL)
659 {
659 {
660 PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status)
660 PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status)
661 }
661 }
662 }
662 }
663
663
664 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
664 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
665 {
665 {
666 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
666 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
667 if (status != RTEMS_SUCCESSFUL)
667 if (status != RTEMS_SUCCESSFUL)
668 {
668 {
669 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
669 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
670 }
670 }
671 }
671 }
672
672
673 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
673 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
674 {
674 {
675 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
675 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
676 if (status != RTEMS_SUCCESSFUL)
676 if (status != RTEMS_SUCCESSFUL)
677 {
677 {
678 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
678 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
679 }
679 }
680 }
680 }
681
681
682 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
682 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
683 {
683 {
684 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
684 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
685 if (status != RTEMS_SUCCESSFUL)
685 if (status != RTEMS_SUCCESSFUL)
686 {
686 {
687 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
687 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
688 }
688 }
689 }
689 }
690
690
691 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
691 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
692 {
692 {
693 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
693 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
694 if (status != RTEMS_SUCCESSFUL)
694 if (status != RTEMS_SUCCESSFUL)
695 {
695 {
696 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
696 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
697 }
697 }
698 }
698 }
699
699
700 return status;
700 return status;
701 }
701 }
702
702
703 void launch_waveform_picker( unsigned char mode )
703 void launch_waveform_picker( unsigned char mode )
704 {
704 {
705 int startDate;
705 int startDate;
706
706
707 reset_current_ring_nodes();
707 reset_current_ring_nodes();
708 reset_waveform_picker_regs();
708 reset_waveform_picker_regs();
709 set_wfp_burst_enable_register( mode );
709 set_wfp_burst_enable_register( mode );
710 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
710 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
711 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
711 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
712 #ifdef VHDL_DEV
712 #ifdef VHDL_DEV
713 startDate = time_management_regs->coarse_time + 2;
713 startDate = time_management_regs->coarse_time + 2;
714 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000]
714 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000]
715 waveform_picker_regs->start_date = startDate;
715 waveform_picker_regs->start_date = startDate;
716 #endif
716 #endif
717 }
717 }
718
718
719 //****************
719 //****************
720 // CLOSING ACTIONS
720 // CLOSING ACTIONS
721 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time)
721 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time)
722 {
722 {
723 /** This function is used to update the HK packets statistics after a successful TC execution.
723 /** This function is used to update the HK packets statistics after a successful TC execution.
724 *
724 *
725 * @param TC points to the TC being processed
725 * @param TC points to the TC being processed
726 * @param time is the time used to date the TC execution
726 * @param time is the time used to date the TC execution
727 *
727 *
728 */
728 */
729
729
730 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
730 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
731 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
731 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
732 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
732 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
733 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
733 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
734 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
734 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
735 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
735 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
736 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
736 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
737 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
737 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
738 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
738 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
739 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
739 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
740 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
740 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
741 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
741 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
742 }
742 }
743
743
744 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time)
744 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time)
745 {
745 {
746 /** This function is used to update the HK packets statistics after a TC rejection.
746 /** This function is used to update the HK packets statistics after a TC rejection.
747 *
747 *
748 * @param TC points to the TC being processed
748 * @param TC points to the TC being processed
749 * @param time is the time used to date the TC rejection
749 * @param time is the time used to date the TC rejection
750 *
750 *
751 */
751 */
752
752
753 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
753 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
754 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
754 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
755 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
755 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
756 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
756 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
757 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
757 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
758 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
758 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
759 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
759 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
760 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
760 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
761 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
761 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
762 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
762 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
763 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
763 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
764 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
764 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
765 }
765 }
766
766
767 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time)
767 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time)
768 {
768 {
769 /** This function is the last step of the TC execution workflow.
769 /** This function is the last step of the TC execution workflow.
770 *
770 *
771 * @param TC points to the TC being processed
771 * @param TC points to the TC being processed
772 * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
772 * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT)
773 * @param queue_id is the id of the RTEMS message queue used to send TM packets
773 * @param queue_id is the id of the RTEMS message queue used to send TM packets
774 * @param time is the time used to date the TC execution
774 * @param time is the time used to date the TC execution
775 *
775 *
776 */
776 */
777
777
778 unsigned int val = 0;
778 unsigned int val = 0;
779
779
780 if (result == LFR_SUCCESSFUL)
780 if (result == LFR_SUCCESSFUL)
781 {
781 {
782 if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
782 if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
783 &&
783 &&
784 !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
784 !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
785 )
785 )
786 {
786 {
787 send_tm_lfr_tc_exe_success( TC, queue_id, time );
787 send_tm_lfr_tc_exe_success( TC, queue_id, time );
788 }
788 }
789 update_last_TC_exe( TC, time );
789 update_last_TC_exe( TC, time );
790 val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1];
790 val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1];
791 val++;
791 val++;
792 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
792 housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8);
793 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val);
793 housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val);
794 }
794 }
795 else
795 else
796 {
796 {
797 update_last_TC_rej( TC, time );
797 update_last_TC_rej( TC, time );
798 val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1];
798 val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1];
799 val++;
799 val++;
800 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
800 housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8);
801 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val);
801 housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val);
802 }
802 }
803 }
803 }
804
804
805 //***************************
805 //***************************
806 // Interrupt Service Routines
806 // Interrupt Service Routines
807 rtems_isr commutation_isr1( rtems_vector_number vector )
807 rtems_isr commutation_isr1( rtems_vector_number vector )
808 {
808 {
809 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
809 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
810 printf("In commutation_isr1 *** Error sending event to DUMB\n");
810 printf("In commutation_isr1 *** Error sending event to DUMB\n");
811 }
811 }
812 }
812 }
813
813
814 rtems_isr commutation_isr2( rtems_vector_number vector )
814 rtems_isr commutation_isr2( rtems_vector_number vector )
815 {
815 {
816 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
816 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
817 printf("In commutation_isr2 *** Error sending event to DUMB\n");
817 printf("In commutation_isr2 *** Error sending event to DUMB\n");
818 }
818 }
819 }
819 }
820
820
821 //****************
821 //****************
822 // OTHER FUNCTIONS
822 // OTHER FUNCTIONS
823 void updateLFRCurrentMode()
823 void updateLFRCurrentMode()
824 {
824 {
825 /** This function updates the value of the global variable lfrCurrentMode.
825 /** This function updates the value of the global variable lfrCurrentMode.
826 *
826 *
827 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
827 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
828 *
828 *
829 */
829 */
830 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
830 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
831 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
831 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
832 }
832 }
833
833
@@ -1,455 +1,484
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, unsigned char *time)
32 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
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 rtems_status_code status;
43 rtems_status_code status;
44
44
45 flag = LFR_SUCCESSFUL;
45 flag = LFR_SUCCESSFUL;
46
46
47 if ( (lfrCurrentMode == LFR_MODE_NORMAL) ||
47 if ( (lfrCurrentMode == LFR_MODE_NORMAL) ||
48 (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) {
48 (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) {
49 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
49 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
50 flag = LFR_DEFAULT;
50 flag = LFR_DEFAULT;
51 }
51 }
52
52
53 //***************
53 //***************
54 // sy_lfr_n_swf_l
54 // sy_lfr_n_swf_l
55 if (flag == LFR_SUCCESSFUL)
55 if (flag == LFR_SUCCESSFUL)
56 {
56 {
57 result = set_sy_lfr_n_swf_l( TC, queue_id, time );
57 result = set_sy_lfr_n_swf_l( TC, queue_id, time );
58 if (result != LFR_SUCCESSFUL)
58 if (result != LFR_SUCCESSFUL)
59 {
59 {
60 flag = LFR_DEFAULT;
60 flag = LFR_DEFAULT;
61 }
61 }
62 }
62 }
63
63
64 //***************
64 //***************
65 // sy_lfr_n_swf_p
65 // sy_lfr_n_swf_p
66 if (flag == LFR_SUCCESSFUL)
66 if (flag == LFR_SUCCESSFUL)
67 {
67 {
68 result = set_sy_lfr_n_swf_p( TC, queue_id, time );
68 result = set_sy_lfr_n_swf_p( TC, queue_id, time );
69 if (result != LFR_SUCCESSFUL)
69 if (result != LFR_SUCCESSFUL)
70 {
70 {
71 flag = LFR_DEFAULT;
71 flag = LFR_DEFAULT;
72 }
72 }
73 }
73 }
74
74
75 //***************
75 //***************
76 // SY_LFR_N_ASM_P
76 // SY_LFR_N_ASM_P
77 if (flag == LFR_SUCCESSFUL)
77 if (flag == LFR_SUCCESSFUL)
78 {
78 {
79 result = set_sy_lfr_n_asm_p( TC, queue_id );
79 result = set_sy_lfr_n_asm_p( TC, queue_id );
80 if (result != LFR_SUCCESSFUL)
80 if (result != LFR_SUCCESSFUL)
81 {
81 {
82 flag = LFR_DEFAULT;
82 flag = LFR_DEFAULT;
83 }
83 }
84 }
84 }
85
85
86 //***************
86 //***************
87 // SY_LFR_N_BP_P0
87 // SY_LFR_N_BP_P0
88 if (flag == LFR_SUCCESSFUL)
88 if (flag == LFR_SUCCESSFUL)
89 {
89 {
90 result = set_sy_lfr_n_bp_p0( TC, queue_id );
90 result = set_sy_lfr_n_bp_p0( TC, queue_id );
91 if (result != LFR_SUCCESSFUL)
91 if (result != LFR_SUCCESSFUL)
92 {
92 {
93 flag = LFR_DEFAULT;
93 flag = LFR_DEFAULT;
94 }
94 }
95 }
95 }
96
96
97 //***************
97 //***************
98 // sy_lfr_n_bp_p1
98 // sy_lfr_n_bp_p1
99 if (flag == LFR_SUCCESSFUL)
99 if (flag == LFR_SUCCESSFUL)
100 {
100 {
101 result = set_sy_lfr_n_bp_p1( TC, queue_id );
101 result = set_sy_lfr_n_bp_p1( TC, queue_id );
102 if (result != LFR_SUCCESSFUL)
102 if (result != LFR_SUCCESSFUL)
103 {
103 {
104 flag = LFR_DEFAULT;
104 flag = LFR_DEFAULT;
105 }
105 }
106 }
106 }
107
107
108 //*********************
109 // sy_lfr_n_cwf_long_f3
110 if (flag == LFR_SUCCESSFUL)
111 {
112 result = set_sy_lfr_n_cwf_long_f3( TC, queue_id );
113 if (result != LFR_SUCCESSFUL)
114 {
115 flag = LFR_DEFAULT;
116 }
117 }
118
108 return flag;
119 return flag;
109 }
120 }
110
121
111 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
122 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
112 {
123 {
113 /** This function updates the LFR registers with the incoming burst parameters.
124 /** This function updates the LFR registers with the incoming burst parameters.
114 *
125 *
115 * @param TC points to the TeleCommand packet that is being processed
126 * @param TC points to the TeleCommand packet that is being processed
116 * @param queue_id is the id of the queue which handles TM related to this execution step
127 * @param queue_id is the id of the queue which handles TM related to this execution step
117 *
128 *
118 */
129 */
119
130
120 int result;
131 int result;
121 unsigned char lfrMode;
132 unsigned char lfrMode;
122 rtems_status_code status;
133 rtems_status_code status;
123
134
124 result = LFR_DEFAULT;
135 result = LFR_DEFAULT;
125 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
136 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
126
137
127 if ( lfrMode == LFR_MODE_BURST ) {
138 if ( lfrMode == LFR_MODE_BURST ) {
128 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
139 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
129 result = LFR_DEFAULT;
140 result = LFR_DEFAULT;
130 }
141 }
131 else {
142 else {
132 parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[0];
143 parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[0];
133 parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[1];
144 parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[1];
134
145
135 result = LFR_SUCCESSFUL;
146 result = LFR_SUCCESSFUL;
136 }
147 }
137
148
138 return result;
149 return result;
139 }
150 }
140
151
141 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
152 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
142 {
153 {
143 /** This function updates the LFR registers with the incoming sbm1 parameters.
154 /** This function updates the LFR registers with the incoming sbm1 parameters.
144 *
155 *
145 * @param TC points to the TeleCommand packet that is being processed
156 * @param TC points to the TeleCommand packet that is being processed
146 * @param queue_id is the id of the queue which handles TM related to this execution step
157 * @param queue_id is the id of the queue which handles TM related to this execution step
147 *
158 *
148 */
159 */
149 int result;
160 int result;
150 unsigned char lfrMode;
161 unsigned char lfrMode;
151 rtems_status_code status;
162 rtems_status_code status;
152
163
153 result = LFR_DEFAULT;
164 result = LFR_DEFAULT;
154 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
165 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
155
166
156 if ( (lfrMode == LFR_MODE_SBM1) || (lfrMode == LFR_MODE_SBM2) ) {
167 if ( (lfrMode == LFR_MODE_SBM1) || (lfrMode == LFR_MODE_SBM2) ) {
157 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
168 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
158 result = LFR_DEFAULT;
169 result = LFR_DEFAULT;
159 }
170 }
160 else {
171 else {
161 parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[0];
172 parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[0];
162 parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[1];
173 parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[1];
163
174
164 result = LFR_SUCCESSFUL;
175 result = LFR_SUCCESSFUL;
165 }
176 }
166
177
167 return result;
178 return result;
168 }
179 }
169
180
170 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
181 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
171 {
182 {
172 /** This function updates the LFR registers with the incoming sbm2 parameters.
183 /** This function updates the LFR registers with the incoming sbm2 parameters.
173 *
184 *
174 * @param TC points to the TeleCommand packet that is being processed
185 * @param TC points to the TeleCommand packet that is being processed
175 * @param queue_id is the id of the queue which handles TM related to this execution step
186 * @param queue_id is the id of the queue which handles TM related to this execution step
176 *
187 *
177 */
188 */
178
189
179 int result;
190 int result;
180 unsigned char lfrMode;
191 unsigned char lfrMode;
181 rtems_status_code status;
192 rtems_status_code status;
182
193
183 result = LFR_DEFAULT;
194 result = LFR_DEFAULT;
184 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
195 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
185
196
186 if ( (lfrMode == LFR_MODE_SBM2) || (lfrMode == LFR_MODE_SBM2) ) {
197 if ( (lfrMode == LFR_MODE_SBM2) || (lfrMode == LFR_MODE_SBM2) ) {
187 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
198 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
188 result = LFR_DEFAULT;
199 result = LFR_DEFAULT;
189 }
200 }
190 else {
201 else {
191 parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[0];
202 parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[0];
192 parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[1];
203 parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[1];
193
204
194 result = LFR_SUCCESSFUL;
205 result = LFR_SUCCESSFUL;
195 }
206 }
196
207
197 return result;
208 return result;
198 }
209 }
199
210
200 int action_dump_par( rtems_id queue_id )
211 int action_dump_par( rtems_id queue_id )
201 {
212 {
202 /** This function dumps the LFR parameters by sending the appropriate TM packet to the dedicated RTEMS message queue.
213 /** This function dumps the LFR parameters by sending the appropriate TM packet to the dedicated RTEMS message queue.
203 *
214 *
204 * @param queue_id is the id of the queue which handles TM related to this execution step.
215 * @param queue_id is the id of the queue which handles TM related to this execution step.
205 *
216 *
206 * @return RTEMS directive status codes:
217 * @return RTEMS directive status codes:
207 * - RTEMS_SUCCESSFUL - message sent successfully
218 * - RTEMS_SUCCESSFUL - message sent successfully
208 * - RTEMS_INVALID_ID - invalid queue id
219 * - RTEMS_INVALID_ID - invalid queue id
209 * - RTEMS_INVALID_SIZE - invalid message size
220 * - RTEMS_INVALID_SIZE - invalid message size
210 * - RTEMS_INVALID_ADDRESS - buffer is NULL
221 * - RTEMS_INVALID_ADDRESS - buffer is NULL
211 * - RTEMS_UNSATISFIED - out of message buffers
222 * - RTEMS_UNSATISFIED - out of message buffers
212 * - RTEMS_TOO_MANY - queue s limit has been reached
223 * - RTEMS_TOO_MANY - queue s limit has been reached
213 *
224 *
214 */
225 */
215
226
216 int status;
227 int status;
217
228
218 // UPDATE TIME
229 // UPDATE TIME
219 increment_seq_counter( parameter_dump_packet.packetSequenceControl );
230 increment_seq_counter( parameter_dump_packet.packetSequenceControl );
220 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
231 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
221 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
232 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
222 parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
233 parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
223 parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
234 parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
224 parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
235 parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
225 parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
236 parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
226 // SEND DATA
237 // SEND DATA
227 status = rtems_message_queue_send( queue_id, &parameter_dump_packet,
238 status = rtems_message_queue_send( queue_id, &parameter_dump_packet,
228 PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
239 PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
229 if (status != RTEMS_SUCCESSFUL) {
240 if (status != RTEMS_SUCCESSFUL) {
230 PRINTF1("in action_dump *** ERR sending packet, code %d", status)
241 PRINTF1("in action_dump *** ERR sending packet, code %d", status)
231 }
242 }
232
243
233 return status;
244 return status;
234 }
245 }
235
246
236 //***********************
247 //***********************
237 // NORMAL MODE PARAMETERS
248 // NORMAL MODE PARAMETERS
238
249
239 int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time )
250 int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time )
240 {
251 {
241 /** This function sets the number of points of a snapshot (sy_lfr_n_swf_l).
252 /** This function sets the number of points of a snapshot (sy_lfr_n_swf_l).
242 *
253 *
243 * @param TC points to the TeleCommand packet that is being processed
254 * @param TC points to the TeleCommand packet that is being processed
244 * @param queue_id is the id of the queue which handles TM related to this execution step
255 * @param queue_id is the id of the queue which handles TM related to this execution step
245 *
256 *
246 */
257 */
247
258
248 unsigned int tmp;
259 unsigned int tmp;
249 int result;
260 int result;
250 unsigned char msb;
261 unsigned char msb;
251 unsigned char lsb;
262 unsigned char lsb;
252 rtems_status_code status;
263 rtems_status_code status;
253
264
254 msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L ];
265 msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L ];
255 lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L+1 ];
266 lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L+1 ];
256
267
257 tmp = ( unsigned int ) floor(
268 tmp = ( unsigned int ) floor(
258 ( ( msb*256 ) + lsb ) / 16
269 ( ( msb*256 ) + lsb ) / 16
259 ) * 16;
270 ) * 16;
260
271
261 if ( (tmp < 16) || (tmp > 2048) ) // the snapshot period is a multiple of 16
272 if ( (tmp < 16) || (tmp > 2048) ) // the snapshot period is a multiple of 16
262 { // 2048 is the maximum limit due to the size of the buffers
273 { // 2048 is the maximum limit due to the size of the buffers
263 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_L+10, lsb, time );
274 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_L+10, lsb, time );
264 result = WRONG_APP_DATA;
275 result = WRONG_APP_DATA;
265 }
276 }
266 else if (tmp != 2048)
277 else if (tmp != 2048)
267 {
278 {
268 status = send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
279 status = send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
269 result = FUNCT_NOT_IMPL;
280 result = FUNCT_NOT_IMPL;
270 }
281 }
271 else
282 else
272 {
283 {
273 parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (tmp >> 8);
284 parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (tmp >> 8);
274 parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (tmp );
285 parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (tmp );
275 result = LFR_SUCCESSFUL;
286 result = LFR_SUCCESSFUL;
276 }
287 }
277
288
278 return result;
289 return result;
279 }
290 }
280
291
281 int set_sy_lfr_n_swf_p(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time)
292 int set_sy_lfr_n_swf_p(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time)
282 {
293 {
283 /** This function sets the time between two snapshots, in s (sy_lfr_n_swf_p).
294 /** This function sets the time between two snapshots, in s (sy_lfr_n_swf_p).
284 *
295 *
285 * @param TC points to the TeleCommand packet that is being processed
296 * @param TC points to the TeleCommand packet that is being processed
286 * @param queue_id is the id of the queue which handles TM related to this execution step
297 * @param queue_id is the id of the queue which handles TM related to this execution step
287 *
298 *
288 */
299 */
289
300
290 unsigned int tmp;
301 unsigned int tmp;
291 int result;
302 int result;
292 unsigned char msb;
303 unsigned char msb;
293 unsigned char lsb;
304 unsigned char lsb;
294 rtems_status_code status;
305 rtems_status_code status;
295
306
296 msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P ];
307 msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P ];
297 lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P+1 ];
308 lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P+1 ];
298
309
299 tmp = ( unsigned int ) floor(
310 tmp = ( unsigned int ) floor(
300 ( ( msb*256 ) + lsb ) / 8
311 ( ( msb*256 ) + lsb ) / 8
301 ) * 8;
312 ) * 8;
302
313
303 if ( (tmp < 16) || (tmp > 65528) )
314 if ( (tmp < 16) || (tmp > 65528) )
304 {
315 {
305 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_P+10, lsb, time );
316 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_P+10, lsb, time );
306 result = WRONG_APP_DATA;
317 result = WRONG_APP_DATA;
307 }
318 }
308 else
319 else
309 {
320 {
310 parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8);
321 parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8);
311 parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp );
322 parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp );
312 result = LFR_SUCCESSFUL;
323 result = LFR_SUCCESSFUL;
313 }
324 }
314
325
315 return result;
326 return result;
316 }
327 }
317
328
318 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
329 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
319 {
330 {
320 /** This function sets the time between two full spectral matrices transmission, in s (SY_LFR_N_ASM_P).
331 /** This function sets the time between two full spectral matrices transmission, in s (SY_LFR_N_ASM_P).
321 *
332 *
322 * @param TC points to the TeleCommand packet that is being processed
333 * @param TC points to the TeleCommand packet that is being processed
323 * @param queue_id is the id of the queue which handles TM related to this execution step
334 * @param queue_id is the id of the queue which handles TM related to this execution step
324 *
335 *
325 */
336 */
326
337
327 int result;
338 int result;
328 unsigned char msb;
339 unsigned char msb;
329 unsigned char lsb;
340 unsigned char lsb;
330
341
331 msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P ];
342 msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P ];
332 lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P+1 ];
343 lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P+1 ];
333
344
334 parameter_dump_packet.sy_lfr_n_asm_p[0] = msb;
345 parameter_dump_packet.sy_lfr_n_asm_p[0] = msb;
335 parameter_dump_packet.sy_lfr_n_asm_p[1] = lsb;
346 parameter_dump_packet.sy_lfr_n_asm_p[1] = lsb;
336 result = LFR_SUCCESSFUL;
347 result = LFR_SUCCESSFUL;
337
348
338 return result;
349 return result;
339 }
350 }
340
351
341 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
352 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
342 {
353 {
343 /** This function sets the time between two basic parameter sets, in s (SY_LFR_N_BP_P0).
354 /** This function sets the time between two basic parameter sets, in s (SY_LFR_N_BP_P0).
344 *
355 *
345 * @param TC points to the TeleCommand packet that is being processed
356 * @param TC points to the TeleCommand packet that is being processed
346 * @param queue_id is the id of the queue which handles TM related to this execution step
357 * @param queue_id is the id of the queue which handles TM related to this execution step
347 *
358 *
348 */
359 */
349
360
350 int status;
361 int status;
351
362
352 status = LFR_SUCCESSFUL;
363 status = LFR_SUCCESSFUL;
353
364
354 parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P0 ];
365 parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P0 ];
355
366
356 return status;
367 return status;
357 }
368 }
358
369
359 int set_sy_lfr_n_bp_p1(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
370 int set_sy_lfr_n_bp_p1(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
360 {
371 {
361 /** This function sets the time between two basic parameter sets (autocorrelation + crosscorrelation), in s (sy_lfr_n_bp_p1).
372 /** This function sets the time between two basic parameter sets (autocorrelation + crosscorrelation), in s (sy_lfr_n_bp_p1).
362 *
373 *
363 * @param TC points to the TeleCommand packet that is being processed
374 * @param TC points to the TeleCommand packet that is being processed
364 * @param queue_id is the id of the queue which handles TM related to this execution step
375 * @param queue_id is the id of the queue which handles TM related to this execution step
365 *
376 *
366 */
377 */
367
378
368 int status;
379 int status;
369
380
370 status = LFR_SUCCESSFUL;
381 status = LFR_SUCCESSFUL;
371
382
372 parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P1 ];
383 parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P1 ];
373
384
374 return status;
385 return status;
375 }
386 }
376
387
388 int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
389 {
390 /** This function allows to switch from CWF_F3 packets to CWF_LONG_F3 packets.
391 *
392 * @param TC points to the TeleCommand packet that is being processed
393 * @param queue_id is the id of the queue which handles TM related to this execution step
394 *
395 */
396
397 int status;
398
399 status = LFR_SUCCESSFUL;
400
401 parameter_dump_packet.sy_lfr_n_cwf_long_f3 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_CWF_LONG_F3 ];
402
403 return status;
404 }
405
377 //**********************
406 //**********************
378 // BURST MODE PARAMETERS
407 // BURST MODE PARAMETERS
379
408
380 //*********************
409 //*********************
381 // SBM1 MODE PARAMETERS
410 // SBM1 MODE PARAMETERS
382
411
383 //*********************
412 //*********************
384 // SBM2 MODE PARAMETERS
413 // SBM2 MODE PARAMETERS
385
414
386 //**********
415 //**********
387 // init dump
416 // init dump
388
417
389 void init_parameter_dump( void )
418 void init_parameter_dump( void )
390 {
419 {
391 /** This function initialize the parameter_dump_packet global variable with default values.
420 /** This function initialize the parameter_dump_packet global variable with default values.
392 *
421 *
393 */
422 */
394
423
395 parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
424 parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
396 parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
425 parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
397 parameter_dump_packet.reserved = CCSDS_RESERVED;
426 parameter_dump_packet.reserved = CCSDS_RESERVED;
398 parameter_dump_packet.userApplication = CCSDS_USER_APP;
427 parameter_dump_packet.userApplication = CCSDS_USER_APP;
399 parameter_dump_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_PARAMETER_DUMP >> 8);
428 parameter_dump_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_PARAMETER_DUMP >> 8);
400 parameter_dump_packet.packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP;
429 parameter_dump_packet.packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP;
401 parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
430 parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
402 parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
431 parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
403 parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8);
432 parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8);
404 parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP;
433 parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP;
405 // DATA FIELD HEADER
434 // DATA FIELD HEADER
406 parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2;
435 parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2;
407 parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP;
436 parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP;
408 parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP;
437 parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP;
409 parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND;
438 parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND;
410 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
439 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
411 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
440 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
412 parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
441 parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
413 parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
442 parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
414 parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
443 parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
415 parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
444 parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
416 parameter_dump_packet.sid = SID_PARAMETER_DUMP;
445 parameter_dump_packet.sid = SID_PARAMETER_DUMP;
417
446
418 //******************
447 //******************
419 // COMMON PARAMETERS
448 // COMMON PARAMETERS
420 parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0;
449 parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0;
421 parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1;
450 parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1;
422
451
423 //******************
452 //******************
424 // NORMAL PARAMETERS
453 // NORMAL PARAMETERS
425 parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (SY_LFR_N_SWF_L >> 8);
454 parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (SY_LFR_N_SWF_L >> 8);
426 parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (SY_LFR_N_SWF_L );
455 parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (SY_LFR_N_SWF_L );
427 parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (SY_LFR_N_SWF_P >> 8);
456 parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (SY_LFR_N_SWF_P >> 8);
428 parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (SY_LFR_N_SWF_P );
457 parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (SY_LFR_N_SWF_P );
429 parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (SY_LFR_N_ASM_P >> 8);
458 parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (SY_LFR_N_ASM_P >> 8);
430 parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (SY_LFR_N_ASM_P );
459 parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (SY_LFR_N_ASM_P );
431 parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) SY_LFR_N_BP_P0;
460 parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) SY_LFR_N_BP_P0;
432 parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) SY_LFR_N_BP_P1;
461 parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) SY_LFR_N_BP_P1;
433
462
434 //*****************
463 //*****************
435 // BURST PARAMETERS
464 // BURST PARAMETERS
436 parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0;
465 parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0;
437 parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1;
466 parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1;
438
467
439 //****************
468 //****************
440 // SBM1 PARAMETERS
469 // SBM1 PARAMETERS
441 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
470 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
442 parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1;
471 parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1;
443
472
444 //****************
473 //****************
445 // SBM2 PARAMETERS
474 // SBM2 PARAMETERS
446 parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0;
475 parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0;
447 parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1;
476 parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1;
448 }
477 }
449
478
450
479
451
480
452
481
453
482
454
483
455
484
@@ -1,1146 +1,1181
1 /** Functions and tasks related to waveform packet generation.
1 /** Functions and tasks related to waveform packet generation.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to handle waveforms, in snapshot or continuous format.\n
6 * A group of functions to handle waveforms, in snapshot or continuous format.\n
7 *
7 *
8 */
8 */
9
9
10 #include "wf_handler.h"
10 #include "wf_handler.h"
11
11
12 //*****************
12 //*****************
13 // waveform headers
13 // waveform headers
14 // SWF
14 // SWF
15 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7];
15 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7];
16 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
16 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
17 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
17 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
18 // CWF
18 // CWF
19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7];
19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7];
20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7];
20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7];
21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7];
21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7];
22 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7];
22 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7];
23 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[7];
23 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[7];
24
24
25 //**************
25 //**************
26 // waveform ring
26 // waveform ring
27 ring_node waveform_ring_f0[NB_RING_NODES_F0];
27 ring_node waveform_ring_f1[NB_RING_NODES_F1];
28 ring_node waveform_ring_f1[NB_RING_NODES_F1];
28 ring_node waveform_ring_f2[NB_RING_NODES_F2];
29 ring_node waveform_ring_f2[NB_RING_NODES_F2];
30 ring_node *current_ring_node_f0;
31 ring_node *ring_node_to_send_swf_f0;
29 ring_node *current_ring_node_f1;
32 ring_node *current_ring_node_f1;
30 ring_node *ring_node_to_send_swf_f1;
33 ring_node *ring_node_to_send_swf_f1;
31 ring_node *ring_node_to_send_cwf_f1;
34 ring_node *ring_node_to_send_cwf_f1;
32 ring_node *current_ring_node_f2;
35 ring_node *current_ring_node_f2;
33 ring_node *ring_node_to_send_swf_f2;
36 ring_node *ring_node_to_send_swf_f2;
34 ring_node *ring_node_to_send_cwf_f2;
37 ring_node *ring_node_to_send_cwf_f2;
35
38
36 unsigned char doubleSendCWF2 = 0;
39 unsigned char doubleSendCWF2 = 0;
37
40
38 rtems_isr waveforms_isr( rtems_vector_number vector )
41 rtems_isr waveforms_isr( rtems_vector_number vector )
39 {
42 {
40 /** This is the interrupt sub routine called by the waveform picker core.
43 /** This is the interrupt sub routine called by the waveform picker core.
41 *
44 *
42 * This ISR launch different actions depending mainly on two pieces of information:
45 * This ISR launch different actions depending mainly on two pieces of information:
43 * 1. the values read in the registers of the waveform picker.
46 * 1. the values read in the registers of the waveform picker.
44 * 2. the current LFR mode.
47 * 2. the current LFR mode.
45 *
48 *
46 */
49 */
47
50
48 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
51 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
49 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
52 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
50 { // in modes other than STANDBY and BURST, send the CWF_F3 data
53 { // in modes other than STANDBY and BURST, send the CWF_F3 data
51 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
54 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
52 // (1) change the receiving buffer for the waveform picker
55 // (1) change the receiving buffer for the waveform picker
53 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
56 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
54 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b);
57 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_b);
55 }
58 }
56 else {
59 else {
57 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a);
60 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a);
58 }
61 }
59 // (2) send an event for the waveforms transmission
62 // (2) send an event for the waveforms transmission
60 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
63 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
61 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
64 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
62 }
65 }
63 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
66 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
64 }
67 }
65 }
68 }
66
69
67 switch(lfrCurrentMode)
70 switch(lfrCurrentMode)
68 {
71 {
69 //********
72 //********
70 // STANDBY
73 // STANDBY
71 case(LFR_MODE_STANDBY):
74 case(LFR_MODE_STANDBY):
72 break;
75 break;
73
76
74 //******
77 //******
75 // NORMAL
78 // NORMAL
76 case(LFR_MODE_NORMAL):
79 case(LFR_MODE_NORMAL):
77 if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full
80 if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full
81 // change F0 ring node
82 ring_node_to_send_swf_f0 = current_ring_node_f0;
83 current_ring_node_f0 = current_ring_node_f0->next;
84 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address;
78 // change F1 ring node
85 // change F1 ring node
79 ring_node_to_send_swf_f1 = current_ring_node_f1;
86 ring_node_to_send_swf_f1 = current_ring_node_f1;
80 current_ring_node_f1 = current_ring_node_f1->next;
87 current_ring_node_f1 = current_ring_node_f1->next;
81 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
88 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
82 // change F2 ring node
89 // change F2 ring node
83 ring_node_to_send_swf_f2 = current_ring_node_f2;
90 ring_node_to_send_swf_f2 = current_ring_node_f2;
84 current_ring_node_f2 = current_ring_node_f2->next;
91 current_ring_node_f2 = current_ring_node_f2->next;
85 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
92 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
86 // send an event to the WFRM task
93 // send an event to the WFRM task
87 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
94 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
88 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
95 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
89 }
96 }
90 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000]
97 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; // [1000 1000 1000]
98 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_7 );
99 // reset_wfp_burst_enable();
91 }
100 }
92 break;
101 break;
93
102
94 //******
103 //******
95 // BURST
104 // BURST
96 case(LFR_MODE_BURST):
105 case(LFR_MODE_BURST):
97 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
106 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
98 // (1) change the receiving buffer for the waveform picker
107 // (1) change the receiving buffer for the waveform picker
99 ring_node_to_send_cwf_f2 = current_ring_node_f2;
108 ring_node_to_send_cwf_f2 = current_ring_node_f2;
100 current_ring_node_f2 = current_ring_node_f2->next;
109 current_ring_node_f2 = current_ring_node_f2->next;
101 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
110 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
102 // (2) send an event for the waveforms transmission
111 // (2) send an event for the waveforms transmission
103 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
112 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 );
113 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
105 }
114 }
106 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
115 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
107 }
116 }
108 break;
117 break;
109
118
110 //*****
119 //*****
111 // SBM1
120 // SBM1
112 case(LFR_MODE_SBM1):
121 case(LFR_MODE_SBM1):
113 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
122 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
114 // (1) change the receiving buffer for the waveform picker
123 // (1) change the receiving buffer for the waveform picker
115 ring_node_to_send_cwf_f1 = current_ring_node_f1;
124 ring_node_to_send_cwf_f1 = current_ring_node_f1;
116 current_ring_node_f1 = current_ring_node_f1->next;
125 current_ring_node_f1 = current_ring_node_f1->next;
117 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
126 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
118 // (2) send an event for the waveforms transmission
127 // (2) send an event for the waveforms transmission
119 if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
128 if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
120 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
129 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
121 }
130 }
122 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0
131 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0
123 }
132 }
124 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
133 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
125 ring_node_to_send_swf_f1 = current_ring_node_f1->previous;
134 ring_node_to_send_swf_f1 = current_ring_node_f1->previous;
126 }
135 }
127 if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit
136 if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit
128 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
137 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
129 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
138 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
130 }
139 }
131 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0
140 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0
132 }
141 }
133 break;
142 break;
134
143
135 //*****
144 //*****
136 // SBM2
145 // SBM2
137 case(LFR_MODE_SBM2):
146 case(LFR_MODE_SBM2):
138 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
147 if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
139 // (1) change the receiving buffer for the waveform picker
148 // (1) change the receiving buffer for the waveform picker
140 ring_node_to_send_cwf_f2 = current_ring_node_f2;
149 ring_node_to_send_cwf_f2 = current_ring_node_f2;
141 current_ring_node_f2 = current_ring_node_f2->next;
150 current_ring_node_f2 = current_ring_node_f2->next;
142 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
151 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
143 // (2) send an event for the waveforms transmission
152 // (2) send an event for the waveforms transmission
144 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
153 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
145 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
154 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
146 }
155 }
147 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
156 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
148 }
157 }
149 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
158 if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
150 ring_node_to_send_swf_f2 = current_ring_node_f2->previous;
159 ring_node_to_send_swf_f2 = current_ring_node_f2->previous;
151 }
160 }
152 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
161 if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
153 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
162 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
154 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
163 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
155 }
164 }
156 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
165 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
157 }
166 }
158 break;
167 break;
159
168
160 //********
169 //********
161 // DEFAULT
170 // DEFAULT
162 default:
171 default:
163 break;
172 break;
164 }
173 }
165 }
174 }
166
175
167 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
176 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
168 {
177 {
169 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
178 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
170 *
179 *
171 * @param unused is the starting argument of the RTEMS task
180 * @param unused is the starting argument of the RTEMS task
172 *
181 *
173 * The following data packets are sent by this task:
182 * The following data packets are sent by this task:
174 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
183 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
175 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
184 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
176 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
185 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
177 *
186 *
178 */
187 */
179
188
180 rtems_event_set event_out;
189 rtems_event_set event_out;
181 rtems_id queue_id;
190 rtems_id queue_id;
182 rtems_status_code status;
191 rtems_status_code status;
183
192
184 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
193 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
185 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
194 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
186 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
195 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
187
196
188 init_waveforms();
197 init_waveforms();
189
198
190 status = get_message_queue_id_send( &queue_id );
199 status = get_message_queue_id_send( &queue_id );
191 if (status != RTEMS_SUCCESSFUL)
200 if (status != RTEMS_SUCCESSFUL)
192 {
201 {
193 PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status)
202 PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status)
194 }
203 }
195
204
196 BOOT_PRINTF("in WFRM ***\n")
205 BOOT_PRINTF("in WFRM ***\n")
197
206
198 while(1){
207 while(1){
199 // wait for an RTEMS_EVENT
208 // wait for an RTEMS_EVENT
200 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
209 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
201 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
210 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
202 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
211 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
203 if (event_out == RTEMS_EVENT_MODE_NORMAL)
212 if (event_out == RTEMS_EVENT_MODE_NORMAL)
204 {
213 {
205 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
214 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
206 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
215 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
207 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
216 send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
208 }
217 }
209 else
218 else
210 {
219 {
211 PRINTF("in WFRM *** unexpected event")
220 PRINTF("in WFRM *** unexpected event")
212 }
221 }
213 }
222 }
214 }
223 }
215
224
216 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
225 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
217 {
226 {
218 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
227 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
219 *
228 *
220 * @param unused is the starting argument of the RTEMS task
229 * @param unused is the starting argument of the RTEMS task
221 *
230 *
222 * The following data packet is sent by this task:
231 * The following data packet is sent by this task:
223 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
232 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
224 *
233 *
225 */
234 */
226
235
227 rtems_event_set event_out;
236 rtems_event_set event_out;
228 rtems_id queue_id;
237 rtems_id queue_id;
229 rtems_status_code status;
238 rtems_status_code status;
230
239
231 init_header_continuous_wf_table( SID_NORM_CWF_F3, headerCWF_F3 );
240 init_header_continuous_wf_table( SID_NORM_CWF_LONG_F3, headerCWF_F3 );
232 init_header_continuous_wf3_light_table( headerCWF_F3_light );
241 init_header_continuous_cwf3_light_table( headerCWF_F3_light );
233
242
234 status = get_message_queue_id_send( &queue_id );
243 status = get_message_queue_id_send( &queue_id );
235 if (status != RTEMS_SUCCESSFUL)
244 if (status != RTEMS_SUCCESSFUL)
236 {
245 {
237 PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status)
246 PRINTF1("in CWF3 *** ERR get_message_queue_id_send %d\n", status)
238 }
247 }
239
248
240 BOOT_PRINTF("in CWF3 ***\n")
249 BOOT_PRINTF("in CWF3 ***\n")
241
250
242 while(1){
251 while(1){
243 // wait for an RTEMS_EVENT
252 // wait for an RTEMS_EVENT
244 rtems_event_receive( RTEMS_EVENT_0,
253 rtems_event_receive( RTEMS_EVENT_0,
245 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
254 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
246 PRINTF("send CWF F3 \n")
255 PRINTF("send CWF F3 \n")
247 #ifdef GSA
248 #else
249 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
256 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
250 send_waveform_CWF3_light( wf_cont_f3_b, headerCWF_F3_light, queue_id );
257 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
258 {
259 send_waveform_CWF( wf_cont_f3_b, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
260 }
261 else
262 {
263 send_waveform_CWF3_light( wf_cont_f3_b, headerCWF_F3_light, queue_id );
264 }
251 }
265 }
252 else {
266 else
253 send_waveform_CWF3_light( wf_cont_f3_a, headerCWF_F3_light, queue_id );
267 {
268 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x00)
269 {
270 send_waveform_CWF( wf_cont_f3_a, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
271 }
272 else
273 {
274 send_waveform_CWF3_light( wf_cont_f3_a, headerCWF_F3_light, queue_id );
275 }
276
254 }
277 }
255 #endif
256 }
278 }
257 }
279 }
258
280
259 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
281 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
260 {
282 {
261 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
283 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
262 *
284 *
263 * @param unused is the starting argument of the RTEMS task
285 * @param unused is the starting argument of the RTEMS task
264 *
286 *
265 * The following data packet is sent by this function:
287 * The following data packet is sent by this function:
266 * - TM_LFR_SCIENCE_BURST_CWF_F2
288 * - TM_LFR_SCIENCE_BURST_CWF_F2
267 * - TM_LFR_SCIENCE_SBM2_CWF_F2
289 * - TM_LFR_SCIENCE_SBM2_CWF_F2
268 *
290 *
269 */
291 */
270
292
271 rtems_event_set event_out;
293 rtems_event_set event_out;
272 rtems_id queue_id;
294 rtems_id queue_id;
273 rtems_status_code status;
295 rtems_status_code status;
274
296
275 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
297 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
276 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
298 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
277
299
278 status = get_message_queue_id_send( &queue_id );
300 status = get_message_queue_id_send( &queue_id );
279 if (status != RTEMS_SUCCESSFUL)
301 if (status != RTEMS_SUCCESSFUL)
280 {
302 {
281 PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status)
303 PRINTF1("in CWF2 *** ERR get_message_queue_id_send %d\n", status)
282 }
304 }
283
305
284 BOOT_PRINTF("in CWF2 ***\n")
306 BOOT_PRINTF("in CWF2 ***\n")
285
307
286 while(1){
308 while(1){
287 // wait for an RTEMS_EVENT
309 // wait for an RTEMS_EVENT
288 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
310 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
289 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
311 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
290 if (event_out == RTEMS_EVENT_MODE_BURST)
312 if (event_out == RTEMS_EVENT_MODE_BURST)
291 {
313 {
292 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
314 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
293 }
315 }
294 if (event_out == RTEMS_EVENT_MODE_SBM2)
316 if (event_out == RTEMS_EVENT_MODE_SBM2)
295 {
317 {
296 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
318 send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
297 }
319 }
298 }
320 }
299 }
321 }
300
322
301 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
323 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
302 {
324 {
303 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
325 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
304 *
326 *
305 * @param unused is the starting argument of the RTEMS task
327 * @param unused is the starting argument of the RTEMS task
306 *
328 *
307 * The following data packet is sent by this function:
329 * The following data packet is sent by this function:
308 * - TM_LFR_SCIENCE_SBM1_CWF_F1
330 * - TM_LFR_SCIENCE_SBM1_CWF_F1
309 *
331 *
310 */
332 */
311
333
312 rtems_event_set event_out;
334 rtems_event_set event_out;
313 rtems_id queue_id;
335 rtems_id queue_id;
314 rtems_status_code status;
336 rtems_status_code status;
315
337
316 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
338 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
317
339
318 status = get_message_queue_id_send( &queue_id );
340 status = get_message_queue_id_send( &queue_id );
319 if (status != RTEMS_SUCCESSFUL)
341 if (status != RTEMS_SUCCESSFUL)
320 {
342 {
321 PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status)
343 PRINTF1("in CWF1 *** ERR get_message_queue_id_send %d\n", status)
322 }
344 }
323
345
324 BOOT_PRINTF("in CWF1 ***\n")
346 BOOT_PRINTF("in CWF1 ***\n")
325
347
326 while(1){
348 while(1){
327 // wait for an RTEMS_EVENT
349 // wait for an RTEMS_EVENT
328 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
350 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
329 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
351 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
330 send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
352 send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
331 }
353 }
332 }
354 }
333
355
334 //******************
356 //******************
335 // general functions
357 // general functions
336 void init_waveforms( void )
358 void init_waveforms( void )
337 {
359 {
338 int i = 0;
360 int i = 0;
339
361
340 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
362 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
341 {
363 {
342 //***
364 //***
343 // F0
365 // F0
344 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
366 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
345 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
367 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
346 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
368 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
347
369
348 //***
370 //***
349 // F1
371 // F1
350 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
372 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
351 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
373 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
352 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
374 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
353
375
354 //***
376 //***
355 // F2
377 // F2
356 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
378 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
357 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
379 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
358 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
380 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
359
381
360 //***
382 //***
361 // F3
383 // F3
362 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
384 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
363 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
385 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
364 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
386 // wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
365 }
387 }
366 }
388 }
367
389
368 void init_waveform_rings( void )
390 void init_waveform_rings( void )
369 {
391 {
370 unsigned char i;
392 unsigned char i;
371
393
394 // F0 RING
395 waveform_ring_f0[0].next = (ring_node*) &waveform_ring_f0[1];
396 waveform_ring_f0[0].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-1];
397 waveform_ring_f0[0].buffer_address = (int) &wf_snap_f0[0][0];
398
399 waveform_ring_f0[NB_RING_NODES_F0-1].next = (ring_node*) &waveform_ring_f0[0];
400 waveform_ring_f0[NB_RING_NODES_F0-1].previous = (ring_node*) &waveform_ring_f0[NB_RING_NODES_F0-2];
401 waveform_ring_f0[NB_RING_NODES_F0-1].buffer_address = (int) &wf_snap_f0[NB_RING_NODES_F0-1][0];
402
403 for(i=1; i<NB_RING_NODES_F0-1; i++)
404 {
405 waveform_ring_f0[i].next = (ring_node*) &waveform_ring_f0[i+1];
406 waveform_ring_f0[i].previous = (ring_node*) &waveform_ring_f0[i-1];
407 waveform_ring_f0[i].buffer_address = (int) &wf_snap_f0[i][0];
408 }
409
372 // F1 RING
410 // F1 RING
373 waveform_ring_f1[0].next = (ring_node*) &waveform_ring_f1[1];
411 waveform_ring_f1[0].next = (ring_node*) &waveform_ring_f1[1];
374 waveform_ring_f1[0].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-1];
412 waveform_ring_f1[0].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-1];
375 waveform_ring_f1[0].buffer_address = (int) &wf_snap_f1[0][0];
413 waveform_ring_f1[0].buffer_address = (int) &wf_snap_f1[0][0];
376
414
377 waveform_ring_f1[NB_RING_NODES_F1-1].next = (ring_node*) &waveform_ring_f1[0];
415 waveform_ring_f1[NB_RING_NODES_F1-1].next = (ring_node*) &waveform_ring_f1[0];
378 waveform_ring_f1[NB_RING_NODES_F1-1].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-2];
416 waveform_ring_f1[NB_RING_NODES_F1-1].previous = (ring_node*) &waveform_ring_f1[NB_RING_NODES_F1-2];
379 waveform_ring_f1[NB_RING_NODES_F1-1].buffer_address = (int) &wf_snap_f1[NB_RING_NODES_F1-1][0];
417 waveform_ring_f1[NB_RING_NODES_F1-1].buffer_address = (int) &wf_snap_f1[NB_RING_NODES_F1-1][0];
380
418
381 for(i=1; i<NB_RING_NODES_F1-1; i++)
419 for(i=1; i<NB_RING_NODES_F1-1; i++)
382 {
420 {
383 waveform_ring_f1[i].next = (ring_node*) &waveform_ring_f1[i+1];
421 waveform_ring_f1[i].next = (ring_node*) &waveform_ring_f1[i+1];
384 waveform_ring_f1[i].previous = (ring_node*) &waveform_ring_f1[i-1];
422 waveform_ring_f1[i].previous = (ring_node*) &waveform_ring_f1[i-1];
385 waveform_ring_f1[i].buffer_address = (int) &wf_snap_f1[i][0];
423 waveform_ring_f1[i].buffer_address = (int) &wf_snap_f1[i][0];
386 }
424 }
387
425
388 // F2 RING
426 // F2 RING
389 waveform_ring_f2[0].next = (ring_node*) &waveform_ring_f2[1];
427 waveform_ring_f2[0].next = (ring_node*) &waveform_ring_f2[1];
390 waveform_ring_f2[0].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-1];
428 waveform_ring_f2[0].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-1];
391 waveform_ring_f2[0].buffer_address = (int) &wf_snap_f2[0][0];
429 waveform_ring_f2[0].buffer_address = (int) &wf_snap_f2[0][0];
392
430
393 waveform_ring_f2[NB_RING_NODES_F2-1].next = (ring_node*) &waveform_ring_f2[0];
431 waveform_ring_f2[NB_RING_NODES_F2-1].next = (ring_node*) &waveform_ring_f2[0];
394 waveform_ring_f2[NB_RING_NODES_F2-1].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-2];
432 waveform_ring_f2[NB_RING_NODES_F2-1].previous = (ring_node*) &waveform_ring_f2[NB_RING_NODES_F2-2];
395 waveform_ring_f2[NB_RING_NODES_F2-1].buffer_address = (int) &wf_snap_f2[NB_RING_NODES_F2-1][0];
433 waveform_ring_f2[NB_RING_NODES_F2-1].buffer_address = (int) &wf_snap_f2[NB_RING_NODES_F2-1][0];
396
434
397 for(i=1; i<NB_RING_NODES_F2-1; i++)
435 for(i=1; i<NB_RING_NODES_F2-1; i++)
398 {
436 {
399 waveform_ring_f2[i].next = (ring_node*) &waveform_ring_f2[i+1];
437 waveform_ring_f2[i].next = (ring_node*) &waveform_ring_f2[i+1];
400 waveform_ring_f2[i].previous = (ring_node*) &waveform_ring_f2[i-1];
438 waveform_ring_f2[i].previous = (ring_node*) &waveform_ring_f2[i-1];
401 waveform_ring_f2[i].buffer_address = (int) &wf_snap_f2[i][0];
439 waveform_ring_f2[i].buffer_address = (int) &wf_snap_f2[i][0];
402 }
440 }
403
441
442 DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0)
404 DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1)
443 DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1)
405 DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2)
444 DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2)
406
445
407 }
446 }
408
447
409 void reset_current_ring_nodes( void )
448 void reset_current_ring_nodes( void )
410 {
449 {
450 current_ring_node_f0 = waveform_ring_f0;
451 ring_node_to_send_swf_f0 = waveform_ring_f0;
452
411 current_ring_node_f1 = waveform_ring_f1;
453 current_ring_node_f1 = waveform_ring_f1;
412 ring_node_to_send_cwf_f1 = waveform_ring_f1;
454 ring_node_to_send_cwf_f1 = waveform_ring_f1;
413 ring_node_to_send_swf_f1 = waveform_ring_f1;
455 ring_node_to_send_swf_f1 = waveform_ring_f1;
414
456
415 current_ring_node_f2 = waveform_ring_f2;
457 current_ring_node_f2 = waveform_ring_f2;
416 ring_node_to_send_cwf_f2 = waveform_ring_f2;
458 ring_node_to_send_cwf_f2 = waveform_ring_f2;
417 ring_node_to_send_swf_f2 = waveform_ring_f2;
459 ring_node_to_send_swf_f2 = waveform_ring_f2;
418 }
460 }
419
461
420 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
462 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
421 {
463 {
422 unsigned char i;
464 unsigned char i;
423
465
424 for (i=0; i<7; i++)
466 for (i=0; i<7; i++)
425 {
467 {
426 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
468 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
427 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
469 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
428 headerSWF[ i ].reserved = DEFAULT_RESERVED;
470 headerSWF[ i ].reserved = DEFAULT_RESERVED;
429 headerSWF[ i ].userApplication = CCSDS_USER_APP;
471 headerSWF[ i ].userApplication = CCSDS_USER_APP;
430 headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
472 headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
431 headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
473 headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
432 if (i == 0)
474 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
475 if (i == 6)
433 {
476 {
434 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
477 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_224 >> 8);
435 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
478 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_224 );
436 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
479 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_224 >> 8);
437 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
480 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_224 );
438 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
439 }
440 else if (i == 6)
441 {
442 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
443 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_8 >> 8);
444 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_8 );
445 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
446 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
447 }
481 }
448 else
482 else
449 {
483 {
450 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
484 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_304 >> 8);
451 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
485 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_304 );
452 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
486 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_304 >> 8);
453 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
487 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_304 );
454 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
455 }
488 }
456 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
489 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
457 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
490 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
458 headerSWF[ i ].pktNr = i+1; // PKT_NR
491 headerSWF[ i ].pktNr = i+1; // PKT_NR
459 // DATA FIELD HEADER
492 // DATA FIELD HEADER
460 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
493 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
461 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
494 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
462 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
495 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
463 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
496 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
464 // AUXILIARY DATA HEADER
497 // AUXILIARY DATA HEADER
465 headerSWF[ i ].time[0] = 0x00;
498 headerSWF[ i ].time[0] = 0x00;
466 headerSWF[ i ].time[0] = 0x00;
499 headerSWF[ i ].time[0] = 0x00;
467 headerSWF[ i ].time[0] = 0x00;
500 headerSWF[ i ].time[0] = 0x00;
468 headerSWF[ i ].time[0] = 0x00;
501 headerSWF[ i ].time[0] = 0x00;
469 headerSWF[ i ].time[0] = 0x00;
502 headerSWF[ i ].time[0] = 0x00;
470 headerSWF[ i ].time[0] = 0x00;
503 headerSWF[ i ].time[0] = 0x00;
471 headerSWF[ i ].sid = sid;
504 headerSWF[ i ].sid = sid;
472 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
505 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
473 }
506 }
474 return LFR_SUCCESSFUL;
507 return LFR_SUCCESSFUL;
475 }
508 }
476
509
477 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
510 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
478 {
511 {
479 unsigned int i;
512 unsigned int i;
480
513
481 for (i=0; i<7; i++)
514 for (i=0; i<7; i++)
482 {
515 {
483 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
516 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
484 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
517 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
485 headerCWF[ i ].reserved = DEFAULT_RESERVED;
518 headerCWF[ i ].reserved = DEFAULT_RESERVED;
486 headerCWF[ i ].userApplication = CCSDS_USER_APP;
519 headerCWF[ i ].userApplication = CCSDS_USER_APP;
487 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
520 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
488 {
521 {
489 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8);
522 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8);
490 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2);
523 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2);
491 }
524 }
492 else
525 else
493 {
526 {
494 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
527 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
495 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
528 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
496 }
529 }
497 if (i == 0)
530 if (i == 0)
498 {
531 {
499 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
532 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
500 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
533 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
501 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
534 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
502 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
535 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
503 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
536 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
504 }
537 }
505 else if (i == 6)
538 else if (i == 6)
506 {
539 {
507 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
540 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
508 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8);
541 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8);
509 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 );
542 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 );
510 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
543 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
511 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
544 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
512 }
545 }
513 else
546 else
514 {
547 {
515 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
548 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
516 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
549 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
517 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
550 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
518 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
551 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
519 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
552 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
520 }
553 }
521 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
554 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
522 // PKT_CNT
555 // PKT_CNT
523 // PKT_NR
556 // PKT_NR
524 // DATA FIELD HEADER
557 // DATA FIELD HEADER
525 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
558 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
526 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
559 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
527 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
560 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
528 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
561 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
529 // AUXILIARY DATA HEADER
562 // AUXILIARY DATA HEADER
530 headerCWF[ i ].sid = sid;
563 headerCWF[ i ].sid = sid;
531 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
564 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
532 headerCWF[ i ].time[0] = 0x00;
565 headerCWF[ i ].time[0] = 0x00;
533 headerCWF[ i ].time[0] = 0x00;
566 headerCWF[ i ].time[0] = 0x00;
534 headerCWF[ i ].time[0] = 0x00;
567 headerCWF[ i ].time[0] = 0x00;
535 headerCWF[ i ].time[0] = 0x00;
568 headerCWF[ i ].time[0] = 0x00;
536 headerCWF[ i ].time[0] = 0x00;
569 headerCWF[ i ].time[0] = 0x00;
537 headerCWF[ i ].time[0] = 0x00;
570 headerCWF[ i ].time[0] = 0x00;
538 }
571 }
539 return LFR_SUCCESSFUL;
572 return LFR_SUCCESSFUL;
540 }
573 }
541
574
542 int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
575 int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
543 {
576 {
544 unsigned int i;
577 unsigned int i;
545
578
546 for (i=0; i<7; i++)
579 for (i=0; i<7; i++)
547 {
580 {
548 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
581 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
549 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
582 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
550 headerCWF[ i ].reserved = DEFAULT_RESERVED;
583 headerCWF[ i ].reserved = DEFAULT_RESERVED;
551 headerCWF[ i ].userApplication = CCSDS_USER_APP;
584 headerCWF[ i ].userApplication = CCSDS_USER_APP;
552
585
553 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
586 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
554 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
587 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
555 if (i == 0)
588 if (i == 0)
556 {
589 {
557 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
590 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
558 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
591 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
559 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
592 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
560 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
593 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
561 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
594 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
562 }
595 }
563 else if (i == 6)
596 else if (i == 6)
564 {
597 {
565 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
598 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
566 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 >> 8);
599 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 >> 8);
567 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 );
600 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 );
568 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
601 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
569 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
602 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
570 }
603 }
571 else
604 else
572 {
605 {
573 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
606 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
574 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
607 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
575 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
608 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
576 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
609 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
577 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
610 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
578 }
611 }
579 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
612 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
580 // DATA FIELD HEADER
613 // DATA FIELD HEADER
581 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
614 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
582 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
615 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
583 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
616 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
584 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
617 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
585 // AUXILIARY DATA HEADER
618 // AUXILIARY DATA HEADER
586 headerCWF[ i ].sid = SID_NORM_CWF_F3;
619 headerCWF[ i ].sid = SID_NORM_CWF_F3;
587 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
620 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
588 headerCWF[ i ].time[0] = 0x00;
621 headerCWF[ i ].time[0] = 0x00;
589 headerCWF[ i ].time[0] = 0x00;
622 headerCWF[ i ].time[0] = 0x00;
590 headerCWF[ i ].time[0] = 0x00;
623 headerCWF[ i ].time[0] = 0x00;
591 headerCWF[ i ].time[0] = 0x00;
624 headerCWF[ i ].time[0] = 0x00;
592 headerCWF[ i ].time[0] = 0x00;
625 headerCWF[ i ].time[0] = 0x00;
593 headerCWF[ i ].time[0] = 0x00;
626 headerCWF[ i ].time[0] = 0x00;
594 }
627 }
595 return LFR_SUCCESSFUL;
628 return LFR_SUCCESSFUL;
596 }
629 }
597
630
598 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
631 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
599 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
632 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
600 {
633 {
601 /** This function sends SWF CCSDS packets (F2, F1 or F0).
634 /** This function sends SWF CCSDS packets (F2, F1 or F0).
602 *
635 *
603 * @param waveform points to the buffer containing the data that will be send.
636 * @param waveform points to the buffer containing the data that will be send.
604 * @param sid is the source identifier of the data that will be sent.
637 * @param sid is the source identifier of the data that will be sent.
605 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
638 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
606 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
639 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
607 * contain information to setup the transmission of the data packets.
640 * contain information to setup the transmission of the data packets.
608 *
641 *
609 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
642 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
610 *
643 *
611 */
644 */
612
645
613 unsigned int i;
646 unsigned int i;
614 int ret;
647 int ret;
615 rtems_status_code status;
648 rtems_status_code status;
616 spw_ioctl_pkt_send spw_ioctl_send_SWF;
649 spw_ioctl_pkt_send spw_ioctl_send_SWF;
617
650
618 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
651 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
619 spw_ioctl_send_SWF.options = 0;
652 spw_ioctl_send_SWF.options = 0;
620
653
621 ret = LFR_DEFAULT;
654 ret = LFR_DEFAULT;
622
655
623 for (i=0; i<7; i++) // send waveform
656 for (i=0; i<7; i++) // send waveform
624 {
657 {
625 #ifdef VHDL_DEV
658 #ifdef VHDL_DEV
626 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) + TIME_OFFSET];
659 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 304 * NB_WORDS_SWF_BLK) + TIME_OFFSET];
627 #else
660 #else
628 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
661 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 304 * NB_WORDS_SWF_BLK) ];
629 #endif
662 #endif
630 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
663 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
631 // BUILD THE DATA
664 // BUILD THE DATA
632 if (i==6) {
665 if (i==6) {
633 spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK;
666 spw_ioctl_send_SWF.dlen = 224 * NB_BYTES_SWF_BLK;
634 }
667 }
635 else {
668 else {
636 spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK;
669 spw_ioctl_send_SWF.dlen = 304 * NB_BYTES_SWF_BLK;
637 }
670 }
638 // SET PACKET SEQUENCE COUNTER
671 // SET PACKET SEQUENCE COUNTER
639 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
672 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
640 // SET PACKET TIME
673 // SET PACKET TIME
641 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
674 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
642 headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
675 headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
643 headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
676 headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
644 headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
677 headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
645 headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
678 headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
646 headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
679 headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
647 headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
680 headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
648 headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
681 headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
649 headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
682 headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
650 headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time);
683 headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time);
651 headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8);
684 headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8);
652 headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time);
685 headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time);
653 // SEND PACKET
686 // SEND PACKET
654 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
687 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
655 if (status != RTEMS_SUCCESSFUL) {
688 if (status != RTEMS_SUCCESSFUL) {
656 printf("%d-%d, ERR %d\n", sid, i, (int) status);
689 printf("%d-%d, ERR %d\n", sid, i, (int) status);
657 ret = LFR_DEFAULT;
690 ret = LFR_DEFAULT;
658 }
691 }
659 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
692 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
660 }
693 }
661
694
662 return ret;
695 return ret;
663 }
696 }
664
697
665 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
698 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
666 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
699 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
667 {
700 {
668 /** This function sends CWF CCSDS packets (F2, F1 or F0).
701 /** This function sends CWF CCSDS packets (F2, F1 or F0).
669 *
702 *
670 * @param waveform points to the buffer containing the data that will be send.
703 * @param waveform points to the buffer containing the data that will be send.
671 * @param sid is the source identifier of the data that will be sent.
704 * @param sid is the source identifier of the data that will be sent.
672 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
705 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
673 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
706 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
674 * contain information to setup the transmission of the data packets.
707 * contain information to setup the transmission of the data packets.
675 *
708 *
676 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
709 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
677 *
710 *
678 */
711 */
679
712
680 unsigned int i;
713 unsigned int i;
681 int ret;
714 int ret;
682 rtems_status_code status;
715 rtems_status_code status;
683 spw_ioctl_pkt_send spw_ioctl_send_CWF;
716 spw_ioctl_pkt_send spw_ioctl_send_CWF;
684
717
685 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
718 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
686 spw_ioctl_send_CWF.options = 0;
719 spw_ioctl_send_CWF.options = 0;
687
720
688 ret = LFR_DEFAULT;
721 ret = LFR_DEFAULT;
689
722
690 for (i=0; i<7; i++) // send waveform
723 for (i=0; i<7; i++) // send waveform
691 {
724 {
692 int coarseTime = 0x00;
725 int coarseTime = 0x00;
693 int fineTime = 0x00;
726 int fineTime = 0x00;
694 #ifdef VHDL_DEV
727 #ifdef VHDL_DEV
695 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) + TIME_OFFSET];
728 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) + TIME_OFFSET];
696 #else
729 #else
697 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
730 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
698 #endif
731 #endif
699 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
732 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
700 // BUILD THE DATA
733 // BUILD THE DATA
701 if (i==6) {
734 if (i==6) {
702 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK;
735 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK;
703 }
736 }
704 else {
737 else {
705 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK;
738 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK;
706 }
739 }
707 // SET PACKET SEQUENCE COUNTER
740 // SET PACKET SEQUENCE COUNTER
708 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
741 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
709 // SET PACKET TIME
742 // SET PACKET TIME
710 coarseTime = time_management_regs->coarse_time;
743 coarseTime = time_management_regs->coarse_time;
711 fineTime = time_management_regs->fine_time;
744 fineTime = time_management_regs->fine_time;
712 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
745 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
713 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
746 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
714 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
747 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
715 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
748 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
716 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
749 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
717 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
750 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
718 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
751 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
719 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
752 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
720 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
753 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
721 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
754 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
722 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
755 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
723 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
756 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
724 // SEND PACKET
757 // SEND PACKET
725 if (sid == SID_NORM_CWF_F3)
758 if (sid == SID_NORM_CWF_LONG_F3)
726 {
759 {
727 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
760 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
728 if (status != RTEMS_SUCCESSFUL) {
761 if (status != RTEMS_SUCCESSFUL) {
729 printf("%d-%d, ERR %d\n", sid, i, (int) status);
762 printf("%d-%d, ERR %d\n", sid, i, (int) status);
730 ret = LFR_DEFAULT;
763 ret = LFR_DEFAULT;
731 }
764 }
732 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
765 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
733 }
766 }
734 else
767 else
735 {
768 {
736 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
769 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
737 if (status != RTEMS_SUCCESSFUL) {
770 if (status != RTEMS_SUCCESSFUL) {
738 printf("%d-%d, ERR %d\n", sid, i, (int) status);
771 printf("%d-%d, ERR %d\n", sid, i, (int) status);
739 ret = LFR_DEFAULT;
772 ret = LFR_DEFAULT;
740 }
773 }
741 }
774 }
742 }
775 }
743
776
744 return ret;
777 return ret;
745 }
778 }
746
779
747 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
780 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
748 {
781 {
749 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
782 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
750 *
783 *
751 * @param waveform points to the buffer containing the data that will be send.
784 * @param waveform points to the buffer containing the data that will be send.
752 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
785 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
753 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
786 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
754 * contain information to setup the transmission of the data packets.
787 * contain information to setup the transmission of the data packets.
755 *
788 *
756 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
789 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
757 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
790 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
758 *
791 *
759 */
792 */
760
793
761 unsigned int i;
794 unsigned int i;
762 int ret;
795 int ret;
763 rtems_status_code status;
796 rtems_status_code status;
764 spw_ioctl_pkt_send spw_ioctl_send_CWF;
797 spw_ioctl_pkt_send spw_ioctl_send_CWF;
765 char *sample;
798 char *sample;
766
799
767 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
800 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
768 spw_ioctl_send_CWF.options = 0;
801 spw_ioctl_send_CWF.options = 0;
769
802
770 ret = LFR_DEFAULT;
803 ret = LFR_DEFAULT;
771
804
772 //**********************
805 //**********************
773 // BUILD CWF3_light DATA
806 // BUILD CWF3_light DATA
774 for ( i=0; i< 2048; i++)
807 for ( i=0; i< 2048; i++)
775 {
808 {
809 #ifdef VHDL_DEV
810 sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
811 #else
776 sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ];
812 sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ];
813 #endif
777 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ];
814 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ];
778 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ];
815 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ];
779 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ];
816 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ];
780 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ];
817 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ];
781 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ];
818 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ];
782 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ];
819 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ];
783 }
820 }
784
821
785 //*********************
822 //*********************
786 // SEND CWF3_light DATA
823 // SEND CWF3_light DATA
787
824
788 for (i=0; i<7; i++) // send waveform
825 for (i=0; i<7; i++) // send waveform
789 {
826 {
790 int coarseTime = 0x00;
827 int coarseTime = 0x00;
791 int fineTime = 0x00;
828 int fineTime = 0x00;
792 #ifdef VHDL_DEV
829
793 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * 340 * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET];
794 #else
795 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * 340 * NB_BYTES_CWF3_LIGHT_BLK) ];
830 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * 340 * NB_BYTES_CWF3_LIGHT_BLK) ];
796 #endif
797 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
831 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
798 // BUILD THE DATA
832 // BUILD THE DATA
799 if ( i == WFRM_INDEX_OF_LAST_PACKET ) {
833 if ( i == WFRM_INDEX_OF_LAST_PACKET ) {
800 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_CWF3_LIGHT_BLK;
834 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_CWF3_LIGHT_BLK;
801 }
835 }
802 else {
836 else {
803 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK;
837 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK;
804 }
838 }
805 // SET PACKET SEQUENCE COUNTER
839 // SET PACKET SEQUENCE COUNTER
806 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
840 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
807 // SET PACKET TIME
841 // SET PACKET TIME
808 coarseTime = time_management_regs->coarse_time;
842 coarseTime = time_management_regs->coarse_time;
809 fineTime = time_management_regs->fine_time;
843 fineTime = time_management_regs->fine_time;
810 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
844 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
811 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
845 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
812 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
846 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
813 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
847 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
814 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
848 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
815 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
849 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
816 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
850 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
817 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
851 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
818 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
852 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
819 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
853 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
820 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
854 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
821 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
855 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
822 // SEND PACKET
856 // SEND PACKET
823 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
857 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
824 if (status != RTEMS_SUCCESSFUL) {
858 if (status != RTEMS_SUCCESSFUL) {
825 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
859 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
826 ret = LFR_DEFAULT;
860 ret = LFR_DEFAULT;
827 }
861 }
828 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
862 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
829 }
863 }
830
864
831 return ret;
865 return ret;
832 }
866 }
833
867
834
868
835 //**************
869 //**************
836 // wfp registers
870 // wfp registers
837 void set_wfp_data_shaping()
871 void set_wfp_data_shaping()
838 {
872 {
839 /** This function sets the data_shaping register of the waveform picker module.
873 /** This function sets the data_shaping register of the waveform picker module.
840 *
874 *
841 * The value is read from one field of the parameter_dump_packet structure:\n
875 * The value is read from one field of the parameter_dump_packet structure:\n
842 * bw_sp0_sp1_r0_r1
876 * bw_sp0_sp1_r0_r1
843 *
877 *
844 */
878 */
845
879
846 unsigned char data_shaping;
880 unsigned char data_shaping;
847
881
848 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
882 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
849 // waveform picker : [R1 R0 SP1 SP0 BW]
883 // waveform picker : [R1 R0 SP1 SP0 BW]
850
884
851 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
885 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
852
886
853 #ifdef GSA
887 #ifdef GSA
854 #else
888 #else
855 waveform_picker_regs->data_shaping =
889 waveform_picker_regs->data_shaping =
856 ( (data_shaping & 0x10) >> 4 ) // BW
890 ( (data_shaping & 0x10) >> 4 ) // BW
857 + ( (data_shaping & 0x08) >> 2 ) // SP0
891 + ( (data_shaping & 0x08) >> 2 ) // SP0
858 + ( (data_shaping & 0x04) ) // SP1
892 + ( (data_shaping & 0x04) ) // SP1
859 + ( (data_shaping & 0x02) << 2 ) // R0
893 + ( (data_shaping & 0x02) << 2 ) // R0
860 + ( (data_shaping & 0x01) << 4 ); // R1
894 + ( (data_shaping & 0x01) << 4 ); // R1
861 #endif
895 #endif
862 }
896 }
863
897
864 char set_wfp_delta_snapshot()
898 char set_wfp_delta_snapshot()
865 {
899 {
866 /** This function sets the delta_snapshot register of the waveform picker module.
900 /** This function sets the delta_snapshot register of the waveform picker module.
867 *
901 *
868 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
902 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
869 * - sy_lfr_n_swf_p[0]
903 * - sy_lfr_n_swf_p[0]
870 * - sy_lfr_n_swf_p[1]
904 * - sy_lfr_n_swf_p[1]
871 *
905 *
872 */
906 */
873
907
874 char ret;
908 char ret;
875 unsigned int delta_snapshot;
909 unsigned int delta_snapshot;
876 unsigned int aux;
910 unsigned int aux;
877
911
878 aux = 0;
912 aux = 0;
879 ret = LFR_DEFAULT;
913 ret = LFR_DEFAULT;
880
914
881 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
915 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
882 + parameter_dump_packet.sy_lfr_n_swf_p[1];
916 + parameter_dump_packet.sy_lfr_n_swf_p[1];
883
917
884 #ifdef GSA
918 #ifdef GSA
885 #else
919 #else
886 if ( delta_snapshot < MIN_DELTA_SNAPSHOT )
920 if ( delta_snapshot < MIN_DELTA_SNAPSHOT )
887 {
921 {
888 aux = MIN_DELTA_SNAPSHOT;
922 aux = MIN_DELTA_SNAPSHOT;
889 ret = LFR_DEFAULT;
923 ret = LFR_DEFAULT;
890 }
924 }
891 else
925 else
892 {
926 {
893 aux = delta_snapshot ;
927 aux = delta_snapshot ;
894 ret = LFR_SUCCESSFUL;
928 ret = LFR_SUCCESSFUL;
895 }
929 }
896 waveform_picker_regs->delta_snapshot = aux - 1; // max 2 bytes
930 waveform_picker_regs->delta_snapshot = aux - 1; // max 2 bytes
897 #endif
931 #endif
898
932
899 return ret;
933 return ret;
900 }
934 }
901
935
902 #ifdef VHDL_DEV
936 #ifdef VHDL_DEV
903 void set_wfp_burst_enable_register( unsigned char mode )
937 void set_wfp_burst_enable_register( unsigned char mode )
904 {
938 {
905 /** This function sets the waveform picker burst_enable register depending on the mode.
939 /** This function sets the waveform picker burst_enable register depending on the mode.
906 *
940 *
907 * @param mode is the LFR mode to launch.
941 * @param mode is the LFR mode to launch.
908 *
942 *
909 * The burst bits shall be before the enable bits.
943 * The burst bits shall be before the enable bits.
910 *
944 *
911 */
945 */
912
946
913 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
947 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
914 // the burst bits shall be set first, before the enable bits
948 // the burst bits shall be set first, before the enable bits
915 switch(mode) {
949 switch(mode) {
916 case(LFR_MODE_NORMAL):
950 case(LFR_MODE_NORMAL):
917 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable
951 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable
918 waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
952 waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
919 break;
953 break;
920 case(LFR_MODE_BURST):
954 case(LFR_MODE_BURST):
921 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
955 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
922 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2
956 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2
923 break;
957 break;
924 case(LFR_MODE_SBM1):
958 case(LFR_MODE_SBM1):
925 waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled
959 waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled
926 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
960 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
927 break;
961 break;
928 case(LFR_MODE_SBM2):
962 case(LFR_MODE_SBM2):
929 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
963 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
930 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
964 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
931 break;
965 break;
932 default:
966 default:
933 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
967 waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
934 break;
968 break;
935 }
969 }
936 }
970 }
937 #else
971 #else
938 void set_wfp_burst_enable_register( unsigned char mode )
972 void set_wfp_burst_enable_register( unsigned char mode )
939 {
973 {
940 /** This function sets the waveform picker burst_enable register depending on the mode.
974 /** This function sets the waveform picker burst_enable register depending on the mode.
941 *
975 *
942 * @param mode is the LFR mode to launch.
976 * @param mode is the LFR mode to launch.
943 *
977 *
944 * The burst bits shall be before the enable bits.
978 * The burst bits shall be before the enable bits.
945 *
979 *
946 */
980 */
947
981
948 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
982 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
949 // the burst bits shall be set first, before the enable bits
983 // the burst bits shall be set first, before the enable bits
950 switch(mode) {
984 switch(mode) {
951 case(LFR_MODE_NORMAL):
985 case(LFR_MODE_NORMAL):
952 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enable
986 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enable
953 waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
987 waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
954 break;
988 break;
955 case(LFR_MODE_BURST):
989 case(LFR_MODE_BURST):
956 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
990 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
957 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2
991 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2
958 break;
992 break;
959 case(LFR_MODE_SBM1):
993 case(LFR_MODE_SBM1):
960 waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled
994 waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled
961 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
995 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
962 break;
996 break;
963 case(LFR_MODE_SBM2):
997 case(LFR_MODE_SBM2):
964 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
998 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
965 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
999 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
966 break;
1000 break;
967 default:
1001 default:
968 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1002 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
969 break;
1003 break;
970 }
1004 }
971 }
1005 }
972 #endif
1006 #endif
973
1007
974 void reset_wfp_burst_enable()
1008 void reset_wfp_burst_enable()
975 {
1009 {
976 /** This function resets the waveform picker burst_enable register.
1010 /** This function resets the waveform picker burst_enable register.
977 *
1011 *
978 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
1012 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
979 *
1013 *
980 */
1014 */
981
1015
982 #ifdef VHDL_DEV
1016 #ifdef VHDL_DEV
983 waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1017 waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
984 #else
1018 #else
985 waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1019 waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
986 #endif
1020 #endif
987 }
1021 }
988
1022
989 void reset_wfp_status()
1023 void reset_wfp_status()
990 {
1024 {
991 /** This function resets the waveform picker status register.
1025 /** This function resets the waveform picker status register.
992 *
1026 *
993 * All status bits are set to 0 [new_err full_err full].
1027 * All status bits are set to 0 [new_err full_err full].
994 *
1028 *
995 */
1029 */
996
1030
997 #ifdef GSA
1031 #ifdef GSA
998 #else
1032 #else
999 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1033 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1000 #endif
1034 #endif
1001 }
1035 }
1002
1036
1003 #ifdef VHDL_DEV
1037 #ifdef VHDL_DEV
1004 void reset_waveform_picker_regs()
1038 void reset_waveform_picker_regs()
1005 {
1039 {
1006 /** This function resets the waveform picker module registers.
1040 /** This function resets the waveform picker module registers.
1007 *
1041 *
1008 * The registers affected by this function are located at the following offset addresses:
1042 * The registers affected by this function are located at the following offset addresses:
1009 * - 0x00 data_shaping
1043 * - 0x00 data_shaping
1010 * - 0x04 run_burst_enable
1044 * - 0x04 run_burst_enable
1011 * - 0x08 addr_data_f0
1045 * - 0x08 addr_data_f0
1012 * - 0x0C addr_data_f1
1046 * - 0x0C addr_data_f1
1013 * - 0x10 addr_data_f2
1047 * - 0x10 addr_data_f2
1014 * - 0x14 addr_data_f3
1048 * - 0x14 addr_data_f3
1015 * - 0x18 status
1049 * - 0x18 status
1016 * - 0x1C delta_snapshot
1050 * - 0x1C delta_snapshot
1017 * - 0x20 delta_f0
1051 * - 0x20 delta_f0
1018 * - 0x24 delta_f0_2
1052 * - 0x24 delta_f0_2
1019 * - 0x28 delta_f1
1053 * - 0x28 delta_f1
1020 * - 0x2c delta_f2
1054 * - 0x2c delta_f2
1021 * - 0x30 nb_data_by_buffer
1055 * - 0x30 nb_data_by_buffer
1022 * - 0x34 nb_snapshot_param
1056 * - 0x34 nb_snapshot_param
1023 * - 0x38 start_date
1057 * - 0x38 start_date
1024 * - 0x3c nb_word_in_buffer
1058 * - 0x3c nb_word_in_buffer
1025 *
1059 *
1026 */
1060 */
1027 waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW
1061 waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW
1028 waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1062 waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1029 waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // 0x08
1063 //waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // 0x08
1064 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08
1030 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c
1065 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c
1031 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10
1066 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10
1032 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14
1067 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14
1033 waveform_picker_regs->status = 0x00; // 0x18
1068 waveform_picker_regs->status = 0x00; // 0x18
1034 // waveform_picker_regs->delta_snapshot = 0x12800; // 0x1c 296 * 256 = 75776
1069 // waveform_picker_regs->delta_snapshot = 0x12800; // 0x1c 296 * 256 = 75776
1035 // waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c 16 * 256 = 4096
1070 waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c 16 * 256 = 4096
1036 waveform_picker_regs->delta_snapshot = 0x2000; // 0x1c 32 * 256 = 8192
1071 //waveform_picker_regs->delta_snapshot = 0x2000; // 0x1c 32 * 256 = 8192
1037 waveform_picker_regs->delta_f0 = 0xbf5; // 0x20 *** 1013
1072 waveform_picker_regs->delta_f0 = 0xbf5; // 0x20 *** 1013
1038 waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits]
1073 waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits]
1039 waveform_picker_regs->delta_f1 = 0xbc0; // 0x28 *** 960
1074 waveform_picker_regs->delta_f1 = 0xbc0; // 0x28 *** 960
1040 // waveform_picker_regs->delta_f2 = 0x12200; // 0x2c *** 290 * 256 = 74240
1075 // waveform_picker_regs->delta_f2 = 0x12200; // 0x2c *** 290 * 256 = 74240
1041 waveform_picker_regs->delta_f2 = 0xc00; // 0x2c *** 12 * 256 = 3072
1076 waveform_picker_regs->delta_f2 = 0xc00; // 0x2c *** 12 * 256 = 3072
1042 waveform_picker_regs->nb_data_by_buffer = 0x7ff; // 0x30 *** 2048 -1 => nb samples -1
1077 waveform_picker_regs->nb_data_by_buffer = 0x7ff; // 0x30 *** 2048 -1 => nb samples -1
1043 waveform_picker_regs->snapshot_param = 0x800; // 0x34 *** 2048 => nb samples
1078 waveform_picker_regs->snapshot_param = 0x800; // 0x34 *** 2048 => nb samples
1044 waveform_picker_regs->start_date = 0x00; // 0x38
1079 waveform_picker_regs->start_date = 0x00; // 0x38
1045 waveform_picker_regs->nb_word_in_buffer = 0x1802; // 0x3c *** 2048 * 3 + 2 = 6146
1080 waveform_picker_regs->nb_word_in_buffer = 0x1802; // 0x3c *** 2048 * 3 + 2 = 6146
1046 }
1081 }
1047 #else
1082 #else
1048 void reset_waveform_picker_regs()
1083 void reset_waveform_picker_regs()
1049 {
1084 {
1050 /** This function resets the waveform picker module registers.
1085 /** This function resets the waveform picker module registers.
1051 *
1086 *
1052 * The registers affected by this function are located at the following offset addresses:
1087 * The registers affected by this function are located at the following offset addresses:
1053 * - 0x00 data_shaping
1088 * - 0x00 data_shaping
1054 * - 0x04 burst_enable
1089 * - 0x04 burst_enable
1055 * - 0x08 addr_data_f0
1090 * - 0x08 addr_data_f0
1056 * - 0x0C addr_data_f1
1091 * - 0x0C addr_data_f1
1057 * - 0x10 addr_data_f2
1092 * - 0x10 addr_data_f2
1058 * - 0x14 addr_data_f3
1093 * - 0x14 addr_data_f3
1059 * - 0x18 status
1094 * - 0x18 status
1060 * - 0x1C delta_snapshot
1095 * - 0x1C delta_snapshot
1061 * - 0x20 delta_f2_f1
1096 * - 0x20 delta_f2_f1
1062 * - 0x24 delta_f2_f0
1097 * - 0x24 delta_f2_f0
1063 * - 0x28 nb_burst
1098 * - 0x28 nb_burst
1064 * - 0x2C nb_snapshot
1099 * - 0x2C nb_snapshot
1065 *
1100 *
1066 */
1101 */
1067
1102
1068 reset_wfp_burst_enable();
1103 reset_wfp_burst_enable();
1069 reset_wfp_status();
1104 reset_wfp_status();
1070 // set buffer addresses
1105 // set buffer addresses
1071 waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0);
1106 waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0);
1072 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
1107 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address;
1073 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
1108 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address;
1074 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a);
1109 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a);
1075 // set other parameters
1110 // set other parameters
1076 set_wfp_data_shaping();
1111 set_wfp_data_shaping();
1077 set_wfp_delta_snapshot(); // time in seconds between two snapshots
1112 set_wfp_delta_snapshot(); // time in seconds between two snapshots
1078 waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes)
1113 waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes)
1079 waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes)
1114 waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes)
1080 // waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
1115 // waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
1081 // // 3 * 2048 / 16 = 384
1116 // // 3 * 2048 / 16 = 384
1082 // waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1
1117 // waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1
1083 waveform_picker_regs->nb_burst_available = 0x1b9; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
1118 waveform_picker_regs->nb_burst_available = 0x1b9; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
1084 // 3 * 2352 / 16 = 441
1119 // 3 * 2352 / 16 = 441
1085 waveform_picker_regs->nb_snapshot_param = 0x944; // max 3 octets, 2372 - 1
1120 waveform_picker_regs->nb_snapshot_param = 0x944; // max 3 octets, 2372 - 1
1086 }
1121 }
1087 #endif
1122 #endif
1088
1123
1089 //*****************
1124 //*****************
1090 // local parameters
1125 // local parameters
1091 void set_local_nb_interrupt_f0_MAX( void )
1126 void set_local_nb_interrupt_f0_MAX( void )
1092 {
1127 {
1093 /** 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.
1094 *
1129 *
1095 * This parameter is used for the SM validation only.\n
1130 * This parameter is used for the SM validation only.\n
1096 * 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
1097 * module before launching a basic processing.
1132 * module before launching a basic processing.
1098 *
1133 *
1099 */
1134 */
1100
1135
1101 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
1102 + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100;
1137 + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100;
1103 }
1138 }
1104
1139
1105 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1140 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1106 {
1141 {
1107 unsigned short *sequence_cnt;
1142 unsigned short *sequence_cnt;
1108 unsigned short segmentation_grouping_flag;
1143 unsigned short segmentation_grouping_flag;
1109 unsigned short new_packet_sequence_control;
1144 unsigned short new_packet_sequence_control;
1110
1145
1111 if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2)
1146 if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2)
1112 || (sid ==SID_NORM_CWF_F3) || (sid ==SID_BURST_CWF_F2) )
1147 || (sid ==SID_NORM_CWF_F3) || (sid==SID_NORM_CWF_LONG_F3) || (sid ==SID_BURST_CWF_F2) )
1113 {
1148 {
1114 sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST;
1149 sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST;
1115 }
1150 }
1116 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) )
1151 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) )
1117 {
1152 {
1118 sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2;
1153 sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2;
1119 }
1154 }
1120 else
1155 else
1121 {
1156 {
1122 sequence_cnt = NULL;
1157 sequence_cnt = NULL;
1123 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1158 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1124 }
1159 }
1125
1160
1126 if (sequence_cnt != NULL)
1161 if (sequence_cnt != NULL)
1127 {
1162 {
1128 segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8;
1163 segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8;
1129 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1164 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1130
1165
1131 new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ;
1166 new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ;
1132
1167
1133 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1168 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1134 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1169 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1135
1170
1136 // increment the sequence counter for the next packet
1171 // increment the sequence counter for the next packet
1137 if ( *sequence_cnt < SEQ_CNT_MAX)
1172 if ( *sequence_cnt < SEQ_CNT_MAX)
1138 {
1173 {
1139 *sequence_cnt = *sequence_cnt + 1;
1174 *sequence_cnt = *sequence_cnt + 1;
1140 }
1175 }
1141 else
1176 else
1142 {
1177 {
1143 *sequence_cnt = 0;
1178 *sequence_cnt = 0;
1144 }
1179 }
1145 }
1180 }
1146 }
1181 }
General Comments 0
You need to be logged in to leave comments. Login now