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