##// END OF EJS Templates
A few changes to debug the VHDL design update
paul -
r83:e32329954fdb nov2013
parent child
Show More
@@ -1,248 +1,248
1 #############################################################################
1 #############################################################################
2 # Makefile for building: bin/fsw
2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Fri Nov 15 07:19:44 2013
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Nov 19 13:58:57 2013
4 # Project: fsw-qt.pro
4 # Project: fsw-qt.pro
5 # Template: app
5 # Template: app
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
7 #############################################################################
7 #############################################################################
8
8
9 ####### Compiler, tools and options
9 ####### Compiler, tools and options
10
10
11 CC = sparc-rtems-gcc
11 CC = sparc-rtems-gcc
12 CXX = sparc-rtems-g++
12 CXX = sparc-rtems-g++
13 DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=22 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS
13 DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=22 -DPRINT_MESSAGES_ON_CONSOLE
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header
17 LINK = sparc-rtems-g++
17 LINK = sparc-rtems-g++
18 LFLAGS =
18 LFLAGS =
19 LIBS = $(SUBLIBS)
19 LIBS = $(SUBLIBS)
20 AR = sparc-rtems-ar rcs
20 AR = sparc-rtems-ar rcs
21 RANLIB =
21 RANLIB =
22 QMAKE = /usr/bin/qmake-qt4
22 QMAKE = /usr/bin/qmake-qt4
23 TAR = tar -cf
23 TAR = tar -cf
24 COMPRESS = gzip -9f
24 COMPRESS = gzip -9f
25 COPY = cp -f
25 COPY = cp -f
26 SED = sed
26 SED = sed
27 COPY_FILE = $(COPY)
27 COPY_FILE = $(COPY)
28 COPY_DIR = $(COPY) -r
28 COPY_DIR = $(COPY) -r
29 STRIP = sparc-rtems-strip
29 STRIP = sparc-rtems-strip
30 INSTALL_FILE = install -m 644 -p
30 INSTALL_FILE = install -m 644 -p
31 INSTALL_DIR = $(COPY_DIR)
31 INSTALL_DIR = $(COPY_DIR)
32 INSTALL_PROGRAM = install -m 755 -p
32 INSTALL_PROGRAM = install -m 755 -p
33 DEL_FILE = rm -f
33 DEL_FILE = rm -f
34 SYMLINK = ln -f -s
34 SYMLINK = ln -f -s
35 DEL_DIR = rmdir
35 DEL_DIR = rmdir
36 MOVE = mv -f
36 MOVE = mv -f
37 CHK_DIR_EXISTS= test -d
37 CHK_DIR_EXISTS= test -d
38 MKDIR = mkdir -p
38 MKDIR = mkdir -p
39
39
40 ####### Output directory
40 ####### Output directory
41
41
42 OBJECTS_DIR = obj/
42 OBJECTS_DIR = obj/
43
43
44 ####### Files
44 ####### Files
45
45
46 SOURCES = ../src/wf_handler.c \
46 SOURCES = ../src/wf_handler.c \
47 ../src/tc_handler.c \
47 ../src/tc_handler.c \
48 ../src/fsw_processing.c \
48 ../src/fsw_processing.c \
49 ../src/fsw_misc.c \
49 ../src/fsw_misc.c \
50 ../src/fsw_init.c \
50 ../src/fsw_init.c \
51 ../src/fsw_globals.c \
51 ../src/fsw_globals.c \
52 ../src/fsw_spacewire.c \
52 ../src/fsw_spacewire.c \
53 ../src/tc_load_dump_parameters.c \
53 ../src/tc_load_dump_parameters.c \
54 ../src/tm_lfr_tc_exe.c \
54 ../src/tm_lfr_tc_exe.c \
55 ../src/tc_acceptance.c
55 ../src/tc_acceptance.c
56 OBJECTS = obj/wf_handler.o \
56 OBJECTS = obj/wf_handler.o \
57 obj/tc_handler.o \
57 obj/tc_handler.o \
58 obj/fsw_processing.o \
58 obj/fsw_processing.o \
59 obj/fsw_misc.o \
59 obj/fsw_misc.o \
60 obj/fsw_init.o \
60 obj/fsw_init.o \
61 obj/fsw_globals.o \
61 obj/fsw_globals.o \
62 obj/fsw_spacewire.o \
62 obj/fsw_spacewire.o \
63 obj/tc_load_dump_parameters.o \
63 obj/tc_load_dump_parameters.o \
64 obj/tm_lfr_tc_exe.o \
64 obj/tm_lfr_tc_exe.o \
65 obj/tc_acceptance.o
65 obj/tc_acceptance.o
66 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
66 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
67 /usr/lib64/qt4/mkspecs/common/linux.conf \
67 /usr/lib64/qt4/mkspecs/common/linux.conf \
68 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
68 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
69 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
69 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
70 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
70 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
71 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
71 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
72 /usr/lib64/qt4/mkspecs/qconfig.pri \
72 /usr/lib64/qt4/mkspecs/qconfig.pri \
73 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
73 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
74 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
74 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
75 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
75 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
76 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
76 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
77 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
77 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
78 sparc.pri \
78 sparc.pri \
79 /usr/lib64/qt4/mkspecs/features/release.prf \
79 /usr/lib64/qt4/mkspecs/features/release.prf \
80 /usr/lib64/qt4/mkspecs/features/default_post.prf \
80 /usr/lib64/qt4/mkspecs/features/default_post.prf \
81 /usr/lib64/qt4/mkspecs/features/shared.prf \
81 /usr/lib64/qt4/mkspecs/features/shared.prf \
82 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
82 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
83 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
83 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
84 /usr/lib64/qt4/mkspecs/features/resources.prf \
84 /usr/lib64/qt4/mkspecs/features/resources.prf \
85 /usr/lib64/qt4/mkspecs/features/uic.prf \
85 /usr/lib64/qt4/mkspecs/features/uic.prf \
86 /usr/lib64/qt4/mkspecs/features/yacc.prf \
86 /usr/lib64/qt4/mkspecs/features/yacc.prf \
87 /usr/lib64/qt4/mkspecs/features/lex.prf \
87 /usr/lib64/qt4/mkspecs/features/lex.prf \
88 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
88 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
89 fsw-qt.pro
89 fsw-qt.pro
90 QMAKE_TARGET = fsw
90 QMAKE_TARGET = fsw
91 DESTDIR = bin/
91 DESTDIR = bin/
92 TARGET = bin/fsw
92 TARGET = bin/fsw
93
93
94 first: all
94 first: all
95 ####### Implicit rules
95 ####### Implicit rules
96
96
97 .SUFFIXES: .o .c .cpp .cc .cxx .C
97 .SUFFIXES: .o .c .cpp .cc .cxx .C
98
98
99 .cpp.o:
99 .cpp.o:
100 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
100 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
101
101
102 .cc.o:
102 .cc.o:
103 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
103 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
104
104
105 .cxx.o:
105 .cxx.o:
106 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
106 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
107
107
108 .C.o:
108 .C.o:
109 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
109 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
110
110
111 .c.o:
111 .c.o:
112 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
112 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
113
113
114 ####### Build rules
114 ####### Build rules
115
115
116 all: Makefile $(TARGET)
116 all: Makefile $(TARGET)
117
117
118 $(TARGET): $(OBJECTS)
118 $(TARGET): $(OBJECTS)
119 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
119 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
120 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
120 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
121
121
122 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
122 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
123 /usr/lib64/qt4/mkspecs/common/linux.conf \
123 /usr/lib64/qt4/mkspecs/common/linux.conf \
124 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
124 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
125 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
125 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
126 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
126 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
127 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
127 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
128 /usr/lib64/qt4/mkspecs/qconfig.pri \
128 /usr/lib64/qt4/mkspecs/qconfig.pri \
129 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
129 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
130 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
130 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
131 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
131 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
132 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
132 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
133 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
133 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
134 sparc.pri \
134 sparc.pri \
135 /usr/lib64/qt4/mkspecs/features/release.prf \
135 /usr/lib64/qt4/mkspecs/features/release.prf \
136 /usr/lib64/qt4/mkspecs/features/default_post.prf \
136 /usr/lib64/qt4/mkspecs/features/default_post.prf \
137 /usr/lib64/qt4/mkspecs/features/shared.prf \
137 /usr/lib64/qt4/mkspecs/features/shared.prf \
138 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
138 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
139 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
139 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
140 /usr/lib64/qt4/mkspecs/features/resources.prf \
140 /usr/lib64/qt4/mkspecs/features/resources.prf \
141 /usr/lib64/qt4/mkspecs/features/uic.prf \
141 /usr/lib64/qt4/mkspecs/features/uic.prf \
142 /usr/lib64/qt4/mkspecs/features/yacc.prf \
142 /usr/lib64/qt4/mkspecs/features/yacc.prf \
143 /usr/lib64/qt4/mkspecs/features/lex.prf \
143 /usr/lib64/qt4/mkspecs/features/lex.prf \
144 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
144 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
145 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
145 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
146 /usr/lib64/qt4/mkspecs/common/unix.conf:
146 /usr/lib64/qt4/mkspecs/common/unix.conf:
147 /usr/lib64/qt4/mkspecs/common/linux.conf:
147 /usr/lib64/qt4/mkspecs/common/linux.conf:
148 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
148 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
149 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
149 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
150 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
150 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
151 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
151 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
152 /usr/lib64/qt4/mkspecs/qconfig.pri:
152 /usr/lib64/qt4/mkspecs/qconfig.pri:
153 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
153 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
154 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
154 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
155 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
155 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
156 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
156 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
157 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
157 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
158 sparc.pri:
158 sparc.pri:
159 /usr/lib64/qt4/mkspecs/features/release.prf:
159 /usr/lib64/qt4/mkspecs/features/release.prf:
160 /usr/lib64/qt4/mkspecs/features/default_post.prf:
160 /usr/lib64/qt4/mkspecs/features/default_post.prf:
161 /usr/lib64/qt4/mkspecs/features/shared.prf:
161 /usr/lib64/qt4/mkspecs/features/shared.prf:
162 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
162 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
163 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
163 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
164 /usr/lib64/qt4/mkspecs/features/resources.prf:
164 /usr/lib64/qt4/mkspecs/features/resources.prf:
165 /usr/lib64/qt4/mkspecs/features/uic.prf:
165 /usr/lib64/qt4/mkspecs/features/uic.prf:
166 /usr/lib64/qt4/mkspecs/features/yacc.prf:
166 /usr/lib64/qt4/mkspecs/features/yacc.prf:
167 /usr/lib64/qt4/mkspecs/features/lex.prf:
167 /usr/lib64/qt4/mkspecs/features/lex.prf:
168 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
168 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
169 qmake: FORCE
169 qmake: FORCE
170 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
170 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
171
171
172 dist:
172 dist:
173 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
173 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
174 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0
174 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0
175
175
176
176
177 clean:compiler_clean
177 clean:compiler_clean
178 -$(DEL_FILE) $(OBJECTS)
178 -$(DEL_FILE) $(OBJECTS)
179 -$(DEL_FILE) *~ core *.core
179 -$(DEL_FILE) *~ core *.core
180
180
181
181
182 ####### Sub-libraries
182 ####### Sub-libraries
183
183
184 distclean: clean
184 distclean: clean
185 -$(DEL_FILE) $(TARGET)
185 -$(DEL_FILE) $(TARGET)
186 -$(DEL_FILE) Makefile
186 -$(DEL_FILE) Makefile
187
187
188
188
189 grmon:
189 grmon:
190 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
190 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
191
191
192 check: first
192 check: first
193
193
194 compiler_rcc_make_all:
194 compiler_rcc_make_all:
195 compiler_rcc_clean:
195 compiler_rcc_clean:
196 compiler_uic_make_all:
196 compiler_uic_make_all:
197 compiler_uic_clean:
197 compiler_uic_clean:
198 compiler_image_collection_make_all: qmake_image_collection.cpp
198 compiler_image_collection_make_all: qmake_image_collection.cpp
199 compiler_image_collection_clean:
199 compiler_image_collection_clean:
200 -$(DEL_FILE) qmake_image_collection.cpp
200 -$(DEL_FILE) qmake_image_collection.cpp
201 compiler_yacc_decl_make_all:
201 compiler_yacc_decl_make_all:
202 compiler_yacc_decl_clean:
202 compiler_yacc_decl_clean:
203 compiler_yacc_impl_make_all:
203 compiler_yacc_impl_make_all:
204 compiler_yacc_impl_clean:
204 compiler_yacc_impl_clean:
205 compiler_lex_make_all:
205 compiler_lex_make_all:
206 compiler_lex_clean:
206 compiler_lex_clean:
207 compiler_clean:
207 compiler_clean:
208
208
209 ####### Compile
209 ####### Compile
210
210
211 obj/wf_handler.o: ../src/wf_handler.c
211 obj/wf_handler.o: ../src/wf_handler.c
212 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
212 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
213
213
214 obj/tc_handler.o: ../src/tc_handler.c
214 obj/tc_handler.o: ../src/tc_handler.c
215 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
215 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
216
216
217 obj/fsw_processing.o: ../src/fsw_processing.c ../src/fsw_processing_globals.c
217 obj/fsw_processing.o: ../src/fsw_processing.c ../src/fsw_processing_globals.c
218 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c
218 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c
219
219
220 obj/fsw_misc.o: ../src/fsw_misc.c
220 obj/fsw_misc.o: ../src/fsw_misc.c
221 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
221 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
222
222
223 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
223 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
224 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
224 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
225
225
226 obj/fsw_globals.o: ../src/fsw_globals.c
226 obj/fsw_globals.o: ../src/fsw_globals.c
227 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
227 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
228
228
229 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
229 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
230 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
230 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
231
231
232 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
232 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
233 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
233 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
234
234
235 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
235 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
236 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
236 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
237
237
238 obj/tc_acceptance.o: ../src/tc_acceptance.c
238 obj/tc_acceptance.o: ../src/tc_acceptance.c
239 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
239 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
240
240
241 ####### Install
241 ####### Install
242
242
243 install: FORCE
243 install: FORCE
244
244
245 uninstall: FORCE
245 uninstall: FORCE
246
246
247 FORCE:
247 FORCE:
248
248
@@ -1,78 +1,78
1 TEMPLATE = app
1 TEMPLATE = app
2 # CONFIG += console v8 sim
2 # CONFIG += console v8 sim
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** gsa
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** gsa
4 CONFIG += console verbose cpu_usage_report
4 CONFIG += console verbose
5 CONFIG -= qt
5 CONFIG -= qt
6
6
7 include(./sparc.pri)
7 include(./sparc.pri)
8
8
9 # flight software version
9 # flight software version
10 SWVERSION=-0-22
10 SWVERSION=-0-22
11 DEFINES += SW_VERSION_N1=0
11 DEFINES += SW_VERSION_N1=0
12 DEFINES += SW_VERSION_N2=0
12 DEFINES += SW_VERSION_N2=0
13 DEFINES += SW_VERSION_N3=0
13 DEFINES += SW_VERSION_N3=0
14 DEFINES += SW_VERSION_N4=22
14 DEFINES += SW_VERSION_N4=22
15
15
16 contains( CONFIG, verbose ) {
16 contains( CONFIG, verbose ) {
17 DEFINES += PRINT_MESSAGES_ON_CONSOLE
17 DEFINES += PRINT_MESSAGES_ON_CONSOLE
18 }
18 }
19
19
20 contains( CONFIG, debug_messages ) {
20 contains( CONFIG, debug_messages ) {
21 DEFINES += DEBUG_MESSAGES
21 DEFINES += DEBUG_MESSAGES
22 }
22 }
23
23
24 contains( CONFIG, cpu_usage_report ) {
24 contains( CONFIG, cpu_usage_report ) {
25 DEFINES += PRINT_TASK_STATISTICS
25 DEFINES += PRINT_TASK_STATISTICS
26 }
26 }
27
27
28 contains( CONFIG, stack_report ) {
28 contains( CONFIG, stack_report ) {
29 DEFINES += PRINT_STACK_REPORT
29 DEFINES += PRINT_STACK_REPORT
30 }
30 }
31
31
32 contains( CONFIG, boot_messages ) {
32 contains( CONFIG, boot_messages ) {
33 DEFINES += BOOT_MESSAGES
33 DEFINES += BOOT_MESSAGES
34 }
34 }
35
35
36 #doxygen.target = doxygen
36 #doxygen.target = doxygen
37 #doxygen.commands = doxygen ../doc/Doxyfile
37 #doxygen.commands = doxygen ../doc/Doxyfile
38 #QMAKE_EXTRA_TARGETS += doxygen
38 #QMAKE_EXTRA_TARGETS += doxygen
39
39
40 TARGET = fsw
40 TARGET = fsw
41 contains( CONFIG, gsa ) {
41 contains( CONFIG, gsa ) {
42 DEFINES += GSA
42 DEFINES += GSA
43 TARGET = fsw-gsa
43 TARGET = fsw-gsa
44 }
44 }
45
45
46 INCLUDEPATH += \
46 INCLUDEPATH += \
47 ../src \
47 ../src \
48 ../header
48 ../header
49
49
50 SOURCES += \
50 SOURCES += \
51 ../src/wf_handler.c \
51 ../src/wf_handler.c \
52 ../src/tc_handler.c \
52 ../src/tc_handler.c \
53 ../src/fsw_processing.c \
53 ../src/fsw_processing.c \
54 ../src/fsw_misc.c \
54 ../src/fsw_misc.c \
55 ../src/fsw_init.c \
55 ../src/fsw_init.c \
56 ../src/fsw_globals.c \
56 ../src/fsw_globals.c \
57 ../src/fsw_spacewire.c \
57 ../src/fsw_spacewire.c \
58 ../src/tc_load_dump_parameters.c \
58 ../src/tc_load_dump_parameters.c \
59 ../src/tm_lfr_tc_exe.c \
59 ../src/tm_lfr_tc_exe.c \
60 ../src/tc_acceptance.c
60 ../src/tc_acceptance.c
61
61
62
62
63 HEADERS += \
63 HEADERS += \
64 ../header/wf_handler.h \
64 ../header/wf_handler.h \
65 ../header/tc_handler.h \
65 ../header/tc_handler.h \
66 ../header/grlib_regs.h \
66 ../header/grlib_regs.h \
67 ../header/fsw_processing.h \
67 ../header/fsw_processing.h \
68 ../header/fsw_params.h \
68 ../header/fsw_params.h \
69 ../header/fsw_misc.h \
69 ../header/fsw_misc.h \
70 ../header/fsw_init.h \
70 ../header/fsw_init.h \
71 ../header/ccsds_types.h \
71 ../header/ccsds_types.h \
72 ../header/fsw_params_processing.h \
72 ../header/fsw_params_processing.h \
73 ../header/fsw_spacewire.h \
73 ../header/fsw_spacewire.h \
74 ../header/tm_byte_positions.h \
74 ../header/tm_byte_positions.h \
75 ../header/tc_load_dump_parameters.h \
75 ../header/tc_load_dump_parameters.h \
76 ../header/tm_lfr_tc_exe.h \
76 ../header/tm_lfr_tc_exe.h \
77 ../header/tc_acceptance.h
77 ../header/tc_acceptance.h
78
78
@@ -1,305 +1,305
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 2.8.1, 2013-11-15T16:54:28. -->
3 <!-- Written by QtCreator 2.8.1, 2013-11-21T16:57:00. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
7 <value type="int">0</value>
7 <value type="int">0</value>
8 </data>
8 </data>
9 <data>
9 <data>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
11 <valuemap type="QVariantMap">
11 <valuemap type="QVariantMap">
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
16 <value type="QString" key="language">Cpp</value>
16 <value type="QString" key="language">Cpp</value>
17 <valuemap type="QVariantMap" key="value">
17 <valuemap type="QVariantMap" key="value">
18 <value type="QString" key="CurrentPreferences">CppGlobal</value>
18 <value type="QString" key="CurrentPreferences">CppGlobal</value>
19 </valuemap>
19 </valuemap>
20 </valuemap>
20 </valuemap>
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
22 <value type="QString" key="language">QmlJS</value>
22 <value type="QString" key="language">QmlJS</value>
23 <valuemap type="QVariantMap" key="value">
23 <valuemap type="QVariantMap" key="value">
24 <value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
24 <value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
25 </valuemap>
25 </valuemap>
26 </valuemap>
26 </valuemap>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
28 <value type="QByteArray" key="EditorConfiguration.Codec">System</value>
28 <value type="QByteArray" key="EditorConfiguration.Codec">System</value>
29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
32 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
32 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
33 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
33 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
34 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
34 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
35 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
35 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
36 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
36 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
37 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
37 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
38 <value type="int" key="EditorConfiguration.TabSize">8</value>
38 <value type="int" key="EditorConfiguration.TabSize">8</value>
39 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
39 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
40 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
40 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
41 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
41 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
42 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
42 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
43 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
43 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
44 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
44 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
45 </valuemap>
45 </valuemap>
46 </data>
46 </data>
47 <data>
47 <data>
48 <variable>ProjectExplorer.Project.PluginSettings</variable>
48 <variable>ProjectExplorer.Project.PluginSettings</variable>
49 <valuemap type="QVariantMap"/>
49 <valuemap type="QVariantMap"/>
50 </data>
50 </data>
51 <data>
51 <data>
52 <variable>ProjectExplorer.Project.Target.0</variable>
52 <variable>ProjectExplorer.Project.Target.0</variable>
53 <valuemap type="QVariantMap">
53 <valuemap type="QVariantMap">
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">1</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">1</value>
60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
61 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
61 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
63 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
63 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
64 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
64 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
67 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
67 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
69 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
69 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
70 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
70 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
71 </valuemap>
71 </valuemap>
72 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
72 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
73 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
73 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
74 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
74 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
77 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
77 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
78 <value type="QString">-w</value>
78 <value type="QString">-w</value>
79 <value type="QString">-r</value>
79 <value type="QString">-r</value>
80 </valuelist>
80 </valuelist>
81 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
81 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
82 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w -j 4</value>
82 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w -j 4</value>
83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
84 </valuemap>
84 </valuemap>
85 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
85 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
86 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
86 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
89 </valuemap>
89 </valuemap>
90 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
90 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
92 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
92 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
93 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
93 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
96 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
96 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
97 <value type="QString">-w</value>
97 <value type="QString">-w</value>
98 <value type="QString">-r</value>
98 <value type="QString">-r</value>
99 </valuelist>
99 </valuelist>
100 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
100 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
101 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value>
101 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value>
102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
103 </valuemap>
103 </valuemap>
104 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
104 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
105 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
105 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
108 </valuemap>
108 </valuemap>
109 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
109 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
110 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
110 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
111 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
111 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
112 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value>
112 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
115 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
115 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
116 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
116 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
118 </valuemap>
118 </valuemap>
119 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
119 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
120 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
120 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
122 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
122 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
126 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
126 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
127 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
127 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
128 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
128 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
129 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
129 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
130 </valuemap>
130 </valuemap>
131 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
131 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
132 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
132 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
133 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
133 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
134 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
134 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
136 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
136 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
137 <value type="QString">-w</value>
137 <value type="QString">-w</value>
138 <value type="QString">-r</value>
138 <value type="QString">-r</value>
139 </valuelist>
139 </valuelist>
140 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
140 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
141 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w </value>
141 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w </value>
142 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
142 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
143 </valuemap>
143 </valuemap>
144 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
144 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
145 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
145 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
146 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
146 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
147 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
147 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
148 </valuemap>
148 </valuemap>
149 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
149 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
150 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
150 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
151 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
151 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
152 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
152 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
153 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
153 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
154 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
154 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
155 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
155 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
156 <value type="QString">-w</value>
156 <value type="QString">-w</value>
157 <value type="QString">-r</value>
157 <value type="QString">-r</value>
158 </valuelist>
158 </valuelist>
159 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
159 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
160 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value>
160 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value>
161 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
161 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
162 </valuemap>
162 </valuemap>
163 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
163 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
164 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
164 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
165 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
165 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
166 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
166 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
167 </valuemap>
167 </valuemap>
168 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
168 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
169 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
169 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
170 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
170 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
171 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value>
171 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
174 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
174 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
175 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
175 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
176 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
176 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
177 </valuemap>
177 </valuemap>
178 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
178 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
179 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
179 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
180 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
180 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
181 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
181 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
182 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
182 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
183 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
183 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
184 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
184 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
185 </valuemap>
185 </valuemap>
186 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
186 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
187 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value>
187 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value>
188 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
188 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
189 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
189 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
190 </valuemap>
190 </valuemap>
191 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
191 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
192 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
192 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
193 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
193 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
194 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
194 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
195 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
195 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
196 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
196 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
197 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
197 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
198 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
198 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
199 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
199 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
200 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
200 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
201 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
201 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
202 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
202 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
203 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
203 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
204 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
204 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
205 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
205 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
206 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
206 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
207 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
207 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
208 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
208 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
209 <value type="int">0</value>
209 <value type="int">0</value>
210 <value type="int">1</value>
210 <value type="int">1</value>
211 <value type="int">2</value>
211 <value type="int">2</value>
212 <value type="int">3</value>
212 <value type="int">3</value>
213 <value type="int">4</value>
213 <value type="int">4</value>
214 <value type="int">5</value>
214 <value type="int">5</value>
215 <value type="int">6</value>
215 <value type="int">6</value>
216 <value type="int">7</value>
216 <value type="int">7</value>
217 <value type="int">8</value>
217 <value type="int">8</value>
218 <value type="int">9</value>
218 <value type="int">9</value>
219 <value type="int">10</value>
219 <value type="int">10</value>
220 <value type="int">11</value>
220 <value type="int">11</value>
221 <value type="int">12</value>
221 <value type="int">12</value>
222 <value type="int">13</value>
222 <value type="int">13</value>
223 <value type="int">14</value>
223 <value type="int">14</value>
224 </valuelist>
224 </valuelist>
225 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
225 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
226 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
226 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
227 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
227 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
228 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
228 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
229 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
229 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
230 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
230 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
231 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
231 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
232 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
232 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
233 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
233 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
234 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
234 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
235 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
235 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
236 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
236 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
237 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
237 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
238 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
238 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
239 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
239 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
240 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
240 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
241 </valuemap>
241 </valuemap>
242 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
242 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
243 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
243 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
244 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
244 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
245 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
245 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
246 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
246 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
247 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
247 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
248 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
248 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
249 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
249 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
250 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
250 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
251 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
251 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
252 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
252 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
253 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
253 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
254 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
254 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
255 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
255 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
256 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
256 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
257 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
257 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
258 <value type="int">0</value>
258 <value type="int">0</value>
259 <value type="int">1</value>
259 <value type="int">1</value>
260 <value type="int">2</value>
260 <value type="int">2</value>
261 <value type="int">3</value>
261 <value type="int">3</value>
262 <value type="int">4</value>
262 <value type="int">4</value>
263 <value type="int">5</value>
263 <value type="int">5</value>
264 <value type="int">6</value>
264 <value type="int">6</value>
265 <value type="int">7</value>
265 <value type="int">7</value>
266 <value type="int">8</value>
266 <value type="int">8</value>
267 <value type="int">9</value>
267 <value type="int">9</value>
268 <value type="int">10</value>
268 <value type="int">10</value>
269 <value type="int">11</value>
269 <value type="int">11</value>
270 <value type="int">12</value>
270 <value type="int">12</value>
271 <value type="int">13</value>
271 <value type="int">13</value>
272 <value type="int">14</value>
272 <value type="int">14</value>
273 </valuelist>
273 </valuelist>
274 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
274 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
275 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
275 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
276 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
276 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
277 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">doxygen</value>
277 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">doxygen</value>
278 <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">true</value>
278 <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">true</value>
279 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">/opt/DEV_PLE/doc</value>
279 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">/opt/DEV_PLE/doc</value>
280 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run doxygen</value>
280 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run doxygen</value>
281 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
281 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
282 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
282 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
283 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
283 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
284 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
284 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
285 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
285 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
286 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
286 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
287 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
287 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
288 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
288 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
289 </valuemap>
289 </valuemap>
290 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">2</value>
290 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">2</value>
291 </valuemap>
291 </valuemap>
292 </data>
292 </data>
293 <data>
293 <data>
294 <variable>ProjectExplorer.Project.TargetCount</variable>
294 <variable>ProjectExplorer.Project.TargetCount</variable>
295 <value type="int">1</value>
295 <value type="int">1</value>
296 </data>
296 </data>
297 <data>
297 <data>
298 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
298 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
299 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
299 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
300 </data>
300 </data>
301 <data>
301 <data>
302 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
302 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
303 <value type="int">14</value>
303 <value type="int">14</value>
304 </data>
304 </data>
305 </qtcreator>
305 </qtcreator>
@@ -1,211 +1,212
1 #ifndef FSW_PARAMS_H_INCLUDED
1 #ifndef FSW_PARAMS_H_INCLUDED
2 #define FSW_PARAMS_H_INCLUDED
2 #define FSW_PARAMS_H_INCLUDED
3
3
4 #include "grlib_regs.h"
4 #include "grlib_regs.h"
5 #include "fsw_params_processing.h"
5 #include "fsw_params_processing.h"
6 #include "tm_byte_positions.h"
6 #include "tm_byte_positions.h"
7 #include "ccsds_types.h"
7 #include "ccsds_types.h"
8
8
9 #define GRSPW_DEVICE_NAME "/dev/grspw0"
9 #define GRSPW_DEVICE_NAME "/dev/grspw0"
10 #define UART_DEVICE_NAME "/dev/console"
10 #define UART_DEVICE_NAME "/dev/console"
11
11
12 //************************
12 //************************
13 // flight software version
13 // flight software version
14 // this parameters is handled by the Qt project options
14 // this parameters is handled by the Qt project options
15
15
16 //**********
16 //**********
17 // LFR MODES
17 // LFR MODES
18 #define LFR_MODE_STANDBY 0
18 #define LFR_MODE_STANDBY 0
19 #define LFR_MODE_NORMAL 1
19 #define LFR_MODE_NORMAL 1
20 #define LFR_MODE_BURST 2
20 #define LFR_MODE_BURST 2
21 #define LFR_MODE_SBM1 3
21 #define LFR_MODE_SBM1 3
22 #define LFR_MODE_SBM2 4
22 #define LFR_MODE_SBM2 4
23 #define LFR_MODE_NORMAL_CWF_F3 5
23 #define LFR_MODE_NORMAL_CWF_F3 5
24
24
25 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
25 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
26 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
26 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
27 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
27 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
28 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
28 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
29 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
29 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
30 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
30 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
31
31
32 //****************************
32 //****************************
33 // LFR DEFAULT MODE PARAMETERS
33 // LFR DEFAULT MODE PARAMETERS
34 // COMMON
34 // COMMON
35 #define DEFAULT_SY_LFR_COMMON0 0x00
35 #define DEFAULT_SY_LFR_COMMON0 0x00
36 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
36 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
37 // NORM
37 // NORM
38 #define SY_LFR_N_SWF_L 2048 // nb sample
38 #define SY_LFR_N_SWF_L 2048 // nb sample
39 #define SY_LFR_N_SWF_P 296 // sec
39 #define SY_LFR_N_SWF_P 296 // sec
40 #define SY_LFR_N_ASM_P 3600 // sec
40 #define SY_LFR_N_ASM_P 3600 // sec
41 #define SY_LFR_N_BP_P0 4 // sec
41 #define SY_LFR_N_BP_P0 4 // sec
42 #define SY_LFR_N_BP_P1 20 // sec
42 #define SY_LFR_N_BP_P1 20 // sec
43 #define MIN_DELTA_SNAPSHOT 16 // sec
43 #define MIN_DELTA_SNAPSHOT 16 // sec
44 // BURST
44 // BURST
45 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
45 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
46 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
46 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
47 // SBM1
47 // SBM1
48 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
48 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
49 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
49 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
50 // SBM2
50 // SBM2
51 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
51 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
52 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
52 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
53 // ADDITIONAL PARAMETERS
53 // ADDITIONAL PARAMETERS
54 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
54 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
55 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
55 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
56 // STATUS WORD
56 // STATUS WORD
57 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
57 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
58 #define DEFAULT_STATUS_WORD_BYTE1 0x00
58 #define DEFAULT_STATUS_WORD_BYTE1 0x00
59 //
59 //
60 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
60 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
61 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
61 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
62 //****************************
62 //****************************
63
63
64 //*****************************
64 //*****************************
65 // APB REGISTERS BASE ADDRESSES
65 // APB REGISTERS BASE ADDRESSES
66 #define REGS_ADDR_APBUART 0x80000100
66 #define REGS_ADDR_APBUART 0x80000100
67 #define REGS_ADDR_GPTIMER 0x80000300
67 #define REGS_ADDR_GPTIMER 0x80000300
68 #define REGS_ADDR_GRSPW 0x80000500
68 #define REGS_ADDR_GRSPW 0x80000500
69 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
69 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
70 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
70 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
71
71
72 #ifdef GSA
72 #ifdef GSA
73 #else
73 #else
74 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20
74 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20
75 #endif
75 #endif
76
76
77 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
77 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
78 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
78 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
79
79
80 //**********
80 //**********
81 // IRQ LINES
81 // IRQ LINES
82 #define IRQ_SM 9
82 #define IRQ_SM 9
83 #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels
83 #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels
84 #define IRQ_WF 10
84 #define IRQ_WF 10
85 #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels
85 #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels
86 #define IRQ_TIME1 12
86 #define IRQ_TIME1 12
87 #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels
87 #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels
88 #define IRQ_TIME2 13
88 #define IRQ_TIME2 13
89 #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels
89 #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels
90 #define IRQ_WAVEFORM_PICKER 14
90 #define IRQ_WAVEFORM_PICKER 14
91 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
91 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
92 #define IRQ_SPECTRAL_MATRIX 6
92 #define IRQ_SPECTRAL_MATRIX 6
93 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
93 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
94
94
95 //*****
95 //*****
96 // TIME
96 // TIME
97 #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms
97 #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms
98 #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s
98 #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s
99 #define TIMER_SM_SIMULATOR 1
99 #define TIMER_SM_SIMULATOR 1
100 #define TIMER_WF_SIMULATOR 2
100 #define TIMER_WF_SIMULATOR 2
101 #define HK_PERIOD 100 // 100 * 10ms => 1sec
101 #define HK_PERIOD 100 // 100 * 10ms => 1sec
102
102
103 //**********
103 //**********
104 // LPP CODES
104 // LPP CODES
105 #define LFR_SUCCESSFUL 0
105 #define LFR_SUCCESSFUL 0
106 #define LFR_DEFAULT 1
106 #define LFR_DEFAULT 1
107
107
108 //******
108 //******
109 // RTEMS
109 // RTEMS
110 #define TASKID_RECV 1
110 #define TASKID_RECV 1
111 #define TASKID_ACTN 2
111 #define TASKID_ACTN 2
112 #define TASKID_SPIQ 3
112 #define TASKID_SPIQ 3
113 #define TASKID_SMIQ 4
113 #define TASKID_SMIQ 4
114 #define TASKID_STAT 5
114 #define TASKID_STAT 5
115 #define TASKID_AVF0 6
115 #define TASKID_AVF0 6
116 #define TASKID_BPF0 7
116 #define TASKID_BPF0 7
117 #define TASKID_WFRM 8
117 #define TASKID_WFRM 8
118 #define TASKID_DUMB 9
118 #define TASKID_DUMB 9
119 #define TASKID_HOUS 10
119 #define TASKID_HOUS 10
120 #define TASKID_MATR 11
120 #define TASKID_MATR 11
121 #define TASKID_CWF3 12
121 #define TASKID_CWF3 12
122 #define TASKID_CWF2 13
122 #define TASKID_CWF2 13
123 #define TASKID_CWF1 14
123 #define TASKID_CWF1 14
124 #define TASKID_SEND 15
124 #define TASKID_SEND 15
125 #define TASKID_WTDG 16
125 #define TASKID_WTDG 16
126
126
127 #define TASK_PRIORITY_SPIQ 5
127 #define TASK_PRIORITY_SPIQ 5
128 #define TASK_PRIORITY_SMIQ 10
128 #define TASK_PRIORITY_SMIQ 10
129 //
129 //
130 #define TASK_PRIORITY_WTDG 20
130 #define TASK_PRIORITY_WTDG 20
131 //
131 //
132 #define TASK_PRIORITY_HOUS 30
132 #define TASK_PRIORITY_HOUS 30
133 //
133 //
134 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
134 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
135 #define TASK_PRIORITY_CWF2 35 //
135 #define TASK_PRIORITY_CWF2 35 //
136 //
136 //
137 #define TASK_PRIORITY_WFRM 40
137 #define TASK_PRIORITY_WFRM 40
138 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
138 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
139 //
139 //
140 #define TASK_PRIORITY_SEND 45
140 #define TASK_PRIORITY_SEND 45
141 //
141 //
142 #define TASK_PRIORITY_RECV 50
142 #define TASK_PRIORITY_RECV 50
143 #define TASK_PRIORITY_ACTN 50
143 #define TASK_PRIORITY_ACTN 50
144 //
144 //
145 #define TASK_PRIORITY_AVF0 60
145 #define TASK_PRIORITY_AVF0 60
146 #define TASK_PRIORITY_BPF0 60
146 #define TASK_PRIORITY_BPF0 60
147 #define TASK_PRIORITY_MATR 100
147 #define TASK_PRIORITY_MATR 100
148 #define TASK_PRIORITY_STAT 200
148 #define TASK_PRIORITY_STAT 200
149 #define TASK_PRIORITY_DUMB 200
149 #define TASK_PRIORITY_DUMB 200
150
150
151 #define SEMQ_PRIORITY_CEILING 30
151 #define SEMQ_PRIORITY_CEILING 30
152
152
153 #define ACTION_MSG_QUEUE_COUNT 10
153 #define ACTION_MSG_QUEUE_COUNT 10
154 #define ACTION_MSG_PKTS_COUNT 50
154 #define ACTION_MSG_PKTS_COUNT 50
155 #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
155 #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
156 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
156 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
157
157
158 #define QUEUE_RECV 0
158 #define QUEUE_RECV 0
159 #define QUEUE_SEND 1
159 #define QUEUE_SEND 1
160
160
161 //*******
161 //*******
162 // MACROS
162 // MACROS
163 #ifdef PRINT_MESSAGES_ON_CONSOLE
163 #ifdef PRINT_MESSAGES_ON_CONSOLE
164 #define PRINTF(x) printf(x);
164 #define PRINTF(x) printf(x);
165 #define PRINTF1(x,y) printf(x,y);
165 #define PRINTF1(x,y) printf(x,y);
166 #define PRINTF2(x,y,z) printf(x,y,z);
166 #define PRINTF2(x,y,z) printf(x,y,z);
167 #else
167 #else
168 #define PRINTF(x) ;
168 #define PRINTF(x) ;
169 #define PRINTF1(x,y) ;
169 #define PRINTF1(x,y) ;
170 #define PRINTF2(x,y,z) ;
170 #define PRINTF2(x,y,z) ;
171 #endif
171 #endif
172
172
173 #ifdef BOOT_MESSAGES
173 #ifdef BOOT_MESSAGES
174 #define BOOT_PRINTF(x) printf(x);
174 #define BOOT_PRINTF(x) printf(x);
175 #define BOOT_PRINTF1(x,y) printf(x,y);
175 #define BOOT_PRINTF1(x,y) printf(x,y);
176 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
176 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
177 #else
177 #else
178 #define BOOT_PRINTF(x) ;
178 #define BOOT_PRINTF(x) ;
179 #define BOOT_PRINTF1(x,y) ;
179 #define BOOT_PRINTF1(x,y) ;
180 #define BOOT_PRINTF2(x,y,z) ;
180 #define BOOT_PRINTF2(x,y,z) ;
181 #endif
181 #endif
182
182
183 #ifdef DEBUG_MESSAGES
183 #ifdef DEBUG_MESSAGES
184 #define DEBUG_PRINTF(x) printf(x);
184 #define DEBUG_PRINTF(x) printf(x);
185 #define DEBUG_PRINTF1(x,y) printf(x,y);
185 #define DEBUG_PRINTF1(x,y) printf(x,y);
186 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
186 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
187 #else
187 #else
188 #define DEBUG_PRINTF(x) ;
188 #define DEBUG_PRINTF(x) ;
189 #define DEBUG_PRINTF1(x,y) ;
189 #define DEBUG_PRINTF1(x,y) ;
190 #define DEBUG_PRINTF2(x,y,z) ;
190 #define DEBUG_PRINTF2(x,y,z) ;
191 #endif
191 #endif
192
192
193 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
193 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
194
194
195 #define NB_SAMPLES_PER_SNAPSHOT 2048
195 #define NB_SAMPLES_PER_SNAPSHOT 2048
196 #define TIME_OFFSET 2
196 #define TIME_OFFSET 2
197 #define ALIGNEMENT_OFFSET 100
197 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
198 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
198 #define NB_BYTES_SWF_BLK (2 * 6)
199 #define NB_BYTES_SWF_BLK (2 * 6)
199 #define NB_WORDS_SWF_BLK 3
200 #define NB_WORDS_SWF_BLK 3
200 #define NB_BYTES_CWF3_LIGHT_BLK 6
201 #define NB_BYTES_CWF3_LIGHT_BLK 6
201 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
202 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
202
203
203 struct param_local_str{
204 struct param_local_str{
204 unsigned int local_sbm1_nb_cwf_sent;
205 unsigned int local_sbm1_nb_cwf_sent;
205 unsigned int local_sbm1_nb_cwf_max;
206 unsigned int local_sbm1_nb_cwf_max;
206 unsigned int local_sbm2_nb_cwf_sent;
207 unsigned int local_sbm2_nb_cwf_sent;
207 unsigned int local_sbm2_nb_cwf_max;
208 unsigned int local_sbm2_nb_cwf_max;
208 unsigned int local_nb_interrupt_f0_MAX;
209 unsigned int local_nb_interrupt_f0_MAX;
209 };
210 };
210
211
211 #endif // FSW_PARAMS_H_INCLUDED
212 #endif // FSW_PARAMS_H_INCLUDED
@@ -1,86 +1,87
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
10
11 #define pi 3.1415
11 #define pi 3.1415
12
12
13 extern int fdSPW;
13 extern int fdSPW;
14 extern volatile int wf_snap_f0[ ];
14 extern volatile int wf_snap_f0[ ];
15 //
15 //
16 extern volatile int wf_snap_f1[ ];
16 extern volatile int wf_snap_f1[ ];
17 extern volatile int wf_snap_f1_bis[ ];
17 extern volatile int wf_snap_f1_bis[ ];
18 extern volatile int wf_snap_f1_norm[ ];
18 extern volatile int wf_snap_f1_norm[ ];
19 //
19 //
20 extern volatile int wf_snap_f2[ ];
20 extern volatile int wf_snap_f2[ ];
21 extern volatile int wf_snap_f2_bis[ ];
21 extern volatile int wf_snap_f2_bis[ ];
22 extern volatile int wf_snap_f2_norm[ ];
22 extern volatile int wf_snap_f2_norm[ ];
23 //
23 //
24 extern volatile int wf_cont_f3[ ];
24 extern volatile int wf_cont_f3[ ];
25 extern volatile int wf_cont_f3_bis[ ];
25 extern volatile int wf_cont_f3_bis[ ];
26 extern char wf_cont_f3_light[ ];
26 extern char wf_cont_f3_light[ ];
27 extern new_waveform_picker_regs_t *new_waveform_picker_regs;
27 extern new_waveform_picker_regs_t *new_waveform_picker_regs;
28 extern time_management_regs_t *time_management_regs;
28 extern time_management_regs_t *time_management_regs;
29 extern Packet_TM_LFR_HK_t housekeeping_packet;
29 extern Packet_TM_LFR_HK_t housekeeping_packet;
30 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
30 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
31 extern struct param_local_str param_local;
31 extern struct param_local_str param_local;
32
32
33 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
33 extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
34 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
34 extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
35 extern unsigned short sequenceCounters_TC_EXE[];
35 extern unsigned short sequenceCounters_TC_EXE[];
36
36
37 extern rtems_name misc_name[5];
37 extern rtems_name misc_name[5];
38 extern rtems_name Task_name[20]; /* array of task ids */
38 extern rtems_name Task_name[20]; /* array of task ids */
39 extern rtems_id Task_id[20]; /* array of task ids */
39 extern rtems_id Task_id[20]; /* array of task ids */
40
40
41 extern unsigned char lfrCurrentMode;
41 extern unsigned char lfrCurrentMode;
42
42
43 rtems_isr waveforms_isr( rtems_vector_number vector );
43 rtems_isr waveforms_isr( rtems_vector_number vector );
44 rtems_isr waveforms_simulator_isr( rtems_vector_number vector );
44 rtems_isr waveforms_simulator_isr( rtems_vector_number vector );
45 rtems_task wfrm_task( rtems_task_argument argument );
45 rtems_task wfrm_task( rtems_task_argument argument );
46 rtems_task cwf3_task( rtems_task_argument argument );
46 rtems_task cwf3_task( rtems_task_argument argument );
47 rtems_task cwf2_task( rtems_task_argument argument );
47 rtems_task cwf2_task( rtems_task_argument argument );
48 rtems_task cwf1_task( rtems_task_argument argument );
48 rtems_task cwf1_task( rtems_task_argument argument );
49
49
50 //******************
50 //******************
51 // general functions
51 // general functions
52 void init_waveforms( void );
52 void init_waveforms( void );
53 //
53 //
54 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
54 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
55 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
55 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
56 int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
56 int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
57 //
57 //
58 void reset_waveforms( void );
58 void reset_waveforms( void );
59 //
59 //
60 int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
60 int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
61 int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
61 int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
62 int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
62 int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
63 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
63 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
64 //
64 //
65 rtems_id get_pkts_queue_id( void );
65 rtems_id get_pkts_queue_id( void );
66
66
67 //**************
67 //**************
68 // wfp registers
68 // wfp registers
69 void set_wfp_data_shaping();
69 void set_wfp_data_shaping();
70 char set_wfp_delta_snapshot();
70 char set_wfp_delta_snapshot();
71 void set_wfp_burst_enable_register( unsigned char mode);
71 void set_wfp_burst_enable_register( unsigned char mode);
72 void reset_wfp_run_burst_enable();
72 void reset_wfp_run_burst_enable();
73 void reset_wfp_status();
73 void reset_wfp_status();
74 void reset_new_waveform_picker_regs();
74 void reset_new_waveform_picker_regs();
75 unsigned int address_alignment( volatile int *address);
75
76
76 //*****************
77 //*****************
77 // local parameters
78 // local parameters
78 void set_local_sbm1_nb_cwf_max();
79 void set_local_sbm1_nb_cwf_max();
79 void set_local_sbm2_nb_cwf_max();
80 void set_local_sbm2_nb_cwf_max();
80 void set_local_nb_interrupt_f0_MAX();
81 void set_local_nb_interrupt_f0_MAX();
81 void reset_local_sbm1_nb_cwf_sent();
82 void reset_local_sbm1_nb_cwf_sent();
82 void reset_local_sbm2_nb_cwf_sent();
83 void reset_local_sbm2_nb_cwf_sent();
83
84
84 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid );
85 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid );
85
86
86 #endif // WF_HANDLER_H_INCLUDED
87 #endif // WF_HANDLER_H_INCLUDED
@@ -1,91 +1,91
1 /** Global variables of the LFR flight software.
1 /** Global variables of the LFR flight software.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * Among global variables, there are:
6 * Among global variables, there are:
7 * - RTEMS names and id.
7 * - RTEMS names and id.
8 * - APB configuration registers.
8 * - APB configuration registers.
9 * - waveforms global buffers, used by the waveform picker hardware module to store data.
9 * - waveforms global buffers, used by the waveform picker hardware module to store data.
10 * - spectral matrices buffesr, used by the hardware module to store data.
10 * - spectral matrices buffesr, used by the hardware module to store data.
11 * - variable related to LFR modes parameters.
11 * - variable related to LFR modes parameters.
12 * - the global HK packet buffer.
12 * - the global HK packet buffer.
13 * - the global dump parameter buffer.
13 * - the global dump parameter buffer.
14 *
14 *
15 */
15 */
16
16
17 #include <rtems.h>
17 #include <rtems.h>
18 #include <grspw.h>
18 #include <grspw.h>
19
19
20 #include "ccsds_types.h"
20 #include "ccsds_types.h"
21 #include "grlib_regs.h"
21 #include "grlib_regs.h"
22 #include "fsw_params.h"
22 #include "fsw_params.h"
23
23
24 // RTEMS GLOBAL VARIABLES
24 // RTEMS GLOBAL VARIABLES
25 rtems_name misc_name[5];
25 rtems_name misc_name[5];
26 rtems_id misc_id[5];
26 rtems_id misc_id[5];
27 rtems_name Task_name[20]; /* array of task names */
27 rtems_name Task_name[20]; /* array of task names */
28 rtems_id Task_id[20]; /* array of task ids */
28 rtems_id Task_id[20]; /* array of task ids */
29 unsigned int maxCount;
29 unsigned int maxCount;
30 int fdSPW = 0;
30 int fdSPW = 0;
31 int fdUART = 0;
31 int fdUART = 0;
32 unsigned char lfrCurrentMode;
32 unsigned char lfrCurrentMode;
33
33
34 // APB CONFIGURATION REGISTERS
34 // APB CONFIGURATION REGISTERS
35 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
35 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
36 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
36 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
37 #ifdef GSA
37 #ifdef GSA
38 #else
38 #else
39 new_waveform_picker_regs_t *new_waveform_picker_regs = (new_waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER;
39 new_waveform_picker_regs_t *new_waveform_picker_regs = (new_waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER;
40 #endif
40 #endif
41 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
41 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
42
42
43 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes
43 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes
44 volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
44 volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET + ALIGNEMENT_OFFSET ];
45 //
45 //
46 volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
46 volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET + ALIGNEMENT_OFFSET ];
47 volatile int wf_snap_f1_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
47 volatile int wf_snap_f1_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET + ALIGNEMENT_OFFSET ];
48 volatile int wf_snap_f1_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
48 volatile int wf_snap_f1_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET + ALIGNEMENT_OFFSET ];
49 //
49 //
50 volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
50 volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET + ALIGNEMENT_OFFSET ];
51 volatile int wf_snap_f2_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
51 volatile int wf_snap_f2_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET + ALIGNEMENT_OFFSET ];
52 volatile int wf_snap_f2_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
52 volatile int wf_snap_f2_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET + ALIGNEMENT_OFFSET ];
53 //
53 //
54 volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
54 volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET + ALIGNEMENT_OFFSET ];
55 volatile int wf_cont_f3_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
55 volatile int wf_cont_f3_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET + ALIGNEMENT_OFFSET ];
56 char wf_cont_f3_light[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_CWF3_LIGHT_BLK ];
56 char wf_cont_f3_light[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_CWF3_LIGHT_BLK + ALIGNEMENT_OFFSET ];
57
57
58 // SPECTRAL MATRICES GLOBAL VARIABLES
58 // SPECTRAL MATRICES GLOBAL VARIABLES
59 volatile int spec_mat_f0_0[ SM_HEADER + TOTAL_SIZE_SM ];
59 volatile int spec_mat_f0_0[ SM_HEADER + TOTAL_SIZE_SM ];
60 volatile int spec_mat_f0_1[ SM_HEADER + TOTAL_SIZE_SM ];
60 volatile int spec_mat_f0_1[ SM_HEADER + TOTAL_SIZE_SM ];
61 volatile int spec_mat_f0_a[ SM_HEADER + TOTAL_SIZE_SM ];
61 volatile int spec_mat_f0_a[ SM_HEADER + TOTAL_SIZE_SM ];
62 volatile int spec_mat_f0_b[ SM_HEADER + TOTAL_SIZE_SM ];
62 volatile int spec_mat_f0_b[ SM_HEADER + TOTAL_SIZE_SM ];
63 volatile int spec_mat_f0_c[ SM_HEADER + TOTAL_SIZE_SM ];
63 volatile int spec_mat_f0_c[ SM_HEADER + TOTAL_SIZE_SM ];
64 volatile int spec_mat_f0_d[ SM_HEADER + TOTAL_SIZE_SM ];
64 volatile int spec_mat_f0_d[ SM_HEADER + TOTAL_SIZE_SM ];
65 volatile int spec_mat_f0_e[ SM_HEADER + TOTAL_SIZE_SM ];
65 volatile int spec_mat_f0_e[ SM_HEADER + TOTAL_SIZE_SM ];
66 volatile int spec_mat_f0_f[ SM_HEADER + TOTAL_SIZE_SM ];
66 volatile int spec_mat_f0_f[ SM_HEADER + TOTAL_SIZE_SM ];
67 volatile int spec_mat_f0_g[ SM_HEADER + TOTAL_SIZE_SM ];
67 volatile int spec_mat_f0_g[ SM_HEADER + TOTAL_SIZE_SM ];
68 volatile int spec_mat_f0_h[ SM_HEADER + TOTAL_SIZE_SM ];
68 volatile int spec_mat_f0_h[ SM_HEADER + TOTAL_SIZE_SM ];
69 volatile int spec_mat_f0_0_bis[ SM_HEADER + TOTAL_SIZE_SM ];
69 volatile int spec_mat_f0_0_bis[ SM_HEADER + TOTAL_SIZE_SM ];
70 volatile int spec_mat_f0_1_bis[ SM_HEADER + TOTAL_SIZE_SM ];
70 volatile int spec_mat_f0_1_bis[ SM_HEADER + TOTAL_SIZE_SM ];
71 //
71 //
72 volatile int spec_mat_f1[ SM_HEADER + TOTAL_SIZE_SM ];
72 volatile int spec_mat_f1[ SM_HEADER + TOTAL_SIZE_SM ];
73 volatile int spec_mat_f1_bis[ SM_HEADER + TOTAL_SIZE_SM ];
73 volatile int spec_mat_f1_bis[ SM_HEADER + TOTAL_SIZE_SM ];
74 //
74 //
75 volatile int spec_mat_f2[ SM_HEADER + TOTAL_SIZE_SM ];
75 volatile int spec_mat_f2[ SM_HEADER + TOTAL_SIZE_SM ];
76 volatile int spec_mat_f2_bis[ SM_HEADER + TOTAL_SIZE_SM ];
76 volatile int spec_mat_f2_bis[ SM_HEADER + TOTAL_SIZE_SM ];
77
77
78 // MODE PARAMETERS
78 // MODE PARAMETERS
79 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
79 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
80 struct param_local_str param_local;
80 struct param_local_str param_local;
81
81
82 // HK PACKETS
82 // HK PACKETS
83 Packet_TM_LFR_HK_t housekeeping_packet;
83 Packet_TM_LFR_HK_t housekeeping_packet;
84 // sequence counters are incremented by APID (PID + CAT) and destination ID
84 // sequence counters are incremented by APID (PID + CAT) and destination ID
85 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
85 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
86 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
86 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
87 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
87 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID];
88 spw_stats spacewire_stats;
88 spw_stats spacewire_stats;
89 spw_stats spacewire_stats_backup;
89 spw_stats spacewire_stats_backup;
90
90
91
91
@@ -1,325 +1,328
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[9] = {"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 "full is 0", // RTEMS_EVENT_7
18 "full is 1" // RTEMS_EVENT_8
17 };
19 };
18
20
19 int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
21 int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
20 unsigned char interrupt_level, rtems_isr (*timer_isr)() )
22 unsigned char interrupt_level, rtems_isr (*timer_isr)() )
21 {
23 {
22 /** This function configures a GPTIMER timer instantiated in the VHDL design.
24 /** This function configures a GPTIMER timer instantiated in the VHDL design.
23 *
25 *
24 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
26 * @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).
27 * @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.
28 * @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.
29 * @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.
30 * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer.
29 *
31 *
30 * @return
32 * @return
31 *
33 *
32 * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76
34 * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76
33 *
35 *
34 */
36 */
35
37
36 rtems_status_code status;
38 rtems_status_code status;
37 rtems_isr_entry old_isr_handler;
39 rtems_isr_entry old_isr_handler;
38
40
39 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
41 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
40 if (status!=RTEMS_SUCCESSFUL)
42 if (status!=RTEMS_SUCCESSFUL)
41 {
43 {
42 PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n")
44 PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n")
43 }
45 }
44
46
45 timer_set_clock_divider( gptimer_regs, timer, clock_divider);
47 timer_set_clock_divider( gptimer_regs, timer, clock_divider);
46
48
47 return 1;
49 return 1;
48 }
50 }
49
51
50 int timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer)
52 int timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer)
51 {
53 {
52 /** This function starts a GPTIMER timer.
54 /** This function starts a GPTIMER timer.
53 *
55 *
54 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
56 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
55 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
57 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
56 *
58 *
57 * @return 1
59 * @return 1
58 *
60 *
59 */
61 */
60
62
61 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
63 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
62 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register
64 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register
63 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer
65 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer
64 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart
66 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart
65 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable
67 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable
66
68
67 return 1;
69 return 1;
68 }
70 }
69
71
70 int timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer)
72 int timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer)
71 {
73 {
72 /** This function stops a GPTIMER timer.
74 /** This function stops a GPTIMER timer.
73 *
75 *
74 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
76 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
75 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
77 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
76 *
78 *
77 * @return 1
79 * @return 1
78 *
80 *
79 */
81 */
80
82
81 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer
83 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer
82 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable
84 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable
83 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
85 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
84
86
85 return 1;
87 return 1;
86 }
88 }
87
89
88 int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider)
90 int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider)
89 {
91 {
90 /** This function sets the clock divider of a GPTIMER timer.
92 /** This function sets the clock divider of a GPTIMER timer.
91 *
93 *
92 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
94 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
93 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
95 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
94 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
96 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
95 *
97 *
96 * @return 1
98 * @return 1
97 *
99 *
98 */
100 */
99
101
100 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
102 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
101
103
102 return 1;
104 return 1;
103 }
105 }
104
106
105 int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port
107 int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port
106 {
108 {
107 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
109 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
108
110
109 apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB;
111 apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB;
110 PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
112 PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
111
113
112 return 0;
114 return 0;
113 }
115 }
114
116
115 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
117 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
116 {
118 {
117 /** This function sets the scaler reload register of the apbuart module
119 /** This function sets the scaler reload register of the apbuart module
118 *
120 *
119 * @param regs is the address of the apbuart registers in memory
121 * @param regs is the address of the apbuart registers in memory
120 * @param value is the value that will be stored in the scaler register
122 * @param value is the value that will be stored in the scaler register
121 *
123 *
122 * The value shall be set by the software to get data on the serial interface.
124 * The value shall be set by the software to get data on the serial interface.
123 *
125 *
124 */
126 */
125
127
126 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
128 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
127
129
128 apbuart_regs->scaler = value;
130 apbuart_regs->scaler = value;
129 BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value)
131 BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value)
130 }
132 }
131
133
132 //************
134 //************
133 // RTEMS TASKS
135 // RTEMS TASKS
134
136
135 rtems_task stat_task(rtems_task_argument argument)
137 rtems_task stat_task(rtems_task_argument argument)
136 {
138 {
137 int i;
139 int i;
138 int j;
140 int j;
139 i = 0;
141 i = 0;
140 j = 0;
142 j = 0;
141 BOOT_PRINTF("in STAT *** \n")
143 BOOT_PRINTF("in STAT *** \n")
142 while(1){
144 while(1){
143 rtems_task_wake_after(1000);
145 rtems_task_wake_after(1000);
144 PRINTF1("%d\n", j)
146 PRINTF1("%d\n", j)
145 if (i == CPU_USAGE_REPORT_PERIOD) {
147 if (i == CPU_USAGE_REPORT_PERIOD) {
146 // #ifdef PRINT_TASK_STATISTICS
148 // #ifdef PRINT_TASK_STATISTICS
147 // rtems_cpu_usage_report();
149 // rtems_cpu_usage_report();
148 // rtems_cpu_usage_reset();
150 // rtems_cpu_usage_reset();
149 // #endif
151 // #endif
150 i = 0;
152 i = 0;
151 }
153 }
152 else i++;
154 else i++;
153 j++;
155 j++;
154 }
156 }
155 }
157 }
156
158
157 rtems_task hous_task(rtems_task_argument argument)
159 rtems_task hous_task(rtems_task_argument argument)
158 {
160 {
159 rtems_status_code status;
161 rtems_status_code status;
160 rtems_id queue_id;
162 rtems_id queue_id;
161
163
162 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id );
164 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id );
163 if (status != RTEMS_SUCCESSFUL)
165 if (status != RTEMS_SUCCESSFUL)
164 {
166 {
165 PRINTF1("in HOUS *** ERR %d\n", status)
167 PRINTF1("in HOUS *** ERR %d\n", status)
166 }
168 }
167
169
168 BOOT_PRINTF("in HOUS ***\n")
170 BOOT_PRINTF("in HOUS ***\n")
169
171
170 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
172 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
171 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
173 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
172 if( status != RTEMS_SUCCESSFUL ) {
174 if( status != RTEMS_SUCCESSFUL ) {
173 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
175 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
174 }
176 }
175 }
177 }
176
178
177 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
179 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
178 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
180 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
179 housekeeping_packet.reserved = DEFAULT_RESERVED;
181 housekeeping_packet.reserved = DEFAULT_RESERVED;
180 housekeeping_packet.userApplication = CCSDS_USER_APP;
182 housekeeping_packet.userApplication = CCSDS_USER_APP;
181 housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8);
183 housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8);
182 housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK);
184 housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK);
183 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
185 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
184 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
186 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
185 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
187 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
186 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
188 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
187 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
189 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
188 housekeeping_packet.serviceType = TM_TYPE_HK;
190 housekeeping_packet.serviceType = TM_TYPE_HK;
189 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
191 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
190 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
192 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
191
193
192 status = rtems_rate_monotonic_cancel(HK_id);
194 status = rtems_rate_monotonic_cancel(HK_id);
193 if( status != RTEMS_SUCCESSFUL ) {
195 if( status != RTEMS_SUCCESSFUL ) {
194 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
196 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
195 }
197 }
196 else {
198 else {
197 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
199 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
198 }
200 }
199
201
200 while(1){ // launch the rate monotonic task
202 while(1){ // launch the rate monotonic task
201 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
203 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
202 if ( status != RTEMS_SUCCESSFUL ) {
204 if ( status != RTEMS_SUCCESSFUL ) {
203 PRINTF1( "in HOUS *** ERR period: %d\n", status);
205 PRINTF1( "in HOUS *** ERR period: %d\n", status);
204 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
206 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
205 }
207 }
206 else {
208 else {
207 increment_seq_counter( housekeeping_packet.packetSequenceControl );
209 increment_seq_counter( housekeeping_packet.packetSequenceControl );
208 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
210 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
209 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
211 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
210 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
212 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
211 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
213 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
212 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
214 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
213 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
215 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
214 housekeeping_packet.sid = SID_HK;
216 housekeeping_packet.sid = SID_HK;
215
217
216 spacewire_update_statistics();
218 spacewire_update_statistics();
217
219
218 // SEND PACKET
220 // SEND PACKET
219 status = rtems_message_queue_send( queue_id, &housekeeping_packet,
221 status = rtems_message_queue_send( queue_id, &housekeeping_packet,
220 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
222 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
221 if (status != RTEMS_SUCCESSFUL) {
223 if (status != RTEMS_SUCCESSFUL) {
222 PRINTF1("in HOUS *** ERR send: %d\n", status)
224 PRINTF1("in HOUS *** ERR send: %d\n", status)
223 }
225 }
224 }
226 }
225 }
227 }
226
228
227 PRINTF("in HOUS *** deleting task\n")
229 PRINTF("in HOUS *** deleting task\n")
228
230
229 status = rtems_task_delete( RTEMS_SELF ); // should not return
231 status = rtems_task_delete( RTEMS_SELF ); // should not return
230 printf( "rtems_task_delete returned with status of %d.\n", status );
232 printf( "rtems_task_delete returned with status of %d.\n", status );
231 return;
233 return;
232 }
234 }
233
235
234 rtems_task dumb_task( rtems_task_argument unused )
236 rtems_task dumb_task( rtems_task_argument unused )
235 {
237 {
236 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
238 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
237 *
239 *
238 * @param unused is the starting argument of the RTEMS task
240 * @param unused is the starting argument of the RTEMS task
239 *
241 *
240 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
242 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
241 *
243 *
242 */
244 */
243
245
244 unsigned int i;
246 unsigned int i;
245 unsigned int intEventOut;
247 unsigned int intEventOut;
246 unsigned int coarse_time = 0;
248 unsigned int coarse_time = 0;
247 unsigned int fine_time = 0;
249 unsigned int fine_time = 0;
248 rtems_event_set event_out;
250 rtems_event_set event_out;
249
251
250 BOOT_PRINTF("in DUMB *** \n")
252 BOOT_PRINTF("in DUMB *** \n")
251
253
252 while(1){
254 while(1){
253 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
255 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
254 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6,
256 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6
257 | RTEMS_EVENT_7 | RTEMS_EVENT_8 | RTEMS_EVENT_9 ,
255 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
258 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
256 intEventOut = (unsigned int) event_out;
259 intEventOut = (unsigned int) event_out;
257 for ( i=0; i<32; i++)
260 for ( i=0; i<32; i++)
258 {
261 {
259 if ( ((intEventOut >> i) & 0x0001) != 0)
262 if ( ((intEventOut >> i) & 0x0001) != 0)
260 {
263 {
261 coarse_time = time_management_regs->coarse_time;
264 coarse_time = time_management_regs->coarse_time;
262 fine_time = time_management_regs->fine_time;
265 fine_time = time_management_regs->fine_time;
263 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
266 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
264 }
267 }
265 }
268 }
266 }
269 }
267 }
270 }
268
271
269 //*****************************
272 //*****************************
270 // init housekeeping parameters
273 // init housekeeping parameters
271
274
272 void init_housekeeping_parameters( void )
275 void init_housekeeping_parameters( void )
273 {
276 {
274 /** This function initialize the housekeeping_packet global variable with default values.
277 /** This function initialize the housekeeping_packet global variable with default values.
275 *
278 *
276 */
279 */
277
280
278 unsigned int i = 0;
281 unsigned int i = 0;
279 char *parameters;
282 char *parameters;
280
283
281 parameters = (char*) &housekeeping_packet.lfr_status_word;
284 parameters = (char*) &housekeeping_packet.lfr_status_word;
282 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
285 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
283 {
286 {
284 parameters[i] = 0x00;
287 parameters[i] = 0x00;
285 }
288 }
286 // init status word
289 // init status word
287 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
290 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
288 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
291 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
289 // init software version
292 // init software version
290 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
293 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
291 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
294 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
292 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
295 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
293 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
296 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
294
297
295 }
298 }
296
299
297 void increment_seq_counter( unsigned char *packet_sequence_control)
300 void increment_seq_counter( unsigned char *packet_sequence_control)
298 {
301 {
299 unsigned short sequence_cnt;
302 unsigned short sequence_cnt;
300 unsigned short segmentation_grouping_flag;
303 unsigned short segmentation_grouping_flag;
301 unsigned short new_packet_sequence_control;
304 unsigned short new_packet_sequence_control;
302
305
303 segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6
306 segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6
304 sequence_cnt = (unsigned short) (
307 sequence_cnt = (unsigned short) (
305 ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0
308 ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0
306 + packet_sequence_control[1]
309 + packet_sequence_control[1]
307 );
310 );
308
311
309 if ( sequence_cnt < SEQ_CNT_MAX)
312 if ( sequence_cnt < SEQ_CNT_MAX)
310 {
313 {
311 sequence_cnt = sequence_cnt + 1;
314 sequence_cnt = sequence_cnt + 1;
312 }
315 }
313 else
316 else
314 {
317 {
315 sequence_cnt = 0;
318 sequence_cnt = 0;
316 }
319 }
317
320
318 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
321 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
319
322
320 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
323 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
321 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
324 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
322 }
325 }
323
326
324
327
325
328
@@ -1,772 +1,772
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 rtems_id queue_rcv_id;
34 rtems_id queue_rcv_id;
35 rtems_id queue_snd_id;
35 rtems_id queue_snd_id;
36
36
37 status = rtems_message_queue_ident( misc_name[QUEUE_RECV], 0, &queue_rcv_id );
37 status = rtems_message_queue_ident( misc_name[QUEUE_RECV], 0, &queue_rcv_id );
38 if (status != RTEMS_SUCCESSFUL)
38 if (status != RTEMS_SUCCESSFUL)
39 {
39 {
40 PRINTF1("in ACTN *** ERR getting queue_rcv_id %d\n", status)
40 PRINTF1("in ACTN *** ERR getting queue_rcv_id %d\n", status)
41 }
41 }
42
42
43 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_snd_id );
43 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_snd_id );
44 if (status != RTEMS_SUCCESSFUL)
44 if (status != RTEMS_SUCCESSFUL)
45 {
45 {
46 PRINTF1("in ACTN *** ERR getting queue_snd_id %d\n", status)
46 PRINTF1("in ACTN *** ERR getting queue_snd_id %d\n", status)
47 }
47 }
48
48
49 result = LFR_SUCCESSFUL;
49 result = LFR_SUCCESSFUL;
50 subtype = 0; // subtype of the current TC packet
50 subtype = 0; // subtype of the current TC packet
51
51
52 BOOT_PRINTF("in ACTN *** \n")
52 BOOT_PRINTF("in ACTN *** \n")
53
53
54 while(1)
54 while(1)
55 {
55 {
56 status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
56 status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
57 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
57 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
58 if (status!=RTEMS_SUCCESSFUL) PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
58 if (status!=RTEMS_SUCCESSFUL) PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
59 else
59 else
60 {
60 {
61 subtype = TC.serviceSubType;
61 subtype = TC.serviceSubType;
62 switch(subtype)
62 switch(subtype)
63 {
63 {
64 case TC_SUBTYPE_RESET:
64 case TC_SUBTYPE_RESET:
65 result = action_reset( &TC, queue_snd_id );
65 result = action_reset( &TC, queue_snd_id );
66 close_action( &TC, result, queue_snd_id );
66 close_action( &TC, result, queue_snd_id );
67 break;
67 break;
68 //
68 //
69 case TC_SUBTYPE_LOAD_COMM:
69 case TC_SUBTYPE_LOAD_COMM:
70 result = action_load_common_par( &TC );
70 result = action_load_common_par( &TC );
71 close_action( &TC, result, queue_snd_id );
71 close_action( &TC, result, queue_snd_id );
72 break;
72 break;
73 //
73 //
74 case TC_SUBTYPE_LOAD_NORM:
74 case TC_SUBTYPE_LOAD_NORM:
75 result = action_load_normal_par( &TC, queue_snd_id );
75 result = action_load_normal_par( &TC, queue_snd_id );
76 close_action( &TC, result, queue_snd_id );
76 close_action( &TC, result, queue_snd_id );
77 break;
77 break;
78 //
78 //
79 case TC_SUBTYPE_LOAD_BURST:
79 case TC_SUBTYPE_LOAD_BURST:
80 result = action_load_burst_par( &TC, queue_snd_id );
80 result = action_load_burst_par( &TC, queue_snd_id );
81 close_action( &TC, result, queue_snd_id );
81 close_action( &TC, result, queue_snd_id );
82 break;
82 break;
83 //
83 //
84 case TC_SUBTYPE_LOAD_SBM1:
84 case TC_SUBTYPE_LOAD_SBM1:
85 result = action_load_sbm1_par( &TC, queue_snd_id );
85 result = action_load_sbm1_par( &TC, queue_snd_id );
86 close_action( &TC, result, queue_snd_id );
86 close_action( &TC, result, queue_snd_id );
87 break;
87 break;
88 //
88 //
89 case TC_SUBTYPE_LOAD_SBM2:
89 case TC_SUBTYPE_LOAD_SBM2:
90 result = action_load_sbm2_par( &TC, queue_snd_id );
90 result = action_load_sbm2_par( &TC, queue_snd_id );
91 close_action( &TC, result, queue_snd_id );
91 close_action( &TC, result, queue_snd_id );
92 break;
92 break;
93 //
93 //
94 case TC_SUBTYPE_DUMP:
94 case TC_SUBTYPE_DUMP:
95 result = action_dump_par( queue_snd_id );
95 result = action_dump_par( queue_snd_id );
96 close_action( &TC, result, queue_snd_id );
96 close_action( &TC, result, queue_snd_id );
97 break;
97 break;
98 //
98 //
99 case TC_SUBTYPE_ENTER:
99 case TC_SUBTYPE_ENTER:
100 result = action_enter_mode( &TC, queue_snd_id );
100 result = action_enter_mode( &TC, queue_snd_id );
101 close_action( &TC, result, queue_snd_id );
101 close_action( &TC, result, queue_snd_id );
102 break;
102 break;
103 //
103 //
104 case TC_SUBTYPE_UPDT_INFO:
104 case TC_SUBTYPE_UPDT_INFO:
105 result = action_update_info( &TC, queue_snd_id );
105 result = action_update_info( &TC, queue_snd_id );
106 close_action( &TC, result, queue_snd_id );
106 close_action( &TC, result, queue_snd_id );
107 break;
107 break;
108 //
108 //
109 case TC_SUBTYPE_EN_CAL:
109 case TC_SUBTYPE_EN_CAL:
110 result = action_enable_calibration( &TC, queue_snd_id );
110 result = action_enable_calibration( &TC, queue_snd_id );
111 close_action( &TC, result, queue_snd_id );
111 close_action( &TC, result, queue_snd_id );
112 break;
112 break;
113 //
113 //
114 case TC_SUBTYPE_DIS_CAL:
114 case TC_SUBTYPE_DIS_CAL:
115 result = action_disable_calibration( &TC, queue_snd_id );
115 result = action_disable_calibration( &TC, queue_snd_id );
116 close_action( &TC, result, queue_snd_id );
116 close_action( &TC, result, queue_snd_id );
117 break;
117 break;
118 //
118 //
119 case TC_SUBTYPE_UPDT_TIME:
119 case TC_SUBTYPE_UPDT_TIME:
120 result = action_update_time( &TC );
120 result = action_update_time( &TC );
121 close_action( &TC, result, queue_snd_id );
121 close_action( &TC, result, queue_snd_id );
122 break;
122 break;
123 //
123 //
124 default:
124 default:
125 break;
125 break;
126 }
126 }
127 }
127 }
128 }
128 }
129 }
129 }
130
130
131 //***********
131 //***********
132 // TC ACTIONS
132 // TC ACTIONS
133
133
134 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
134 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
135 {
135 {
136 /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
136 /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
137 *
137 *
138 * @param TC points to the TeleCommand packet that is being processed
138 * @param TC points to the TeleCommand packet that is being processed
139 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
139 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
140 *
140 *
141 */
141 */
142
142
143 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
143 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
144 return LFR_DEFAULT;
144 return LFR_DEFAULT;
145 }
145 }
146
146
147 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
147 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
148 {
148 {
149 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
149 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
150 *
150 *
151 * @param TC points to the TeleCommand packet that is being processed
151 * @param TC points to the TeleCommand packet that is being processed
152 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
152 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
153 *
153 *
154 */
154 */
155
155
156 rtems_status_code status;
156 rtems_status_code status;
157 unsigned char requestedMode;
157 unsigned char requestedMode;
158
158
159 requestedMode = TC->dataAndCRC[1];
159 requestedMode = TC->dataAndCRC[1];
160
160
161 if ( (requestedMode != LFR_MODE_STANDBY)
161 if ( (requestedMode != LFR_MODE_STANDBY)
162 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
162 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
163 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
163 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
164 {
164 {
165 status = RTEMS_UNSATISFIED;
165 status = RTEMS_UNSATISFIED;
166 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode );
166 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode );
167 }
167 }
168 else
168 else
169 {
169 {
170 printf("try to enter mode %d\n", requestedMode);
170 printf("try to enter mode %d\n", requestedMode);
171
171
172 #ifdef PRINT_TASK_STATISTICS
172 #ifdef PRINT_TASK_STATISTICS
173 if (requestedMode != LFR_MODE_STANDBY)
173 if (requestedMode != LFR_MODE_STANDBY)
174 {
174 {
175 rtems_cpu_usage_reset();
175 rtems_cpu_usage_reset();
176 maxCount = 0;
176 maxCount = 0;
177 }
177 }
178 #endif
178 #endif
179
179
180 status = transition_validation(requestedMode);
180 status = transition_validation(requestedMode);
181
181
182 if ( status == LFR_SUCCESSFUL ) {
182 if ( status == LFR_SUCCESSFUL ) {
183 if ( lfrCurrentMode != LFR_MODE_STANDBY)
183 if ( lfrCurrentMode != LFR_MODE_STANDBY)
184 {
184 {
185 status = stop_current_mode();
185 status = stop_current_mode();
186 }
186 }
187 if (status != RTEMS_SUCCESSFUL)
187 if (status != RTEMS_SUCCESSFUL)
188 {
188 {
189 PRINTF("ERR *** in action_enter *** stop_current_mode\n")
189 PRINTF("ERR *** in action_enter *** stop_current_mode\n")
190 }
190 }
191 status = enter_mode(requestedMode, TC);
191 status = enter_mode(requestedMode, TC);
192 }
192 }
193 else
193 else
194 {
194 {
195 PRINTF("ERR *** in action_enter *** transition rejected\n")
195 PRINTF("ERR *** in action_enter *** transition rejected\n")
196 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
196 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
197 }
197 }
198 }
198 }
199
199
200 return status;
200 return status;
201 }
201 }
202
202
203 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
203 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
204 {
204 {
205 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
205 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
206 *
206 *
207 * @param TC points to the TeleCommand packet that is being processed
207 * @param TC points to the TeleCommand packet that is being processed
208 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
208 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
209 *
209 *
210 * @return LFR directive status code:
210 * @return LFR directive status code:
211 * - LFR_DEFAULT
211 * - LFR_DEFAULT
212 * - LFR_SUCCESSFUL
212 * - LFR_SUCCESSFUL
213 *
213 *
214 */
214 */
215
215
216 unsigned int val;
216 unsigned int val;
217 int result;
217 int result;
218
218
219 result = LFR_DEFAULT;
219 result = LFR_DEFAULT;
220
220
221 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
221 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
222 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
222 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
223 val++;
223 val++;
224 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
224 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
225 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
225 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
226
226
227 return result;
227 return result;
228 }
228 }
229
229
230 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
230 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
231 {
231 {
232 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
232 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
233 *
233 *
234 * @param TC points to the TeleCommand packet that is being processed
234 * @param TC points to the TeleCommand packet that is being processed
235 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
235 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
236 *
236 *
237 */
237 */
238
238
239 int result;
239 int result;
240 unsigned char lfrMode;
240 unsigned char lfrMode;
241
241
242 result = LFR_DEFAULT;
242 result = LFR_DEFAULT;
243 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
243 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
244
244
245 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
245 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
246 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
246 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
247 result = LFR_DEFAULT;
247 result = LFR_DEFAULT;
248 }
248 }
249 else {
249 else {
250 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
250 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
251 result = LFR_DEFAULT;
251 result = LFR_DEFAULT;
252 }
252 }
253 return result;
253 return result;
254 }
254 }
255
255
256 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
256 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
257 {
257 {
258 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
258 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
259 *
259 *
260 * @param TC points to the TeleCommand packet that is being processed
260 * @param TC points to the TeleCommand packet that is being processed
261 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
261 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
262 *
262 *
263 */
263 */
264
264
265 int result;
265 int result;
266 unsigned char lfrMode;
266 unsigned char lfrMode;
267
267
268 result = LFR_DEFAULT;
268 result = LFR_DEFAULT;
269 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
269 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
270
270
271 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
271 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
272 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
272 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
273 result = LFR_DEFAULT;
273 result = LFR_DEFAULT;
274 }
274 }
275 else {
275 else {
276 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
276 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
277 result = LFR_DEFAULT;
277 result = LFR_DEFAULT;
278 }
278 }
279 return result;
279 return result;
280 }
280 }
281
281
282 int action_update_time(ccsdsTelecommandPacket_t *TC)
282 int action_update_time(ccsdsTelecommandPacket_t *TC)
283 {
283 {
284 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
284 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
285 *
285 *
286 * @param TC points to the TeleCommand packet that is being processed
286 * @param TC points to the TeleCommand packet that is being processed
287 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
287 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
288 *
288 *
289 * @return LFR_SUCCESSFUL
289 * @return LFR_SUCCESSFUL
290 *
290 *
291 */
291 */
292
292
293 unsigned int val;
293 unsigned int val;
294
294
295 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
295 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
296 + (TC->dataAndCRC[1] << 16)
296 + (TC->dataAndCRC[1] << 16)
297 + (TC->dataAndCRC[2] << 8)
297 + (TC->dataAndCRC[2] << 8)
298 + TC->dataAndCRC[3];
298 + TC->dataAndCRC[3];
299 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
299 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
300 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
300 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
301 val++;
301 val++;
302 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
302 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
303 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
303 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
304 time_management_regs->ctrl = time_management_regs->ctrl | 1;
304 time_management_regs->ctrl = time_management_regs->ctrl | 1;
305
305
306 return LFR_SUCCESSFUL;
306 return LFR_SUCCESSFUL;
307 }
307 }
308
308
309 //*******************
309 //*******************
310 // ENTERING THE MODES
310 // ENTERING THE MODES
311
311
312 int transition_validation(unsigned char requestedMode)
312 int transition_validation(unsigned char requestedMode)
313 {
313 {
314 int status;
314 int status;
315
315
316 switch (requestedMode)
316 switch (requestedMode)
317 {
317 {
318 case LFR_MODE_STANDBY:
318 case LFR_MODE_STANDBY:
319 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
319 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
320 status = LFR_DEFAULT;
320 status = LFR_DEFAULT;
321 }
321 }
322 else
322 else
323 {
323 {
324 status = LFR_SUCCESSFUL;
324 status = LFR_SUCCESSFUL;
325 }
325 }
326 break;
326 break;
327 case LFR_MODE_NORMAL:
327 case LFR_MODE_NORMAL:
328 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
328 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
329 status = LFR_DEFAULT;
329 status = LFR_DEFAULT;
330 }
330 }
331 else {
331 else {
332 status = LFR_SUCCESSFUL;
332 status = LFR_SUCCESSFUL;
333 }
333 }
334 break;
334 break;
335 case LFR_MODE_BURST:
335 case LFR_MODE_BURST:
336 if ( lfrCurrentMode == LFR_MODE_BURST ) {
336 if ( lfrCurrentMode == LFR_MODE_BURST ) {
337 status = LFR_DEFAULT;
337 status = LFR_DEFAULT;
338 }
338 }
339 else {
339 else {
340 status = LFR_SUCCESSFUL;
340 status = LFR_SUCCESSFUL;
341 }
341 }
342 break;
342 break;
343 case LFR_MODE_SBM1:
343 case LFR_MODE_SBM1:
344 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
344 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
345 status = LFR_DEFAULT;
345 status = LFR_DEFAULT;
346 }
346 }
347 else {
347 else {
348 status = LFR_SUCCESSFUL;
348 status = LFR_SUCCESSFUL;
349 }
349 }
350 break;
350 break;
351 case LFR_MODE_SBM2:
351 case LFR_MODE_SBM2:
352 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
352 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
353 status = LFR_DEFAULT;
353 status = LFR_DEFAULT;
354 }
354 }
355 else {
355 else {
356 status = LFR_SUCCESSFUL;
356 status = LFR_SUCCESSFUL;
357 }
357 }
358 break;
358 break;
359 default:
359 default:
360 status = LFR_DEFAULT;
360 status = LFR_DEFAULT;
361 break;
361 break;
362 }
362 }
363
363
364 return status;
364 return status;
365 }
365 }
366
366
367 int stop_current_mode()
367 int stop_current_mode()
368 {
368 {
369 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
369 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
370 *
370 *
371 * @return RTEMS directive status codes:
371 * @return RTEMS directive status codes:
372 * - RTEMS_SUCCESSFUL - task restarted successfully
372 * - RTEMS_SUCCESSFUL - task restarted successfully
373 * - RTEMS_INVALID_ID - task id invalid
373 * - RTEMS_INVALID_ID - task id invalid
374 * - RTEMS_ALREADY_SUSPENDED - task already suspended
374 * - RTEMS_ALREADY_SUSPENDED - task already suspended
375 *
375 *
376 */
376 */
377
377
378 rtems_status_code status;
378 rtems_status_code status;
379
379
380 status = RTEMS_SUCCESSFUL;
380 status = RTEMS_SUCCESSFUL;
381
381
382 #ifdef GSA
382 #ifdef GSA
383 LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP)
383 LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP)
384 LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP)
384 LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP)
385 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR );
385 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR );
386 #else
386 #else
387 // mask interruptions
387 // mask interruptions
388 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
388 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
389 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt
389 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt
390 // reset registers
390 // reset registers
391 reset_wfp_run_burst_enable(); // reset run, burst and enable bits, [r b2 b1 b0 e3 e2 e1 e0]
391 reset_wfp_run_burst_enable(); // reset run, burst and enable bits, [r b2 b1 b0 e3 e2 e1 e0]
392 reset_wfp_status(); // reset all the status bits
392 reset_wfp_status(); // reset all the status bits
393 // creal interruptions
393 // creal interruptions
394 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
394 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
395 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectarl matrix interrupt
395 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectarl matrix interrupt
396 #endif
396 #endif
397 //**********************
397 //**********************
398 // suspend several tasks
398 // suspend several tasks
399 if (lfrCurrentMode != LFR_MODE_STANDBY) {
399 if (lfrCurrentMode != LFR_MODE_STANDBY) {
400 status = suspend_science_tasks();
400 status = suspend_science_tasks();
401 }
401 }
402
402
403 if (status != RTEMS_SUCCESSFUL)
403 if (status != RTEMS_SUCCESSFUL)
404 {
404 {
405 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
405 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
406 }
406 }
407
407
408 return status;
408 return status;
409 }
409 }
410
410
411 int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC )
411 int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC )
412 {
412 {
413 rtems_status_code status;
413 rtems_status_code status;
414
414
415 status = RTEMS_UNSATISFIED;
415 status = RTEMS_UNSATISFIED;
416
416
417 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d);
417 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d);
418 updateLFRCurrentMode();
418 updateLFRCurrentMode();
419
419
420 switch(mode){
420 switch(mode){
421 case LFR_MODE_STANDBY:
421 case LFR_MODE_STANDBY:
422 status = enter_standby_mode( );
422 status = enter_standby_mode( );
423 break;
423 break;
424 case LFR_MODE_NORMAL:
424 case LFR_MODE_NORMAL:
425 status = enter_normal_mode( );
425 status = enter_normal_mode( );
426 break;
426 break;
427 case LFR_MODE_BURST:
427 case LFR_MODE_BURST:
428 status = enter_burst_mode( );
428 status = enter_burst_mode( );
429 break;
429 break;
430 case LFR_MODE_SBM1:
430 case LFR_MODE_SBM1:
431 status = enter_sbm1_mode( );
431 status = enter_sbm1_mode( );
432 break;
432 break;
433 case LFR_MODE_SBM2:
433 case LFR_MODE_SBM2:
434 status = enter_sbm2_mode( );
434 status = enter_sbm2_mode( );
435 break;
435 break;
436 default:
436 default:
437 status = RTEMS_UNSATISFIED;
437 status = RTEMS_UNSATISFIED;
438 }
438 }
439
439
440 if (status != RTEMS_SUCCESSFUL)
440 if (status != RTEMS_SUCCESSFUL)
441 {
441 {
442 PRINTF("in enter_mode *** ERR\n")
442 PRINTF("in enter_mode *** ERR\n")
443 status = RTEMS_UNSATISFIED;
443 status = RTEMS_UNSATISFIED;
444 }
444 }
445
445
446 return status;
446 return status;
447 }
447 }
448
448
449 int enter_standby_mode()
449 int enter_standby_mode()
450 {
450 {
451 PRINTF1("maxCount = %d\n", maxCount)
451 PRINTF1("maxCount = %d\n", maxCount)
452
452
453 #ifdef PRINT_TASK_STATISTICS
453 #ifdef PRINT_TASK_STATISTICS
454 rtems_cpu_usage_report();
454 rtems_cpu_usage_report();
455 #endif
455 #endif
456
456
457 #ifdef PRINT_STACK_REPORT
457 #ifdef PRINT_STACK_REPORT
458 rtems_stack_checker_report_usage();
458 rtems_stack_checker_report_usage();
459 #endif
459 #endif
460
460
461 return LFR_SUCCESSFUL;
461 return LFR_SUCCESSFUL;
462 }
462 }
463
463
464 int enter_normal_mode()
464 int enter_normal_mode()
465 {
465 {
466 rtems_status_code status;
466 rtems_status_code status;
467 int startDate;
467 int startDate;
468
468
469 status = restart_science_tasks();
469 status = restart_science_tasks();
470
470
471 #ifdef GSA
471 #ifdef GSA
472 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR );
472 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR );
473 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
473 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
474 LEON_Clear_interrupt( IRQ_WF );
474 LEON_Clear_interrupt( IRQ_WF );
475 LEON_Unmask_interrupt( IRQ_WF );
475 LEON_Unmask_interrupt( IRQ_WF );
476 //
476 //
477 set_local_nb_interrupt_f0_MAX();
477 set_local_nb_interrupt_f0_MAX();
478 LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board
478 LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board
479 LEON_Unmask_interrupt( IRQ_SM );
479 LEON_Unmask_interrupt( IRQ_SM );
480 #else
480 #else
481 //****************
481 //****************
482 // waveform picker
482 // waveform picker
483 reset_new_waveform_picker_regs();
483 reset_new_waveform_picker_regs();
484 set_wfp_burst_enable_register(LFR_MODE_NORMAL);
484 set_wfp_burst_enable_register( LFR_MODE_NORMAL );
485 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
485 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
486 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
486 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
487 startDate = time_management_regs->coarse_time + 2;
487 startDate = time_management_regs->coarse_time + 2;
488 new_waveform_picker_regs->run_burst_enable = new_waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000]
488 new_waveform_picker_regs->start_date = startDate;
489 new_waveform_picker_regs->start_date = startDate;
489 new_waveform_picker_regs->run_burst_enable = new_waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000]
490 //****************
490 //****************
491 // spectral matrix
491 // spectral matrix
492 #endif
492 #endif
493
493
494 return status;
494 return status;
495 }
495 }
496
496
497 int enter_burst_mode()
497 int enter_burst_mode()
498 {
498 {
499 rtems_status_code status;
499 rtems_status_code status;
500
500
501 status = restart_science_tasks();
501 status = restart_science_tasks();
502
502
503 #ifdef GSA
503 #ifdef GSA
504 LEON_Unmask_interrupt( IRQ_SM );
504 LEON_Unmask_interrupt( IRQ_SM );
505 #else
505 #else
506 reset_new_waveform_picker_regs();
506 reset_new_waveform_picker_regs();
507 set_wfp_burst_enable_register(LFR_MODE_BURST);
507 set_wfp_burst_enable_register(LFR_MODE_BURST);
508 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
508 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
509 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
509 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
510 #endif
510 #endif
511
511
512 return status;
512 return status;
513 }
513 }
514
514
515 int enter_sbm1_mode()
515 int enter_sbm1_mode()
516 {
516 {
517 rtems_status_code status;
517 rtems_status_code status;
518
518
519 status = restart_science_tasks();
519 status = restart_science_tasks();
520
520
521 set_local_sbm1_nb_cwf_max();
521 set_local_sbm1_nb_cwf_max();
522
522
523 reset_local_sbm1_nb_cwf_sent();
523 reset_local_sbm1_nb_cwf_sent();
524
524
525 #ifdef GSA
525 #ifdef GSA
526 LEON_Unmask_interrupt( IRQ_SM );
526 LEON_Unmask_interrupt( IRQ_SM );
527 #else
527 #else
528 reset_new_waveform_picker_regs();
528 reset_new_waveform_picker_regs();
529 set_wfp_burst_enable_register(LFR_MODE_SBM1);
529 set_wfp_burst_enable_register(LFR_MODE_SBM1);
530 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
530 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
531 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
531 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
532 // SM simulation
532 // SM simulation
533 // timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
533 // timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
534 // LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board
534 // LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board
535 // LEON_Unmask_interrupt( IRQ_SM );
535 // LEON_Unmask_interrupt( IRQ_SM );
536 #endif
536 #endif
537
537
538 return status;
538 return status;
539 }
539 }
540
540
541 int enter_sbm2_mode()
541 int enter_sbm2_mode()
542 {
542 {
543 rtems_status_code status;
543 rtems_status_code status;
544
544
545 status = restart_science_tasks();
545 status = restart_science_tasks();
546
546
547 set_local_sbm2_nb_cwf_max();
547 set_local_sbm2_nb_cwf_max();
548
548
549 reset_local_sbm2_nb_cwf_sent();
549 reset_local_sbm2_nb_cwf_sent();
550
550
551 #ifdef GSA
551 #ifdef GSA
552 LEON_Unmask_interrupt( IRQ_SM );
552 LEON_Unmask_interrupt( IRQ_SM );
553 #else
553 #else
554 reset_new_waveform_picker_regs();
554 reset_new_waveform_picker_regs();
555 set_wfp_burst_enable_register(LFR_MODE_SBM2);
555 set_wfp_burst_enable_register(LFR_MODE_SBM2);
556 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
556 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
557 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
557 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
558 #endif
558 #endif
559
559
560 return status;
560 return status;
561 }
561 }
562
562
563 int restart_science_tasks()
563 int restart_science_tasks()
564 {
564 {
565 rtems_status_code status[6];
565 rtems_status_code status[6];
566 rtems_status_code ret;
566 rtems_status_code ret;
567
567
568 ret = RTEMS_SUCCESSFUL;
568 ret = RTEMS_SUCCESSFUL;
569
569
570 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 );
570 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 );
571 if (status[0] != RTEMS_SUCCESSFUL)
571 if (status[0] != RTEMS_SUCCESSFUL)
572 {
572 {
573 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
573 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
574 }
574 }
575
575
576 status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 );
576 status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 );
577 if (status[1] != RTEMS_SUCCESSFUL)
577 if (status[1] != RTEMS_SUCCESSFUL)
578 {
578 {
579 PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1])
579 PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1])
580 }
580 }
581
581
582 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
582 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
583 if (status[2] != RTEMS_SUCCESSFUL)
583 if (status[2] != RTEMS_SUCCESSFUL)
584 {
584 {
585 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
585 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
586 }
586 }
587
587
588 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
588 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
589 if (status[3] != RTEMS_SUCCESSFUL)
589 if (status[3] != RTEMS_SUCCESSFUL)
590 {
590 {
591 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
591 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
592 }
592 }
593
593
594 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
594 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
595 if (status[4] != RTEMS_SUCCESSFUL)
595 if (status[4] != RTEMS_SUCCESSFUL)
596 {
596 {
597 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
597 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
598 }
598 }
599
599
600 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
600 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
601 if (status[5] != RTEMS_SUCCESSFUL)
601 if (status[5] != RTEMS_SUCCESSFUL)
602 {
602 {
603 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
603 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
604 }
604 }
605
605
606 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
606 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
607 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
607 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
608 {
608 {
609 ret = RTEMS_UNSATISFIED;
609 ret = RTEMS_UNSATISFIED;
610 }
610 }
611
611
612 return ret;
612 return ret;
613 }
613 }
614
614
615 int suspend_science_tasks()
615 int suspend_science_tasks()
616 {
616 {
617 /** This function suspends the science tasks.
617 /** This function suspends the science tasks.
618 *
618 *
619 * @return RTEMS directive status codes:
619 * @return RTEMS directive status codes:
620 * - RTEMS_SUCCESSFUL - task restarted successfully
620 * - RTEMS_SUCCESSFUL - task restarted successfully
621 * - RTEMS_INVALID_ID - task id invalid
621 * - RTEMS_INVALID_ID - task id invalid
622 * - RTEMS_ALREADY_SUSPENDED - task already suspended
622 * - RTEMS_ALREADY_SUSPENDED - task already suspended
623 *
623 *
624 */
624 */
625
625
626 rtems_status_code status;
626 rtems_status_code status;
627
627
628 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
628 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
629 if (status != RTEMS_SUCCESSFUL)
629 if (status != RTEMS_SUCCESSFUL)
630 {
630 {
631 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
631 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
632 }
632 }
633
633
634 if (status == RTEMS_SUCCESSFUL) // suspend BPF0
634 if (status == RTEMS_SUCCESSFUL) // suspend BPF0
635 {
635 {
636 status = rtems_task_suspend( Task_id[TASKID_BPF0] );
636 status = rtems_task_suspend( Task_id[TASKID_BPF0] );
637 if (status != RTEMS_SUCCESSFUL)
637 if (status != RTEMS_SUCCESSFUL)
638 {
638 {
639 PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status)
639 PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status)
640 }
640 }
641 }
641 }
642
642
643 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
643 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
644 {
644 {
645 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
645 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
646 if (status != RTEMS_SUCCESSFUL)
646 if (status != RTEMS_SUCCESSFUL)
647 {
647 {
648 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
648 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
649 }
649 }
650 }
650 }
651
651
652 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
652 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
653 {
653 {
654 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
654 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
655 if (status != RTEMS_SUCCESSFUL)
655 if (status != RTEMS_SUCCESSFUL)
656 {
656 {
657 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
657 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
658 }
658 }
659 }
659 }
660
660
661 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
661 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
662 {
662 {
663 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
663 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
664 if (status != RTEMS_SUCCESSFUL)
664 if (status != RTEMS_SUCCESSFUL)
665 {
665 {
666 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
666 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
667 }
667 }
668 }
668 }
669
669
670 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
670 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
671 {
671 {
672 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
672 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
673 if (status != RTEMS_SUCCESSFUL)
673 if (status != RTEMS_SUCCESSFUL)
674 {
674 {
675 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
675 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
676 }
676 }
677 }
677 }
678
678
679 return status;
679 return status;
680 }
680 }
681
681
682 //****************
682 //****************
683 // CLOSING ACTIONS
683 // CLOSING ACTIONS
684 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC)
684 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC)
685 {
685 {
686 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
686 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
687 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
687 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
688 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
688 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
689 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
689 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
690 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
690 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
691 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
691 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
692 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
692 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
693 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
693 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
694 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
694 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
695 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time);
695 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time);
696 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8);
696 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8);
697 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = (unsigned char) (time_management_regs->fine_time);
697 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = (unsigned char) (time_management_regs->fine_time);
698 }
698 }
699
699
700 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC)
700 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC)
701 {
701 {
702 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
702 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
703 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
703 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
704 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
704 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
705 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
705 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
706 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
706 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
707 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
707 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
708 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
708 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
709 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
709 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
710 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
710 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
711 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time);
711 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time);
712 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8);
712 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8);
713 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = (unsigned char) (time_management_regs->fine_time);
713 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = (unsigned char) (time_management_regs->fine_time);
714 }
714 }
715
715
716 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id)
716 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id)
717 {
717 {
718 unsigned int val = 0;
718 unsigned int val = 0;
719 if (result == LFR_SUCCESSFUL)
719 if (result == LFR_SUCCESSFUL)
720 {
720 {
721 if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
721 if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
722 &&
722 &&
723 !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
723 !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
724 )
724 )
725 {
725 {
726 send_tm_lfr_tc_exe_success( TC, queue_id );
726 send_tm_lfr_tc_exe_success( TC, queue_id );
727 }
727 }
728 update_last_TC_exe( TC );
728 update_last_TC_exe( TC );
729 val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1];
729 val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1];
730 val++;
730 val++;
731 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
731 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
732 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val);
732 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val);
733 }
733 }
734 else
734 else
735 {
735 {
736 update_last_TC_rej( TC );
736 update_last_TC_rej( TC );
737 val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1];
737 val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1];
738 val++;
738 val++;
739 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
739 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
740 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val);
740 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val);
741 }
741 }
742 }
742 }
743
743
744 //***************************
744 //***************************
745 // Interrupt Service Routines
745 // Interrupt Service Routines
746 rtems_isr commutation_isr1( rtems_vector_number vector )
746 rtems_isr commutation_isr1( rtems_vector_number vector )
747 {
747 {
748 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
748 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
749 printf("In commutation_isr1 *** Error sending event to DUMB\n");
749 printf("In commutation_isr1 *** Error sending event to DUMB\n");
750 }
750 }
751 }
751 }
752
752
753 rtems_isr commutation_isr2( rtems_vector_number vector )
753 rtems_isr commutation_isr2( rtems_vector_number vector )
754 {
754 {
755 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
755 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
756 printf("In commutation_isr2 *** Error sending event to DUMB\n");
756 printf("In commutation_isr2 *** Error sending event to DUMB\n");
757 }
757 }
758 }
758 }
759
759
760 //****************
760 //****************
761 // OTHER FUNCTIONS
761 // OTHER FUNCTIONS
762 void updateLFRCurrentMode()
762 void updateLFRCurrentMode()
763 {
763 {
764 /** This function updates the value of the global variable lfrCurrentMode.
764 /** This function updates the value of the global variable lfrCurrentMode.
765 *
765 *
766 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
766 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
767 *
767 *
768 */
768 */
769 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
769 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
770 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
770 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
771 }
771 }
772
772
@@ -1,1251 +1,1351
1 /** Functions and tasks related to waveform packet generation.
1 /** Functions and tasks related to waveform packet generation.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to handle waveforms, in snapshot or continuous format.\n
6 * A group of functions to handle waveforms, in snapshot or continuous format.\n
7 *
7 *
8 */
8 */
9
9
10 #include "wf_handler.h"
10 #include "wf_handler.h"
11
11
12 // SWF
12 // SWF
13 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7];
13 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7];
14 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
14 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
15 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
15 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
16 // CWF
16 // CWF
17 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7];
17 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7];
18 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7];
18 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7];
19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7];
19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7];
20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7];
20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7];
21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[7];
21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[7];
22
22
23 unsigned char doubleSendCWF1 = 0;
23 unsigned char doubleSendCWF1 = 0;
24 unsigned char doubleSendCWF2 = 0;
24 unsigned char doubleSendCWF2 = 0;
25 unsigned char fullRecord;
25 unsigned char fullRecord;
26
26
27 rtems_isr waveforms_isr( rtems_vector_number vector )
27 rtems_isr waveforms_isr( rtems_vector_number vector )
28 {
28 {
29 unsigned int statusReg;
29 unsigned int statusReg;
30
30
31 /** This is the interrupt sub routine called by the waveform picker core.
31 /** This is the interrupt sub routine called by the waveform picker core.
32 *
32 *
33 * This ISR launch different actions depending mainly on two pieces of information:
33 * This ISR launch different actions depending mainly on two pieces of information:
34 * 1. the values read in the registers of the waveform picker.
34 * 1. the values read in the registers of the waveform picker.
35 * 2. the current LFR mode.
35 * 2. the current LFR mode.
36 *
36 *
37 */
37 */
38
38
39 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffff00f; // clear new_err and full_err
39 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffff00f; // clear new_err and full_err
40
40
41 #ifdef GSA
41 #ifdef GSA
42 #else
42 #else
43 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
43 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
44 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
44 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
45 { // in modes other than STANDBY and BURST, send the CWF_F3 data
45 { // in modes other than STANDBY and BURST, send the CWF_F3 data
46 if ((new_waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
46 if ((new_waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
47 // (1) change the receiving buffer for the waveform picker
47 // (1) change the receiving buffer for the waveform picker
48 if (new_waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) {
48 if (new_waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) {
49 new_waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_bis);
49 new_waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_bis);
50 }
50 }
51 else {
51 else {
52 new_waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3);
52 new_waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3);
53 }
53 }
54 // (2) send an event for the waveforms transmission
54 // (2) send an event for the waveforms transmission
55 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
55 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
56 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
56 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
57 }
57 }
58 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
58 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
59 }
59 }
60 }
60 }
61 #endif
61 #endif
62
62
63 switch(lfrCurrentMode)
63 switch(lfrCurrentMode)
64 {
64 {
65 //********
65 //********
66 // STANDBY
66 // STANDBY
67 case(LFR_MODE_STANDBY):
67 case(LFR_MODE_STANDBY):
68 break;
68 break;
69
69
70 //******
70 //******
71 // NORMAL
71 // NORMAL
72 case(LFR_MODE_NORMAL):
72 case(LFR_MODE_NORMAL):
73 #ifdef GSA
73 #ifdef GSA
74 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
74 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
75 #else
75 #else
76 statusReg = new_waveform_picker_regs->status;
76 statusReg = new_waveform_picker_regs->status;
77 fullRecord = fullRecord | ( statusReg & 0x7 );
77 fullRecord = fullRecord | ( statusReg & 0x7 );
78 // if ( (new_waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full
78 // if ( (new_waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full
79 if ( (new_waveform_picker_regs->status & 0x1) == 0x1 ){ // f2 is full
79 // if ( (new_waveform_picker_regs->status & 0x1) == 0x1 ) // f0 is full
80 if ( (new_waveform_picker_regs->status & 0x4) == 0x4 ) // f2 is full
81 {
80 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
82 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
81 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
83 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
82 }
84 }
83 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffff888;
85 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffff888;
86 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffff888;
87 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffff888;
88 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffff888;
89 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffff888;
90 // if ( (new_waveform_picker_regs->status & 0x1) == 0x1 )
91 if ( (new_waveform_picker_regs->status & 0x4) == 0x4 ) // f2 is full
92 {
93 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
94 }
95 // if ( (new_waveform_picker_regs->status & 0x1) == 0x0 )
96 if ( (new_waveform_picker_regs->status & 0x4) == 0x0 )
97 {
98 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_7 );
99 }
84 }
100 }
85 // if ( fullRecord == 0x7 ){ // f2 f1 and f0 are full
86 // if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
87 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
88 // }
89 // fullRecord = 0x00;
90 // }
91 // new_waveform_picker_regs->status = ( new_waveform_picker_regs->status & (~statusReg) )
92 // | ( new_waveform_picker_regs->status & 0xfffffff8 );
93 #endif
101 #endif
94 break;
102 break;
95
103
96 //******
104 //******
97 // BURST
105 // BURST
98 case(LFR_MODE_BURST):
106 case(LFR_MODE_BURST):
99 #ifdef GSA
107 #ifdef GSA
100 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
108 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
101 #else
109 #else
102 if ((new_waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit
110 if ((new_waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit
103 // (1) change the receiving buffer for the waveform picker
111 // (1) change the receiving buffer for the waveform picker
104 if (new_waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
112 if (new_waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
105 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
113 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
106 }
114 }
107 else {
115 else {
108 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
116 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
109 }
117 }
110 // (2) send an event for the waveforms transmission
118 // (2) send an event for the waveforms transmission
111 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
119 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
112 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
120 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
113 }
121 }
114 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0
122 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0
115 }
123 }
116 #endif
124 #endif
117 break;
125 break;
118
126
119 //*****
127 //*****
120 // SBM1
128 // SBM1
121 case(LFR_MODE_SBM1):
129 case(LFR_MODE_SBM1):
122 #ifdef GSA
130 #ifdef GSA
123 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
131 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
124 #else
132 #else
125 if ((new_waveform_picker_regs->status & 0x02) == 0x02){ // [0010] check the f1 full bit
133 if ((new_waveform_picker_regs->status & 0x02) == 0x02){ // [0010] check the f1 full bit
126 // (1) change the receiving buffer for the waveform picker
134 // (1) change the receiving buffer for the waveform picker
127 if ( param_local.local_sbm1_nb_cwf_sent == (param_local.local_sbm1_nb_cwf_max-1) )
135 if ( param_local.local_sbm1_nb_cwf_sent == (param_local.local_sbm1_nb_cwf_max-1) )
128 {
136 {
129 new_waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_norm);
137 new_waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_norm);
130 }
138 }
131 else if ( new_waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1_norm )
139 else if ( new_waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1_norm )
132 {
140 {
133 doubleSendCWF1 = 1;
141 doubleSendCWF1 = 1;
134 new_waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
142 new_waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
135 }
143 }
136 else if ( new_waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1 ) {
144 else if ( new_waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1 ) {
137 new_waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis);
145 new_waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis);
138 }
146 }
139 else {
147 else {
140 new_waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
148 new_waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
141 }
149 }
142 // (2) send an event for the waveforms transmission
150 // (2) send an event for the waveforms transmission
143 if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
151 if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
144 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
152 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
145 }
153 }
146 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0
154 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0
147 }
155 }
148 if ( ( (new_waveform_picker_regs->status & 0x05) == 0x05 ) ) { // [0101] check the f2 and f0 full bit
156 if ( ( (new_waveform_picker_regs->status & 0x05) == 0x05 ) ) { // [0101] check the f2 and f0 full bit
149 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
157 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
150 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
158 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
151 }
159 }
152 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0
160 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0
153 reset_local_sbm1_nb_cwf_sent();
161 reset_local_sbm1_nb_cwf_sent();
154 }
162 }
155
163
156 #endif
164 #endif
157 break;
165 break;
158
166
159 //*****
167 //*****
160 // SBM2
168 // SBM2
161 case(LFR_MODE_SBM2):
169 case(LFR_MODE_SBM2):
162 #ifdef GSA
170 #ifdef GSA
163 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
171 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
164 #else
172 #else
165 if ((new_waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit
173 if ((new_waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit
166 // (1) change the receiving buffer for the waveform picker
174 // (1) change the receiving buffer for the waveform picker
167 if ( param_local.local_sbm2_nb_cwf_sent == (param_local.local_sbm2_nb_cwf_max-1) )
175 if ( param_local.local_sbm2_nb_cwf_sent == (param_local.local_sbm2_nb_cwf_max-1) )
168 {
176 {
169 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_norm);
177 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_norm);
170 }
178 }
171 else if ( new_waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2_norm ) {
179 else if ( new_waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2_norm ) {
172 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
180 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
173 doubleSendCWF2 = 1;
181 doubleSendCWF2 = 1;
174 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2_WFRM ) != RTEMS_SUCCESSFUL) {
182 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2_WFRM ) != RTEMS_SUCCESSFUL) {
175 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
183 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
176 }
184 }
177 reset_local_sbm2_nb_cwf_sent();
185 reset_local_sbm2_nb_cwf_sent();
178 }
186 }
179 else if ( new_waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2 ) {
187 else if ( new_waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2 ) {
180 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
188 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
181 }
189 }
182 else {
190 else {
183 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
191 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
184 }
192 }
185 // (2) send an event for the waveforms transmission
193 // (2) send an event for the waveforms transmission
186 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
194 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
187 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
195 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
188 }
196 }
189 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
197 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
190 }
198 }
191 if ( ( (new_waveform_picker_regs->status & 0x03) == 0x03 ) ) { // [0011] f3 f2 f1 f0, f1 and f0 are full
199 if ( ( (new_waveform_picker_regs->status & 0x03) == 0x03 ) ) { // [0011] f3 f2 f1 f0, f1 and f0 are full
192 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
200 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
193 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
201 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
194 }
202 }
195 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
203 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
196 }
204 }
197 #endif
205 #endif
198 break;
206 break;
199
207
200 //********
208 //********
201 // DEFAULT
209 // DEFAULT
202 default:
210 default:
203 break;
211 break;
204 }
212 }
205 }
213 }
206
214
207 rtems_isr waveforms_simulator_isr( rtems_vector_number vector )
215 rtems_isr waveforms_simulator_isr( rtems_vector_number vector )
208 {
216 {
209 /** This is the interrupt sub routine called by the waveform picker simulator.
217 /** This is the interrupt sub routine called by the waveform picker simulator.
210 *
218 *
211 * This ISR is for debug purpose only.
219 * This ISR is for debug purpose only.
212 *
220 *
213 */
221 */
214
222
215 unsigned char lfrMode;
223 unsigned char lfrMode;
216 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
224 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
217
225
218 switch(lfrMode) {
226 switch(lfrMode) {
219 case (LFR_MODE_STANDBY):
227 case (LFR_MODE_STANDBY):
220 break;
228 break;
221 case (LFR_MODE_NORMAL):
229 case (LFR_MODE_NORMAL):
222 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
230 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
223 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_5 );
231 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_5 );
224 }
232 }
225 break;
233 break;
226 case (LFR_MODE_BURST):
234 case (LFR_MODE_BURST):
227 break;
235 break;
228 case (LFR_MODE_SBM1):
236 case (LFR_MODE_SBM1):
229 break;
237 break;
230 case (LFR_MODE_SBM2):
238 case (LFR_MODE_SBM2):
231 break;
239 break;
232 }
240 }
233 }
241 }
234
242
235 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
243 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
236 {
244 {
237 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
245 /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode.
238 *
246 *
239 * @param unused is the starting argument of the RTEMS task
247 * @param unused is the starting argument of the RTEMS task
240 *
248 *
241 * The following data packets are sent by this task:
249 * The following data packets are sent by this task:
242 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
250 * - TM_LFR_SCIENCE_NORMAL_SWF_F0
243 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
251 * - TM_LFR_SCIENCE_NORMAL_SWF_F1
244 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
252 * - TM_LFR_SCIENCE_NORMAL_SWF_F2
245 *
253 *
246 */
254 */
247
255
248 rtems_event_set event_out;
256 rtems_event_set event_out;
249 rtems_id queue_id;
257 rtems_id queue_id;
250
258
251 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
259 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
252 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
260 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
253 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
261 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
254
262
255 init_waveforms();
263 init_waveforms();
256
264
257 queue_id = get_pkts_queue_id();
265 queue_id = get_pkts_queue_id();
258
266
259 BOOT_PRINTF("in WFRM ***\n")
267 BOOT_PRINTF("in WFRM ***\n")
260
268
261 while(1){
269 while(1){
262 // wait for an RTEMS_EVENT
270 // wait for an RTEMS_EVENT
263 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
271 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
264 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
272 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
265 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
273 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
266
274
267 if (event_out == RTEMS_EVENT_MODE_NORMAL)
275 if (event_out == RTEMS_EVENT_MODE_NORMAL)
268 {
276 {
269 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
277 //send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
270 send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
278 //send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
271 send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
279 send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
272 #ifdef GSA
280 #ifdef GSA
273 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xf888; // [1111 1000 1000 1000] f2, f1, f0 bits =0
281 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xf888; // [1111 1000 1000 1000] f2, f1, f0 bits =0
274 #endif
282 #endif
275 }
283 }
276 else if (event_out == RTEMS_EVENT_MODE_SBM1)
284 else if (event_out == RTEMS_EVENT_MODE_SBM1)
277 {
285 {
278 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
286 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
279 send_waveform_SWF(wf_snap_f1_norm, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
287 send_waveform_SWF(wf_snap_f1_norm, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
280 send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
288 send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
281 #ifdef GSA
289 #ifdef GSA
282 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2, f0 bits = 0
290 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2, f0 bits = 0
283 #endif
291 #endif
284 }
292 }
285 else if (event_out == RTEMS_EVENT_MODE_SBM2)
293 else if (event_out == RTEMS_EVENT_MODE_SBM2)
286 {
294 {
287 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
295 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
288 send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
296 send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
289 #ifdef GSA
297 #ifdef GSA
290 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
298 new_waveform_picker_regs->status = new_waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
291 #endif
299 #endif
292 }
300 }
293 else if (event_out == RTEMS_EVENT_MODE_SBM2_WFRM)
301 else if (event_out == RTEMS_EVENT_MODE_SBM2_WFRM)
294 {
302 {
295 send_waveform_SWF(wf_snap_f2_norm, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
303 send_waveform_SWF(wf_snap_f2_norm, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
296 }
304 }
297 else
305 else
298 {
306 {
299 PRINTF("in WFRM *** unexpected event")
307 PRINTF("in WFRM *** unexpected event")
300 }
308 }
301
309
302
310
303 #ifdef GSA
311 #ifdef GSA
304 // irq processed, reset the related register of the timer unit
312 // irq processed, reset the related register of the timer unit
305 gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl = gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl | 0x00000010;
313 gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl = gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl | 0x00000010;
306 // clear the interruption
314 // clear the interruption
307 LEON_Unmask_interrupt( IRQ_WF );
315 LEON_Unmask_interrupt( IRQ_WF );
308 #endif
316 #endif
309 }
317 }
310 }
318 }
311
319
312 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
320 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
313 {
321 {
314 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
322 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3.
315 *
323 *
316 * @param unused is the starting argument of the RTEMS task
324 * @param unused is the starting argument of the RTEMS task
317 *
325 *
318 * The following data packet is sent by this task:
326 * The following data packet is sent by this task:
319 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
327 * - TM_LFR_SCIENCE_NORMAL_CWF_F3
320 *
328 *
321 */
329 */
322
330
323 rtems_event_set event_out;
331 rtems_event_set event_out;
324 rtems_id queue_id;
332 rtems_id queue_id;
325
333
326 init_header_continuous_wf_table( SID_NORM_CWF_F3, headerCWF_F3 );
334 init_header_continuous_wf_table( SID_NORM_CWF_F3, headerCWF_F3 );
327 init_header_continuous_wf3_light_table( headerCWF_F3_light );
335 init_header_continuous_wf3_light_table( headerCWF_F3_light );
328
336
329 queue_id = get_pkts_queue_id();
337 queue_id = get_pkts_queue_id();
330
338
331 BOOT_PRINTF("in CWF3 ***\n")
339 BOOT_PRINTF("in CWF3 ***\n")
332
340
333 while(1){
341 while(1){
334 // wait for an RTEMS_EVENT
342 // wait for an RTEMS_EVENT
335 rtems_event_receive( RTEMS_EVENT_0,
343 rtems_event_receive( RTEMS_EVENT_0,
336 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
344 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
337 PRINTF("send CWF F3 \n")
345 PRINTF("send CWF F3 \n")
338 #ifdef GSA
346 #ifdef GSA
339 #else
347 #else
340 if (new_waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) {
348 if (new_waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) {
341 send_waveform_CWF3_light( wf_cont_f3_bis, headerCWF_F3_light, queue_id );
349 send_waveform_CWF3_light( wf_cont_f3_bis, headerCWF_F3_light, queue_id );
342 }
350 }
343 else {
351 else {
344 send_waveform_CWF3_light( wf_cont_f3, headerCWF_F3_light, queue_id );
352 send_waveform_CWF3_light( wf_cont_f3, headerCWF_F3_light, queue_id );
345 }
353 }
346 #endif
354 #endif
347 }
355 }
348 }
356 }
349
357
350 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
358 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
351 {
359 {
352 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
360 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2.
353 *
361 *
354 * @param unused is the starting argument of the RTEMS task
362 * @param unused is the starting argument of the RTEMS task
355 *
363 *
356 * The following data packet is sent by this function:
364 * The following data packet is sent by this function:
357 * - TM_LFR_SCIENCE_BURST_CWF_F2
365 * - TM_LFR_SCIENCE_BURST_CWF_F2
358 * - TM_LFR_SCIENCE_SBM2_CWF_F2
366 * - TM_LFR_SCIENCE_SBM2_CWF_F2
359 *
367 *
360 */
368 */
361
369
362 rtems_event_set event_out;
370 rtems_event_set event_out;
363 rtems_id queue_id;
371 rtems_id queue_id;
364
372
365 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
373 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
366 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
374 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
367
375
368 queue_id = get_pkts_queue_id();
376 queue_id = get_pkts_queue_id();
369
377
370 BOOT_PRINTF("in CWF2 ***\n")
378 BOOT_PRINTF("in CWF2 ***\n")
371
379
372 while(1){
380 while(1){
373 // wait for an RTEMS_EVENT
381 // wait for an RTEMS_EVENT
374 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
382 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
375 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
383 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
376
384
377 if (event_out == RTEMS_EVENT_MODE_BURST)
385 if (event_out == RTEMS_EVENT_MODE_BURST)
378 {
386 {
379 // F2
387 // F2
380 #ifdef GSA
388 #ifdef GSA
381 #else
389 #else
382 if (new_waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
390 if (new_waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
383 send_waveform_CWF( wf_snap_f2_bis, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
391 send_waveform_CWF( wf_snap_f2_bis, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
384 }
392 }
385 else {
393 else {
386 send_waveform_CWF( wf_snap_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
394 send_waveform_CWF( wf_snap_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
387 }
395 }
388 #endif
396 #endif
389 }
397 }
390
398
391 else if (event_out == RTEMS_EVENT_MODE_SBM2)
399 else if (event_out == RTEMS_EVENT_MODE_SBM2)
392 {
400 {
393 #ifdef GSA
401 #ifdef GSA
394 #else
402 #else
395 if (doubleSendCWF2 == 1)
403 if (doubleSendCWF2 == 1)
396 {
404 {
397 doubleSendCWF2 = 0;
405 doubleSendCWF2 = 0;
398 send_waveform_CWF( wf_snap_f2_norm, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
406 send_waveform_CWF( wf_snap_f2_norm, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
399 }
407 }
400 else if (new_waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
408 else if (new_waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
401 send_waveform_CWF( wf_snap_f2_bis, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
409 send_waveform_CWF( wf_snap_f2_bis, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
402 }
410 }
403 else {
411 else {
404 send_waveform_CWF( wf_snap_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
412 send_waveform_CWF( wf_snap_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
405 }
413 }
406 param_local.local_sbm2_nb_cwf_sent ++;
414 param_local.local_sbm2_nb_cwf_sent ++;
407 #endif
415 #endif
408 }
416 }
409 else
417 else
410 {
418 {
411 PRINTF1("in CWF2 *** ERR mode = %d\n", lfrCurrentMode)
419 PRINTF1("in CWF2 *** ERR mode = %d\n", lfrCurrentMode)
412 }
420 }
413 }
421 }
414 }
422 }
415
423
416 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
424 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
417 {
425 {
418 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
426 /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1.
419 *
427 *
420 * @param unused is the starting argument of the RTEMS task
428 * @param unused is the starting argument of the RTEMS task
421 *
429 *
422 * The following data packet is sent by this function:
430 * The following data packet is sent by this function:
423 * - TM_LFR_SCIENCE_SBM1_CWF_F1
431 * - TM_LFR_SCIENCE_SBM1_CWF_F1
424 *
432 *
425 */
433 */
426
434
427 rtems_event_set event_out;
435 rtems_event_set event_out;
428 rtems_id queue_id;
436 rtems_id queue_id;
429
437
430 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
438 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
431
439
432 queue_id = get_pkts_queue_id();
440 queue_id = get_pkts_queue_id();
433
441
434 BOOT_PRINTF("in CWF1 ***\n")
442 BOOT_PRINTF("in CWF1 ***\n")
435
443
436 while(1){
444 while(1){
437 // wait for an RTEMS_EVENT
445 // wait for an RTEMS_EVENT
438 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
446 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
439 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
447 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
440 if (event_out == RTEMS_EVENT_MODE_SBM1)
448 if (event_out == RTEMS_EVENT_MODE_SBM1)
441 {
449 {
442 #ifdef GSA
450 #ifdef GSA
443 #else
451 #else
444 if (doubleSendCWF1 == 1)
452 if (doubleSendCWF1 == 1)
445 {
453 {
446 doubleSendCWF1 = 0;
454 doubleSendCWF1 = 0;
447 send_waveform_CWF( wf_snap_f1_norm, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
455 send_waveform_CWF( wf_snap_f1_norm, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
448 }
456 }
449 else if (new_waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
457 else if (new_waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
450 send_waveform_CWF( wf_snap_f1_bis, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
458 send_waveform_CWF( wf_snap_f1_bis, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
451 }
459 }
452 else {
460 else {
453 send_waveform_CWF( wf_snap_f1, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
461 send_waveform_CWF( wf_snap_f1, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
454 }
462 }
455 param_local.local_sbm1_nb_cwf_sent ++;
463 param_local.local_sbm1_nb_cwf_sent ++;
456 #endif
464 #endif
457 }
465 }
458 else
466 else
459 {
467 {
460 PRINTF1("in CWF1 *** ERR mode = %d\n", lfrCurrentMode)
468 PRINTF1("in CWF1 *** ERR mode = %d\n", lfrCurrentMode)
461 }
469 }
462 }
470 }
463 }
471 }
464
472
465 //******************
473 //******************
466 // general functions
474 // general functions
467 void init_waveforms( void )
475 void init_waveforms( void )
468 {
476 {
469 int i = 0;
477 int i = 0;
470
478
471 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
479 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
472 {
480 {
473 // //***
481 // //***
474 // // F0
482 // // F0
475 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
483 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
476 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
484 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
477 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
485 // wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
478
486
479 // //***
487 // //***
480 // // F1
488 // // F1
481 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
489 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
482 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
490 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
483 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
491 // wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
484
492
485 // //***
493 // //***
486 // // F2
494 // // F2
487 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
495 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
488 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
496 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
489 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
497 // wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
490
498
491 //***
499 //***
492 // F0
500 // F0
493 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x0; //
501 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x0; //
494 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x0; //
502 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x0; //
495 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x0; //
503 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x0; //
496
504
497 //***
505 //***
498 // F1
506 // F1
499 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x0;
507 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x0;
500 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x0;
508 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x0;
501 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x0;
509 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x0;
502
510
503 //***
511 //***
504 // F2
512 // F2
505 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x0;
513 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x0;
506 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x0;
514 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x0;
507 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x0;
515 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x0;
508
516
509 //***
517 //***
510 // F3
518 // F3
511 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
519 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
512 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
520 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
513 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
521 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
514 }
522 }
515 }
523 }
516
524
517 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
525 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
518 {
526 {
519 unsigned char i;
527 unsigned char i;
520
528
521 for (i=0; i<7; i++)
529 for (i=0; i<7; i++)
522 {
530 {
523 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
531 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
524 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
532 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
525 headerSWF[ i ].reserved = DEFAULT_RESERVED;
533 headerSWF[ i ].reserved = DEFAULT_RESERVED;
526 headerSWF[ i ].userApplication = CCSDS_USER_APP;
534 headerSWF[ i ].userApplication = CCSDS_USER_APP;
527 headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
535 headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
528 headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
536 headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
529 if (i == 0)
537 if (i == 0)
530 {
538 {
531 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
539 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
532 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
540 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
533 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
541 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
534 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
542 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
535 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
543 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
536 }
544 }
537 else if (i == 6)
545 else if (i == 6)
538 {
546 {
539 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
547 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
540 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_8 >> 8);
548 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_8 >> 8);
541 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_8 );
549 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_8 );
542 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
550 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
543 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
551 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
544 }
552 }
545 else
553 else
546 {
554 {
547 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
555 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
548 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
556 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
549 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
557 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
550 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
558 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
551 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
559 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
552 }
560 }
553 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
561 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
554 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
562 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
555 headerSWF[ i ].pktNr = i+1; // PKT_NR
563 headerSWF[ i ].pktNr = i+1; // PKT_NR
556 // DATA FIELD HEADER
564 // DATA FIELD HEADER
557 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
565 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
558 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
566 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
559 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
567 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
560 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
568 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
561 // AUXILIARY DATA HEADER
569 // AUXILIARY DATA HEADER
562 headerSWF[ i ].sid = sid;
570 headerSWF[ i ].sid = sid;
563 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
571 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
564 headerSWF[ i ].time[0] = 0x00;
572 headerSWF[ i ].time[0] = 0x00;
565 headerSWF[ i ].time[0] = 0x00;
573 headerSWF[ i ].time[0] = 0x00;
566 headerSWF[ i ].time[0] = 0x00;
574 headerSWF[ i ].time[0] = 0x00;
567 headerSWF[ i ].time[0] = 0x00;
575 headerSWF[ i ].time[0] = 0x00;
568 headerSWF[ i ].time[0] = 0x00;
576 headerSWF[ i ].time[0] = 0x00;
569 headerSWF[ i ].time[0] = 0x00;
577 headerSWF[ i ].time[0] = 0x00;
570 }
578 }
571 return LFR_SUCCESSFUL;
579 return LFR_SUCCESSFUL;
572 }
580 }
573
581
574 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
582 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
575 {
583 {
576 unsigned int i;
584 unsigned int i;
577
585
578 for (i=0; i<7; i++)
586 for (i=0; i<7; i++)
579 {
587 {
580 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
588 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
581 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
589 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
582 headerCWF[ i ].reserved = DEFAULT_RESERVED;
590 headerCWF[ i ].reserved = DEFAULT_RESERVED;
583 headerCWF[ i ].userApplication = CCSDS_USER_APP;
591 headerCWF[ i ].userApplication = CCSDS_USER_APP;
584 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
592 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
585 {
593 {
586 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8);
594 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8);
587 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2);
595 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2);
588 }
596 }
589 else
597 else
590 {
598 {
591 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
599 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
592 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
600 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
593 }
601 }
594 if (i == 0)
602 if (i == 0)
595 {
603 {
596 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
604 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
597 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
605 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
598 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
606 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
599 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
607 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
600 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
608 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
601 }
609 }
602 else if (i == 6)
610 else if (i == 6)
603 {
611 {
604 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
612 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
605 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8);
613 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8);
606 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 );
614 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 );
607 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
615 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
608 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
616 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
609 }
617 }
610 else
618 else
611 {
619 {
612 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
620 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
613 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
621 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
614 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
622 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
615 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
623 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
616 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
624 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
617 }
625 }
618 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
626 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
619 // PKT_CNT
627 // PKT_CNT
620 // PKT_NR
628 // PKT_NR
621 // DATA FIELD HEADER
629 // DATA FIELD HEADER
622 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
630 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
623 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
631 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
624 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
632 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
625 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
633 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
626 // AUXILIARY DATA HEADER
634 // AUXILIARY DATA HEADER
627 headerCWF[ i ].sid = sid;
635 headerCWF[ i ].sid = sid;
628 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
636 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
629 headerCWF[ i ].time[0] = 0x00;
637 headerCWF[ i ].time[0] = 0x00;
630 headerCWF[ i ].time[0] = 0x00;
638 headerCWF[ i ].time[0] = 0x00;
631 headerCWF[ i ].time[0] = 0x00;
639 headerCWF[ i ].time[0] = 0x00;
632 headerCWF[ i ].time[0] = 0x00;
640 headerCWF[ i ].time[0] = 0x00;
633 headerCWF[ i ].time[0] = 0x00;
641 headerCWF[ i ].time[0] = 0x00;
634 headerCWF[ i ].time[0] = 0x00;
642 headerCWF[ i ].time[0] = 0x00;
635 }
643 }
636 return LFR_SUCCESSFUL;
644 return LFR_SUCCESSFUL;
637 }
645 }
638
646
639 int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
647 int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
640 {
648 {
641 unsigned int i;
649 unsigned int i;
642
650
643 for (i=0; i<7; i++)
651 for (i=0; i<7; i++)
644 {
652 {
645 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
653 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
646 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
654 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
647 headerCWF[ i ].reserved = DEFAULT_RESERVED;
655 headerCWF[ i ].reserved = DEFAULT_RESERVED;
648 headerCWF[ i ].userApplication = CCSDS_USER_APP;
656 headerCWF[ i ].userApplication = CCSDS_USER_APP;
649
657
650 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
658 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
651 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
659 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
652 if (i == 0)
660 if (i == 0)
653 {
661 {
654 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
662 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
655 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
663 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
656 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
664 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
657 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
665 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
658 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
666 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
659 }
667 }
660 else if (i == 6)
668 else if (i == 6)
661 {
669 {
662 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
670 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
663 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 >> 8);
671 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 >> 8);
664 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 );
672 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 );
665 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
673 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
666 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
674 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
667 }
675 }
668 else
676 else
669 {
677 {
670 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
678 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
671 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
679 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
672 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
680 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
673 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
681 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
674 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
682 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
675 }
683 }
676 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
684 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
677 // DATA FIELD HEADER
685 // DATA FIELD HEADER
678 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
686 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
679 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
687 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
680 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
688 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
681 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
689 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
682 // AUXILIARY DATA HEADER
690 // AUXILIARY DATA HEADER
683 headerCWF[ i ].sid = SID_NORM_CWF_F3;
691 headerCWF[ i ].sid = SID_NORM_CWF_F3;
684 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
692 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
685 headerCWF[ i ].time[0] = 0x00;
693 headerCWF[ i ].time[0] = 0x00;
686 headerCWF[ i ].time[0] = 0x00;
694 headerCWF[ i ].time[0] = 0x00;
687 headerCWF[ i ].time[0] = 0x00;
695 headerCWF[ i ].time[0] = 0x00;
688 headerCWF[ i ].time[0] = 0x00;
696 headerCWF[ i ].time[0] = 0x00;
689 headerCWF[ i ].time[0] = 0x00;
697 headerCWF[ i ].time[0] = 0x00;
690 headerCWF[ i ].time[0] = 0x00;
698 headerCWF[ i ].time[0] = 0x00;
691 }
699 }
692 return LFR_SUCCESSFUL;
700 return LFR_SUCCESSFUL;
693 }
701 }
694
702
695 void reset_waveforms( void )
703 void reset_waveforms( void )
696 {
704 {
697 int i = 0;
705 int i = 0;
698
706
699 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
707 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
700 {
708 {
701 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000;
709 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000;
702 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
710 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
703 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
711 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
704
712
705 //***
713 //***
706 // F1
714 // F1
707 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000;
715 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000;
708 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000;
716 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000;
709 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
717 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
710
718
711 //***
719 //***
712 // F2
720 // F2
713 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000;
721 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000;
714 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
722 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
715 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000;
723 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000;
716
724
717 //***
725 //***
718 // F3
726 // F3
719 /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1
727 /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1
720 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1
728 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1
721 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/
729 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/
722 }
730 }
723 }
731 }
724
732
725 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
733 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
726 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
734 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
727 {
735 {
728 /** This function sends SWF CCSDS packets (F2, F1 or F0).
736 /** This function sends SWF CCSDS packets (F2, F1 or F0).
729 *
737 *
730 * @param waveform points to the buffer containing the data that will be send.
738 * @param waveform points to the buffer containing the data that will be send.
731 * @param sid is the source identifier of the data that will be sent.
739 * @param sid is the source identifier of the data that will be sent.
732 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
740 * @param headerSWF points to a table of headers that have been prepared for the data transmission.
733 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
741 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
734 * contain information to setup the transmission of the data packets.
742 * contain information to setup the transmission of the data packets.
735 *
743 *
736 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
744 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
737 *
745 *
738 */
746 */
739
747
740 unsigned int i;
748 unsigned int i;
741 int ret;
749 int ret;
742 rtems_status_code status;
750 rtems_status_code status;
743 spw_ioctl_pkt_send spw_ioctl_send_SWF;
751 spw_ioctl_pkt_send spw_ioctl_send_SWF;
744
752
745 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
753 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
746 spw_ioctl_send_SWF.options = 0;
754 spw_ioctl_send_SWF.options = 0;
747
755
748 ret = LFR_DEFAULT;
756 ret = LFR_DEFAULT;
749
757
750 for (i=0; i<7; i++) // send waveform
758 for (i=0; i<7; i++) // send waveform
751 {
759 {
752 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
760 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
753 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
761 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
754 // BUILD THE DATA
762 // BUILD THE DATA
755 if (i==6) {
763 if (i==6) {
756 spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK;
764 spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK;
757 }
765 }
758 else {
766 else {
759 spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK;
767 spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK;
760 }
768 }
761 // SET PACKET SEQUENCE COUNTER
769 // SET PACKET SEQUENCE COUNTER
762 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
770 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
763 // SET PACKET TIME
771 // SET PACKET TIME
764 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
772 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
765 headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
773 headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
766 headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
774 headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
767 headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
775 headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
768 headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
776 headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
769 headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
777 headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
770 headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
778 headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
771 headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
779 headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
772 headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
780 headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
773 headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time);
781 headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time);
774 headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8);
782 headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8);
775 headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time);
783 headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time);
776 // SEND PACKET
784 // SEND PACKET
777 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
785 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
778 if (status != RTEMS_SUCCESSFUL) {
786 if (status != RTEMS_SUCCESSFUL) {
779 printf("%d-%d, ERR %d\n", sid, i, (int) status);
787 printf("%d-%d, ERR %d\n", sid, i, (int) status);
780 ret = LFR_DEFAULT;
788 ret = LFR_DEFAULT;
781 }
789 }
782 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
790 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
783 }
791 }
784
792
785 return ret;
793 return ret;
786 }
794 }
787
795
788 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
796 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
789 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
797 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
790 {
798 {
791 /** This function sends CWF CCSDS packets (F2, F1 or F0).
799 /** This function sends CWF CCSDS packets (F2, F1 or F0).
792 *
800 *
793 * @param waveform points to the buffer containing the data that will be send.
801 * @param waveform points to the buffer containing the data that will be send.
794 * @param sid is the source identifier of the data that will be sent.
802 * @param sid is the source identifier of the data that will be sent.
795 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
803 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
796 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
804 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
797 * contain information to setup the transmission of the data packets.
805 * contain information to setup the transmission of the data packets.
798 *
806 *
799 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
807 * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks.
800 *
808 *
801 */
809 */
802
810
803 unsigned int i;
811 unsigned int i;
804 int ret;
812 int ret;
805 rtems_status_code status;
813 rtems_status_code status;
806 spw_ioctl_pkt_send spw_ioctl_send_CWF;
814 spw_ioctl_pkt_send spw_ioctl_send_CWF;
807
815
808 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
816 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
809 spw_ioctl_send_CWF.options = 0;
817 spw_ioctl_send_CWF.options = 0;
810
818
811 ret = LFR_DEFAULT;
819 ret = LFR_DEFAULT;
812
820
813 for (i=0; i<7; i++) // send waveform
821 for (i=0; i<7; i++) // send waveform
814 {
822 {
815 int coarseTime = 0x00;
823 int coarseTime = 0x00;
816 int fineTime = 0x00;
824 int fineTime = 0x00;
817 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
825 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
818 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
826 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
819 // BUILD THE DATA
827 // BUILD THE DATA
820 if (i==6) {
828 if (i==6) {
821 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK;
829 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK;
822 }
830 }
823 else {
831 else {
824 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK;
832 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK;
825 }
833 }
826 // SET PACKET SEQUENCE COUNTER
834 // SET PACKET SEQUENCE COUNTER
827 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
835 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
828 // SET PACKET TIME
836 // SET PACKET TIME
829 coarseTime = time_management_regs->coarse_time;
837 coarseTime = time_management_regs->coarse_time;
830 fineTime = time_management_regs->fine_time;
838 fineTime = time_management_regs->fine_time;
831 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
839 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
832 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
840 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
833 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
841 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
834 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
842 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
835 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
843 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
836 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
844 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
837 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
845 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
838 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
846 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
839 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
847 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
840 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
848 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
841 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
849 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
842 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
850 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
843 // SEND PACKET
851 // SEND PACKET
844 if (sid == SID_NORM_CWF_F3)
852 if (sid == SID_NORM_CWF_F3)
845 {
853 {
846 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
854 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
847 if (status != RTEMS_SUCCESSFUL) {
855 if (status != RTEMS_SUCCESSFUL) {
848 printf("%d-%d, ERR %d\n", sid, i, (int) status);
856 printf("%d-%d, ERR %d\n", sid, i, (int) status);
849 ret = LFR_DEFAULT;
857 ret = LFR_DEFAULT;
850 }
858 }
851 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
859 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
852 }
860 }
853 else
861 else
854 {
862 {
855 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
863 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
856 if (status != RTEMS_SUCCESSFUL) {
864 if (status != RTEMS_SUCCESSFUL) {
857 printf("%d-%d, ERR %d\n", sid, i, (int) status);
865 printf("%d-%d, ERR %d\n", sid, i, (int) status);
858 ret = LFR_DEFAULT;
866 ret = LFR_DEFAULT;
859 }
867 }
860 }
868 }
861 }
869 }
862
870
863 return ret;
871 return ret;
864 }
872 }
865
873
866 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
874 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
867 {
875 {
868 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
876 /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data.
869 *
877 *
870 * @param waveform points to the buffer containing the data that will be send.
878 * @param waveform points to the buffer containing the data that will be send.
871 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
879 * @param headerCWF points to a table of headers that have been prepared for the data transmission.
872 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
880 * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures
873 * contain information to setup the transmission of the data packets.
881 * contain information to setup the transmission of the data packets.
874 *
882 *
875 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
883 * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer
876 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
884 * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks.
877 *
885 *
878 */
886 */
879
887
880 unsigned int i;
888 unsigned int i;
881 int ret;
889 int ret;
882 rtems_status_code status;
890 rtems_status_code status;
883 spw_ioctl_pkt_send spw_ioctl_send_CWF;
891 spw_ioctl_pkt_send spw_ioctl_send_CWF;
884 char *sample;
892 char *sample;
885
893
886 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
894 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
887 spw_ioctl_send_CWF.options = 0;
895 spw_ioctl_send_CWF.options = 0;
888
896
889 ret = LFR_DEFAULT;
897 ret = LFR_DEFAULT;
890
898
891 //**********************
899 //**********************
892 // BUILD CWF3_light DATA
900 // BUILD CWF3_light DATA
893 for ( i=0; i< 2048; i++)
901 for ( i=0; i< 2048; i++)
894 {
902 {
895 sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ];
903 sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ];
896 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ];
904 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ];
897 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ];
905 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ];
898 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ];
906 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ];
899 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ];
907 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ];
900 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ];
908 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ];
901 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ];
909 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ];
902 }
910 }
903
911
904 //*********************
912 //*********************
905 // SEND CWF3_light DATA
913 // SEND CWF3_light DATA
906
914
907 for (i=0; i<7; i++) // send waveform
915 for (i=0; i<7; i++) // send waveform
908 {
916 {
909 int coarseTime = 0x00;
917 int coarseTime = 0x00;
910 int fineTime = 0x00;
918 int fineTime = 0x00;
911 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * 340 * NB_BYTES_CWF3_LIGHT_BLK) ];
919 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * 340 * NB_BYTES_CWF3_LIGHT_BLK) ];
912 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
920 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
913 // BUILD THE DATA
921 // BUILD THE DATA
914 if ( i == WFRM_INDEX_OF_LAST_PACKET ) {
922 if ( i == WFRM_INDEX_OF_LAST_PACKET ) {
915 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_CWF3_LIGHT_BLK;
923 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_CWF3_LIGHT_BLK;
916 }
924 }
917 else {
925 else {
918 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK;
926 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK;
919 }
927 }
920 // SET PACKET SEQUENCE COUNTER
928 // SET PACKET SEQUENCE COUNTER
921 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
929 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
922 // SET PACKET TIME
930 // SET PACKET TIME
923 coarseTime = time_management_regs->coarse_time;
931 coarseTime = time_management_regs->coarse_time;
924 fineTime = time_management_regs->fine_time;
932 fineTime = time_management_regs->fine_time;
925 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
933 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
926 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
934 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
927 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
935 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
928 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
936 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
929 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
937 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
930 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
938 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
931 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
939 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
932 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
940 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
933 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
941 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
934 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
942 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
935 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
943 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
936 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
944 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
937 // SEND PACKET
945 // SEND PACKET
938 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
946 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
939 if (status != RTEMS_SUCCESSFUL) {
947 if (status != RTEMS_SUCCESSFUL) {
940 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
948 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
941 ret = LFR_DEFAULT;
949 ret = LFR_DEFAULT;
942 }
950 }
943 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
951 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
944 }
952 }
945
953
946 return ret;
954 return ret;
947 }
955 }
948
956
949
957
950 //**************
958 //**************
951 // wfp registers
959 // wfp registers
952 void set_wfp_data_shaping()
960 void set_wfp_data_shaping()
953 {
961 {
954 /** This function sets the data_shaping register of the waveform picker module.
962 /** This function sets the data_shaping register of the waveform picker module.
955 *
963 *
956 * The value is read from one field of the parameter_dump_packet structure:\n
964 * The value is read from one field of the parameter_dump_packet structure:\n
957 * bw_sp0_sp1_r0_r1
965 * bw_sp0_sp1_r0_r1
958 *
966 *
959 */
967 */
960
968
961 unsigned char data_shaping;
969 unsigned char data_shaping;
962
970
963 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
971 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
964 // waveform picker : [R1 R0 SP1 SP0 BW]
972 // waveform picker : [R1 R0 SP1 SP0 BW]
965
973
966 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
974 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
967
975
968 #ifdef GSA
976 #ifdef GSA
969 #else
977 #else
970 new_waveform_picker_regs->data_shaping =
978 new_waveform_picker_regs->data_shaping =
971 ( (data_shaping & 0x10) >> 4 ) // BW
979 ( (data_shaping & 0x10) >> 4 ) // BW
972 + ( (data_shaping & 0x08) >> 2 ) // SP0
980 + ( (data_shaping & 0x08) >> 2 ) // SP0
973 + ( (data_shaping & 0x04) ) // SP1
981 + ( (data_shaping & 0x04) ) // SP1
974 + ( (data_shaping & 0x02) << 2 ) // R0
982 + ( (data_shaping & 0x02) << 2 ) // R0
975 + ( (data_shaping & 0x01) << 4 ); // R1
983 + ( (data_shaping & 0x01) << 4 ); // R1
976 #endif
984 #endif
977 }
985 }
978
986
979 char set_wfp_delta_snapshot()
987 char set_wfp_delta_snapshot()
980 {
988 {
981 /** This function sets the delta_snapshot register of the waveform picker module.
989 /** This function sets the delta_snapshot register of the waveform picker module.
982 *
990 *
983 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
991 * The value is read from two (unsigned char) of the parameter_dump_packet structure:
984 * - sy_lfr_n_swf_p[0]
992 * - sy_lfr_n_swf_p[0]
985 * - sy_lfr_n_swf_p[1]
993 * - sy_lfr_n_swf_p[1]
986 *
994 *
987 */
995 */
988
996
989 char ret;
997 char ret;
990 unsigned int delta_snapshot;
998 unsigned int delta_snapshot;
991 unsigned int aux;
999 unsigned int aux;
992
1000
993 aux = 0;
1001 aux = 0;
994 ret = LFR_DEFAULT;
1002 ret = LFR_DEFAULT;
995
1003
996 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
1004 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
997 + parameter_dump_packet.sy_lfr_n_swf_p[1];
1005 + parameter_dump_packet.sy_lfr_n_swf_p[1];
998
1006
999 #ifdef GSA
1007 #ifdef GSA
1000 #else
1008 #else
1001 if ( delta_snapshot < MIN_DELTA_SNAPSHOT )
1009 if ( delta_snapshot < MIN_DELTA_SNAPSHOT )
1002 {
1010 {
1003 aux = MIN_DELTA_SNAPSHOT;
1011 aux = MIN_DELTA_SNAPSHOT;
1004 ret = LFR_DEFAULT;
1012 ret = LFR_DEFAULT;
1005 }
1013 }
1006 else
1014 else
1007 {
1015 {
1008 aux = delta_snapshot ;
1016 aux = delta_snapshot ;
1009 ret = LFR_SUCCESSFUL;
1017 ret = LFR_SUCCESSFUL;
1010 }
1018 }
1011 new_waveform_picker_regs->delta_snapshot = aux - 1; // max 2 bytes
1019 new_waveform_picker_regs->delta_snapshot = aux - 1; // max 2 bytes
1012 #endif
1020 #endif
1013
1021
1014 return ret;
1022 return ret;
1015 }
1023 }
1016
1024
1017 void set_wfp_burst_enable_register( unsigned char mode)
1025 void set_wfp_burst_enable_register( unsigned char mode)
1018 {
1026 {
1019 /** This function sets the waveform picker burst_enable register depending on the mode.
1027 /** This function sets the waveform picker burst_enable register depending on the mode.
1020 *
1028 *
1021 * @param mode is the LFR mode to launch.
1029 * @param mode is the LFR mode to launch.
1022 *
1030 *
1023 * The burst bits shall be before the enable bits.
1031 * The burst bits shall be before the enable bits.
1024 *
1032 *
1025 */
1033 */
1026
1034
1027 #ifdef GSA
1035 #ifdef GSA
1028 #else
1036 #else
1029 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1037 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
1030 // the burst bits shall be set first, before the enable bits
1038 // the burst bits shall be set first, before the enable bits
1031 switch(mode) {
1039 switch(mode) {
1032 case(LFR_MODE_NORMAL):
1040 case(LFR_MODE_NORMAL):
1033 new_waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable
1041 new_waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enable
1034 // new_waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1042 // new_waveform_picker_regs->run_burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
1035 // new_waveform_picker_regs->run_burst_enable = 0x07; // [0000 0111] enable f2 f1 f0
1043 // new_waveform_picker_regs->run_burst_enable = 0x07; // [0000 0111] enable f2 f1 f0
1036 new_waveform_picker_regs->run_burst_enable = 0x01; // [0000 0111] enable f0
1044 // new_waveform_picker_regs->run_burst_enable = 0x01; // [0000 0001] enable f0
1045 new_waveform_picker_regs->run_burst_enable = 0x04; // [0000 0100] enable f0
1037 break;
1046 break;
1038 case(LFR_MODE_BURST):
1047 case(LFR_MODE_BURST):
1039 new_waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1048 new_waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1040 new_waveform_picker_regs->run_burst_enable = new_waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2
1049 new_waveform_picker_regs->run_burst_enable = new_waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2
1041 break;
1050 break;
1042 case(LFR_MODE_SBM1):
1051 case(LFR_MODE_SBM1):
1043 new_waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled
1052 new_waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled
1044 new_waveform_picker_regs->run_burst_enable = new_waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1053 new_waveform_picker_regs->run_burst_enable = new_waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1045 break;
1054 break;
1046 case(LFR_MODE_SBM2):
1055 case(LFR_MODE_SBM2):
1047 new_waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1056 new_waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1048 new_waveform_picker_regs->run_burst_enable = new_waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1057 new_waveform_picker_regs->run_burst_enable = new_waveform_picker_regs->run_burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
1049 break;
1058 break;
1050 default:
1059 default:
1051 new_waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1060 new_waveform_picker_regs->run_burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
1052 break;
1061 break;
1053 }
1062 }
1054 #endif
1063 #endif
1055 }
1064 }
1056
1065
1057 void reset_wfp_run_burst_enable()
1066 void reset_wfp_run_burst_enable()
1058 {
1067 {
1059 /** This function resets the waveform picker burst_enable register.
1068 /** This function resets the waveform picker burst_enable register.
1060 *
1069 *
1061 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
1070 * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0.
1062 *
1071 *
1063 */
1072 */
1064
1073
1065 #ifdef GSA
1074 #ifdef GSA
1066 #else
1075 #else
1067 new_waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1076 new_waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1068 #endif
1077 #endif
1069 }
1078 }
1070
1079
1071 void reset_wfp_status()
1080 void reset_wfp_status()
1072 {
1081 {
1073 /** This function resets the waveform picker status register.
1082 /** This function resets the waveform picker status register.
1074 *
1083 *
1075 * All status bits are set to 0 [new_err full_err full].
1084 * All status bits are set to 0 [new_err full_err full].
1076 *
1085 *
1077 */
1086 */
1078
1087
1079 #ifdef GSA
1088 #ifdef GSA
1080 #else
1089 #else
1081 new_waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1090 new_waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1082 #endif
1091 #endif
1083 }
1092 }
1084
1093
1085 void reset_new_waveform_picker_regs()
1094 void reset_new_waveform_picker_regs()
1086 {
1095 {
1087 /** This function resets the waveform picker module registers.
1096 /** This function resets the waveform picker module registers.
1088 *
1097 *
1089 * The registers affected by this function are located at the following offset addresses:
1098 * The registers affected by this function are located at the following offset addresses:
1090 * - 0x00 data_shaping
1099 * - 0x00 data_shaping
1091 * - 0x04 run_burst_enable
1100 * - 0x04 run_burst_enable
1092 * - 0x08 addr_data_f0
1101 * - 0x08 addr_data_f0
1093 * - 0x0C addr_data_f1
1102 * - 0x0C addr_data_f1
1094 * - 0x10 addr_data_f2
1103 * - 0x10 addr_data_f2
1095 * - 0x14 addr_data_f3
1104 * - 0x14 addr_data_f3
1096 * - 0x18 status
1105 * - 0x18 status
1097 * - 0x1C delta_snapshot
1106 * - 0x1C delta_snapshot
1098 * - 0x20 delta_f0
1107 * - 0x20 delta_f0
1099 * - 0x24 delta_f0_2
1108 * - 0x24 delta_f0_2
1100 * - 0x28 delta_f1
1109 * - 0x28 delta_f1
1101 * - 0x2c delta_f2
1110 * - 0x2c delta_f2
1102 * - 0x30 nb_data_by_buffer
1111 * - 0x30 nb_data_by_buffer
1103 * - 0x34 nb_snapshot_param
1112 * - 0x34 nb_snapshot_param
1104 * - 0x38 start_date
1113 * - 0x38 start_date
1105 * - 0x3c nb_word_in_buffer
1114 * - 0x3c nb_word_in_buffer
1106 *
1115 *
1107 */
1116 */
1108
1117
1118 unsigned int wf_snap_f0_aligned;
1119 unsigned int wf_snap_f1_aligned;
1120 unsigned int wf_snap_f2_aligned;
1121 unsigned int wf_cont_f3_aligned;
1122
1109 new_waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW
1123 new_waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW
1110 new_waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1124 new_waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1111 new_waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // 0x08
1125 wf_snap_f0_aligned = address_alignment( wf_snap_f0 );
1112 new_waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); // 0x0c
1126 wf_snap_f1_aligned = address_alignment( wf_snap_f1 );
1113 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); // 0x10
1127 wf_snap_f2_aligned = address_alignment( wf_snap_f2 );
1114 new_waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); // 0x14
1128 wf_cont_f3_aligned = address_alignment( wf_cont_f3 );
1129 new_waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0_aligned); // 0x08
1130 new_waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_aligned); // 0x0c
1131 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_aligned); // 0x10
1132 new_waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_aligned); // 0x14
1133 new_waveform_picker_regs->status = 0x00; // 0x18
1134 // new_waveform_picker_regs->delta_snapshot = 0x12800; // 0x1c 296 * 256 = 75776
1135 // new_waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c 16 * 256 = 4096
1136 new_waveform_picker_regs->delta_snapshot = 0x2000; // 0x1c 32 * 256 = 8192
1137 new_waveform_picker_regs->delta_f0 = 0xbf5; // 0x20 *** 1013
1138 new_waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits]
1139 new_waveform_picker_regs->delta_f1 = 0xbc0; // 0x28 *** 960
1140 // new_waveform_picker_regs->delta_f2 = 0x12200; // 0x2c *** 74240
1141 new_waveform_picker_regs->delta_f2 = 0xc00; // 0x2c *** 12 * 256 = 3072
1142 new_waveform_picker_regs->nb_data_by_buffer = 0x7ff; // 0x30 *** 2048 -1 => nb samples -1
1143 new_waveform_picker_regs->snapshot_param = 0x800; // 0x34 *** 2048 => nb samples
1144 new_waveform_picker_regs->start_date = 0x00; // 0x38
1145 new_waveform_picker_regs->nb_word_in_buffer = 0x1802; // 0x3c *** 2048 * 3 + 2 = 6146
1146 }
1147
1148 void reset_new_waveform_picker_regs_alt()
1149 {
1150 /** This function resets the waveform picker module registers.
1151 *
1152 * The registers affected by this function are located at the following offset addresses:
1153 * - 0x00 data_shaping
1154 * - 0x04 run_burst_enable
1155 * - 0x08 addr_data_f0
1156 * - 0x0C addr_data_f1
1157 * - 0x10 addr_data_f2
1158 * - 0x14 addr_data_f3
1159 * - 0x18 status
1160 * - 0x1C delta_snapshot
1161 * - 0x20 delta_f0
1162 * - 0x24 delta_f0_2
1163 * - 0x28 delta_f1
1164 * - 0x2c delta_f2
1165 * - 0x30 nb_data_by_buffer
1166 * - 0x34 nb_snapshot_param
1167 * - 0x38 start_date
1168 * - 0x3c nb_word_in_buffer
1169 *
1170 */
1171
1172 unsigned int wf_snap_f0_aligned;
1173 unsigned int wf_snap_f1_aligned;
1174 unsigned int wf_snap_f2_aligned;
1175 unsigned int wf_cont_f3_aligned;
1176
1177 new_waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW
1178 new_waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1179 wf_snap_f0_aligned = address_alignment( wf_snap_f0 );
1180 wf_snap_f1_aligned = address_alignment( wf_snap_f1 );
1181 wf_snap_f2_aligned = address_alignment( wf_snap_f2 );
1182 wf_cont_f3_aligned = address_alignment( wf_cont_f3 );
1183 new_waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0_aligned); // 0x08
1184 new_waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_aligned); // 0x0c
1185 new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_aligned); // 0x10
1186 new_waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_aligned); // 0x14
1115 new_waveform_picker_regs->status = 0x00; // 0x18
1187 new_waveform_picker_regs->status = 0x00; // 0x18
1116 // new_waveform_picker_regs->delta_snapshot = 0x12800; // 0x1c 296 * 256 = 75776
1188 // new_waveform_picker_regs->delta_snapshot = 0x12800; // 0x1c 296 * 256 = 75776
1117 new_waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c 16 * 256 = 4096
1189 new_waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c 16 * 256 = 4096
1118 new_waveform_picker_regs->delta_f0 = 0x3f5; // 0x20 *** 1013
1190 new_waveform_picker_regs->delta_f0 = 0xbf5; // 0x20 *** 1013
1119 new_waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits]
1191 new_waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 [7 bits]
1120 new_waveform_picker_regs->delta_f1 = 0x3c0; // 0x28 *** 960
1192 new_waveform_picker_regs->delta_f1 = 0xbc0; // 0x28 *** 960
1121 // new_waveform_picker_regs->delta_f2 = 0x12200; // 0x2c *** 74240
1193 // new_waveform_picker_regs->delta_f2 = 0x12200; // 0x2c *** 74240
1122 new_waveform_picker_regs->delta_f2 = 0xc00; // 0x2c *** 12 * 256 = 3072
1194 new_waveform_picker_regs->delta_f2 = 0xc00; // 0x2c *** 12 * 256 = 3072
1123 new_waveform_picker_regs->nb_data_by_buffer = 0x7ff; // 0x30 *** 2048 -1
1195 new_waveform_picker_regs->nb_data_by_buffer = 0x07; // 0x30 *** 7
1124 new_waveform_picker_regs->snapshot_param = 0x800; // 0x34 *** 2048
1196 new_waveform_picker_regs->snapshot_param = 0x10; // 0x34 *** 16
1125 new_waveform_picker_regs->start_date = 0x00; // 0x38
1197 new_waveform_picker_regs->start_date = 0x00; // 0x38
1126 new_waveform_picker_regs->nb_word_in_buffer = 0x1802; // 0x3c *** 2048 * 3 + 2 = 6146
1198 new_waveform_picker_regs->nb_word_in_buffer = 0x34; // 0x3c *** (3 * 8 + 2) * 2
1127 }
1199 }
1128
1200
1129 //*****************
1201 //*****************
1130 // local parameters
1202 // local parameters
1131 void set_local_sbm1_nb_cwf_max()
1203 void set_local_sbm1_nb_cwf_max()
1132 {
1204 {
1133 /** This function sets the value of the sbm1_nb_cwf_max local parameter.
1205 /** This function sets the value of the sbm1_nb_cwf_max local parameter.
1134 *
1206 *
1135 * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n
1207 * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n
1136 * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.\n\n
1208 * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.\n\n
1137 * (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot)
1209 * (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot)
1138 *
1210 *
1139 */
1211 */
1140 param_local.local_sbm1_nb_cwf_max = 2 *
1212 param_local.local_sbm1_nb_cwf_max = 2 *
1141 (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256
1213 (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256
1142 + parameter_dump_packet.sy_lfr_n_swf_p[1]) - 8; // 16 CWF1 parts during 1 SWF2
1214 + parameter_dump_packet.sy_lfr_n_swf_p[1]) - 8; // 16 CWF1 parts during 1 SWF2
1143 }
1215 }
1144
1216
1145 void set_local_sbm2_nb_cwf_max()
1217 void set_local_sbm2_nb_cwf_max()
1146 {
1218 {
1147 /** This function sets the value of the sbm1_nb_cwf_max local parameter.
1219 /** This function sets the value of the sbm1_nb_cwf_max local parameter.
1148 *
1220 *
1149 * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n
1221 * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n
1150 * This parameter is used to send CWF_F2 data as normal data when the SBM2 is active.\n\n
1222 * This parameter is used to send CWF_F2 data as normal data when the SBM2 is active.\n\n
1151 * (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz)
1223 * (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz)
1152 *
1224 *
1153 */
1225 */
1154
1226
1155 param_local.local_sbm2_nb_cwf_max = (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256
1227 param_local.local_sbm2_nb_cwf_max = (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256
1156 + parameter_dump_packet.sy_lfr_n_swf_p[1]) / 8;
1228 + parameter_dump_packet.sy_lfr_n_swf_p[1]) / 8;
1157 }
1229 }
1158
1230
1159 void set_local_nb_interrupt_f0_MAX()
1231 void set_local_nb_interrupt_f0_MAX()
1160 {
1232 {
1161 /** This function sets the value of the nb_interrupt_f0_MAX local parameter.
1233 /** This function sets the value of the nb_interrupt_f0_MAX local parameter.
1162 *
1234 *
1163 * This parameter is used for the SM validation only.\n
1235 * This parameter is used for the SM validation only.\n
1164 * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices
1236 * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices
1165 * module before launching a basic processing.
1237 * module before launching a basic processing.
1166 *
1238 *
1167 */
1239 */
1168
1240
1169 param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256
1241 param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256
1170 + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100;
1242 + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100;
1171 }
1243 }
1172
1244
1173 void reset_local_sbm1_nb_cwf_sent()
1245 void reset_local_sbm1_nb_cwf_sent()
1174 {
1246 {
1175 /** This function resets the value of the sbm1_nb_cwf_sent local parameter.
1247 /** This function resets the value of the sbm1_nb_cwf_sent local parameter.
1176 *
1248 *
1177 * The sbm1_nb_cwf_sent parameter counts the number of CWF_F1 records that have been sent.\n
1249 * The sbm1_nb_cwf_sent parameter counts the number of CWF_F1 records that have been sent.\n
1178 * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.
1250 * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.
1179 *
1251 *
1180 */
1252 */
1181
1253
1182 param_local.local_sbm1_nb_cwf_sent = 0;
1254 param_local.local_sbm1_nb_cwf_sent = 0;
1183 }
1255 }
1184
1256
1185 void reset_local_sbm2_nb_cwf_sent()
1257 void reset_local_sbm2_nb_cwf_sent()
1186 {
1258 {
1187 /** This function resets the value of the sbm2_nb_cwf_sent local parameter.
1259 /** This function resets the value of the sbm2_nb_cwf_sent local parameter.
1188 *
1260 *
1189 * The sbm2_nb_cwf_sent parameter counts the number of CWF_F2 records that have been sent.\n
1261 * The sbm2_nb_cwf_sent parameter counts the number of CWF_F2 records that have been sent.\n
1190 * This parameter is used to send CWF_F2 data as normal data when the SBM2 mode is active.
1262 * This parameter is used to send CWF_F2 data as normal data when the SBM2 mode is active.
1191 *
1263 *
1192 */
1264 */
1193
1265
1194 param_local.local_sbm2_nb_cwf_sent = 0;
1266 param_local.local_sbm2_nb_cwf_sent = 0;
1195 }
1267 }
1196
1268
1197 rtems_id get_pkts_queue_id( void )
1269 rtems_id get_pkts_queue_id( void )
1198 {
1270 {
1199 rtems_id queue_id;
1271 rtems_id queue_id;
1200 rtems_status_code status;
1272 rtems_status_code status;
1201 rtems_name queue_send_name;
1273 rtems_name queue_send_name;
1202
1274
1203 queue_send_name = rtems_build_name( 'Q', '_', 'S', 'D' );
1275 queue_send_name = rtems_build_name( 'Q', '_', 'S', 'D' );
1204
1276
1205 status = rtems_message_queue_ident( queue_send_name, 0, &queue_id );
1277 status = rtems_message_queue_ident( queue_send_name, 0, &queue_id );
1206 if (status != RTEMS_SUCCESSFUL)
1278 if (status != RTEMS_SUCCESSFUL)
1207 {
1279 {
1208 PRINTF1("in get_pkts_queue_id *** ERR %d\n", status)
1280 PRINTF1("in get_pkts_queue_id *** ERR %d\n", status)
1209 }
1281 }
1210 return queue_id;
1282 return queue_id;
1211 }
1283 }
1212
1284
1213 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1285 void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid )
1214 {
1286 {
1215 unsigned short *sequence_cnt;
1287 unsigned short *sequence_cnt;
1216 unsigned short segmentation_grouping_flag;
1288 unsigned short segmentation_grouping_flag;
1217 unsigned short new_packet_sequence_control;
1289 unsigned short new_packet_sequence_control;
1218
1290
1219 if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2)
1291 if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2)
1220 || (sid ==SID_NORM_CWF_F3) || (sid ==SID_BURST_CWF_F2) )
1292 || (sid ==SID_NORM_CWF_F3) || (sid ==SID_BURST_CWF_F2) )
1221 {
1293 {
1222 sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST;
1294 sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST;
1223 }
1295 }
1224 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) )
1296 else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) )
1225 {
1297 {
1226 sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2;
1298 sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2;
1227 }
1299 }
1228 else
1300 else
1229 {
1301 {
1230 sequence_cnt = &sequenceCounters_TC_EXE[ UNKNOWN ];
1302 sequence_cnt = &sequenceCounters_TC_EXE[ UNKNOWN ];
1231 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1303 PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid)
1232 }
1304 }
1233
1305
1234 segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8;
1306 segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8;
1235 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1307 *sequence_cnt = (*sequence_cnt) & 0x3fff;
1236
1308
1237 new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ;
1309 new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ;
1238
1310
1239 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1311 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
1240 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1312 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
1241
1313
1242 // increment the sequence counter for the next packet
1314 // increment the sequence counter for the next packet
1243 if ( *sequence_cnt < SEQ_CNT_MAX)
1315 if ( *sequence_cnt < SEQ_CNT_MAX)
1244 {
1316 {
1245 *sequence_cnt = *sequence_cnt + 1;
1317 *sequence_cnt = *sequence_cnt + 1;
1246 }
1318 }
1247 else
1319 else
1248 {
1320 {
1249 *sequence_cnt = 0;
1321 *sequence_cnt = 0;
1250 }
1322 }
1251 }
1323 }
1324
1325 unsigned int address_alignment( volatile int *address)
1326 {
1327 unsigned char i;
1328 unsigned char lastByte;
1329 unsigned int addressAligned;
1330
1331 addressAligned = (unsigned int) address;
1332
1333 PRINTF1("address %x\n", addressAligned );
1334
1335 for (i=0; i<256; i++)
1336 {
1337 lastByte = (unsigned char) ( addressAligned & 0x000000ff ) ;
1338 if (lastByte == 0x00)
1339 {
1340 break;
1341 }
1342 else
1343 {
1344 addressAligned = addressAligned + 1;
1345 }
1346 }
1347
1348 PRINTF2("i = %d, address %x\n", i, (int) addressAligned);
1349
1350 return addressAligned;
1351 }
General Comments 0
You need to be logged in to leave comments. Login now