@@ -1,1 +1,1 | |||
|
1 |
src/basic_parameters = https:// |
|
|
1 | src/basic_parameters = https://hephaistos.lpp.polytechnique.fr/rhodecode/HG_REPOSITORIES/LPP/INSTRUMENTATION/SOLO_LFR/LFR_basic-parameters |
@@ -1,253 +1,253 | |||
|
1 | 1 | ############################################################################# |
|
2 | 2 | # Makefile for building: bin/fsw |
|
3 |
# Generated by qmake (2.01a) (Qt 4.8.5) on: |
|
|
3 | # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Mar 4 09:15:37 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=2 -DPRINT_MESSAGES_ON_CONSOLE | |
|
13 | DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=2 -DPRINT_MESSAGES_ON_CONSOLE -DDEBUG_MESSAGES | |
|
14 | 14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
15 | 15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
16 | 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 | 55 | ../src/tc_acceptance.c \ |
|
56 | 56 | ../../LFR_basic-parameters/basic_parameters.c |
|
57 | 57 | OBJECTS = obj/wf_handler.o \ |
|
58 | 58 | obj/tc_handler.o \ |
|
59 | 59 | obj/fsw_processing.o \ |
|
60 | 60 | obj/fsw_misc.o \ |
|
61 | 61 | obj/fsw_init.o \ |
|
62 | 62 | obj/fsw_globals.o \ |
|
63 | 63 | obj/fsw_spacewire.o \ |
|
64 | 64 | obj/tc_load_dump_parameters.o \ |
|
65 | 65 | obj/tm_lfr_tc_exe.o \ |
|
66 | 66 | obj/tc_acceptance.o \ |
|
67 | 67 | obj/basic_parameters.o |
|
68 | 68 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
69 | 69 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
70 | 70 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
71 | 71 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
72 | 72 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
73 | 73 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
74 | 74 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
75 | 75 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
76 | 76 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
77 | 77 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
78 | 78 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
79 | 79 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
80 | 80 | sparc.pri \ |
|
81 | 81 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
82 | 82 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
83 | 83 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
84 | 84 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
85 | 85 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
86 | 86 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
87 | 87 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
88 | 88 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
89 | 89 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
90 | 90 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ |
|
91 | 91 | fsw-qt.pro |
|
92 | 92 | QMAKE_TARGET = fsw |
|
93 | 93 | DESTDIR = bin/ |
|
94 | 94 | TARGET = bin/fsw |
|
95 | 95 | |
|
96 | 96 | first: all |
|
97 | 97 | ####### Implicit rules |
|
98 | 98 | |
|
99 | 99 | .SUFFIXES: .o .c .cpp .cc .cxx .C |
|
100 | 100 | |
|
101 | 101 | .cpp.o: |
|
102 | 102 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
103 | 103 | |
|
104 | 104 | .cc.o: |
|
105 | 105 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
106 | 106 | |
|
107 | 107 | .cxx.o: |
|
108 | 108 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
109 | 109 | |
|
110 | 110 | .C.o: |
|
111 | 111 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
112 | 112 | |
|
113 | 113 | .c.o: |
|
114 | 114 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" |
|
115 | 115 | |
|
116 | 116 | ####### Build rules |
|
117 | 117 | |
|
118 | 118 | all: Makefile $(TARGET) |
|
119 | 119 | |
|
120 | 120 | $(TARGET): $(OBJECTS) |
|
121 | 121 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ |
|
122 | 122 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) |
|
123 | 123 | |
|
124 | 124 | Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
125 | 125 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
126 | 126 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
127 | 127 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
128 | 128 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
129 | 129 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
130 | 130 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
131 | 131 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
132 | 132 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
133 | 133 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
134 | 134 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
135 | 135 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
136 | 136 | sparc.pri \ |
|
137 | 137 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
138 | 138 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
139 | 139 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
140 | 140 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
141 | 141 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
142 | 142 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
143 | 143 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
144 | 144 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
145 | 145 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
146 | 146 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf |
|
147 | 147 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
148 | 148 | /usr/lib64/qt4/mkspecs/common/unix.conf: |
|
149 | 149 | /usr/lib64/qt4/mkspecs/common/linux.conf: |
|
150 | 150 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: |
|
151 | 151 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: |
|
152 | 152 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: |
|
153 | 153 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: |
|
154 | 154 | /usr/lib64/qt4/mkspecs/qconfig.pri: |
|
155 | 155 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: |
|
156 | 156 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: |
|
157 | 157 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: |
|
158 | 158 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: |
|
159 | 159 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: |
|
160 | 160 | sparc.pri: |
|
161 | 161 | /usr/lib64/qt4/mkspecs/features/release.prf: |
|
162 | 162 | /usr/lib64/qt4/mkspecs/features/default_post.prf: |
|
163 | 163 | /usr/lib64/qt4/mkspecs/features/shared.prf: |
|
164 | 164 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: |
|
165 | 165 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: |
|
166 | 166 | /usr/lib64/qt4/mkspecs/features/resources.prf: |
|
167 | 167 | /usr/lib64/qt4/mkspecs/features/uic.prf: |
|
168 | 168 | /usr/lib64/qt4/mkspecs/features/yacc.prf: |
|
169 | 169 | /usr/lib64/qt4/mkspecs/features/lex.prf: |
|
170 | 170 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: |
|
171 | 171 | qmake: FORCE |
|
172 | 172 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
173 | 173 | |
|
174 | 174 | dist: |
|
175 | 175 | @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0 |
|
176 | 176 | $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0 |
|
177 | 177 | |
|
178 | 178 | |
|
179 | 179 | clean:compiler_clean |
|
180 | 180 | -$(DEL_FILE) $(OBJECTS) |
|
181 | 181 | -$(DEL_FILE) *~ core *.core |
|
182 | 182 | |
|
183 | 183 | |
|
184 | 184 | ####### Sub-libraries |
|
185 | 185 | |
|
186 | 186 | distclean: clean |
|
187 | 187 | -$(DEL_FILE) $(TARGET) |
|
188 | 188 | -$(DEL_FILE) Makefile |
|
189 | 189 | |
|
190 | 190 | |
|
191 | 191 | grmon: |
|
192 | 192 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u |
|
193 | 193 | |
|
194 | 194 | check: first |
|
195 | 195 | |
|
196 | 196 | compiler_rcc_make_all: |
|
197 | 197 | compiler_rcc_clean: |
|
198 | 198 | compiler_uic_make_all: |
|
199 | 199 | compiler_uic_clean: |
|
200 | 200 | compiler_image_collection_make_all: qmake_image_collection.cpp |
|
201 | 201 | compiler_image_collection_clean: |
|
202 | 202 | -$(DEL_FILE) qmake_image_collection.cpp |
|
203 | 203 | compiler_yacc_decl_make_all: |
|
204 | 204 | compiler_yacc_decl_clean: |
|
205 | 205 | compiler_yacc_impl_make_all: |
|
206 | 206 | compiler_yacc_impl_clean: |
|
207 | 207 | compiler_lex_make_all: |
|
208 | 208 | compiler_lex_clean: |
|
209 | 209 | compiler_clean: |
|
210 | 210 | |
|
211 | 211 | ####### Compile |
|
212 | 212 | |
|
213 | 213 | obj/wf_handler.o: ../src/wf_handler.c |
|
214 | 214 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c |
|
215 | 215 | |
|
216 | 216 | obj/tc_handler.o: ../src/tc_handler.c |
|
217 | 217 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c |
|
218 | 218 | |
|
219 | 219 | obj/fsw_processing.o: ../src/fsw_processing.c ../src/fsw_processing_globals.c |
|
220 | 220 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c |
|
221 | 221 | |
|
222 | 222 | obj/fsw_misc.o: ../src/fsw_misc.c |
|
223 | 223 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c |
|
224 | 224 | |
|
225 | 225 | obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c |
|
226 | 226 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c |
|
227 | 227 | |
|
228 | 228 | obj/fsw_globals.o: ../src/fsw_globals.c |
|
229 | 229 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c |
|
230 | 230 | |
|
231 | 231 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c |
|
232 | 232 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c |
|
233 | 233 | |
|
234 | 234 | obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c |
|
235 | 235 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c |
|
236 | 236 | |
|
237 | 237 | obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c |
|
238 | 238 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c |
|
239 | 239 | |
|
240 | 240 | obj/tc_acceptance.o: ../src/tc_acceptance.c |
|
241 | 241 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c |
|
242 | 242 | |
|
243 | 243 | obj/basic_parameters.o: ../../LFR_basic-parameters/basic_parameters.c ../../LFR_basic-parameters/basic_parameters.h |
|
244 | 244 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/basic_parameters.o ../../LFR_basic-parameters/basic_parameters.c |
|
245 | 245 | |
|
246 | 246 | ####### Install |
|
247 | 247 | |
|
248 | 248 | install: FORCE |
|
249 | 249 | |
|
250 | 250 | uninstall: FORCE |
|
251 | 251 | |
|
252 | 252 | FORCE: |
|
253 | 253 |
@@ -1,78 +1,77 | |||
|
1 | 1 | TEMPLATE = app |
|
2 | 2 | # CONFIG += console v8 sim |
|
3 | 3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report |
|
4 | CONFIG += console verbose | |
|
4 | CONFIG += console verbose debug_messages | |
|
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=2 # 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 | |
|
42 | 42 | INCLUDEPATH += \ |
|
43 | 43 | ../src \ |
|
44 | 44 | ../header \ |
|
45 | 45 | ../../LFR_basic-parameters |
|
46 | 46 | |
|
47 | 47 | SOURCES += \ |
|
48 | 48 | ../src/wf_handler.c \ |
|
49 | 49 | ../src/tc_handler.c \ |
|
50 | 50 | ../src/fsw_processing.c \ |
|
51 | 51 | ../src/fsw_misc.c \ |
|
52 | 52 | ../src/fsw_init.c \ |
|
53 | 53 | ../src/fsw_globals.c \ |
|
54 | 54 | ../src/fsw_spacewire.c \ |
|
55 | 55 | ../src/tc_load_dump_parameters.c \ |
|
56 | 56 | ../src/tm_lfr_tc_exe.c \ |
|
57 | 57 | ../src/tc_acceptance.c \ |
|
58 | 58 | ../../LFR_basic-parameters/basic_parameters.c |
|
59 | 59 | |
|
60 | 60 | |
|
61 | 61 | HEADERS += \ |
|
62 | 62 | ../header/wf_handler.h \ |
|
63 | 63 | ../header/tc_handler.h \ |
|
64 | 64 | ../header/grlib_regs.h \ |
|
65 | 65 | ../header/fsw_processing.h \ |
|
66 | 66 | ../header/fsw_params.h \ |
|
67 | 67 | ../header/fsw_misc.h \ |
|
68 | 68 | ../header/fsw_init.h \ |
|
69 | 69 | ../header/ccsds_types.h \ |
|
70 | 70 | ../header/fsw_params_processing.h \ |
|
71 | 71 | ../header/fsw_spacewire.h \ |
|
72 | ../header/tm_byte_positions.h \ | |
|
73 | 72 | ../header/tc_load_dump_parameters.h \ |
|
74 | 73 | ../header/tm_lfr_tc_exe.h \ |
|
75 | 74 | ../header/tc_acceptance.h \ |
|
76 | 75 | ../header/fsw_params_nb_bytes.h \ |
|
77 | 76 | ../../LFR_basic-parameters/basic_parameters.h |
|
78 | 77 |
@@ -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-03-0 |
|
|
3 | <!-- Written by QtCreator 3.0.0, 2014-03-04T07:03:18. --> | |
|
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,609 +1,609 | |||
|
1 | 1 | #ifndef CCSDS_TYPES_H_INCLUDED |
|
2 | 2 | #define CCSDS_TYPES_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include "fsw_params_processing.h" |
|
5 | 5 | |
|
6 | 6 | #define CCSDS_PROTOCOLE_EXTRA_BYTES 4 |
|
7 | 7 | #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4 |
|
8 | 8 | #define CCSDS_TM_PKT_MAX_SIZE 4412 |
|
9 | 9 | #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4 |
|
10 | 10 | #define CCSDS_TC_PKT_MAX_SIZE 256 |
|
11 | 11 | #define CCSDS_TC_PKT_MIN_SIZE 16 |
|
12 | 12 | #define CCSDS_TC_TM_PACKET_OFFSET 7 |
|
13 | 13 | #define CCSDS_PROCESS_ID 76 |
|
14 | 14 | #define CCSDS_PACKET_CATEGORY 12 |
|
15 | 15 | #define CCSDS_NODE_ADDRESS 0xfe |
|
16 | 16 | #define CCSDS_USER_APP 0x00 |
|
17 | 17 | |
|
18 | 18 | #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10 |
|
19 | 19 | #define DEFAULT_RESERVED 0x00 |
|
20 | 20 | #define DEFAULT_HKBIA 0x1e // 0001 1110 |
|
21 | 21 | |
|
22 | 22 | // PACKET ID |
|
23 | 23 | #define TM_PACKET_ID_TC_EXE 0x0cc1 // PID 76 CAT 1 |
|
24 | 24 | #define TM_PACKET_ID_HK 0x0cc4 // PID 76 CAT 4 |
|
25 | 25 | #define TM_PACKET_ID_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9 |
|
26 | 26 | #define TM_PACKET_ID_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12 |
|
27 | 27 | #define TM_PACKET_ID_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12 |
|
28 | 28 | #define TM_PACKET_PID_DEFAULT 76 |
|
29 | 29 | #define TM_PACKET_PID_BURST_SBM1_SBM2 79 |
|
30 | 30 | #define TM_PACKET_CAT_TC_EXE 1 |
|
31 | 31 | #define TM_PACKET_CAT_HK 4 |
|
32 | 32 | #define TM_PACKET_CAT_PARAMETER_DUMP 9 |
|
33 | 33 | #define TM_PACKET_CAT_SCIENCE 12 |
|
34 | 34 | |
|
35 | 35 | // PACKET SEQUENCE CONTROL |
|
36 | 36 | #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000] |
|
37 | 37 | #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000] |
|
38 | 38 | #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000] |
|
39 | 39 | #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000] |
|
40 | 40 | #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000] |
|
41 | 41 | |
|
42 | 42 | // DESTINATION ID |
|
43 | 43 | #define TM_DESTINATION_ID_GROUND 0 |
|
44 | 44 | #define TM_DESTINATION_ID_MISSION_TIMELINE 110 |
|
45 | 45 | #define TM_DESTINATION_ID_TC_SEQUENCES 111 |
|
46 | 46 | #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112 |
|
47 | 47 | #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113 |
|
48 | 48 | #define TM_DESTINATION_ID_DIRECT_CMD 120 |
|
49 | 49 | #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121 |
|
50 | 50 | #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122 |
|
51 | 51 | #define TM_DESTINATION_ID_OBCP 15 |
|
52 | 52 | #define TM_DESTINATION_ID_SYSTEM_CONTROL 14 |
|
53 | 53 | #define TM_DESTINATION_ID_AOCS 11 |
|
54 | 54 | |
|
55 | 55 | #define CCSDS_DESTINATION_ID 0x01 |
|
56 | 56 | #define CCSDS_PROTOCOLE_ID 0x02 |
|
57 | 57 | #define CCSDS_RESERVED 0x00 |
|
58 | 58 | #define CCSDS_USER_APP 0x00 |
|
59 | 59 | |
|
60 | 60 | #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24 |
|
61 | 61 | #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32 |
|
62 | 62 | #define SIZE_HK_PARAMETERS 112 |
|
63 | 63 | |
|
64 | 64 | // TC TYPES |
|
65 | 65 | #define TC_TYPE_GEN 181 |
|
66 | 66 | #define TC_TYPE_TIME 9 |
|
67 | 67 | |
|
68 | 68 | // TC SUBTYPES |
|
69 | 69 | #define TC_SUBTYPE_RESET 1 |
|
70 | 70 | #define TC_SUBTYPE_LOAD_COMM 11 |
|
71 | 71 | #define TC_SUBTYPE_LOAD_NORM 13 |
|
72 | 72 | #define TC_SUBTYPE_LOAD_BURST 19 |
|
73 | 73 | #define TC_SUBTYPE_LOAD_SBM1 25 |
|
74 | 74 | #define TC_SUBTYPE_LOAD_SBM2 27 |
|
75 | 75 | #define TC_SUBTYPE_DUMP 31 |
|
76 | 76 | #define TC_SUBTYPE_ENTER 41 |
|
77 | 77 | #define TC_SUBTYPE_UPDT_INFO 51 |
|
78 | 78 | #define TC_SUBTYPE_EN_CAL 61 |
|
79 | 79 | #define TC_SUBTYPE_DIS_CAL 63 |
|
80 | 80 | #define TC_SUBTYPE_UPDT_TIME 129 |
|
81 | 81 | |
|
82 | 82 | // TC LEN |
|
83 | 83 | #define TC_LEN_RESET 12 |
|
84 | 84 | #define TC_LEN_LOAD_COMM 14 |
|
85 | 85 | #define TC_LEN_LOAD_NORM 22 |
|
86 | 86 | #define TC_LEN_LOAD_BURST 14 |
|
87 | 87 | #define TC_LEN_LOAD_SBM1 14 |
|
88 | 88 | #define TC_LEN_LOAD_SBM2 14 |
|
89 | 89 | #define TC_LEN_DUMP 12 |
|
90 | 90 | #define TC_LEN_ENTER 20 |
|
91 | 91 | #define TC_LEN_UPDT_INFO 46 |
|
92 | 92 | #define TC_LEN_EN_CAL 12 |
|
93 | 93 | #define TC_LEN_DIS_CAL 12 |
|
94 | 94 | #define TC_LEN_UPDT_TIME 18 |
|
95 | 95 | |
|
96 | 96 | // TM TYPES |
|
97 | 97 | #define TM_TYPE_TC_EXE 1 |
|
98 | 98 | #define TM_TYPE_HK 3 |
|
99 | 99 | #define TM_TYPE_PARAMETER_DUMP 3 |
|
100 | 100 | #define TM_TYPE_LFR_SCIENCE 21 |
|
101 | 101 | |
|
102 | 102 | // TM SUBTYPES |
|
103 | 103 | #define TM_SUBTYPE_EXE_OK 7 |
|
104 | 104 | #define TM_SUBTYPE_EXE_NOK 8 |
|
105 | 105 | #define TM_SUBTYPE_HK 25 |
|
106 | 106 | #define TM_SUBTYPE_PARAMETER_DUMP 25 |
|
107 | 107 | #define TM_SUBTYPE_SCIENCE 3 |
|
108 | 108 | #define TM_SUBTYPE_LFR_SCIENCE 3 |
|
109 | 109 | |
|
110 | 110 | // FAILURE CODES |
|
111 | 111 | #define ILLEGAL_APID 0 |
|
112 | 112 | #define WRONG_LEN_PKT 1 |
|
113 | 113 | #define INCOR_CHECKSUM 2 |
|
114 | 114 | #define ILL_TYPE 3 |
|
115 | 115 | #define ILL_SUBTYPE 4 |
|
116 | 116 | #define WRONG_APP_DATA 5 // 0x00 0x05 |
|
117 | 117 | #define TC_NOT_EXE 42000 // 0xa4 0x10 |
|
118 | 118 | #define WRONG_SRC_ID 42001 // 0xa4 0x11 |
|
119 | 119 | #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12 |
|
120 | 120 | #define FAIL_DETECTED 42003 // 0xa4 0x13 |
|
121 | 121 | #define NOT_ALLOWED 42004 // 0xa4 0x14 |
|
122 | 122 | #define CORRUPTED 42005 // 0xa4 0x15 |
|
123 | 123 | #define CCSDS_TM_VALID 7 |
|
124 | 124 | |
|
125 | 125 | // TC SID |
|
126 | #define SID_TC_GROUND 0 | |
|
126 | #define SID_TC_GROUND 0 | |
|
127 | 127 | #define SID_TC_MISSION_TIMELINE 110 |
|
128 | 128 | #define SID_TC_TC_SEQUENCES 111 |
|
129 | 129 | #define SID_TC_RECOVERY_ACTION_CMD 112 |
|
130 | 130 | #define SID_TC_BACKUP_MISSION_TIMELINE 113 |
|
131 | 131 | #define SID_TC_DIRECT_CMD 120 |
|
132 | 132 | #define SID_TC_SPARE_GRD_SRC1 121 |
|
133 | 133 | #define SID_TC_SPARE_GRD_SRC2 122 |
|
134 | 134 | #define SID_TC_OBCP 15 |
|
135 | 135 | #define SID_TC_SYSTEM_CONTROL 14 |
|
136 | 136 | #define SID_TC_AOCS 11 |
|
137 | 137 | #define SID_TC_RPW_INTERNAL 254 |
|
138 | 138 | |
|
139 | 139 | enum apid_destid{ |
|
140 | 140 | GROUND, |
|
141 | 141 | MISSION_TIMELINE, |
|
142 | 142 | TC_SEQUENCES, |
|
143 | 143 | RECOVERY_ACTION_CMD, |
|
144 | 144 | BACKUP_MISSION_TIMELINE, |
|
145 | 145 | DIRECT_CMD, |
|
146 | 146 | SPARE_GRD_SRC1, |
|
147 | 147 | SPARE_GRD_SRC2, |
|
148 | 148 | OBCP, |
|
149 | 149 | SYSTEM_CONTROL, |
|
150 | 150 | AOCS, |
|
151 | 151 | RPW_INTERNAL |
|
152 | 152 | }; |
|
153 | 153 | // SEQUENCE COUNTERS |
|
154 | 154 | #define SEQ_CNT_MAX 16383 |
|
155 | 155 | #define SEQ_CNT_NB_DEST_ID 12 |
|
156 | 156 | |
|
157 | 157 | // TM SID |
|
158 | 158 | #define SID_HK 1 |
|
159 | 159 | #define SID_PARAMETER_DUMP 10 |
|
160 | 160 | |
|
161 | 161 | #define SID_NORM_SWF_F0 3 |
|
162 | 162 | #define SID_NORM_SWF_F1 4 |
|
163 | 163 | #define SID_NORM_SWF_F2 5 |
|
164 | 164 | #define SID_NORM_CWF_F3 1 |
|
165 | 165 | #define SID_BURST_CWF_F2 2 |
|
166 | 166 | #define SID_SBM1_CWF_F1 24 |
|
167 | 167 | #define SID_SBM2_CWF_F2 25 |
|
168 | 168 | #define SID_NORM_ASM_F0 11 |
|
169 | 169 | #define SID_NORM_ASM_F1 12 |
|
170 | 170 | #define SID_NORM_ASM_F2 13 |
|
171 | 171 | #define SID_NORM_BP1_F0 14 |
|
172 | 172 | #define SID_NORM_BP1_F1 15 |
|
173 | 173 | #define SID_NORM_BP1_F2 16 |
|
174 | 174 | #define SID_NORM_BP2_F0 19 |
|
175 | 175 | #define SID_NORM_BP2_F1 20 |
|
176 | 176 | #define SID_NORM_BP2_F2 21 |
|
177 | 177 | #define SID_BURST_BP1_F0 17 |
|
178 | 178 | #define SID_BURST_BP2_F0 22 |
|
179 | 179 | #define SID_BURST_BP1_F1 18 |
|
180 | 180 | #define SID_BURST_BP2_F1 23 |
|
181 | 181 | #define SID_SBM1_BP1_F0 28 |
|
182 | 182 | #define SID_SBM1_BP2_F0 31 |
|
183 | 183 | #define SID_SBM2_BP1_F0 29 |
|
184 | 184 | #define SID_SBM2_BP2_F0 32 |
|
185 | 185 | #define SID_SBM2_BP1_F1 30 |
|
186 | 186 | #define SID_SBM2_BP2_F1 33 |
|
187 | 187 | #define SID_NORM_CWF_LONG_F3 34 |
|
188 | 188 | |
|
189 | 189 | // LENGTH (BYTES) |
|
190 | 190 | #define LENGTH_TM_LFR_TC_EXE_MAX 32 |
|
191 | 191 | #define LENGTH_TM_LFR_HK 126 |
|
192 | 192 | |
|
193 | 193 | // HEADER_LENGTH |
|
194 | 194 | #define TM_HEADER_LEN 16 |
|
195 | 195 | #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28 |
|
196 | 196 | // PACKET_LENGTH |
|
197 | 197 | #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET) |
|
198 | 198 | #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET) |
|
199 | 199 | #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET) |
|
200 | 200 | #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET) |
|
201 | 201 | #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET) |
|
202 | 202 | #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET) |
|
203 | 203 | #define PACKET_LENGTH_HK (124 - CCSDS_TC_TM_PACKET_OFFSET) |
|
204 | 204 | #define PACKET_LENGTH_PARAMETER_DUMP (36 - CCSDS_TC_TM_PACKET_OFFSET) |
|
205 | 205 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 2221 // 44 * 25 * 2 + 28 - 7 |
|
206 | 206 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 2621 // 52 * 25 * 2 + 28 - 7 |
|
207 | 207 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 2421 // 48 * 25 * 2 + 28 - 7 |
|
208 | 208 | |
|
209 | 209 | #define SPARE1_PUSVERSION_SPARE2 0x10 |
|
210 | 210 | |
|
211 | 211 | // R1 |
|
212 | 212 | #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1 |
|
213 | 213 | #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1 |
|
214 | 214 | #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1 |
|
215 | 215 | #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1 |
|
216 | 216 | #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1 |
|
217 | 217 | #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1 |
|
218 | 218 | // R2 |
|
219 | 219 | #define TM_LEN_SCI_SWF_304 3669 // 304 * 12 + 10 + 12 - 1 |
|
220 | 220 | #define TM_LEN_SCI_SWF_224 2709 // 224 * 12 + 10 + 12 - 1 |
|
221 | 221 | #define TM_LEN_SCI_CWF_336 4051 // 336 * 12 + 10 + 10 - 1 |
|
222 | 222 | #define TM_LEN_SCI_CWF_672 4051 // 672 * 6 + 10 + 10 - 1 |
|
223 | 223 | // |
|
224 | 224 | #define DEFAULT_PKTCNT 0x07 |
|
225 | 225 | #define BLK_NR_304 0x0130 |
|
226 | 226 | #define BLK_NR_224 0x00e0 |
|
227 | 227 | #define BLK_NR_CWF 0x0150 // 336 |
|
228 | 228 | #define BLK_NR_CWF_SHORT_F3 0x02a0 // 672 |
|
229 | 229 | |
|
230 | 230 | enum TM_TYPE{ |
|
231 | 231 | TM_LFR_TC_EXE_OK, |
|
232 | 232 | TM_LFR_TC_EXE_ERR, |
|
233 | 233 | TM_LFR_HK, |
|
234 | 234 | TM_LFR_SCI, |
|
235 | 235 | TM_LFR_SCI_SBM, |
|
236 | 236 | TM_LFR_PAR_DUMP |
|
237 | 237 | }; |
|
238 | 238 | |
|
239 | 239 | typedef struct { |
|
240 | 240 | unsigned char targetLogicalAddress; |
|
241 | 241 | unsigned char protocolIdentifier; |
|
242 | 242 | unsigned char reserved; |
|
243 | 243 | unsigned char userApplication; |
|
244 | 244 | // PACKET HEADER |
|
245 | 245 | unsigned char packetID[2]; |
|
246 | 246 | unsigned char packetSequenceControl[2]; |
|
247 | 247 | unsigned char packetLength[2]; |
|
248 | 248 | // DATA FIELD HEADER |
|
249 | 249 | unsigned char spare1_pusVersion_spare2; |
|
250 | 250 | unsigned char serviceType; |
|
251 | 251 | unsigned char serviceSubType; |
|
252 | 252 | unsigned char destinationID; |
|
253 | 253 | unsigned char time[6]; |
|
254 | 254 | // |
|
255 | 255 | unsigned char telecommand_pkt_id[2]; |
|
256 | 256 | unsigned char pkt_seq_control[2]; |
|
257 | 257 | } Packet_TM_LFR_TC_EXE_SUCCESS_t; |
|
258 | 258 | |
|
259 | 259 | typedef struct { |
|
260 | 260 | unsigned char targetLogicalAddress; |
|
261 | 261 | unsigned char protocolIdentifier; |
|
262 | 262 | unsigned char reserved; |
|
263 | 263 | unsigned char userApplication; |
|
264 | 264 | // PACKET HEADER |
|
265 | 265 | unsigned char packetID[2]; |
|
266 | 266 | unsigned char packetSequenceControl[2]; |
|
267 | 267 | unsigned char packetLength[2]; |
|
268 | 268 | // DATA FIELD HEADER |
|
269 | 269 | unsigned char spare1_pusVersion_spare2; |
|
270 | 270 | unsigned char serviceType; |
|
271 | 271 | unsigned char serviceSubType; |
|
272 | 272 | unsigned char destinationID; |
|
273 | 273 | unsigned char time[6]; |
|
274 | 274 | // |
|
275 | 275 | unsigned char tc_failure_code[2]; |
|
276 | 276 | unsigned char telecommand_pkt_id[2]; |
|
277 | 277 | unsigned char pkt_seq_control[2]; |
|
278 | 278 | unsigned char tc_service; |
|
279 | 279 | unsigned char tc_subtype; |
|
280 | 280 | unsigned char byte_position; |
|
281 | 281 | unsigned char rcv_value; |
|
282 | 282 | } Packet_TM_LFR_TC_EXE_INCONSISTENT_t; |
|
283 | 283 | |
|
284 | 284 | typedef struct { |
|
285 | 285 | unsigned char targetLogicalAddress; |
|
286 | 286 | unsigned char protocolIdentifier; |
|
287 | 287 | unsigned char reserved; |
|
288 | 288 | unsigned char userApplication; |
|
289 | 289 | // PACKET HEADER |
|
290 | 290 | unsigned char packetID[2]; |
|
291 | 291 | unsigned char packetSequenceControl[2]; |
|
292 | 292 | unsigned char packetLength[2]; |
|
293 | 293 | // DATA FIELD HEADER |
|
294 | 294 | unsigned char spare1_pusVersion_spare2; |
|
295 | 295 | unsigned char serviceType; |
|
296 | 296 | unsigned char serviceSubType; |
|
297 | 297 | unsigned char destinationID; |
|
298 | 298 | unsigned char time[6]; |
|
299 | 299 | // |
|
300 | 300 | unsigned char tc_failure_code[2]; |
|
301 | 301 | unsigned char telecommand_pkt_id[2]; |
|
302 | 302 | unsigned char pkt_seq_control[2]; |
|
303 | 303 | unsigned char tc_service; |
|
304 | 304 | unsigned char tc_subtype; |
|
305 | 305 | unsigned char lfr_status_word[2]; |
|
306 | 306 | } Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t; |
|
307 | 307 | |
|
308 | 308 | typedef struct { |
|
309 | 309 | unsigned char targetLogicalAddress; |
|
310 | 310 | unsigned char protocolIdentifier; |
|
311 | 311 | unsigned char reserved; |
|
312 | 312 | unsigned char userApplication; |
|
313 | 313 | // PACKET HEADER |
|
314 | 314 | unsigned char packetID[2]; |
|
315 | 315 | unsigned char packetSequenceControl[2]; |
|
316 | 316 | unsigned char packetLength[2]; |
|
317 | 317 | // DATA FIELD HEADER |
|
318 | 318 | unsigned char spare1_pusVersion_spare2; |
|
319 | 319 | unsigned char serviceType; |
|
320 | 320 | unsigned char serviceSubType; |
|
321 | 321 | unsigned char destinationID; |
|
322 | 322 | unsigned char time[6]; |
|
323 | 323 | // |
|
324 | 324 | unsigned char tc_failure_code[2]; |
|
325 | 325 | unsigned char telecommand_pkt_id[2]; |
|
326 | 326 | unsigned char pkt_seq_control[2]; |
|
327 | 327 | unsigned char tc_service; |
|
328 | 328 | unsigned char tc_subtype; |
|
329 | 329 | } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t; |
|
330 | 330 | |
|
331 | 331 | typedef struct { |
|
332 | 332 | unsigned char targetLogicalAddress; |
|
333 | 333 | unsigned char protocolIdentifier; |
|
334 | 334 | unsigned char reserved; |
|
335 | 335 | unsigned char userApplication; |
|
336 | 336 | // PACKET HEADER |
|
337 | 337 | unsigned char packetID[2]; |
|
338 | 338 | unsigned char packetSequenceControl[2]; |
|
339 | 339 | unsigned char packetLength[2]; |
|
340 | 340 | // DATA FIELD HEADER |
|
341 | 341 | unsigned char spare1_pusVersion_spare2; |
|
342 | 342 | unsigned char serviceType; |
|
343 | 343 | unsigned char serviceSubType; |
|
344 | 344 | unsigned char destinationID; |
|
345 | 345 | unsigned char time[6]; |
|
346 | 346 | // |
|
347 | 347 | unsigned char tc_failure_code[2]; |
|
348 | 348 | unsigned char telecommand_pkt_id[2]; |
|
349 | 349 | unsigned char pkt_seq_control[2]; |
|
350 | 350 | unsigned char tc_service; |
|
351 | 351 | unsigned char tc_subtype; |
|
352 | 352 | } Packet_TM_LFR_TC_EXE_ERROR_t; |
|
353 | 353 | |
|
354 | 354 | typedef struct { |
|
355 | 355 | unsigned char targetLogicalAddress; |
|
356 | 356 | unsigned char protocolIdentifier; |
|
357 | 357 | unsigned char reserved; |
|
358 | 358 | unsigned char userApplication; |
|
359 | 359 | // PACKET HEADER |
|
360 | 360 | unsigned char packetID[2]; |
|
361 | 361 | unsigned char packetSequenceControl[2]; |
|
362 | 362 | unsigned char packetLength[2]; |
|
363 | 363 | // DATA FIELD HEADER |
|
364 | 364 | unsigned char spare1_pusVersion_spare2; |
|
365 | 365 | unsigned char serviceType; |
|
366 | 366 | unsigned char serviceSubType; |
|
367 | 367 | unsigned char destinationID; |
|
368 | 368 | unsigned char time[6]; |
|
369 | 369 | // |
|
370 | 370 | unsigned char tc_failure_code[2]; |
|
371 | 371 | unsigned char telecommand_pkt_id[2]; |
|
372 | 372 | unsigned char pkt_seq_control[2]; |
|
373 | 373 | unsigned char tc_service; |
|
374 | 374 | unsigned char tc_subtype; |
|
375 | 375 | unsigned char pkt_len_rcv_value[2]; |
|
376 | 376 | unsigned char pkt_datafieldsize_cnt[2]; |
|
377 | 377 | unsigned char rcv_crc[2]; |
|
378 | 378 | unsigned char computed_crc[2]; |
|
379 | 379 | } Packet_TM_LFR_TC_EXE_CORRUPTED_t; |
|
380 | 380 | |
|
381 | 381 | typedef struct { |
|
382 | 382 | unsigned char targetLogicalAddress; |
|
383 | 383 | unsigned char protocolIdentifier; |
|
384 | 384 | unsigned char reserved; |
|
385 | 385 | unsigned char userApplication; |
|
386 | 386 | unsigned char packetID[2]; |
|
387 | 387 | unsigned char packetSequenceControl[2]; |
|
388 | 388 | unsigned char packetLength[2]; |
|
389 | 389 | // DATA FIELD HEADER |
|
390 | 390 | unsigned char spare1_pusVersion_spare2; |
|
391 | 391 | unsigned char serviceType; |
|
392 | 392 | unsigned char serviceSubType; |
|
393 | 393 | unsigned char destinationID; |
|
394 | 394 | unsigned char time[6]; |
|
395 | 395 | // AUXILIARY HEADER |
|
396 | 396 | unsigned char sid; |
|
397 | 397 | unsigned char hkBIA; |
|
398 | 398 | unsigned char pktCnt; |
|
399 | 399 | unsigned char pktNr; |
|
400 | 400 | unsigned char acquisitionTime[6]; |
|
401 | 401 | unsigned char blkNr[2]; |
|
402 | 402 | } Header_TM_LFR_SCIENCE_SWF_t; |
|
403 | 403 | |
|
404 | 404 | typedef struct { |
|
405 | 405 | unsigned char targetLogicalAddress; |
|
406 | 406 | unsigned char protocolIdentifier; |
|
407 | 407 | unsigned char reserved; |
|
408 | 408 | unsigned char userApplication; |
|
409 | 409 | unsigned char packetID[2]; |
|
410 | 410 | unsigned char packetSequenceControl[2]; |
|
411 | 411 | unsigned char packetLength[2]; |
|
412 | 412 | // DATA FIELD HEADER |
|
413 | 413 | unsigned char spare1_pusVersion_spare2; |
|
414 | 414 | unsigned char serviceType; |
|
415 | 415 | unsigned char serviceSubType; |
|
416 | 416 | unsigned char destinationID; |
|
417 | 417 | unsigned char time[6]; |
|
418 | 418 | // AUXILIARY DATA HEADER |
|
419 | 419 | unsigned char sid; |
|
420 | 420 | unsigned char hkBIA; |
|
421 | 421 | unsigned char acquisitionTime[6]; |
|
422 | 422 | unsigned char blkNr[2]; |
|
423 | 423 | } Header_TM_LFR_SCIENCE_CWF_t; |
|
424 | 424 | |
|
425 | 425 | typedef struct { |
|
426 | 426 | unsigned char targetLogicalAddress; |
|
427 | 427 | unsigned char protocolIdentifier; |
|
428 | 428 | unsigned char reserved; |
|
429 | 429 | unsigned char userApplication; |
|
430 | 430 | unsigned char packetID[2]; |
|
431 | 431 | unsigned char packetSequenceControl[2]; |
|
432 | 432 | unsigned char packetLength[2]; |
|
433 | 433 | // DATA FIELD HEADER |
|
434 | 434 | unsigned char spare1_pusVersion_spare2; |
|
435 | 435 | unsigned char serviceType; |
|
436 | 436 | unsigned char serviceSubType; |
|
437 | 437 | unsigned char destinationID; |
|
438 | 438 | unsigned char time[6]; |
|
439 | 439 | // AUXILIARY HEADER |
|
440 | 440 | unsigned char sid; |
|
441 | 441 | unsigned char biaStatusInfo; |
|
442 | 442 | unsigned char pa_lfr_pkt_cnt_asm; |
|
443 | 443 | unsigned char pa_lfr_pkt_nr_asm; |
|
444 | 444 | unsigned char acquisitionTime[6]; |
|
445 | 445 | unsigned char pa_lfr_asm_blk_nr[2]; |
|
446 | 446 | } Header_TM_LFR_SCIENCE_ASM_t; |
|
447 | 447 | |
|
448 | 448 | typedef struct { |
|
449 | 449 | //targetLogicalAddress is removed by the grspw module |
|
450 | 450 | unsigned char protocolIdentifier; |
|
451 | 451 | unsigned char reserved; |
|
452 | 452 | unsigned char userApplication; |
|
453 | 453 | unsigned char packetID[2]; |
|
454 | 454 | unsigned char packetSequenceControl[2]; |
|
455 | 455 | unsigned char packetLength[2]; |
|
456 | 456 | // DATA FIELD HEADER |
|
457 | 457 | unsigned char headerFlag_pusVersion_Ack; |
|
458 | 458 | unsigned char serviceType; |
|
459 | 459 | unsigned char serviceSubType; |
|
460 | 460 | unsigned char sourceID; |
|
461 | 461 | unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10]; |
|
462 | 462 | } ccsdsTelecommandPacket_t; |
|
463 | 463 | |
|
464 | 464 | typedef struct { |
|
465 | 465 | unsigned char targetLogicalAddress; |
|
466 | 466 | unsigned char protocolIdentifier; |
|
467 | 467 | unsigned char reserved; |
|
468 | 468 | unsigned char userApplication; |
|
469 | 469 | unsigned char packetID[2]; |
|
470 | 470 | unsigned char packetSequenceControl[2]; |
|
471 | 471 | unsigned char packetLength[2]; |
|
472 | 472 | unsigned char spare1_pusVersion_spare2; |
|
473 | 473 | unsigned char serviceType; |
|
474 | 474 | unsigned char serviceSubType; |
|
475 | 475 | unsigned char destinationID; |
|
476 | 476 | unsigned char time[6]; |
|
477 | 477 | unsigned char sid; |
|
478 | 478 | |
|
479 | 479 | //************** |
|
480 | 480 | // HK PARAMETERS |
|
481 | 481 | unsigned char lfr_status_word[2]; |
|
482 | 482 | unsigned char lfr_sw_version[4]; |
|
483 | 483 | unsigned char lfr_fpga_version[3]; |
|
484 | 484 | // ressource statistics |
|
485 | 485 | unsigned char hk_lfr_cpu_load; |
|
486 | 486 | unsigned char hk_lfr_load_max; |
|
487 | 487 | unsigned char hk_lfr_load_aver; |
|
488 | 488 | // tc statistics |
|
489 | 489 | unsigned char hk_lfr_update_info_tc_cnt[2]; |
|
490 | 490 | unsigned char hk_lfr_update_time_tc_cnt[2]; |
|
491 | 491 | unsigned char hk_lfr_exe_tc_cnt[2]; |
|
492 | 492 | unsigned char hk_lfr_rej_tc_cnt[2]; |
|
493 | 493 | unsigned char hk_lfr_last_exe_tc_id[2]; |
|
494 | 494 | unsigned char hk_lfr_last_exe_tc_type[2]; |
|
495 | 495 | unsigned char hk_lfr_last_exe_tc_subtype[2]; |
|
496 | 496 | unsigned char hk_lfr_last_exe_tc_time[6]; |
|
497 | 497 | unsigned char hk_lfr_last_rej_tc_id[2]; |
|
498 | 498 | unsigned char hk_lfr_last_rej_tc_type[2]; |
|
499 | 499 | unsigned char hk_lfr_last_rej_tc_subtype[2]; |
|
500 | 500 | unsigned char hk_lfr_last_rej_tc_time[6]; |
|
501 | 501 | // anomaly statistics |
|
502 | 502 | unsigned char hk_lfr_le_cnt[2]; |
|
503 | 503 | unsigned char hk_lfr_me_cnt[2]; |
|
504 | 504 | unsigned char hk_lfr_he_cnt[2]; |
|
505 | 505 | unsigned char hk_lfr_last_er_rid[2]; |
|
506 | 506 | unsigned char hk_lfr_last_er_code; |
|
507 | 507 | unsigned char hk_lfr_last_er_time[6]; |
|
508 | 508 | // vhdl_blk_status |
|
509 | 509 | unsigned char hk_lfr_vhdl_aa_sm; |
|
510 | 510 | unsigned char hk_lfr_vhdl_fft_sr; |
|
511 | 511 | unsigned char hk_lfr_vhdl_cic_hk; |
|
512 | 512 | unsigned char hk_lfr_vhdl_iir_cal; |
|
513 | 513 | // spacewire_if_statistics |
|
514 | 514 | unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2]; |
|
515 | 515 | unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2]; |
|
516 | 516 | unsigned char hk_lfr_dpu_spw_tick_out_cnt; |
|
517 | 517 | unsigned char hk_lfr_dpu_spw_last_timc; |
|
518 | 518 | // ahb error statistics |
|
519 | 519 | unsigned int hk_lfr_last_fail_addr; |
|
520 | 520 | // temperatures |
|
521 | 521 | unsigned char hk_lfr_temp_scm[2]; |
|
522 | 522 | unsigned char hk_lfr_temp_pcb[2]; |
|
523 | 523 | unsigned char hk_lfr_temp_fpga[2]; |
|
524 | 524 | // spacecraft potential |
|
525 | 525 | unsigned char hk_lfr_sc_v_f3[2]; |
|
526 | 526 | unsigned char hk_lfr_sc_e1_f3[2]; |
|
527 | 527 | unsigned char hk_lfr_sc_e2_f3[2]; |
|
528 | 528 | // error counters |
|
529 | 529 | unsigned char hk_lfr_dpu_spw_parity; |
|
530 | 530 | unsigned char hk_lfr_dpu_spw_disconnect; |
|
531 | 531 | unsigned char hk_lfr_dpu_spw_escape; |
|
532 | 532 | unsigned char hk_lfr_dpu_spw_credit; |
|
533 | 533 | unsigned char hk_lfr_dpu_spw_write_sync; |
|
534 | 534 | unsigned char hk_lfr_dpu_spw_rx_ahb; |
|
535 | 535 | unsigned char hk_lfr_dpu_spw_tx_ahb; |
|
536 | 536 | unsigned char hk_lfr_dpu_spw_early_eop; |
|
537 | 537 | unsigned char hk_lfr_dpu_spw_invalid_addr; |
|
538 | 538 | unsigned char hk_lfr_dpu_spw_eep; |
|
539 | 539 | unsigned char hk_lfr_dpu_spw_rx_too_big; |
|
540 | 540 | // timecode |
|
541 | 541 | unsigned char hk_lfr_timecode_erroneous; |
|
542 | 542 | unsigned char hk_lfr_timecode_missing; |
|
543 | 543 | unsigned char hk_lfr_timecode_invalid; |
|
544 | 544 | // time |
|
545 | 545 | unsigned char hk_lfr_time_timecode_it; |
|
546 | 546 | unsigned char hk_lfr_time_not_synchro; |
|
547 | 547 | unsigned char hk_lfr_time_timecode_ctr; |
|
548 | 548 | // hk_lfr_buffer_dpu_ |
|
549 | 549 | unsigned char hk_lfr_buffer_dpu_tc_fifo; |
|
550 | 550 | unsigned char hk_lfr_buffer_dpu_tm_fifo; |
|
551 | 551 | // hk_lfr_ahb_ |
|
552 | 552 | unsigned char hk_lfr_ahb_correctable; |
|
553 | 553 | unsigned char hk_lfr_ahb_uncorrectable; |
|
554 | 554 | // spare |
|
555 | 555 | unsigned char parameters_spare; |
|
556 | 556 | } Packet_TM_LFR_HK_t; |
|
557 | 557 | |
|
558 | 558 | typedef struct { |
|
559 | 559 | unsigned char targetLogicalAddress; |
|
560 | 560 | unsigned char protocolIdentifier; |
|
561 | 561 | unsigned char reserved; |
|
562 | 562 | unsigned char userApplication; |
|
563 | 563 | unsigned char packetID[2]; |
|
564 | 564 | unsigned char packetSequenceControl[2]; |
|
565 | 565 | unsigned char packetLength[2]; |
|
566 | 566 | // DATA FIELD HEADER |
|
567 | 567 | unsigned char spare1_pusVersion_spare2; |
|
568 | 568 | unsigned char serviceType; |
|
569 | 569 | unsigned char serviceSubType; |
|
570 | 570 | unsigned char destinationID; |
|
571 | 571 | unsigned char time[6]; |
|
572 | 572 | unsigned char sid; |
|
573 | 573 | |
|
574 | 574 | //****************** |
|
575 | 575 | // COMMON PARAMETERS |
|
576 | 576 | unsigned char unused0; |
|
577 | 577 | unsigned char bw_sp0_sp1_r0_r1; |
|
578 | 578 | |
|
579 | 579 | //****************** |
|
580 | 580 | // NORMAL PARAMETERS |
|
581 | 581 | unsigned char sy_lfr_n_swf_l[2]; |
|
582 | 582 | unsigned char sy_lfr_n_swf_p[2]; |
|
583 | 583 | unsigned char sy_lfr_n_asm_p[2]; |
|
584 | 584 | unsigned char sy_lfr_n_bp_p0; |
|
585 | 585 | unsigned char sy_lfr_n_bp_p1; |
|
586 | 586 | unsigned char sy_lfr_n_cwf_long_f3; |
|
587 | 587 | unsigned char lfr_normal_parameters_spare; |
|
588 | 588 | |
|
589 | 589 | //***************** |
|
590 | 590 | // BURST PARAMETERS |
|
591 | 591 | unsigned char sy_lfr_b_bp_p0; |
|
592 | 592 | unsigned char sy_lfr_b_bp_p1; |
|
593 | 593 | |
|
594 | 594 | //**************** |
|
595 | 595 | // SBM1 PARAMETERS |
|
596 | 596 | unsigned char sy_lfr_s1_bp_p0; |
|
597 | 597 | unsigned char sy_lfr_s1_bp_p1; |
|
598 | 598 | |
|
599 | 599 | //**************** |
|
600 | 600 | // SBM2 PARAMETERS |
|
601 | 601 | unsigned char sy_lfr_s2_bp_p0; |
|
602 | 602 | unsigned char sy_lfr_s2_bp_p1; |
|
603 | 603 | |
|
604 | 604 | // SPARE |
|
605 | 605 | unsigned char source_data_spare; |
|
606 | 606 | } Packet_TM_LFR_PARAMETER_DUMP_t; |
|
607 | 607 | |
|
608 | 608 | |
|
609 | 609 | #endif // CCSDS_TYPES_H_INCLUDED |
@@ -1,40 +1,41 | |||
|
1 | 1 | #ifndef FSW_INIT_H_INCLUDED |
|
2 | 2 | #define FSW_INIT_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include <rtems.h> |
|
5 | 5 | #include <leon.h> |
|
6 | 6 | |
|
7 | 7 | #include "fsw_params.h" |
|
8 | 8 | #include "fsw_misc.h" |
|
9 | 9 | #include "fsw_processing.h" |
|
10 | 10 | #include "tc_handler.h" |
|
11 | 11 | #include "wf_handler.h" |
|
12 | 12 | |
|
13 | 13 | #include "fsw_spacewire.h" |
|
14 | 14 | |
|
15 | 15 | extern rtems_name Task_name[20]; /* array of task names */ |
|
16 | 16 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
17 | 17 | |
|
18 | 18 | // RTEMS TASKS |
|
19 | 19 | rtems_task Init( rtems_task_argument argument); |
|
20 | 20 | |
|
21 | 21 | // OTHER functions |
|
22 | 22 | void create_names( void ); |
|
23 | 23 | int create_all_tasks( void ); |
|
24 | 24 | int start_all_tasks( void ); |
|
25 | 25 | // |
|
26 | 26 | rtems_status_code create_message_queues( void ); |
|
27 | 27 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); |
|
28 | 28 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); |
|
29 | 29 | // |
|
30 | 30 | int start_recv_send_tasks( void ); |
|
31 | 31 | // |
|
32 | 32 | void init_local_mode_parameters( void ); |
|
33 | void reset_local_time( void ); | |
|
33 | 34 | |
|
34 | 35 | extern int rtems_cpu_usage_report( void ); |
|
35 | 36 | extern int rtems_cpu_usage_reset( void ); |
|
36 | 37 | extern void rtems_stack_checker_report_usage( void ); |
|
37 | 38 | |
|
38 | 39 | extern int sched_yield( void ); |
|
39 | 40 | |
|
40 | 41 | #endif // FSW_INIT_H_INCLUDED |
@@ -1,212 +1,225 | |||
|
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 | #include "fsw_params_nb_bytes.h" | |
|
6 | 7 | #include "tm_byte_positions.h" |
|
7 | 8 | #include "ccsds_types.h" |
|
8 | 9 | |
|
9 | 10 | #define GRSPW_DEVICE_NAME "/dev/grspw0" |
|
10 | 11 | #define UART_DEVICE_NAME "/dev/console" |
|
11 | 12 | |
|
12 | 13 | typedef struct ring_node |
|
13 | 14 | { |
|
14 | 15 | struct ring_node *previous; |
|
15 | 16 | int buffer_address; |
|
16 | 17 | struct ring_node *next; |
|
17 | 18 | unsigned int status; |
|
18 | 19 | } ring_node; |
|
19 | 20 | |
|
20 | 21 | //************************ |
|
21 | 22 | // flight software version |
|
22 | 23 | // this parameters is handled by the Qt project options |
|
23 | 24 | |
|
24 | 25 | #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk |
|
25 | 26 | #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk |
|
26 | 27 | #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688 |
|
27 | 28 | #define TIME_OFFSET 2 |
|
28 | 29 | #define TIME_OFFSET_IN_BYTES 8 |
|
29 | 30 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 |
|
30 | 31 | #define NB_BYTES_SWF_BLK (2 * 6) |
|
31 | 32 | #define NB_WORDS_SWF_BLK 3 |
|
32 | 33 | #define NB_BYTES_CWF3_LIGHT_BLK 6 |
|
33 | 34 | #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 |
|
34 | 35 | #define NB_RING_NODES_F0 3 // AT LEAST 3 |
|
35 | 36 | #define NB_RING_NODES_F1 5 // AT LEAST 3 |
|
36 | 37 | #define NB_RING_NODES_F2 5 // AT LEAST 3 |
|
37 | 38 | #define NB_RING_NODES_ASM_F0 12 // AT LEAST 3 |
|
38 | 39 | #define NB_RING_NODES_ASM_F1 2 // AT LEAST 3 |
|
39 | 40 | #define NB_RING_NODES_ASM_F2 2 // AT LEAST 3 |
|
40 | 41 | |
|
41 | 42 | //********** |
|
42 | 43 | // LFR MODES |
|
43 | #define LFR_MODE_STANDBY 0 | |
|
44 | #define LFR_MODE_NORMAL 1 | |
|
45 | #define LFR_MODE_BURST 2 | |
|
46 | #define LFR_MODE_SBM1 3 | |
|
47 | #define LFR_MODE_SBM2 4 | |
|
48 | #define LFR_MODE_NORMAL_CWF_F3 5 | |
|
44 | #define LFR_MODE_STANDBY 0 | |
|
45 | #define LFR_MODE_NORMAL 1 | |
|
46 | #define LFR_MODE_BURST 2 | |
|
47 | #define LFR_MODE_SBM1 3 | |
|
48 | #define LFR_MODE_SBM2 4 | |
|
49 | ||
|
50 | #define TDS_MODE_LFM 5 | |
|
51 | #define TDS_MODE_STANDBY 0 | |
|
52 | #define TDS_MODE_NORMAL 1 | |
|
53 | #define TDS_MODE_BURST 2 | |
|
54 | #define TDS_MODE_SBM1 3 | |
|
55 | #define TDS_MODE_SBM2 4 | |
|
56 | ||
|
57 | #define THR_MODE_STANDBY 0 | |
|
58 | #define THR_MODE_NORMAL 1 | |
|
59 | #define THR_MODE_BURST 2 | |
|
49 | 60 | |
|
50 | 61 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 |
|
51 | 62 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 |
|
52 | 63 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 |
|
53 | 64 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 |
|
54 | 65 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 |
|
55 | 66 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 |
|
56 | 67 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F0 RTEMS_EVENT_6 |
|
57 | 68 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F1 RTEMS_EVENT_7 |
|
58 | 69 | #define RTEMS_EVENT_MODE_NORMAL_SWF_F2 RTEMS_EVENT_8 |
|
59 | 70 | |
|
60 | 71 | //**************************** |
|
61 | 72 | // LFR DEFAULT MODE PARAMETERS |
|
62 | 73 | // COMMON |
|
63 | 74 | #define DEFAULT_SY_LFR_COMMON0 0x00 |
|
64 | 75 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 |
|
65 | 76 | // NORM |
|
66 | 77 | #define SY_LFR_N_SWF_L 2048 // nb sample |
|
67 | 78 | #define SY_LFR_N_SWF_P 300 // sec |
|
68 | 79 | #define SY_LFR_N_ASM_P 3600 // sec |
|
69 | 80 | #define SY_LFR_N_BP_P0 4 // sec |
|
70 | 81 | #define SY_LFR_N_BP_P1 20 // sec |
|
71 | 82 | #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3 |
|
72 | 83 | #define MIN_DELTA_SNAPSHOT 16 // sec |
|
73 | 84 | // BURST |
|
74 | 85 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec |
|
75 | 86 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec |
|
76 | 87 | // SBM1 |
|
77 | 88 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec |
|
78 | 89 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec |
|
79 | 90 | // SBM2 |
|
80 | 91 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec |
|
81 | 92 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec |
|
82 | 93 | // ADDITIONAL PARAMETERS |
|
83 | 94 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms |
|
84 | 95 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s |
|
85 | 96 | // STATUS WORD |
|
86 | 97 | #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits |
|
87 | 98 | #define DEFAULT_STATUS_WORD_BYTE1 0x00 |
|
88 | 99 | // |
|
89 | 100 | #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s |
|
90 | 101 | #define SY_LFR_DPU_CONNECT_ATTEMPT 3 |
|
91 | 102 | //**************************** |
|
92 | 103 | |
|
93 | 104 | //***************************** |
|
94 | 105 | // APB REGISTERS BASE ADDRESSES |
|
95 | 106 | #define REGS_ADDR_APBUART 0x80000100 |
|
96 | 107 | #define REGS_ADDR_GPTIMER 0x80000300 |
|
97 | 108 | #define REGS_ADDR_GRSPW 0x80000500 |
|
98 | 109 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 |
|
99 | 110 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 |
|
100 | 111 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20 |
|
101 | 112 | |
|
102 | 113 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
|
103 | 114 | #define APBUART_CTRL_REG_MASK_TE 0x00000002 |
|
104 | 115 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) |
|
105 | 116 | |
|
106 | 117 | //********** |
|
107 | 118 | // IRQ LINES |
|
108 | 119 | #define IRQ_SM_SIMULATOR 9 |
|
109 | 120 | #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels |
|
110 | 121 | #define IRQ_WAVEFORM_PICKER 14 |
|
111 | 122 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels |
|
112 | 123 | #define IRQ_SPECTRAL_MATRIX 6 |
|
113 | 124 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels |
|
114 | 125 | |
|
115 | 126 | //***** |
|
116 | 127 | // TIME |
|
117 | 128 | #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms |
|
118 | 129 | #define TIMER_SM_SIMULATOR 1 |
|
119 |
#define HK_PERIOD 100 // 100 * 10ms => 1s |
|
|
130 | #define HK_PERIOD 100 // 100 * 10ms => 1s | |
|
131 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000 | |
|
132 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s | |
|
120 | 133 | |
|
121 | 134 | //********** |
|
122 | 135 | // LPP CODES |
|
123 | 136 | #define LFR_SUCCESSFUL 0 |
|
124 | 137 | #define LFR_DEFAULT 1 |
|
125 | 138 | |
|
126 | 139 | //****** |
|
127 | 140 | // RTEMS |
|
128 | 141 | #define TASKID_RECV 1 |
|
129 | 142 | #define TASKID_ACTN 2 |
|
130 | 143 | #define TASKID_SPIQ 3 |
|
131 | 144 | #define TASKID_SMIQ 4 |
|
132 | 145 | #define TASKID_STAT 5 |
|
133 | 146 | #define TASKID_AVF0 6 |
|
134 | 147 | //#define TASKID_BPF0 7 |
|
135 | 148 | #define TASKID_WFRM 8 |
|
136 | 149 | #define TASKID_DUMB 9 |
|
137 | 150 | #define TASKID_HOUS 10 |
|
138 | 151 | #define TASKID_MATR 11 |
|
139 | 152 | #define TASKID_CWF3 12 |
|
140 | 153 | #define TASKID_CWF2 13 |
|
141 | 154 | #define TASKID_CWF1 14 |
|
142 | 155 | #define TASKID_SEND 15 |
|
143 | 156 | #define TASKID_WTDG 16 |
|
144 | 157 | |
|
145 | 158 | #define TASK_PRIORITY_SPIQ 5 |
|
146 | 159 | #define TASK_PRIORITY_SMIQ 10 |
|
147 | 160 | #define TASK_PRIORITY_WTDG 20 |
|
148 | 161 | #define TASK_PRIORITY_HOUS 30 |
|
149 | 162 | #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together |
|
150 | 163 | #define TASK_PRIORITY_CWF2 35 // |
|
151 | 164 | #define TASK_PRIORITY_WFRM 40 |
|
152 | 165 | #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1 |
|
153 | 166 | #define TASK_PRIORITY_SEND 45 |
|
154 | 167 | #define TASK_PRIORITY_RECV 50 |
|
155 | 168 | #define TASK_PRIORITY_ACTN 50 |
|
156 | 169 | #define TASK_PRIORITY_AVF0 60 |
|
157 | 170 | #define TASK_PRIORITY_BPF0 60 |
|
158 | 171 | #define TASK_PRIORITY_MATR 100 |
|
159 | 172 | #define TASK_PRIORITY_STAT 200 |
|
160 | 173 | #define TASK_PRIORITY_DUMB 200 |
|
161 | 174 | |
|
162 | 175 | #define ACTION_MSG_QUEUE_COUNT 10 |
|
163 | 176 | #define ACTION_MSG_PKTS_COUNT 50 |
|
164 | 177 | #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES) |
|
165 | 178 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options |
|
166 | 179 | |
|
167 | 180 | #define QUEUE_RECV 0 |
|
168 | 181 | #define QUEUE_SEND 1 |
|
169 | 182 | |
|
170 | 183 | //******* |
|
171 | 184 | // MACROS |
|
172 | 185 | #ifdef PRINT_MESSAGES_ON_CONSOLE |
|
173 | 186 | #define PRINTF(x) printf(x); |
|
174 | 187 | #define PRINTF1(x,y) printf(x,y); |
|
175 | 188 | #define PRINTF2(x,y,z) printf(x,y,z); |
|
176 | 189 | #else |
|
177 | 190 | #define PRINTF(x) ; |
|
178 | 191 | #define PRINTF1(x,y) ; |
|
179 | 192 | #define PRINTF2(x,y,z) ; |
|
180 | 193 | #endif |
|
181 | 194 | |
|
182 | 195 | #ifdef BOOT_MESSAGES |
|
183 | 196 | #define BOOT_PRINTF(x) printf(x); |
|
184 | 197 | #define BOOT_PRINTF1(x,y) printf(x,y); |
|
185 | 198 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); |
|
186 | 199 | #else |
|
187 | 200 | #define BOOT_PRINTF(x) ; |
|
188 | 201 | #define BOOT_PRINTF1(x,y) ; |
|
189 | 202 | #define BOOT_PRINTF2(x,y,z) ; |
|
190 | 203 | #endif |
|
191 | 204 | |
|
192 | 205 | #ifdef DEBUG_MESSAGES |
|
193 | 206 | #define DEBUG_PRINTF(x) printf(x); |
|
194 | 207 | #define DEBUG_PRINTF1(x,y) printf(x,y); |
|
195 | 208 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); |
|
196 | 209 | #else |
|
197 | 210 | #define DEBUG_PRINTF(x) ; |
|
198 | 211 | #define DEBUG_PRINTF1(x,y) ; |
|
199 | 212 | #define DEBUG_PRINTF2(x,y,z) ; |
|
200 | 213 | #endif |
|
201 | 214 | |
|
202 | 215 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period |
|
203 | 216 | |
|
204 | 217 | struct param_local_str{ |
|
205 | 218 | unsigned int local_sbm1_nb_cwf_sent; |
|
206 | 219 | unsigned int local_sbm1_nb_cwf_max; |
|
207 | 220 | unsigned int local_sbm2_nb_cwf_sent; |
|
208 | 221 | unsigned int local_sbm2_nb_cwf_max; |
|
209 | 222 | unsigned int local_nb_interrupt_f0_MAX; |
|
210 | 223 | }; |
|
211 | 224 | |
|
212 | 225 | #endif // FSW_PARAMS_H_INCLUDED |
@@ -1,22 +1,26 | |||
|
1 | 1 | #ifndef TM_BYTE_POSITIONS_H |
|
2 | 2 | #define TM_BYTE_POSITIONS_H |
|
3 | 3 | |
|
4 | 4 | #define BYTE_POS_CP_LFR_MODE 11 |
|
5 | 5 | |
|
6 | 6 | // TC_LFR_LOAD_COMMON_PAR |
|
7 | 7 | |
|
8 | 8 | // TC_LFR_LOAD_NORMAL_PAR |
|
9 | 9 | #define BYTE_POS_SY_LFR_N_SWF_L 0 |
|
10 | 10 | #define BYTE_POS_SY_LFR_N_SWF_P 2 |
|
11 | 11 | #define BYTE_POS_SY_LFR_N_ASM_P 4 |
|
12 | 12 | #define BYTE_POS_SY_LFR_N_BP_P0 6 |
|
13 | 13 | #define BYTE_POS_SY_LFR_N_BP_P1 7 |
|
14 | #define BYTE_POS_SY_LFR_N_CWF_LONG_F3 8 | |
|
14 | 15 | |
|
15 | 16 | // TC_LFR_LOAD_BURST_PAR |
|
16 | 17 | |
|
17 | 18 | // TC_LFR_LOAD_SBM1_PAR |
|
18 | 19 | |
|
19 | 20 | // TC_LFR_LOAD_SBM2_PAR |
|
20 | 21 | |
|
22 | // TC_LFR_UPDATE_INFO | |
|
23 | #define BYTE_POS_HK_UPDATE_INFO_PAR_SET5 24 // 34 - 10 | |
|
24 | #define BYTE_POS_HK_UPDATE_INFO_PAR_SET6 25 // 35 - 10 | |
|
21 | 25 | |
|
22 | 26 | #endif // TM_BYTE_POSITIONS_H |
@@ -1,25 +1,25 | |||
|
1 | 1 | #ifndef TC_ACCEPTANCE_H_INCLUDED |
|
2 | 2 | #define TC_ACCEPTANCE_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | //#include "tm_lfr_tc_exe.h" |
|
5 | 5 | #include "fsw_params.h" |
|
6 | 6 | |
|
7 | 7 | //********************** |
|
8 | 8 | // GENERAL USE FUNCTIONS |
|
9 | 9 | unsigned int Crc_opt( unsigned char D, unsigned int Chk); |
|
10 | 10 | void initLookUpTableForCRC( void ); |
|
11 | 11 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData); |
|
12 | 12 | |
|
13 | 13 | //********************* |
|
14 | 14 | // ACCEPTANCE FUNCTIONS |
|
15 | 15 | int tc_parser(ccsdsTelecommandPacket_t * TCPacket, unsigned int TC_LEN_RCV, unsigned char *computed_CRC); |
|
16 | 16 | int tc_check_type( unsigned char packetType ); |
|
17 | int tc_check_subtype( unsigned char packetType ); | |
|
17 | int tc_check_type_subtype( unsigned char packetType, unsigned char packetSubType ); | |
|
18 | 18 | int tc_check_sid( unsigned char sid ); |
|
19 | 19 | int tc_check_length( unsigned char packetType, unsigned int length ); |
|
20 | 20 | int tc_check_crc(ccsdsTelecommandPacket_t * TCPacket, unsigned int length , unsigned char *computed_CRC); |
|
21 | 21 | |
|
22 | 22 | #endif // TC_ACCEPTANCE_H_INCLUDED |
|
23 | 23 | |
|
24 | 24 | |
|
25 | 25 |
@@ -1,58 +1,58 | |||
|
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 | 11 | #include "fsw_processing.h" |
|
12 | 12 | |
|
13 | 13 | // MODE PARAMETERS |
|
14 | 14 | extern unsigned int maxCount; |
|
15 | 15 | |
|
16 | 16 | //**** |
|
17 | 17 | // ISR |
|
18 | 18 | rtems_isr commutation_isr1( rtems_vector_number vector ); |
|
19 | 19 | rtems_isr commutation_isr2( rtems_vector_number vector ); |
|
20 | 20 | |
|
21 | 21 | //*********** |
|
22 | 22 | // RTEMS TASK |
|
23 | 23 | rtems_task actn_task( rtems_task_argument unused ); |
|
24 | 24 | |
|
25 | 25 | //*********** |
|
26 | 26 | // TC ACTIONS |
|
27 | 27 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
28 | 28 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
29 | 29 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
30 | 30 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
31 | 31 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
32 | 32 | int action_update_time(ccsdsTelecommandPacket_t *TC); |
|
33 | 33 | |
|
34 | 34 | // mode transition |
|
35 | 35 | int transition_validation(unsigned char requestedMode); |
|
36 | 36 | int stop_current_mode( void ); |
|
37 | 37 | int enter_mode(unsigned char mode); |
|
38 | 38 | int restart_science_tasks(); |
|
39 | 39 | int suspend_science_tasks(); |
|
40 | 40 | void launch_waveform_picker( unsigned char mode ); |
|
41 | 41 | void launch_spectral_matrix( unsigned char mode ); |
|
42 | 42 | void enable_irq_on_new_ready_matrix( void ); |
|
43 | 43 | void disable_irq_on_new_ready_matrix( void ); |
|
44 | 44 | void launch_spectral_matrix_simu( unsigned char mode ); |
|
45 | 45 | |
|
46 | 46 | // other functions |
|
47 | 47 | void updateLFRCurrentMode(); |
|
48 |
void update_last_TC_exe(ccsdsTelecommandPacket_t *TC |
|
|
49 |
void update_last_TC_rej(ccsdsTelecommandPacket_t *TC |
|
|
50 |
void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id |
|
|
48 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC ); | |
|
49 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC ); | |
|
50 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ); | |
|
51 | 51 | |
|
52 | 52 | extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); |
|
53 | 53 | extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); |
|
54 | 54 | |
|
55 | 55 | #endif // TC_HANDLER_H_INCLUDED |
|
56 | 56 | |
|
57 | 57 | |
|
58 | 58 |
@@ -1,28 +1,33 | |||
|
1 | 1 | #ifndef TC_LOAD_DUMP_PARAMETERS_H |
|
2 | 2 | #define TC_LOAD_DUMP_PARAMETERS_H |
|
3 | 3 | |
|
4 | 4 | #include <rtems.h> |
|
5 | 5 | #include <stdio.h> |
|
6 | 6 | |
|
7 | 7 | #include "fsw_params.h" |
|
8 | 8 | #include "wf_handler.h" |
|
9 | 9 | #include "tm_lfr_tc_exe.h" |
|
10 | 10 | #include "fsw_misc.h" |
|
11 | 11 | |
|
12 | 12 | int action_load_common_par( ccsdsTelecommandPacket_t *TC ); |
|
13 | 13 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
14 | 14 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
15 | 15 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
16 | 16 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
17 | 17 | int action_dump_par(rtems_id queue_id ); |
|
18 | 18 | |
|
19 | 19 | int set_sy_lfr_n_swf_l(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
20 | 20 | int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); |
|
21 | 21 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
22 | 22 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
23 | 23 | int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
24 | 24 | int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
25 | 25 | |
|
26 | // TC_LFR_UPDATE_INFO | |
|
27 | unsigned int check_update_info_hk_lfr_mode( unsigned char mode ); | |
|
28 | unsigned int check_update_info_hk_tds_mode( unsigned char mode ); | |
|
29 | unsigned int check_update_info_hk_thr_mode( unsigned char mode ); | |
|
30 | ||
|
26 | 31 | void init_parameter_dump( void ); |
|
27 | 32 | |
|
28 | 33 | #endif // TC_LOAD_DUMP_PARAMETERS_H |
@@ -1,26 +1,26 | |||
|
1 | 1 | #ifndef TM_LFR_TC_EXE_H_INCLUDED |
|
2 | 2 | #define TM_LFR_TC_EXE_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include <rtems.h> |
|
5 | 5 | #include <stdio.h> |
|
6 | 6 | |
|
7 | 7 | #include "fsw_params.h" |
|
8 | 8 | #include "fsw_spacewire.h" |
|
9 | 9 | |
|
10 | 10 | extern unsigned short sequenceCounters_TC_EXE[]; |
|
11 | 11 | |
|
12 |
int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id |
|
|
13 | int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, | |
|
14 |
unsigned char byte_position, unsigned char rcv_value |
|
|
15 |
int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id |
|
|
16 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); | |
|
17 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); | |
|
18 | int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, | |
|
19 |
unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV, unsigned char destinationID |
|
|
12 | int send_tm_lfr_tc_exe_success( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |
|
13 | int send_tm_lfr_tc_exe_inconsistent( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, | |
|
14 | unsigned char byte_position, unsigned char rcv_value ); | |
|
15 | int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |
|
16 | int send_tm_lfr_tc_exe_not_implemented( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); | |
|
17 | int send_tm_lfr_tc_exe_error( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); | |
|
18 | int send_tm_lfr_tc_exe_corrupted( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, | |
|
19 | unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV, unsigned char destinationID ); | |
|
20 | 20 | |
|
21 | 21 | void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id ); |
|
22 | 22 | |
|
23 | 23 | #endif // TM_LFR_TC_EXE_H_INCLUDED |
|
24 | 24 | |
|
25 | 25 | |
|
26 | 26 |
@@ -1,598 +1,604 | |||
|
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 | reset_local_time(); | |
|
73 | 74 | |
|
74 | 75 | rtems_status_code status; |
|
75 | 76 | rtems_status_code status_spw; |
|
76 | 77 | rtems_isr_entry old_isr_handler; |
|
77 | 78 | |
|
78 | 79 | // UART settings |
|
79 | 80 | send_console_outputs_on_apbuart_port(); |
|
80 | 81 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); |
|
81 | 82 | enable_apbuart_transmitter(); |
|
82 | 83 | DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") |
|
83 | 84 | |
|
84 | 85 | PRINTF("\n\n\n\n\n") |
|
85 | 86 | PRINTF("*************************\n") |
|
86 | 87 | PRINTF("** LFR Flight Software **\n") |
|
87 | 88 | PRINTF1("** %d.", SW_VERSION_N1) |
|
88 | 89 | PRINTF1("%d.", SW_VERSION_N2) |
|
89 | 90 | PRINTF1("%d.", SW_VERSION_N3) |
|
90 | 91 | PRINTF1("%d **\n", SW_VERSION_N4) |
|
91 | 92 | PRINTF("*************************\n") |
|
92 | 93 | PRINTF("\n\n") |
|
93 | 94 | |
|
94 | 95 | reset_wfp_burst_enable(); // stop the waveform picker if it was running |
|
95 | 96 | init_waveform_rings(); // initialize the waveform rings |
|
96 | 97 | init_sm_rings(); |
|
97 | 98 | |
|
98 | 99 | init_parameter_dump(); |
|
99 | 100 | init_local_mode_parameters(); |
|
100 | 101 | init_housekeeping_parameters(); |
|
101 | 102 | |
|
102 | 103 | updateLFRCurrentMode(); |
|
103 | 104 | |
|
104 | 105 | BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) |
|
105 | 106 | |
|
106 | 107 | create_names(); // create all names |
|
107 | 108 | |
|
108 | 109 | status = create_message_queues(); // create message queues |
|
109 | 110 | if (status != RTEMS_SUCCESSFUL) |
|
110 | 111 | { |
|
111 | 112 | PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) |
|
112 | 113 | } |
|
113 | 114 | |
|
114 | 115 | status = create_all_tasks(); // create all tasks |
|
115 | 116 | if (status != RTEMS_SUCCESSFUL) |
|
116 | 117 | { |
|
117 | 118 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status) |
|
118 | 119 | } |
|
119 | 120 | |
|
120 | 121 | // ************************** |
|
121 | 122 | // <SPACEWIRE INITIALIZATION> |
|
122 | 123 | grspw_timecode_callback = &timecode_irq_handler; |
|
123 | 124 | |
|
124 | 125 | status_spw = spacewire_open_link(); // (1) open the link |
|
125 | 126 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
126 | 127 | { |
|
127 | 128 | PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) |
|
128 | 129 | } |
|
129 | 130 | |
|
130 | 131 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link |
|
131 | 132 | { |
|
132 | 133 | status_spw = spacewire_configure_link( fdSPW ); |
|
133 | 134 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
134 | 135 | { |
|
135 | 136 | PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) |
|
136 | 137 | } |
|
137 | 138 | } |
|
138 | 139 | |
|
139 | 140 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link |
|
140 | 141 | { |
|
141 | 142 | status_spw = spacewire_start_link( fdSPW ); |
|
142 | 143 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
143 | 144 | { |
|
144 | 145 | PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) |
|
145 | 146 | } |
|
146 | 147 | } |
|
147 | 148 | // </SPACEWIRE INITIALIZATION> |
|
148 | 149 | // *************************** |
|
149 | 150 | |
|
150 | 151 | status = start_all_tasks(); // start all tasks |
|
151 | 152 | if (status != RTEMS_SUCCESSFUL) |
|
152 | 153 | { |
|
153 | 154 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) |
|
154 | 155 | } |
|
155 | 156 | |
|
156 | 157 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization |
|
157 | 158 | status = start_recv_send_tasks(); |
|
158 | 159 | if ( status != RTEMS_SUCCESSFUL ) |
|
159 | 160 | { |
|
160 | 161 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) |
|
161 | 162 | } |
|
162 | 163 | |
|
163 | 164 | // suspend science tasks. they will be restarted later depending on the mode |
|
164 | 165 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) |
|
165 | 166 | if (status != RTEMS_SUCCESSFUL) |
|
166 | 167 | { |
|
167 | 168 | PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
168 | 169 | } |
|
169 | 170 | |
|
170 | 171 | //****************************** |
|
171 | 172 | // <SPECTRAL MATRICES SIMULATOR> |
|
172 | 173 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); |
|
173 | 174 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, |
|
174 | 175 | IRQ_SPARC_SM_SIMULATOR, spectral_matrices_isr_simu ); |
|
175 | 176 | // </SPECTRAL MATRICES SIMULATOR> |
|
176 | 177 | //******************************* |
|
177 | 178 | |
|
178 | 179 | // configure IRQ handling for the waveform picker unit |
|
179 | 180 | status = rtems_interrupt_catch( waveforms_isr, |
|
180 | 181 | IRQ_SPARC_WAVEFORM_PICKER, |
|
181 | 182 | &old_isr_handler) ; |
|
182 | 183 | // configure IRQ handling for the spectral matrices unit |
|
183 | 184 | status = rtems_interrupt_catch( spectral_matrices_isr, |
|
184 | 185 | IRQ_SPARC_SPECTRAL_MATRIX, |
|
185 | 186 | &old_isr_handler) ; |
|
186 | 187 | |
|
187 | 188 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery |
|
188 | 189 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
189 | 190 | { |
|
190 | 191 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); |
|
191 | 192 | if ( status != RTEMS_SUCCESSFUL ) { |
|
192 | 193 | PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) |
|
193 | 194 | } |
|
194 | 195 | } |
|
195 | 196 | |
|
196 | 197 | BOOT_PRINTF("delete INIT\n") |
|
197 | 198 | |
|
198 | 199 | status = rtems_task_delete(RTEMS_SELF); |
|
199 | 200 | |
|
200 | 201 | } |
|
201 | 202 | |
|
202 | 203 | void init_local_mode_parameters( void ) |
|
203 | 204 | { |
|
204 | 205 | /** This function initialize the param_local global variable with default values. |
|
205 | 206 | * |
|
206 | 207 | */ |
|
207 | 208 | |
|
208 | 209 | unsigned int i; |
|
209 | 210 | |
|
210 | 211 | // LOCAL PARAMETERS |
|
211 | 212 | set_local_nb_interrupt_f0_MAX(); |
|
212 | 213 | |
|
213 | 214 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
214 | 215 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
215 | 216 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
216 | 217 | |
|
217 | 218 | // init sequence counters |
|
218 | 219 | |
|
219 | 220 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) |
|
220 | 221 | { |
|
221 | 222 | sequenceCounters_TC_EXE[i] = 0x00; |
|
222 | 223 | } |
|
223 | 224 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; |
|
224 | 225 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; |
|
225 | 226 | } |
|
226 | 227 | |
|
228 | void reset_local_time( void ) | |
|
229 | { | |
|
230 | ||
|
231 | } | |
|
232 | ||
|
227 | 233 | void create_names( void ) // create all names for tasks and queues |
|
228 | 234 | { |
|
229 | 235 | /** This function creates all RTEMS names used in the software for tasks and queues. |
|
230 | 236 | * |
|
231 | 237 | * @return RTEMS directive status codes: |
|
232 | 238 | * - RTEMS_SUCCESSFUL - successful completion |
|
233 | 239 | * |
|
234 | 240 | */ |
|
235 | 241 | |
|
236 | 242 | // task names |
|
237 | 243 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); |
|
238 | 244 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); |
|
239 | 245 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
|
240 | 246 | Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' ); |
|
241 | 247 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); |
|
242 | 248 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); |
|
243 | 249 | // Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' ); |
|
244 | 250 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
245 | 251 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); |
|
246 | 252 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
247 | 253 | Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' ); |
|
248 | 254 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); |
|
249 | 255 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); |
|
250 | 256 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); |
|
251 | 257 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); |
|
252 | 258 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); |
|
253 | 259 | |
|
254 | 260 | // rate monotonic period names |
|
255 | 261 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
256 | 262 | |
|
257 | 263 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
258 | 264 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
259 | 265 | } |
|
260 | 266 | |
|
261 | 267 | int create_all_tasks( void ) // create all tasks which run in the software |
|
262 | 268 | { |
|
263 | 269 | /** This function creates all RTEMS tasks used in the software. |
|
264 | 270 | * |
|
265 | 271 | * @return RTEMS directive status codes: |
|
266 | 272 | * - RTEMS_SUCCESSFUL - task created successfully |
|
267 | 273 | * - RTEMS_INVALID_ADDRESS - id is NULL |
|
268 | 274 | * - RTEMS_INVALID_NAME - invalid task name |
|
269 | 275 | * - RTEMS_INVALID_PRIORITY - invalid task priority |
|
270 | 276 | * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured |
|
271 | 277 | * - RTEMS_TOO_MANY - too many tasks created |
|
272 | 278 | * - RTEMS_UNSATISFIED - not enough memory for stack/FP context |
|
273 | 279 | * - RTEMS_TOO_MANY - too many global objects |
|
274 | 280 | * |
|
275 | 281 | */ |
|
276 | 282 | |
|
277 | 283 | rtems_status_code status; |
|
278 | 284 | |
|
279 | 285 | // RECV |
|
280 | 286 | status = rtems_task_create( |
|
281 | 287 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, |
|
282 | 288 | RTEMS_DEFAULT_MODES, |
|
283 | 289 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] |
|
284 | 290 | ); |
|
285 | 291 | |
|
286 | 292 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
287 | 293 | { |
|
288 | 294 | status = rtems_task_create( |
|
289 | 295 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, |
|
290 | 296 | RTEMS_DEFAULT_MODES, |
|
291 | 297 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] |
|
292 | 298 | ); |
|
293 | 299 | } |
|
294 | 300 | if (status == RTEMS_SUCCESSFUL) // SPIQ |
|
295 | 301 | { |
|
296 | 302 | status = rtems_task_create( |
|
297 | 303 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
298 | 304 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
299 | 305 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] |
|
300 | 306 | ); |
|
301 | 307 | } |
|
302 | 308 | if (status == RTEMS_SUCCESSFUL) // SMIQ |
|
303 | 309 | { |
|
304 | 310 | status = rtems_task_create( |
|
305 | 311 | Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
306 | 312 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
307 | 313 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ] |
|
308 | 314 | ); |
|
309 | 315 | } |
|
310 | 316 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
311 | 317 | { |
|
312 | 318 | status = rtems_task_create( |
|
313 | 319 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, |
|
314 | 320 | RTEMS_DEFAULT_MODES, |
|
315 | 321 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] |
|
316 | 322 | ); |
|
317 | 323 | } |
|
318 | 324 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
319 | 325 | { |
|
320 | 326 | status = rtems_task_create( |
|
321 | 327 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, |
|
322 | 328 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
323 | 329 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] |
|
324 | 330 | ); |
|
325 | 331 | } |
|
326 | 332 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
327 | 333 | { |
|
328 | 334 | status = rtems_task_create( |
|
329 | 335 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, |
|
330 | 336 | RTEMS_DEFAULT_MODES, |
|
331 | 337 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] |
|
332 | 338 | ); |
|
333 | 339 | } |
|
334 | 340 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
335 | 341 | { |
|
336 | 342 | status = rtems_task_create( |
|
337 | 343 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, |
|
338 | 344 | RTEMS_DEFAULT_MODES, |
|
339 | 345 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] |
|
340 | 346 | ); |
|
341 | 347 | } |
|
342 | 348 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
343 | 349 | { |
|
344 | 350 | status = rtems_task_create( |
|
345 | 351 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, |
|
346 | 352 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
347 | 353 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] |
|
348 | 354 | ); |
|
349 | 355 | } |
|
350 | 356 | if (status == RTEMS_SUCCESSFUL) // MATR |
|
351 | 357 | { |
|
352 | 358 | status = rtems_task_create( |
|
353 | 359 | Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE, |
|
354 | 360 | RTEMS_DEFAULT_MODES, |
|
355 | 361 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR] |
|
356 | 362 | ); |
|
357 | 363 | } |
|
358 | 364 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
359 | 365 | { |
|
360 | 366 | status = rtems_task_create( |
|
361 | 367 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, |
|
362 | 368 | RTEMS_DEFAULT_MODES, |
|
363 | 369 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3] |
|
364 | 370 | ); |
|
365 | 371 | } |
|
366 | 372 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
367 | 373 | { |
|
368 | 374 | status = rtems_task_create( |
|
369 | 375 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, |
|
370 | 376 | RTEMS_DEFAULT_MODES, |
|
371 | 377 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2] |
|
372 | 378 | ); |
|
373 | 379 | } |
|
374 | 380 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
375 | 381 | { |
|
376 | 382 | status = rtems_task_create( |
|
377 | 383 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, |
|
378 | 384 | RTEMS_DEFAULT_MODES, |
|
379 | 385 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1] |
|
380 | 386 | ); |
|
381 | 387 | } |
|
382 | 388 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
383 | 389 | { |
|
384 | 390 | status = rtems_task_create( |
|
385 | 391 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, |
|
386 | 392 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
387 | 393 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] |
|
388 | 394 | ); |
|
389 | 395 | } |
|
390 | 396 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
391 | 397 | { |
|
392 | 398 | status = rtems_task_create( |
|
393 | 399 | Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE, |
|
394 | 400 | RTEMS_DEFAULT_MODES, |
|
395 | 401 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG] |
|
396 | 402 | ); |
|
397 | 403 | } |
|
398 | 404 | |
|
399 | 405 | return status; |
|
400 | 406 | } |
|
401 | 407 | |
|
402 | 408 | int start_recv_send_tasks( void ) |
|
403 | 409 | { |
|
404 | 410 | rtems_status_code status; |
|
405 | 411 | |
|
406 | 412 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); |
|
407 | 413 | if (status!=RTEMS_SUCCESSFUL) { |
|
408 | 414 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") |
|
409 | 415 | } |
|
410 | 416 | |
|
411 | 417 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
412 | 418 | { |
|
413 | 419 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); |
|
414 | 420 | if (status!=RTEMS_SUCCESSFUL) { |
|
415 | 421 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") |
|
416 | 422 | } |
|
417 | 423 | } |
|
418 | 424 | |
|
419 | 425 | return status; |
|
420 | 426 | } |
|
421 | 427 | |
|
422 | 428 | int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS |
|
423 | 429 | { |
|
424 | 430 | /** This function starts all RTEMS tasks used in the software. |
|
425 | 431 | * |
|
426 | 432 | * @return RTEMS directive status codes: |
|
427 | 433 | * - RTEMS_SUCCESSFUL - ask started successfully |
|
428 | 434 | * - RTEMS_INVALID_ADDRESS - invalid task entry point |
|
429 | 435 | * - RTEMS_INVALID_ID - invalid task id |
|
430 | 436 | * - RTEMS_INCORRECT_STATE - task not in the dormant state |
|
431 | 437 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task |
|
432 | 438 | * |
|
433 | 439 | */ |
|
434 | 440 | // starts all the tasks fot eh flight software |
|
435 | 441 | |
|
436 | 442 | rtems_status_code status; |
|
437 | 443 | |
|
438 | 444 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); |
|
439 | 445 | if (status!=RTEMS_SUCCESSFUL) { |
|
440 | 446 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") |
|
441 | 447 | } |
|
442 | 448 | |
|
443 | 449 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
444 | 450 | { |
|
445 | 451 | status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 ); |
|
446 | 452 | if (status!=RTEMS_SUCCESSFUL) { |
|
447 | 453 | BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n") |
|
448 | 454 | } |
|
449 | 455 | } |
|
450 | 456 | |
|
451 | 457 | if (status == RTEMS_SUCCESSFUL) // SMIQ |
|
452 | 458 | { |
|
453 | 459 | status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 ); |
|
454 | 460 | if (status!=RTEMS_SUCCESSFUL) { |
|
455 | 461 | BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n") |
|
456 | 462 | } |
|
457 | 463 | } |
|
458 | 464 | |
|
459 | 465 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
460 | 466 | { |
|
461 | 467 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); |
|
462 | 468 | if (status!=RTEMS_SUCCESSFUL) { |
|
463 | 469 | BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") |
|
464 | 470 | } |
|
465 | 471 | } |
|
466 | 472 | |
|
467 | 473 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
468 | 474 | { |
|
469 | 475 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); |
|
470 | 476 | if (status!=RTEMS_SUCCESSFUL) { |
|
471 | 477 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") |
|
472 | 478 | } |
|
473 | 479 | } |
|
474 | 480 | |
|
475 | 481 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
476 | 482 | { |
|
477 | 483 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 ); |
|
478 | 484 | if (status!=RTEMS_SUCCESSFUL) { |
|
479 | 485 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") |
|
480 | 486 | } |
|
481 | 487 | } |
|
482 | 488 | |
|
483 | 489 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
484 | 490 | { |
|
485 | 491 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); |
|
486 | 492 | if (status!=RTEMS_SUCCESSFUL) { |
|
487 | 493 | BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") |
|
488 | 494 | } |
|
489 | 495 | } |
|
490 | 496 | |
|
491 | 497 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
492 | 498 | { |
|
493 | 499 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); |
|
494 | 500 | if (status!=RTEMS_SUCCESSFUL) { |
|
495 | 501 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") |
|
496 | 502 | } |
|
497 | 503 | } |
|
498 | 504 | |
|
499 | 505 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
500 | 506 | { |
|
501 | 507 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); |
|
502 | 508 | if (status!=RTEMS_SUCCESSFUL) { |
|
503 | 509 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") |
|
504 | 510 | } |
|
505 | 511 | } |
|
506 | 512 | |
|
507 | 513 | if (status == RTEMS_SUCCESSFUL) // MATR |
|
508 | 514 | { |
|
509 | 515 | status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 ); |
|
510 | 516 | if (status!=RTEMS_SUCCESSFUL) { |
|
511 | 517 | BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n") |
|
512 | 518 | } |
|
513 | 519 | } |
|
514 | 520 | |
|
515 | 521 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
516 | 522 | { |
|
517 | 523 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); |
|
518 | 524 | if (status!=RTEMS_SUCCESSFUL) { |
|
519 | 525 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") |
|
520 | 526 | } |
|
521 | 527 | } |
|
522 | 528 | |
|
523 | 529 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
524 | 530 | { |
|
525 | 531 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); |
|
526 | 532 | if (status!=RTEMS_SUCCESSFUL) { |
|
527 | 533 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") |
|
528 | 534 | } |
|
529 | 535 | } |
|
530 | 536 | |
|
531 | 537 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
532 | 538 | { |
|
533 | 539 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); |
|
534 | 540 | if (status!=RTEMS_SUCCESSFUL) { |
|
535 | 541 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") |
|
536 | 542 | } |
|
537 | 543 | } |
|
538 | 544 | return status; |
|
539 | 545 | } |
|
540 | 546 | |
|
541 | 547 | rtems_status_code create_message_queues( void ) // create the two message queues used in the software |
|
542 | 548 | { |
|
543 | 549 | rtems_status_code status_recv; |
|
544 | 550 | rtems_status_code status_send; |
|
545 | 551 | rtems_status_code ret; |
|
546 | 552 | rtems_id queue_id; |
|
547 | 553 | |
|
548 | 554 | // create the queue for handling valid TCs |
|
549 | 555 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], |
|
550 | 556 | ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE, |
|
551 | 557 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
552 | 558 | if ( status_recv != RTEMS_SUCCESSFUL ) { |
|
553 | 559 | PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) |
|
554 | 560 | } |
|
555 | 561 | |
|
556 | 562 | // create the queue for handling TM packet sending |
|
557 | 563 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], |
|
558 | 564 | ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE, |
|
559 | 565 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
560 | 566 | if ( status_send != RTEMS_SUCCESSFUL ) { |
|
561 | 567 | PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) |
|
562 | 568 | } |
|
563 | 569 | |
|
564 | 570 | if ( status_recv != RTEMS_SUCCESSFUL ) |
|
565 | 571 | { |
|
566 | 572 | ret = status_recv; |
|
567 | 573 | } |
|
568 | 574 | else |
|
569 | 575 | { |
|
570 | 576 | ret = status_send; |
|
571 | 577 | } |
|
572 | 578 | |
|
573 | 579 | return ret; |
|
574 | 580 | } |
|
575 | 581 | |
|
576 | 582 | rtems_status_code get_message_queue_id_send( rtems_id *queue_id ) |
|
577 | 583 | { |
|
578 | 584 | rtems_status_code status; |
|
579 | 585 | rtems_name queue_name; |
|
580 | 586 | |
|
581 | 587 | queue_name = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
582 | 588 | |
|
583 | 589 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
584 | 590 | |
|
585 | 591 | return status; |
|
586 | 592 | } |
|
587 | 593 | |
|
588 | 594 | rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ) |
|
589 | 595 | { |
|
590 | 596 | rtems_status_code status; |
|
591 | 597 | rtems_name queue_name; |
|
592 | 598 | |
|
593 | 599 | queue_name = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
594 | 600 | |
|
595 | 601 | status = rtems_message_queue_ident( queue_name, 0, queue_id ); |
|
596 | 602 | |
|
597 | 603 | return status; |
|
598 | 604 | } |
@@ -1,344 +1,364 | |||
|
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 | gptimer_regs->timer[timer].ctrl = 0x00; // reset the control register |
|
29 | 29 | |
|
30 | 30 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels |
|
31 | 31 | if (status!=RTEMS_SUCCESSFUL) |
|
32 | 32 | { |
|
33 | 33 | PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n") |
|
34 | 34 | } |
|
35 | 35 | |
|
36 | 36 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); |
|
37 | 37 | } |
|
38 | 38 | |
|
39 | 39 | void timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
40 | 40 | { |
|
41 | 41 | /** This function starts a GPTIMER timer. |
|
42 | 42 | * |
|
43 | 43 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
44 | 44 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
45 | 45 | * |
|
46 | 46 | */ |
|
47 | 47 | |
|
48 | 48 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
49 | 49 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register |
|
50 | 50 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer |
|
51 | 51 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart |
|
52 | 52 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable |
|
53 | 53 | } |
|
54 | 54 | |
|
55 | 55 | void timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
56 | 56 | { |
|
57 | 57 | /** This function stops a GPTIMER timer. |
|
58 | 58 | * |
|
59 | 59 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
60 | 60 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
61 | 61 | * |
|
62 | 62 | */ |
|
63 | 63 | |
|
64 | 64 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer |
|
65 | 65 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable |
|
66 | 66 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
67 | 67 | } |
|
68 | 68 | |
|
69 | 69 | void timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider) |
|
70 | 70 | { |
|
71 | 71 | /** This function sets the clock divider of a GPTIMER timer. |
|
72 | 72 | * |
|
73 | 73 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
74 | 74 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
75 | 75 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. |
|
76 | 76 | * |
|
77 | 77 | */ |
|
78 | 78 | |
|
79 | 79 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz |
|
80 | 80 | } |
|
81 | 81 | |
|
82 | 82 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port |
|
83 | 83 | { |
|
84 | 84 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
85 | 85 | |
|
86 | 86 | apbuart_regs->ctrl = APBUART_CTRL_REG_MASK_TE; |
|
87 | 87 | |
|
88 | 88 | return 0; |
|
89 | 89 | } |
|
90 | 90 | |
|
91 | 91 | int enable_apbuart_transmitter( void ) // set the bit 1, TE Transmitter Enable to 1 in the APBUART control register |
|
92 | 92 | { |
|
93 | 93 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
94 | 94 | |
|
95 | 95 | apbuart_regs->ctrl = apbuart_regs->ctrl | APBUART_CTRL_REG_MASK_TE; |
|
96 | 96 | |
|
97 | 97 | return 0; |
|
98 | 98 | } |
|
99 | 99 | |
|
100 | 100 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) |
|
101 | 101 | { |
|
102 | 102 | /** This function sets the scaler reload register of the apbuart module |
|
103 | 103 | * |
|
104 | 104 | * @param regs is the address of the apbuart registers in memory |
|
105 | 105 | * @param value is the value that will be stored in the scaler register |
|
106 | 106 | * |
|
107 | 107 | * The value shall be set by the software to get data on the serial interface. |
|
108 | 108 | * |
|
109 | 109 | */ |
|
110 | 110 | |
|
111 | 111 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; |
|
112 | 112 | |
|
113 | 113 | apbuart_regs->scaler = value; |
|
114 | 114 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) |
|
115 | 115 | } |
|
116 | 116 | |
|
117 | 117 | //************ |
|
118 | 118 | // RTEMS TASKS |
|
119 | 119 | |
|
120 | 120 | rtems_task stat_task(rtems_task_argument argument) |
|
121 | 121 | { |
|
122 | 122 | int i; |
|
123 | 123 | int j; |
|
124 | 124 | i = 0; |
|
125 | 125 | j = 0; |
|
126 | 126 | BOOT_PRINTF("in STAT *** \n") |
|
127 | 127 | while(1){ |
|
128 | 128 | rtems_task_wake_after(1000); |
|
129 | 129 | PRINTF1("%d\n", j) |
|
130 | 130 | if (i == CPU_USAGE_REPORT_PERIOD) { |
|
131 | 131 | // #ifdef PRINT_TASK_STATISTICS |
|
132 | 132 | // rtems_cpu_usage_report(); |
|
133 | 133 | // rtems_cpu_usage_reset(); |
|
134 | 134 | // #endif |
|
135 | 135 | i = 0; |
|
136 | 136 | } |
|
137 | 137 | else i++; |
|
138 | 138 | j++; |
|
139 | 139 | } |
|
140 | 140 | } |
|
141 | 141 | |
|
142 | 142 | rtems_task hous_task(rtems_task_argument argument) |
|
143 | 143 | { |
|
144 | 144 | rtems_status_code status; |
|
145 | 145 | rtems_id queue_id; |
|
146 | rtems_rate_monotonic_period_status period_status; | |
|
146 | 147 | |
|
147 | 148 | status = get_message_queue_id_send( &queue_id ); |
|
148 | 149 | if (status != RTEMS_SUCCESSFUL) |
|
149 | 150 | { |
|
150 | 151 | PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status) |
|
151 | 152 | } |
|
152 | 153 | |
|
153 | 154 | BOOT_PRINTF("in HOUS ***\n") |
|
154 | 155 | |
|
155 | 156 | if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) { |
|
156 | 157 | status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id ); |
|
157 | 158 | if( status != RTEMS_SUCCESSFUL ) { |
|
158 | 159 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) |
|
159 | 160 | } |
|
160 | 161 | } |
|
161 | 162 | |
|
162 | 163 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
163 | 164 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
164 | 165 | housekeeping_packet.reserved = DEFAULT_RESERVED; |
|
165 | 166 | housekeeping_packet.userApplication = CCSDS_USER_APP; |
|
166 | 167 | housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8); |
|
167 | 168 | housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK); |
|
168 | 169 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
169 | 170 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
170 | 171 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
171 | 172 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
172 | 173 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
173 | 174 | housekeeping_packet.serviceType = TM_TYPE_HK; |
|
174 | 175 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; |
|
175 | 176 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
176 | 177 | housekeeping_packet.sid = SID_HK; |
|
177 | 178 | |
|
178 | 179 | status = rtems_rate_monotonic_cancel(HK_id); |
|
179 | 180 | if( status != RTEMS_SUCCESSFUL ) { |
|
180 | 181 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) |
|
181 | 182 | } |
|
182 | 183 | else { |
|
183 | 184 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") |
|
184 | 185 | } |
|
185 | 186 | |
|
187 | // startup phase | |
|
188 | status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks ); | |
|
189 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); | |
|
190 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) | |
|
191 | while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway | |
|
192 | { | |
|
193 | if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization | |
|
194 | { | |
|
195 | break; // break if LFR is synchronized | |
|
196 | } | |
|
197 | else | |
|
198 | { | |
|
199 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); | |
|
200 | sched_yield(); | |
|
201 | } | |
|
202 | } | |
|
203 | status = rtems_rate_monotonic_cancel(HK_id); | |
|
204 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) | |
|
205 | ||
|
186 | 206 | while(1){ // launch the rate monotonic task |
|
187 | 207 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); |
|
188 | 208 | if ( status != RTEMS_SUCCESSFUL ) { |
|
189 | 209 | PRINTF1( "in HOUS *** ERR period: %d\n", status); |
|
190 | 210 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 ); |
|
191 | 211 | } |
|
192 | 212 | else { |
|
193 | 213 | increment_seq_counter( housekeeping_packet.packetSequenceControl ); |
|
194 | 214 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
195 | 215 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
196 | 216 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
197 | 217 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
198 | 218 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
199 | 219 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
200 | 220 | |
|
201 | 221 | spacewire_update_statistics(); |
|
202 | 222 | |
|
203 | 223 | // SEND PACKET |
|
204 | 224 | status = rtems_message_queue_send( queue_id, &housekeeping_packet, |
|
205 | 225 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
206 | 226 | if (status != RTEMS_SUCCESSFUL) { |
|
207 | 227 | PRINTF1("in HOUS *** ERR send: %d\n", status) |
|
208 | 228 | } |
|
209 | 229 | } |
|
210 | 230 | } |
|
211 | 231 | |
|
212 | 232 | PRINTF("in HOUS *** deleting task\n") |
|
213 | 233 | |
|
214 | 234 | status = rtems_task_delete( RTEMS_SELF ); // should not return |
|
215 | 235 | printf( "rtems_task_delete returned with status of %d.\n", status ); |
|
216 | 236 | return; |
|
217 | 237 | } |
|
218 | 238 | |
|
219 | 239 | rtems_task dumb_task( rtems_task_argument unused ) |
|
220 | 240 | { |
|
221 | 241 | /** This RTEMS taks is used to print messages without affecting the general behaviour of the software. |
|
222 | 242 | * |
|
223 | 243 | * @param unused is the starting argument of the RTEMS task |
|
224 | 244 | * |
|
225 | 245 | * The DUMB taks waits for RTEMS events and print messages depending on the incoming events. |
|
226 | 246 | * |
|
227 | 247 | */ |
|
228 | 248 | |
|
229 | 249 | unsigned int i; |
|
230 | 250 | unsigned int intEventOut; |
|
231 | 251 | unsigned int coarse_time = 0; |
|
232 | 252 | unsigned int fine_time = 0; |
|
233 | 253 | rtems_event_set event_out; |
|
234 | 254 | |
|
235 | 255 | char *DumbMessages[9] = {"in DUMB *** default", // RTEMS_EVENT_0 |
|
236 | 256 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 |
|
237 | 257 | "in DUMB *** waveforms_isr", // RTEMS_EVENT_2 |
|
238 | 258 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 |
|
239 | 259 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 |
|
240 | 260 | "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5 |
|
241 | 261 | "ERR HK", // RTEMS_EVENT_6 |
|
242 | 262 | "ready for dump", // RTEMS_EVENT_7 |
|
243 | 263 | "in DUMB *** spectral_matrices_isr" // RTEMS_EVENT_8 |
|
244 | 264 | }; |
|
245 | 265 | |
|
246 | 266 | BOOT_PRINTF("in DUMB *** \n") |
|
247 | 267 | |
|
248 | 268 | while(1){ |
|
249 | 269 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 |
|
250 | 270 | | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6 | RTEMS_EVENT_7 |
|
251 | 271 | | RTEMS_EVENT_8, |
|
252 | 272 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT |
|
253 | 273 | intEventOut = (unsigned int) event_out; |
|
254 | 274 | for ( i=0; i<32; i++) |
|
255 | 275 | { |
|
256 | 276 | if ( ((intEventOut >> i) & 0x0001) != 0) |
|
257 | 277 | { |
|
258 | 278 | coarse_time = time_management_regs->coarse_time; |
|
259 | 279 | fine_time = time_management_regs->fine_time; |
|
260 | 280 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); |
|
261 | 281 | } |
|
262 | 282 | } |
|
263 | 283 | } |
|
264 | 284 | } |
|
265 | 285 | |
|
266 | 286 | //***************************** |
|
267 | 287 | // init housekeeping parameters |
|
268 | 288 | |
|
269 | 289 | void init_housekeeping_parameters( void ) |
|
270 | 290 | { |
|
271 | 291 | /** This function initialize the housekeeping_packet global variable with default values. |
|
272 | 292 | * |
|
273 | 293 | */ |
|
274 | 294 | |
|
275 | 295 | unsigned int i = 0; |
|
276 | 296 | unsigned char *parameters; |
|
277 | 297 | |
|
278 | 298 | parameters = (unsigned char*) &housekeeping_packet.lfr_status_word; |
|
279 | 299 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) |
|
280 | 300 | { |
|
281 | 301 | parameters[i] = 0x00; |
|
282 | 302 | } |
|
283 | 303 | // init status word |
|
284 | 304 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; |
|
285 | 305 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; |
|
286 | 306 | // init software version |
|
287 | 307 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
288 | 308 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
289 | 309 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
290 | 310 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
291 | 311 | // init fpga version |
|
292 | 312 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xd0); |
|
293 | 313 | housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1 |
|
294 | 314 | housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2 |
|
295 | 315 | housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3 |
|
296 | 316 | } |
|
297 | 317 | |
|
298 | 318 | void increment_seq_counter( unsigned char *packet_sequence_control) |
|
299 | 319 | { |
|
300 | 320 | /** This function increment the sequence counter psased in argument. |
|
301 | 321 | * |
|
302 | 322 | * The increment does not affect the grouping flag. In case of an overflow, the counter is reset to 0. |
|
303 | 323 | * |
|
304 | 324 | */ |
|
305 | 325 | |
|
306 | 326 | unsigned short sequence_cnt; |
|
307 | 327 | unsigned short segmentation_grouping_flag; |
|
308 | 328 | unsigned short new_packet_sequence_control; |
|
309 | 329 | |
|
310 | 330 | segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6 |
|
311 | 331 | sequence_cnt = (unsigned short) ( |
|
312 | 332 | ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0 |
|
313 | 333 | + packet_sequence_control[1] |
|
314 | 334 | ); |
|
315 | 335 | |
|
316 | 336 | if ( sequence_cnt < SEQ_CNT_MAX) |
|
317 | 337 | { |
|
318 | 338 | sequence_cnt = sequence_cnt + 1; |
|
319 | 339 | } |
|
320 | 340 | else |
|
321 | 341 | { |
|
322 | 342 | sequence_cnt = 0; |
|
323 | 343 | } |
|
324 | 344 | |
|
325 | 345 | new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ; |
|
326 | 346 | |
|
327 | 347 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); |
|
328 | 348 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); |
|
329 | 349 | } |
|
330 | 350 | |
|
331 | 351 | void getTime( unsigned char *time) |
|
332 | 352 | { |
|
333 | 353 | /** This function write the current local time in the time buffer passed in argument. |
|
334 | 354 | * |
|
335 | 355 | */ |
|
336 | 356 | |
|
337 | 357 | time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
338 | 358 | time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
339 | 359 | time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
340 | 360 | time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
341 | 361 | time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
342 | 362 | time[5] = (unsigned char) (time_management_regs->fine_time); |
|
343 | 363 | } |
|
344 | 364 |
@@ -1,736 +1,739 | |||
|
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 | 20 | ring_node *ring_node_for_averaging_sm_f0; |
|
21 | 21 | ring_node *current_ring_node_sm_f1; |
|
22 | 22 | ring_node *current_ring_node_sm_f2; |
|
23 | 23 | |
|
24 | 24 | BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ]; |
|
25 | 25 | float averaged_sm_f0 [ TIME_OFFSET + TOTAL_SIZE_SM ]; |
|
26 | 26 | float averaged_sm_f0_reorganized[ TIME_OFFSET + TOTAL_SIZE_SM ]; |
|
27 | 27 | char averaged_sm_f0_char [ TIME_OFFSET_IN_BYTES + TOTAL_SIZE_SM * 2 ]; |
|
28 | 28 | float compressed_sm_f0 [ TOTAL_SIZE_COMPRESSED_ASM_F0 ]; |
|
29 | 29 | |
|
30 | 30 | unsigned int nb_sm_f0; |
|
31 | 31 | |
|
32 | 32 | void init_sm_rings( void ) |
|
33 | 33 | { |
|
34 | 34 | unsigned char i; |
|
35 | 35 | |
|
36 | 36 | // F0 RING |
|
37 | 37 | sm_ring_f0[0].next = (ring_node*) &sm_ring_f0[1]; |
|
38 | 38 | sm_ring_f0[0].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-1]; |
|
39 | 39 | sm_ring_f0[0].buffer_address = (int) &sm_f0[0][0]; |
|
40 | 40 | |
|
41 | 41 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].next = (ring_node*) &sm_ring_f0[0]; |
|
42 | 42 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].previous = (ring_node*) &sm_ring_f0[NB_RING_NODES_ASM_F0-2]; |
|
43 | 43 | sm_ring_f0[NB_RING_NODES_ASM_F0-1].buffer_address = (int) &sm_f0[NB_RING_NODES_ASM_F0-1][0]; |
|
44 | 44 | |
|
45 | 45 | for(i=1; i<NB_RING_NODES_ASM_F0-1; i++) |
|
46 | 46 | { |
|
47 | 47 | sm_ring_f0[i].next = (ring_node*) &sm_ring_f0[i+1]; |
|
48 | 48 | sm_ring_f0[i].previous = (ring_node*) &sm_ring_f0[i-1]; |
|
49 | 49 | sm_ring_f0[i].buffer_address = (int) &sm_f0[i][0]; |
|
50 | 50 | } |
|
51 | 51 | |
|
52 | 52 | DEBUG_PRINTF1("asm_ring_f0 @%x\n", (unsigned int) sm_ring_f0) |
|
53 | 53 | |
|
54 | 54 | spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address; |
|
55 | 55 | DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0) |
|
56 | 56 | } |
|
57 | 57 | |
|
58 | 58 | void reset_current_sm_ring_nodes( void ) |
|
59 | 59 | { |
|
60 | 60 | current_ring_node_sm_f0 = sm_ring_f0; |
|
61 | 61 | ring_node_for_averaging_sm_f0 = sm_ring_f0; |
|
62 | 62 | } |
|
63 | 63 | |
|
64 | 64 | //*********************************************************** |
|
65 | 65 | // Interrupt Service Routine for spectral matrices processing |
|
66 | 66 | void reset_nb_sm_f0( void ) |
|
67 | 67 | { |
|
68 | 68 | nb_sm_f0 = 0; |
|
69 | 69 | } |
|
70 | 70 | |
|
71 | 71 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
72 | 72 | { |
|
73 | 73 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
74 | 74 | |
|
75 | 75 | if ( (spectral_matrix_regs->status & 0x1) == 0x01) |
|
76 | 76 | { |
|
77 | 77 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
78 | 78 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
79 | 79 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110 |
|
80 | 80 | nb_sm_f0 = nb_sm_f0 + 1; |
|
81 | 81 | } |
|
82 | 82 | else if ( (spectral_matrix_regs->status & 0x2) == 0x02) |
|
83 | 83 | { |
|
84 | 84 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
85 | 85 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; |
|
86 | 86 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 |
|
87 | 87 | nb_sm_f0 = nb_sm_f0 + 1; |
|
88 | 88 | } |
|
89 | 89 | |
|
90 | 90 | if ( (spectral_matrix_regs->status & 0x30) != 0x00) |
|
91 | 91 | { |
|
92 | 92 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
93 | 93 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111 |
|
94 | 94 | } |
|
95 | 95 | |
|
96 | 96 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011 |
|
97 | 97 | |
|
98 | 98 | if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) ) |
|
99 | 99 | { |
|
100 | 100 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; |
|
101 | 101 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
102 | 102 | { |
|
103 | 103 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
104 | 104 | } |
|
105 | 105 | nb_sm_f0 = 0; |
|
106 | 106 | } |
|
107 | 107 | else |
|
108 | 108 | { |
|
109 | 109 | nb_sm_f0 = nb_sm_f0 + 1; |
|
110 | 110 | } |
|
111 | 111 | } |
|
112 | 112 | |
|
113 | 113 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) |
|
114 | 114 | { |
|
115 | 115 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
116 | 116 | |
|
117 | 117 | if ( (spectral_matrix_regs->status & 0x1) == 0x01) |
|
118 | 118 | { |
|
119 | 119 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
120 | 120 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
121 | 121 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110 |
|
122 | 122 | nb_sm_f0 = nb_sm_f0 + 1; |
|
123 | 123 | } |
|
124 | 124 | else if ( (spectral_matrix_regs->status & 0x2) == 0x02) |
|
125 | 125 | { |
|
126 | 126 | current_ring_node_sm_f0 = current_ring_node_sm_f0->next; |
|
127 | 127 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; |
|
128 | 128 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // 1101 |
|
129 | 129 | nb_sm_f0 = nb_sm_f0 + 1; |
|
130 | 130 | } |
|
131 | 131 | |
|
132 | 132 | if ( (spectral_matrix_regs->status & 0x30) != 0x00) |
|
133 | 133 | { |
|
134 | 134 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 ); |
|
135 | 135 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // 1100 1111 |
|
136 | 136 | } |
|
137 | 137 | |
|
138 | 138 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff3; // 0011 |
|
139 | 139 | |
|
140 | 140 | if (nb_sm_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) ) |
|
141 | 141 | { |
|
142 | 142 | ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0; |
|
143 | 143 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
144 | 144 | { |
|
145 | 145 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
146 | 146 | } |
|
147 | 147 | nb_sm_f0 = 0; |
|
148 | 148 | } |
|
149 | 149 | else |
|
150 | 150 | { |
|
151 | 151 | nb_sm_f0 = nb_sm_f0 + 1; |
|
152 | 152 | } |
|
153 | 153 | } |
|
154 | 154 | |
|
155 | 155 | //************ |
|
156 | 156 | // RTEMS TASKS |
|
157 | 157 | |
|
158 | 158 | rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ |
|
159 | 159 | { |
|
160 | 160 | rtems_event_set event_out; |
|
161 | 161 | |
|
162 | 162 | BOOT_PRINTF("in SMIQ *** \n") |
|
163 | 163 | |
|
164 | 164 | while(1){ |
|
165 | 165 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
166 | 166 | } |
|
167 | 167 | } |
|
168 | 168 | |
|
169 | 169 | rtems_task avf0_task(rtems_task_argument argument) |
|
170 | 170 | { |
|
171 | 171 | int i; |
|
172 | 172 | static int nb_average; |
|
173 | 173 | rtems_event_set event_out; |
|
174 | 174 | rtems_status_code status; |
|
175 | 175 | ring_node *ring_node_tab[8]; |
|
176 | 176 | |
|
177 | 177 | nb_average = 0; |
|
178 | 178 | |
|
179 | 179 | BOOT_PRINTF("in AVFO *** \n") |
|
180 | 180 | |
|
181 | 181 | while(1){ |
|
182 | 182 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
183 | 183 | ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-1] = ring_node_for_averaging_sm_f0; |
|
184 | 184 | for (i=2; i<NB_SM_TO_RECEIVE_BEFORE_AVF0+1; i++) |
|
185 | 185 | { |
|
186 | 186 | ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous; |
|
187 | 187 | ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0; |
|
188 | 188 | } |
|
189 | ||
|
190 | averaged_sm_f0[0] = ( (int *) (ring_node_tab[7]->buffer_address) ) [0]; | |
|
191 | averaged_sm_f0[1] = ( (int *) (ring_node_tab[7]->buffer_address) ) [1]; | |
|
189 | 192 | for(i=0; i<TOTAL_SIZE_SM; i++) |
|
190 | 193 | { |
|
191 | 194 | averaged_sm_f0[i] = ( (int *) (ring_node_tab[0]->buffer_address) ) [i + TIME_OFFSET] |
|
192 | 195 | + ( (int *) (ring_node_tab[1]->buffer_address) ) [i + TIME_OFFSET] |
|
193 | 196 | + ( (int *) (ring_node_tab[2]->buffer_address) ) [i + TIME_OFFSET] |
|
194 | 197 | + ( (int *) (ring_node_tab[3]->buffer_address) ) [i + TIME_OFFSET] |
|
195 | 198 | + ( (int *) (ring_node_tab[4]->buffer_address) ) [i + TIME_OFFSET] |
|
196 | 199 | + ( (int *) (ring_node_tab[5]->buffer_address) ) [i + TIME_OFFSET] |
|
197 | 200 | + ( (int *) (ring_node_tab[6]->buffer_address) ) [i + TIME_OFFSET] |
|
198 | 201 | + ( (int *) (ring_node_tab[7]->buffer_address) ) [i + TIME_OFFSET]; |
|
199 | 202 | } |
|
200 | 203 | |
|
201 | 204 | nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0; |
|
202 | 205 | if (nb_average == NB_AVERAGE_NORMAL_f0) { |
|
203 | 206 | nb_average = 0; |
|
204 | 207 | status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0 |
|
205 | 208 | if (status != RTEMS_SUCCESSFUL) { |
|
206 | 209 | printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status); |
|
207 | 210 | } |
|
208 | 211 | } |
|
209 | 212 | } |
|
210 | 213 | } |
|
211 | 214 | |
|
212 | 215 | rtems_task matr_task(rtems_task_argument argument) |
|
213 | 216 | { |
|
214 | 217 | spw_ioctl_pkt_send spw_ioctl_send_ASM; |
|
215 | 218 | rtems_event_set event_out; |
|
216 | 219 | rtems_status_code status; |
|
217 | 220 | rtems_id queue_id; |
|
218 | 221 | Header_TM_LFR_SCIENCE_ASM_t headerASM; |
|
219 | 222 | |
|
220 | 223 | init_header_asm( &headerASM ); |
|
221 | 224 | |
|
222 | 225 | status = get_message_queue_id_send( &queue_id ); |
|
223 | 226 | if (status != RTEMS_SUCCESSFUL) |
|
224 | 227 | { |
|
225 | 228 | PRINTF1("in MATR *** ERR get_message_queue_id_send %d\n", status) |
|
226 | 229 | } |
|
227 | 230 | |
|
228 | 231 | BOOT_PRINTF("in MATR *** \n") |
|
229 | 232 | |
|
230 | 233 | fill_averaged_spectral_matrix( ); |
|
231 | 234 | |
|
232 | 235 | while(1){ |
|
233 | 236 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
234 | 237 | // 1) compress the matrix for Basic Parameters calculation |
|
235 | 238 | ASM_compress( averaged_sm_f0, 0, compressed_sm_f0 ); |
|
236 | 239 | // 2) |
|
237 | 240 | //BP1_set(compressed_sm_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0); |
|
238 | 241 | // 3) convert the float array in a char array |
|
239 | 242 | ASM_reorganize( averaged_sm_f0, averaged_sm_f0_reorganized ); |
|
240 | 243 | ASM_convert( averaged_sm_f0_reorganized, averaged_sm_f0_char); |
|
241 | 244 | // 4) send the spectral matrix packets |
|
242 | 245 | ASM_send( &headerASM, averaged_sm_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); |
|
243 | 246 | } |
|
244 | 247 | } |
|
245 | 248 | |
|
246 | 249 | //***************************** |
|
247 | 250 | // Spectral matrices processing |
|
248 | 251 | |
|
249 | 252 | void matrix_reset(volatile float *averaged_spec_mat) |
|
250 | 253 | { |
|
251 | 254 | int i; |
|
252 | 255 | for(i=0; i<TOTAL_SIZE_SM; i++){ |
|
253 | 256 | averaged_spec_mat[i] = 0; |
|
254 | 257 | } |
|
255 | 258 | } |
|
256 | 259 | |
|
257 | 260 | void ASM_reorganize( float *averaged_spec_mat, float *averaged_spec_mat_reorganized ) |
|
258 | 261 | { |
|
259 | 262 | int frequencyBin; |
|
260 | 263 | int asmComponent; |
|
261 | 264 | |
|
262 | 265 | // copy the time information |
|
263 | 266 | averaged_spec_mat_reorganized[ 0 ] = averaged_spec_mat[ 0 ]; |
|
264 | 267 | averaged_spec_mat_reorganized[ 1 ] = averaged_spec_mat[ 1 ]; |
|
265 | 268 | |
|
266 | 269 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) |
|
267 | 270 | { |
|
268 | 271 | for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ ) |
|
269 | 272 | { |
|
270 | 273 | averaged_spec_mat_reorganized[ frequencyBin * NB_VALUES_PER_SM + asmComponent + TIME_OFFSET ] = |
|
271 | 274 | averaged_spec_mat[ asmComponent * NB_BINS_PER_SM + frequencyBin + TIME_OFFSET]; |
|
272 | 275 | } |
|
273 | 276 | } |
|
274 | 277 | } |
|
275 | 278 | |
|
276 | 279 | void ASM_compress( float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat ) |
|
277 | 280 | { |
|
278 | 281 | int frequencyBin; |
|
279 | 282 | int asmComponent; |
|
280 | 283 | int offsetASM; |
|
281 | 284 | int offsetCompressed; |
|
282 | 285 | int k; |
|
283 | 286 | |
|
284 | 287 | switch (fChannel){ |
|
285 | 288 | case 0: |
|
286 | 289 | for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++) |
|
287 | 290 | { |
|
288 | 291 | for( frequencyBin = 0; frequencyBin < NB_BINS_COMPRESSED_SM_F0; frequencyBin++ ) |
|
289 | 292 | { |
|
290 | 293 | offsetASM = asmComponent * NB_BINS_PER_SM |
|
291 | 294 | + ASM_F0_INDICE_START |
|
292 | 295 | + frequencyBin * NB_BINS_TO_AVERAGE_ASM_F0; |
|
293 | 296 | offsetCompressed = frequencyBin * NB_VALUES_PER_SM |
|
294 | 297 | + asmComponent; |
|
295 | 298 | compressed_spec_mat[ offsetCompressed ] = 0; |
|
296 | 299 | for ( k = 0; k < NB_BINS_TO_AVERAGE_ASM_F0; k++ ) |
|
297 | 300 | { |
|
298 | 301 | compressed_spec_mat[offsetCompressed ] = |
|
299 | 302 | compressed_spec_mat[ offsetCompressed ] |
|
300 | 303 | + averaged_spec_mat[ offsetASM + k ]; |
|
301 | 304 | } |
|
302 | 305 | } |
|
303 | 306 | } |
|
304 | 307 | break; |
|
305 | 308 | |
|
306 | 309 | case 1: |
|
307 | 310 | // case fChannel = f1 to be completed later |
|
308 | 311 | break; |
|
309 | 312 | |
|
310 | 313 | case 2: |
|
311 | 314 | // case fChannel = f1 to be completed later |
|
312 | 315 | break; |
|
313 | 316 | |
|
314 | 317 | default: |
|
315 | 318 | break; |
|
316 | 319 | } |
|
317 | 320 | } |
|
318 | 321 | |
|
319 | 322 | void ASM_convert( volatile float *input_matrix, char *output_matrix) |
|
320 | 323 | { |
|
321 | 324 | unsigned int i; |
|
322 | 325 | unsigned int frequencyBin; |
|
323 | 326 | unsigned int asmComponent; |
|
324 | 327 | char * pt_char_input; |
|
325 | 328 | char * pt_char_output; |
|
326 | 329 | |
|
327 | 330 | pt_char_input = (char*) &input_matrix; |
|
328 | 331 | pt_char_output = (char*) &output_matrix; |
|
329 | 332 | |
|
330 | 333 | // copy the time information |
|
331 | 334 | for (i=0; i<TIME_OFFSET_IN_BYTES; i++) |
|
332 | 335 | { |
|
333 | 336 | pt_char_output[ i ] = pt_char_output[ i ]; |
|
334 | 337 | } |
|
335 | 338 | |
|
336 | 339 | // convert all other data |
|
337 | 340 | for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++) |
|
338 | 341 | { |
|
339 | 342 | for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++) |
|
340 | 343 | { |
|
341 | 344 | pt_char_input = (char*) &input_matrix [ (frequencyBin*NB_VALUES_PER_SM) + asmComponent + TIME_OFFSET ]; |
|
342 | 345 | pt_char_output = (char*) &output_matrix[ 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) + TIME_OFFSET_IN_BYTES ]; |
|
343 | 346 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float |
|
344 | 347 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float |
|
345 | 348 | } |
|
346 | 349 | } |
|
347 | 350 | } |
|
348 | 351 | |
|
349 | 352 | void ASM_send(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
350 | 353 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) |
|
351 | 354 | { |
|
352 | 355 | unsigned int i; |
|
353 | 356 | unsigned int length = 0; |
|
354 | 357 | rtems_status_code status; |
|
355 | 358 | |
|
356 | 359 | for (i=0; i<2; i++) |
|
357 | 360 | { |
|
358 | 361 | // (1) BUILD THE DATA |
|
359 | 362 | switch(sid) |
|
360 | 363 | { |
|
361 | 364 | case SID_NORM_ASM_F0: |
|
362 | 365 | spw_ioctl_send->dlen = TOTAL_SIZE_ASM_F0_IN_BYTES / 2; |
|
363 | 366 | spw_ioctl_send->data = &spectral_matrix[ |
|
364 | 367 | ( (ASM_F0_INDICE_START + (i*NB_BINS_PER_PKT_ASM_F0) ) * NB_VALUES_PER_SM ) * 2 |
|
365 | 368 | + TIME_OFFSET_IN_BYTES |
|
366 | 369 | ]; |
|
367 | 370 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0; |
|
368 | 371 | header->pa_lfr_asm_blk_nr[0] = (unsigned char) ( (NB_BINS_PER_PKT_ASM_F0) >> 8 ); // BLK_NR MSB |
|
369 | 372 | header->pa_lfr_asm_blk_nr[1] = (unsigned char) (NB_BINS_PER_PKT_ASM_F0); // BLK_NR LSB |
|
370 | 373 | break; |
|
371 | 374 | case SID_NORM_ASM_F1: |
|
372 | 375 | break; |
|
373 | 376 | case SID_NORM_ASM_F2: |
|
374 | 377 | break; |
|
375 | 378 | default: |
|
376 | 379 | PRINTF1("ERR *** in ASM_send *** unexpected sid %d\n", sid) |
|
377 | 380 | break; |
|
378 | 381 | } |
|
379 | 382 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
380 | 383 | spw_ioctl_send->hdr = (char *) header; |
|
381 | 384 | spw_ioctl_send->options = 0; |
|
382 | 385 | |
|
383 | 386 | // (2) BUILD THE HEADER |
|
384 | 387 | header->packetLength[0] = (unsigned char) (length>>8); |
|
385 | 388 | header->packetLength[1] = (unsigned char) (length); |
|
386 | 389 | header->sid = (unsigned char) sid; // SID |
|
387 | 390 | header->pa_lfr_pkt_cnt_asm = 2; |
|
388 | 391 | header->pa_lfr_pkt_nr_asm = (unsigned char) (i+1); |
|
389 | 392 | |
|
390 | 393 | // (3) SET PACKET TIME |
|
391 | 394 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
392 | 395 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
393 | 396 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
394 | 397 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
395 | 398 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
396 | 399 | header->time[5] = (unsigned char) (time_management_regs->fine_time); |
|
397 | 400 | // |
|
398 | 401 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
399 | 402 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
400 | 403 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
401 | 404 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); |
|
402 | 405 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
403 | 406 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); |
|
404 | 407 | |
|
405 | 408 | // (4) SEND PACKET |
|
406 | 409 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
407 | 410 | if (status != RTEMS_SUCCESSFUL) { |
|
408 | 411 | printf("in ASM_send *** ERR %d\n", (int) status); |
|
409 | 412 | } |
|
410 | 413 | } |
|
411 | 414 | } |
|
412 | 415 | |
|
413 | 416 | void BP1_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){ |
|
414 | 417 | int i; |
|
415 | 418 | int j; |
|
416 | 419 | unsigned char tmp_u_char; |
|
417 | 420 | unsigned char * pt_char = NULL; |
|
418 | 421 | float PSDB, PSDE; |
|
419 | 422 | float NVEC_V0; |
|
420 | 423 | float NVEC_V1; |
|
421 | 424 | float NVEC_V2; |
|
422 | 425 | //float significand; |
|
423 | 426 | //int exponent; |
|
424 | 427 | float aux; |
|
425 | 428 | float tr_SB_SB; |
|
426 | 429 | float tmp; |
|
427 | 430 | float sx_re; |
|
428 | 431 | float sx_im; |
|
429 | 432 | float nebx_re = 0; |
|
430 | 433 | float nebx_im = 0; |
|
431 | 434 | float ny = 0; |
|
432 | 435 | float nz = 0; |
|
433 | 436 | float bx_bx_star = 0; |
|
434 | 437 | for(i=0; i<nb_bins_compressed_spec_mat; i++){ |
|
435 | 438 | //============================================== |
|
436 | 439 | // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits |
|
437 | 440 | PSDB = compressed_spec_mat[i*30] // S11 |
|
438 | 441 | + compressed_spec_mat[(i*30) + 10] // S22 |
|
439 | 442 | + compressed_spec_mat[(i*30) + 18]; // S33 |
|
440 | 443 | //significand = frexp(PSDB, &exponent); |
|
441 | 444 | pt_char = (unsigned char*) &PSDB; |
|
442 | 445 | LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float |
|
443 | 446 | LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float |
|
444 | 447 | //============================================== |
|
445 | 448 | // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits |
|
446 | 449 | PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44 |
|
447 | 450 | + compressed_spec_mat[(i*30) + 28] * K55_pe // S55 |
|
448 | 451 | + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45 |
|
449 | 452 | - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45 |
|
450 | 453 | pt_char = (unsigned char*) &PSDE; |
|
451 | 454 | LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float |
|
452 | 455 | LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float |
|
453 | 456 | //============================================================================== |
|
454 | 457 | // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits |
|
455 | 458 | // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits |
|
456 | 459 | // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits |
|
457 | 460 | tmp = sqrt( |
|
458 | 461 | compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12 |
|
459 | 462 | +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13 |
|
460 | 463 | +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23 |
|
461 | 464 | ); |
|
462 | 465 | NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23 |
|
463 | 466 | NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13 |
|
464 | 467 | NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12 |
|
465 | 468 | LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127); |
|
466 | 469 | LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127); |
|
467 | 470 | pt_char = (unsigned char*) &NVEC_V2; |
|
468 | 471 | LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2 |
|
469 | 472 | //======================================================= |
|
470 | 473 | // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits |
|
471 | 474 | aux = 2*tmp / PSDB; // compute the ellipticity |
|
472 | 475 | tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity |
|
473 | 476 | LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char |
|
474 | 477 | //============================================================== |
|
475 | 478 | // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits |
|
476 | 479 | for(j = 0; j<NB_VALUES_PER_SM;j++){ |
|
477 | 480 | tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30] |
|
478 | 481 | + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10] |
|
479 | 482 | + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18] |
|
480 | 483 | + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2] |
|
481 | 484 | + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3] |
|
482 | 485 | + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4] |
|
483 | 486 | + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5] |
|
484 | 487 | + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12] |
|
485 | 488 | + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13]; |
|
486 | 489 | } |
|
487 | 490 | aux = PSDB*PSDB; |
|
488 | 491 | tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) ); |
|
489 | 492 | tmp_u_char = (unsigned char) (NVEC_V0*(8-1)); |
|
490 | 493 | LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char |
|
491 | 494 | //======================================================================================= |
|
492 | 495 | // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1) |
|
493 | 496 | sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re |
|
494 | 497 | + compressed_spec_mat[(i*30) + 6] * K14_sx_re |
|
495 | 498 | + compressed_spec_mat[(i*30) + 8] * K15_sx_re |
|
496 | 499 | + compressed_spec_mat[(i*30) + 14] * K24_sx_re |
|
497 | 500 | + compressed_spec_mat[(i*30) + 16] * K25_sx_re |
|
498 | 501 | + compressed_spec_mat[(i*30) + 22] * K35_sx_re; |
|
499 | 502 | sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im |
|
500 | 503 | + compressed_spec_mat[(i*30) + 7] * K14_sx_im |
|
501 | 504 | + compressed_spec_mat[(i*30) + 9] * K15_sx_im |
|
502 | 505 | + compressed_spec_mat[(i*30) + 15] * K24_sx_im |
|
503 | 506 | + compressed_spec_mat[(i*30) + 17] * K25_sx_im |
|
504 | 507 | + compressed_spec_mat[(i*30) + 23] * K35_sx_im; |
|
505 | 508 | LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression |
|
506 | 509 | if ( abs(sx_re) > abs(sx_im) ) { |
|
507 | 510 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx |
|
508 | 511 | } |
|
509 | 512 | else { |
|
510 | 513 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx |
|
511 | 514 | } |
|
512 | 515 | //====================================================================== |
|
513 | 516 | // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1) |
|
514 | 517 | ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2; |
|
515 | 518 | nz = NVEC_V0; |
|
516 | 519 | bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22 |
|
517 | 520 | + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33 |
|
518 | 521 | - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23 |
|
519 | 522 | nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re |
|
520 | 523 | +compressed_spec_mat[(i*30) + 16] * K25_ny_re |
|
521 | 524 | +compressed_spec_mat[(i*30) + 20] * K34_ny_re |
|
522 | 525 | +compressed_spec_mat[(i*30) + 22] * K35_ny_re) |
|
523 | 526 | + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re |
|
524 | 527 | +compressed_spec_mat[(i*30) + 16] * K25_nz_re |
|
525 | 528 | +compressed_spec_mat[(i*30) + 20] * K34_nz_re |
|
526 | 529 | +compressed_spec_mat[(i*30) + 22] * K35_nz_re); |
|
527 | 530 | nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re |
|
528 | 531 | +compressed_spec_mat[(i*30) + 17] * K25_ny_re |
|
529 | 532 | +compressed_spec_mat[(i*30) + 21] * K34_ny_re |
|
530 | 533 | +compressed_spec_mat[(i*30) + 23] * K35_ny_re) |
|
531 | 534 | + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im |
|
532 | 535 | +compressed_spec_mat[(i*30) + 17] * K25_nz_im |
|
533 | 536 | +compressed_spec_mat[(i*30) + 21] * K34_nz_im |
|
534 | 537 | +compressed_spec_mat[(i*30) + 23] * K35_nz_im); |
|
535 | 538 | tmp = nebx_re / bx_bx_star; |
|
536 | 539 | LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression |
|
537 | 540 | if ( abs(nebx_re) > abs(nebx_im) ) { |
|
538 | 541 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx |
|
539 | 542 | } |
|
540 | 543 | else { |
|
541 | 544 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx |
|
542 | 545 | } |
|
543 | 546 | } |
|
544 | 547 | |
|
545 | 548 | } |
|
546 | 549 | |
|
547 | 550 | void BP2_set_old(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){ |
|
548 | 551 | // BP2 autocorrelation |
|
549 | 552 | int i; |
|
550 | 553 | int aux = 0; |
|
551 | 554 | |
|
552 | 555 | for(i = 0; i<nb_bins_compressed_spec_mat; i++){ |
|
553 | 556 | // S12 |
|
554 | 557 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]); |
|
555 | 558 | compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux; |
|
556 | 559 | compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux; |
|
557 | 560 | // S13 |
|
558 | 561 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]); |
|
559 | 562 | compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux; |
|
560 | 563 | compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux; |
|
561 | 564 | // S23 |
|
562 | 565 | aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]); |
|
563 | 566 | compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux; |
|
564 | 567 | compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux; |
|
565 | 568 | // S45 |
|
566 | 569 | aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]); |
|
567 | 570 | compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux; |
|
568 | 571 | compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux; |
|
569 | 572 | // S14 |
|
570 | 573 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]); |
|
571 | 574 | compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux; |
|
572 | 575 | compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux; |
|
573 | 576 | // S15 |
|
574 | 577 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]); |
|
575 | 578 | compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux; |
|
576 | 579 | compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux; |
|
577 | 580 | // S24 |
|
578 | 581 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]); |
|
579 | 582 | compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux; |
|
580 | 583 | compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux; |
|
581 | 584 | // S25 |
|
582 | 585 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]); |
|
583 | 586 | compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux; |
|
584 | 587 | compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux; |
|
585 | 588 | // S34 |
|
586 | 589 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]); |
|
587 | 590 | compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux; |
|
588 | 591 | compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux; |
|
589 | 592 | // S35 |
|
590 | 593 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]); |
|
591 | 594 | compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux; |
|
592 | 595 | compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux; |
|
593 | 596 | } |
|
594 | 597 | } |
|
595 | 598 | |
|
596 | 599 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header) |
|
597 | 600 | { |
|
598 | 601 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
599 | 602 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
600 | 603 | header->reserved = 0x00; |
|
601 | 604 | header->userApplication = CCSDS_USER_APP; |
|
602 | 605 | header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
603 | 606 | header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
604 | 607 | header->packetSequenceControl[0] = 0xc0; |
|
605 | 608 | header->packetSequenceControl[1] = 0x00; |
|
606 | 609 | header->packetLength[0] = 0x00; |
|
607 | 610 | header->packetLength[1] = 0x00; |
|
608 | 611 | // DATA FIELD HEADER |
|
609 | 612 | header->spare1_pusVersion_spare2 = 0x10; |
|
610 | 613 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
611 | 614 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
612 | 615 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
613 | 616 | // AUXILIARY DATA HEADER |
|
614 | 617 | header->sid = 0x00; |
|
615 | 618 | header->biaStatusInfo = 0x00; |
|
616 | 619 | header->pa_lfr_pkt_cnt_asm = 0x00; |
|
617 | 620 | header->pa_lfr_pkt_nr_asm = 0x00; |
|
618 | 621 | header->time[0] = 0x00; |
|
619 | 622 | header->time[0] = 0x00; |
|
620 | 623 | header->time[0] = 0x00; |
|
621 | 624 | header->time[0] = 0x00; |
|
622 | 625 | header->time[0] = 0x00; |
|
623 | 626 | header->time[0] = 0x00; |
|
624 | 627 | header->pa_lfr_asm_blk_nr[0] = 0x00; // BLK_NR MSB |
|
625 | 628 | header->pa_lfr_asm_blk_nr[1] = 0x00; // BLK_NR LSB |
|
626 | 629 | } |
|
627 | 630 | |
|
628 | 631 | void fill_averaged_spectral_matrix(void) |
|
629 | 632 | { |
|
630 | 633 | /** This function fills spectral matrices related buffers with arbitrary data. |
|
631 | 634 | * |
|
632 | 635 | * This function is for testing purpose only. |
|
633 | 636 | * |
|
634 | 637 | */ |
|
635 | 638 | |
|
636 | 639 | float offset; |
|
637 | 640 | float coeff; |
|
638 | 641 | |
|
639 | 642 | offset = 10.; |
|
640 | 643 | coeff = 100000.; |
|
641 | 644 | averaged_sm_f0[ 0 + 25 * 0 ] = 0. + offset; |
|
642 | 645 | averaged_sm_f0[ 0 + 25 * 1 ] = 1. + offset; |
|
643 | 646 | averaged_sm_f0[ 0 + 25 * 2 ] = 2. + offset; |
|
644 | 647 | averaged_sm_f0[ 0 + 25 * 3 ] = 3. + offset; |
|
645 | 648 | averaged_sm_f0[ 0 + 25 * 4 ] = 4. + offset; |
|
646 | 649 | averaged_sm_f0[ 0 + 25 * 5 ] = 5. + offset; |
|
647 | 650 | averaged_sm_f0[ 0 + 25 * 6 ] = 6. + offset; |
|
648 | 651 | averaged_sm_f0[ 0 + 25 * 7 ] = 7. + offset; |
|
649 | 652 | averaged_sm_f0[ 0 + 25 * 8 ] = 8. + offset; |
|
650 | 653 | averaged_sm_f0[ 0 + 25 * 9 ] = 9. + offset; |
|
651 | 654 | averaged_sm_f0[ 0 + 25 * 10 ] = 10. + offset; |
|
652 | 655 | averaged_sm_f0[ 0 + 25 * 11 ] = 11. + offset; |
|
653 | 656 | averaged_sm_f0[ 0 + 25 * 12 ] = 12. + offset; |
|
654 | 657 | averaged_sm_f0[ 0 + 25 * 13 ] = 13. + offset; |
|
655 | 658 | averaged_sm_f0[ 0 + 25 * 14 ] = 14. + offset; |
|
656 | 659 | averaged_sm_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff; |
|
657 | 660 | averaged_sm_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff; |
|
658 | 661 | averaged_sm_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff; |
|
659 | 662 | averaged_sm_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff; |
|
660 | 663 | averaged_sm_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff; |
|
661 | 664 | averaged_sm_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff; |
|
662 | 665 | averaged_sm_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff; |
|
663 | 666 | averaged_sm_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff; |
|
664 | 667 | averaged_sm_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff; |
|
665 | 668 | averaged_sm_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff; |
|
666 | 669 | averaged_sm_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff; |
|
667 | 670 | averaged_sm_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff; |
|
668 | 671 | averaged_sm_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff; |
|
669 | 672 | averaged_sm_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff; |
|
670 | 673 | averaged_sm_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff; |
|
671 | 674 | |
|
672 | 675 | offset = 10000000; |
|
673 | 676 | averaged_sm_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff; |
|
674 | 677 | averaged_sm_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff; |
|
675 | 678 | averaged_sm_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff; |
|
676 | 679 | averaged_sm_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff; |
|
677 | 680 | averaged_sm_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff; |
|
678 | 681 | averaged_sm_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff; |
|
679 | 682 | averaged_sm_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff; |
|
680 | 683 | averaged_sm_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff; |
|
681 | 684 | averaged_sm_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff; |
|
682 | 685 | averaged_sm_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff; |
|
683 | 686 | averaged_sm_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff; |
|
684 | 687 | averaged_sm_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff; |
|
685 | 688 | averaged_sm_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff; |
|
686 | 689 | averaged_sm_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff; |
|
687 | 690 | averaged_sm_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff; |
|
688 | 691 | |
|
689 | 692 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_sm_f0[ 0 ]; |
|
690 | 693 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_sm_f0[ 1 ]; |
|
691 | 694 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_sm_f0[ 2 ]; |
|
692 | 695 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_sm_f0[ 3 ]; |
|
693 | 696 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_sm_f0[ 4 ]; |
|
694 | 697 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_sm_f0[ 5 ]; |
|
695 | 698 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_sm_f0[ 6 ]; |
|
696 | 699 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_sm_f0[ 7 ]; |
|
697 | 700 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_sm_f0[ 8 ]; |
|
698 | 701 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_sm_f0[ 9 ]; |
|
699 | 702 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_sm_f0[ 10 ]; |
|
700 | 703 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_sm_f0[ 11 ]; |
|
701 | 704 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_sm_f0[ 12 ]; |
|
702 | 705 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_sm_f0[ 13 ]; |
|
703 | 706 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_sm_f0[ 14 ]; |
|
704 | 707 | averaged_sm_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_sm_f0[ 15 ]; |
|
705 | 708 | } |
|
706 | 709 | |
|
707 | 710 | void reset_spectral_matrix_regs() |
|
708 | 711 | { |
|
709 | 712 | /** This function resets the spectral matrices module registers. |
|
710 | 713 | * |
|
711 | 714 | * The registers affected by this function are located at the following offset addresses: |
|
712 | 715 | * |
|
713 | 716 | * - 0x00 config |
|
714 | 717 | * - 0x04 status |
|
715 | 718 | * - 0x08 matrixF0_Address0 |
|
716 | 719 | * - 0x10 matrixFO_Address1 |
|
717 | 720 | * - 0x14 matrixF1_Address |
|
718 | 721 | * - 0x18 matrixF2_Address |
|
719 | 722 | * |
|
720 | 723 | */ |
|
721 | 724 | |
|
722 | 725 | spectral_matrix_regs->config = 0x00; |
|
723 | 726 | spectral_matrix_regs->status = 0x00; |
|
724 | 727 | |
|
725 | 728 | spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address; |
|
726 | 729 | spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address; |
|
727 | 730 | spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address; |
|
728 | 731 | spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address; |
|
729 | 732 | } |
|
730 | 733 | |
|
731 | 734 | //****************** |
|
732 | 735 | // general functions |
|
733 | 736 | |
|
734 | 737 | |
|
735 | 738 | |
|
736 | 739 |
@@ -1,601 +1,601 | |||
|
1 | 1 | /** Functions related to the SpaceWire interface. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * A group of functions to handle SpaceWire transmissions: |
|
7 | 7 | * - configuration of the SpaceWire link |
|
8 | 8 | * - SpaceWire related interruption requests processing |
|
9 | 9 | * - transmission of TeleMetry packets by a dedicated RTEMS task |
|
10 | 10 | * - reception of TeleCommands by a dedicated RTEMS task |
|
11 | 11 | * |
|
12 | 12 | */ |
|
13 | 13 | |
|
14 | 14 | #include "fsw_spacewire.h" |
|
15 | 15 | |
|
16 | 16 | rtems_name semq_name; |
|
17 | 17 | rtems_id semq_id; |
|
18 | 18 | |
|
19 | 19 | //*********** |
|
20 | 20 | // RTEMS TASK |
|
21 | 21 | rtems_task spiq_task(rtems_task_argument unused) |
|
22 | 22 | { |
|
23 | 23 | /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver. |
|
24 | 24 | * |
|
25 | 25 | * @param unused is the starting argument of the RTEMS task |
|
26 | 26 | * |
|
27 | 27 | */ |
|
28 | 28 | |
|
29 | 29 | rtems_event_set event_out; |
|
30 | 30 | rtems_status_code status; |
|
31 | 31 | int linkStatus; |
|
32 | 32 | |
|
33 | 33 | BOOT_PRINTF("in SPIQ *** \n") |
|
34 | 34 | |
|
35 | 35 | while(true){ |
|
36 | 36 | rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT |
|
37 | 37 | PRINTF("in SPIQ *** got SPW_LINKERR_EVENT\n") |
|
38 | 38 | |
|
39 | 39 | // [0] SUSPEND RECV AND SEND TASKS |
|
40 | 40 | status = rtems_task_suspend( Task_id[ TASKID_RECV ] ); |
|
41 | 41 | if ( status != RTEMS_SUCCESSFUL ) { |
|
42 | 42 | PRINTF("in SPIQ *** ERR suspending RECV Task\n") |
|
43 | 43 | } |
|
44 | 44 | status = rtems_task_suspend( Task_id[ TASKID_SEND ] ); |
|
45 | 45 | if ( status != RTEMS_SUCCESSFUL ) { |
|
46 | 46 | PRINTF("in SPIQ *** ERR suspending SEND Task\n") |
|
47 | 47 | } |
|
48 | 48 | |
|
49 | 49 | // [1] CHECK THE LINK |
|
50 | 50 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1) |
|
51 | 51 | if ( linkStatus != 5) { |
|
52 | 52 | PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus) |
|
53 | 53 | status = rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms |
|
54 | 54 | } |
|
55 | 55 | |
|
56 | 56 | // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT |
|
57 | 57 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2) |
|
58 | 58 | if ( linkStatus != 5 ) // [2.a] not in run state, reset the link |
|
59 | 59 | { |
|
60 | 60 | spacewire_compute_stats_offsets(); |
|
61 | 61 | status = spacewire_reset_link( ); |
|
62 | 62 | } |
|
63 | 63 | else // [2.b] in run state, start the link |
|
64 | 64 | { |
|
65 | 65 | status = spacewire_stop_start_link( fdSPW ); // start the link |
|
66 | 66 | if ( status != RTEMS_SUCCESSFUL) |
|
67 | 67 | { |
|
68 | 68 | PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status) |
|
69 | 69 | } |
|
70 | 70 | } |
|
71 | 71 | |
|
72 | 72 | // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS |
|
73 | 73 | if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully |
|
74 | 74 | { |
|
75 | 75 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); |
|
76 | 76 | if ( status != RTEMS_SUCCESSFUL ) { |
|
77 | 77 | PRINTF("in SPIQ *** ERR resuming SEND Task\n") |
|
78 | 78 | } |
|
79 | 79 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); |
|
80 | 80 | if ( status != RTEMS_SUCCESSFUL ) { |
|
81 | 81 | PRINTF("in SPIQ *** ERR resuming RECV Task\n") |
|
82 | 82 | } |
|
83 | 83 | } |
|
84 | 84 | else // [3.b] the link is not in run state, go in STANDBY mode |
|
85 | 85 | { |
|
86 | 86 | status = stop_current_mode(); |
|
87 | 87 | if ( status != RTEMS_SUCCESSFUL ) { |
|
88 | 88 | PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status) |
|
89 | 89 | } |
|
90 | 90 | status = enter_mode( LFR_MODE_STANDBY ); |
|
91 | 91 | if ( status != RTEMS_SUCCESSFUL ) { |
|
92 | 92 | PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status) |
|
93 | 93 | } |
|
94 | 94 | // wake the WTDG task up to wait for the link recovery |
|
95 | 95 | status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 ); |
|
96 | 96 | status = rtems_task_suspend( RTEMS_SELF ); |
|
97 | 97 | } |
|
98 | 98 | } |
|
99 | 99 | } |
|
100 | 100 | |
|
101 | 101 | rtems_task recv_task( rtems_task_argument unused ) |
|
102 | 102 | { |
|
103 | 103 | /** This RTEMS task is dedicated to the reception of incoming TeleCommands. |
|
104 | 104 | * |
|
105 | 105 | * @param unused is the starting argument of the RTEMS task |
|
106 | 106 | * |
|
107 | 107 | * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked: |
|
108 | 108 | * 1. It reads the incoming data. |
|
109 | 109 | * 2. Launches the acceptance procedure. |
|
110 | 110 | * 3. If the Telecommand is valid, sends it to a dedicated RTEMS message queue. |
|
111 | 111 | * |
|
112 | 112 | */ |
|
113 | 113 | |
|
114 | 114 | int len; |
|
115 | 115 | ccsdsTelecommandPacket_t currentTC; |
|
116 | 116 | unsigned char computed_CRC[ 2 ]; |
|
117 | 117 | unsigned char currentTC_LEN_RCV[ 2 ]; |
|
118 | 118 | unsigned char destinationID; |
|
119 | 119 | unsigned int currentTC_LEN_RCV_AsUnsignedInt; |
|
120 | 120 | unsigned int parserCode; |
|
121 | 121 | unsigned char time[6]; |
|
122 | 122 | rtems_status_code status; |
|
123 | 123 | rtems_id queue_recv_id; |
|
124 | 124 | rtems_id queue_send_id; |
|
125 | 125 | |
|
126 | 126 | initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes |
|
127 | 127 | |
|
128 | 128 | status = get_message_queue_id_recv( &queue_recv_id ); |
|
129 | 129 | if (status != RTEMS_SUCCESSFUL) |
|
130 | 130 | { |
|
131 | 131 | PRINTF1("in RECV *** ERR get_message_queue_id_recv %d\n", status) |
|
132 | 132 | } |
|
133 | 133 | |
|
134 | 134 | status = get_message_queue_id_send( &queue_send_id ); |
|
135 | 135 | if (status != RTEMS_SUCCESSFUL) |
|
136 | 136 | { |
|
137 | 137 | PRINTF1("in RECV *** ERR get_message_queue_id_send %d\n", status) |
|
138 | 138 | } |
|
139 | 139 | |
|
140 | 140 | BOOT_PRINTF("in RECV *** \n") |
|
141 | 141 | |
|
142 | 142 | while(1) |
|
143 | 143 | { |
|
144 | 144 | len = read( fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking |
|
145 | 145 | if (len == -1){ // error during the read call |
|
146 | 146 | PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno) |
|
147 | 147 | } |
|
148 | 148 | else { |
|
149 | 149 | if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) { |
|
150 | 150 | PRINTF("in RECV *** packet lenght too short\n") |
|
151 | 151 | } |
|
152 | 152 | else { |
|
153 | 153 | currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes |
|
154 | 154 | currentTC_LEN_RCV[ 0 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt >> 8); |
|
155 | 155 | currentTC_LEN_RCV[ 1 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt ); |
|
156 | 156 | // CHECK THE TC |
|
157 | 157 | parserCode = tc_parser( ¤tTC, currentTC_LEN_RCV_AsUnsignedInt, computed_CRC ) ; |
|
158 | 158 | if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT) |
|
159 | 159 | || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE) |
|
160 | 160 | || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA) |
|
161 | 161 | || (parserCode == WRONG_SRC_ID) ) |
|
162 | 162 | { // send TM_LFR_TC_EXE_CORRUPTED |
|
163 | 163 | if ( !( (currentTC.serviceType==TC_TYPE_TIME) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
164 | 164 | && |
|
165 | 165 | !( (currentTC.serviceType==TC_TYPE_GEN) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
166 | 166 | ) |
|
167 | 167 | { |
|
168 | 168 | if ( parserCode == WRONG_SRC_ID ) |
|
169 | 169 | { |
|
170 | 170 | destinationID = SID_TC_GROUND; |
|
171 | 171 | } |
|
172 | 172 | else |
|
173 | 173 | { |
|
174 | 174 | destinationID = currentTC.sourceID; |
|
175 | 175 | } |
|
176 | 176 | getTime( time ); |
|
177 |
close_action( ¤tTC, LFR_DEFAULT, queue_send_id |
|
|
177 | close_action( ¤tTC, LFR_DEFAULT, queue_send_id ); | |
|
178 | 178 | send_tm_lfr_tc_exe_corrupted( ¤tTC, queue_send_id, |
|
179 | 179 | computed_CRC, currentTC_LEN_RCV, |
|
180 |
destinationID |
|
|
180 | destinationID ); | |
|
181 | 181 | } |
|
182 | 182 | } |
|
183 | 183 | else |
|
184 | 184 | { // send valid TC to the action launcher |
|
185 | 185 | status = rtems_message_queue_send( queue_recv_id, ¤tTC, |
|
186 | 186 | currentTC_LEN_RCV_AsUnsignedInt + CCSDS_TC_TM_PACKET_OFFSET + 3); |
|
187 | 187 | } |
|
188 | 188 | } |
|
189 | 189 | } |
|
190 | 190 | } |
|
191 | 191 | } |
|
192 | 192 | |
|
193 | 193 | rtems_task send_task( rtems_task_argument argument) |
|
194 | 194 | { |
|
195 | 195 | /** This RTEMS task is dedicated to the transmission of TeleMetry packets. |
|
196 | 196 | * |
|
197 | 197 | * @param unused is the starting argument of the RTEMS task |
|
198 | 198 | * |
|
199 | 199 | * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives: |
|
200 | 200 | * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call. |
|
201 | 201 | * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After |
|
202 | 202 | * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the |
|
203 | 203 | * data it contains. |
|
204 | 204 | * |
|
205 | 205 | */ |
|
206 | 206 | |
|
207 | 207 | rtems_status_code status; // RTEMS status code |
|
208 | 208 | char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer |
|
209 | 209 | spw_ioctl_pkt_send *spw_ioctl_send; |
|
210 | 210 | size_t size; // size of the incoming TC packet |
|
211 | 211 | u_int32_t count; |
|
212 | 212 | rtems_id queue_id; |
|
213 | 213 | |
|
214 | 214 | status = get_message_queue_id_send( &queue_id ); |
|
215 | 215 | if (status != RTEMS_SUCCESSFUL) |
|
216 | 216 | { |
|
217 | 217 | PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status) |
|
218 | 218 | } |
|
219 | 219 | |
|
220 | 220 | BOOT_PRINTF("in SEND *** \n") |
|
221 | 221 | |
|
222 | 222 | while(1) |
|
223 | 223 | { |
|
224 | 224 | status = rtems_message_queue_receive( queue_id, incomingData, &size, |
|
225 | 225 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); |
|
226 | 226 | |
|
227 | 227 | if (status!=RTEMS_SUCCESSFUL) |
|
228 | 228 | { |
|
229 | 229 | PRINTF1("in SEND *** (1) ERR = %d\n", status) |
|
230 | 230 | } |
|
231 | 231 | else |
|
232 | 232 | { |
|
233 | 233 | if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet |
|
234 | 234 | { |
|
235 | 235 | status = write( fdSPW, incomingData, size ); |
|
236 | 236 | if (status == -1){ |
|
237 | 237 | PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size) |
|
238 | 238 | } |
|
239 | 239 | } |
|
240 | 240 | else // the incoming message is a spw_ioctl_pkt_send structure |
|
241 | 241 | { |
|
242 | 242 | spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData; |
|
243 | 243 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send ); |
|
244 | 244 | if (status == -1){ |
|
245 | 245 | PRINTF2("in SEND *** (2.b) ERRNO = %d, RTEMS = %d\n", errno, status) |
|
246 | 246 | } |
|
247 | 247 | } |
|
248 | 248 | } |
|
249 | 249 | |
|
250 | 250 | status = rtems_message_queue_get_number_pending( queue_id, &count ); |
|
251 | 251 | if (status != RTEMS_SUCCESSFUL) |
|
252 | 252 | { |
|
253 | 253 | PRINTF1("in SEND *** (3) ERR = %d\n", status) |
|
254 | 254 | } |
|
255 | 255 | else |
|
256 | 256 | { |
|
257 | 257 | if (count > maxCount) |
|
258 | 258 | { |
|
259 | 259 | maxCount = count; |
|
260 | 260 | } |
|
261 | 261 | } |
|
262 | 262 | } |
|
263 | 263 | } |
|
264 | 264 | |
|
265 | 265 | rtems_task wtdg_task( rtems_task_argument argument ) |
|
266 | 266 | { |
|
267 | 267 | rtems_event_set event_out; |
|
268 | 268 | rtems_status_code status; |
|
269 | 269 | int linkStatus; |
|
270 | 270 | |
|
271 | 271 | BOOT_PRINTF("in WTDG ***\n") |
|
272 | 272 | |
|
273 | 273 | while(1) |
|
274 | 274 | { |
|
275 | 275 | // wait for an RTEMS_EVENT |
|
276 | 276 | rtems_event_receive( RTEMS_EVENT_0, |
|
277 | 277 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
278 | 278 | PRINTF("in WTDG *** wait for the link\n") |
|
279 | 279 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
280 | 280 | while( linkStatus != 5) // wait for the link |
|
281 | 281 | { |
|
282 | 282 | rtems_task_wake_after( 10 ); |
|
283 | 283 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
284 | 284 | } |
|
285 | 285 | |
|
286 | 286 | status = spacewire_stop_start_link( fdSPW ); |
|
287 | 287 | |
|
288 | 288 | if (status != RTEMS_SUCCESSFUL) |
|
289 | 289 | { |
|
290 | 290 | PRINTF1("in WTDG *** ERR link not started %d\n", status) |
|
291 | 291 | } |
|
292 | 292 | else |
|
293 | 293 | { |
|
294 | 294 | PRINTF("in WTDG *** OK link started\n") |
|
295 | 295 | } |
|
296 | 296 | |
|
297 | 297 | // restart the SPIQ task |
|
298 | 298 | status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 ); |
|
299 | 299 | if ( status != RTEMS_SUCCESSFUL ) { |
|
300 | 300 | PRINTF("in SPIQ *** ERR restarting SPIQ Task\n") |
|
301 | 301 | } |
|
302 | 302 | |
|
303 | 303 | // restart RECV and SEND |
|
304 | 304 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); |
|
305 | 305 | if ( status != RTEMS_SUCCESSFUL ) { |
|
306 | 306 | PRINTF("in SPIQ *** ERR restarting SEND Task\n") |
|
307 | 307 | } |
|
308 | 308 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); |
|
309 | 309 | if ( status != RTEMS_SUCCESSFUL ) { |
|
310 | 310 | PRINTF("in SPIQ *** ERR restarting RECV Task\n") |
|
311 | 311 | } |
|
312 | 312 | } |
|
313 | 313 | } |
|
314 | 314 | |
|
315 | 315 | //**************** |
|
316 | 316 | // OTHER FUNCTIONS |
|
317 | 317 | int spacewire_open_link( void ) |
|
318 | 318 | { |
|
319 | 319 | /** This function opens the SpaceWire link. |
|
320 | 320 | * |
|
321 | 321 | * @return a valid file descriptor in case of success, -1 in case of a failure |
|
322 | 322 | * |
|
323 | 323 | */ |
|
324 | 324 | rtems_status_code status; |
|
325 | 325 | |
|
326 | 326 | fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware |
|
327 | 327 | if ( fdSPW < 0 ) { |
|
328 | 328 | PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno) |
|
329 | 329 | } |
|
330 | 330 | else |
|
331 | 331 | { |
|
332 | 332 | status = RTEMS_SUCCESSFUL; |
|
333 | 333 | } |
|
334 | 334 | |
|
335 | 335 | return status; |
|
336 | 336 | } |
|
337 | 337 | |
|
338 | 338 | int spacewire_start_link( int fd ) |
|
339 | 339 | { |
|
340 | 340 | rtems_status_code status; |
|
341 | 341 | |
|
342 | 342 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started |
|
343 | 343 | // -1 default hardcoded driver timeout |
|
344 | 344 | |
|
345 | 345 | return status; |
|
346 | 346 | } |
|
347 | 347 | |
|
348 | 348 | int spacewire_stop_start_link( int fd ) |
|
349 | 349 | { |
|
350 | 350 | rtems_status_code status; |
|
351 | 351 | |
|
352 | 352 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0 |
|
353 | 353 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started |
|
354 | 354 | // -1 default hardcoded driver timeout |
|
355 | 355 | |
|
356 | 356 | return status; |
|
357 | 357 | } |
|
358 | 358 | |
|
359 | 359 | int spacewire_configure_link( int fd ) |
|
360 | 360 | { |
|
361 | 361 | /** This function configures the SpaceWire link. |
|
362 | 362 | * |
|
363 | 363 | * @return GR-RTEMS-DRIVER directive status codes: |
|
364 | 364 | * - 22 EINVAL - Null pointer or an out of range value was given as the argument. |
|
365 | 365 | * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode. |
|
366 | 366 | * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used. |
|
367 | 367 | * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up. |
|
368 | 368 | * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers. |
|
369 | 369 | * - 5 EIO - Error when writing to grswp hardware registers. |
|
370 | 370 | * - 2 ENOENT - No such file or directory |
|
371 | 371 | */ |
|
372 | 372 | |
|
373 | 373 | rtems_status_code status; |
|
374 | 374 | |
|
375 | 375 | spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force |
|
376 | 376 | spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration |
|
377 | 377 | |
|
378 | 378 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception |
|
379 | 379 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n") |
|
380 | 380 | // |
|
381 | 381 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a |
|
382 | 382 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs |
|
383 | 383 | // |
|
384 | 384 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts |
|
385 | 385 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n") |
|
386 | 386 | // |
|
387 | 387 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit |
|
388 | 388 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n") |
|
389 | 389 | // |
|
390 | 390 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks |
|
391 | 391 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n") |
|
392 | 392 | // |
|
393 | 393 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available |
|
394 | 394 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n") |
|
395 | 395 | // |
|
396 | 396 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ] |
|
397 | 397 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n") |
|
398 | 398 | |
|
399 | 399 | return status; |
|
400 | 400 | } |
|
401 | 401 | |
|
402 | 402 | int spacewire_reset_link( void ) |
|
403 | 403 | { |
|
404 | 404 | /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver. |
|
405 | 405 | * |
|
406 | 406 | * @return RTEMS directive status code: |
|
407 | 407 | * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s. |
|
408 | 408 | * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout. |
|
409 | 409 | * |
|
410 | 410 | */ |
|
411 | 411 | |
|
412 | 412 | rtems_status_code status_spw; |
|
413 | 413 | int i; |
|
414 | 414 | |
|
415 | 415 | for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ ) |
|
416 | 416 | { |
|
417 | 417 | PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i); |
|
418 | 418 | |
|
419 | 419 | // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM |
|
420 | 420 | |
|
421 | 421 | status_spw = spacewire_stop_start_link( fdSPW ); |
|
422 | 422 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
423 | 423 | { |
|
424 | 424 | PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw) |
|
425 | 425 | } |
|
426 | 426 | |
|
427 | 427 | if ( status_spw == RTEMS_SUCCESSFUL) |
|
428 | 428 | { |
|
429 | 429 | break; |
|
430 | 430 | } |
|
431 | 431 | } |
|
432 | 432 | |
|
433 | 433 | return status_spw; |
|
434 | 434 | } |
|
435 | 435 | |
|
436 | 436 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force |
|
437 | 437 | { |
|
438 | 438 | /** This function sets the [N]o [P]ort force bit of the GRSPW control register. |
|
439 | 439 | * |
|
440 | 440 | * @param val is the value, 0 or 1, used to set the value of the NP bit. |
|
441 | 441 | * @param regAddr is the address of the GRSPW control register. |
|
442 | 442 | * |
|
443 | 443 | * NP is the bit 20 of the GRSPW control register. |
|
444 | 444 | * |
|
445 | 445 | */ |
|
446 | 446 | |
|
447 | 447 | unsigned int *spwptr = (unsigned int*) regAddr; |
|
448 | 448 | |
|
449 | 449 | if (val == 1) { |
|
450 | 450 | *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit |
|
451 | 451 | } |
|
452 | 452 | if (val== 0) { |
|
453 | 453 | *spwptr = *spwptr & 0xffdfffff; |
|
454 | 454 | } |
|
455 | 455 | } |
|
456 | 456 | |
|
457 | 457 | void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable |
|
458 | 458 | { |
|
459 | 459 | /** This function sets the [R]MAP [E]nable bit of the GRSPW control register. |
|
460 | 460 | * |
|
461 | 461 | * @param val is the value, 0 or 1, used to set the value of the RE bit. |
|
462 | 462 | * @param regAddr is the address of the GRSPW control register. |
|
463 | 463 | * |
|
464 | 464 | * RE is the bit 16 of the GRSPW control register. |
|
465 | 465 | * |
|
466 | 466 | */ |
|
467 | 467 | |
|
468 | 468 | unsigned int *spwptr = (unsigned int*) regAddr; |
|
469 | 469 | |
|
470 | 470 | if (val == 1) |
|
471 | 471 | { |
|
472 | 472 | *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit |
|
473 | 473 | } |
|
474 | 474 | if (val== 0) |
|
475 | 475 | { |
|
476 | 476 | *spwptr = *spwptr & 0xfffdffff; |
|
477 | 477 | } |
|
478 | 478 | } |
|
479 | 479 | |
|
480 | 480 | void spacewire_compute_stats_offsets( void ) |
|
481 | 481 | { |
|
482 | 482 | /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising. |
|
483 | 483 | * |
|
484 | 484 | * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics |
|
485 | 485 | * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it |
|
486 | 486 | * during the open systel call). |
|
487 | 487 | * |
|
488 | 488 | */ |
|
489 | 489 | |
|
490 | 490 | spw_stats spacewire_stats_grspw; |
|
491 | 491 | rtems_status_code status; |
|
492 | 492 | |
|
493 | 493 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); |
|
494 | 494 | |
|
495 | 495 | spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received |
|
496 | 496 | + spacewire_stats.packets_received; |
|
497 | 497 | spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent |
|
498 | 498 | + spacewire_stats.packets_sent; |
|
499 | 499 | spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err |
|
500 | 500 | + spacewire_stats.parity_err; |
|
501 | 501 | spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err |
|
502 | 502 | + spacewire_stats.disconnect_err; |
|
503 | 503 | spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err |
|
504 | 504 | + spacewire_stats.escape_err; |
|
505 | 505 | spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err |
|
506 | 506 | + spacewire_stats.credit_err; |
|
507 | 507 | spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err |
|
508 | 508 | + spacewire_stats.write_sync_err; |
|
509 | 509 | spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err |
|
510 | 510 | + spacewire_stats.rx_rmap_header_crc_err; |
|
511 | 511 | spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err |
|
512 | 512 | + spacewire_stats.rx_rmap_data_crc_err; |
|
513 | 513 | spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep |
|
514 | 514 | + spacewire_stats.early_ep; |
|
515 | 515 | spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address |
|
516 | 516 | + spacewire_stats.invalid_address; |
|
517 | 517 | spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err |
|
518 | 518 | + spacewire_stats.rx_eep_err; |
|
519 | 519 | spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated |
|
520 | 520 | + spacewire_stats.rx_truncated; |
|
521 | 521 | } |
|
522 | 522 | |
|
523 | 523 | void spacewire_update_statistics( void ) |
|
524 | 524 | { |
|
525 | 525 | rtems_status_code status; |
|
526 | 526 | spw_stats spacewire_stats_grspw; |
|
527 | 527 | |
|
528 | 528 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); |
|
529 | 529 | |
|
530 | 530 | spacewire_stats.packets_received = spacewire_stats_backup.packets_received |
|
531 | 531 | + spacewire_stats_grspw.packets_received; |
|
532 | 532 | spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent |
|
533 | 533 | + spacewire_stats_grspw.packets_sent; |
|
534 | 534 | spacewire_stats.parity_err = spacewire_stats_backup.parity_err |
|
535 | 535 | + spacewire_stats_grspw.parity_err; |
|
536 | 536 | spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err |
|
537 | 537 | + spacewire_stats_grspw.disconnect_err; |
|
538 | 538 | spacewire_stats.escape_err = spacewire_stats_backup.escape_err |
|
539 | 539 | + spacewire_stats_grspw.escape_err; |
|
540 | 540 | spacewire_stats.credit_err = spacewire_stats_backup.credit_err |
|
541 | 541 | + spacewire_stats_grspw.credit_err; |
|
542 | 542 | spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err |
|
543 | 543 | + spacewire_stats_grspw.write_sync_err; |
|
544 | 544 | spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err |
|
545 | 545 | + spacewire_stats_grspw.rx_rmap_header_crc_err; |
|
546 | 546 | spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err |
|
547 | 547 | + spacewire_stats_grspw.rx_rmap_data_crc_err; |
|
548 | 548 | spacewire_stats.early_ep = spacewire_stats_backup.early_ep |
|
549 | 549 | + spacewire_stats_grspw.early_ep; |
|
550 | 550 | spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address |
|
551 | 551 | + spacewire_stats_grspw.invalid_address; |
|
552 | 552 | spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err |
|
553 | 553 | + spacewire_stats_grspw.rx_eep_err; |
|
554 | 554 | spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated |
|
555 | 555 | + spacewire_stats_grspw.rx_truncated; |
|
556 | 556 | //spacewire_stats.tx_link_err; |
|
557 | 557 | |
|
558 | 558 | //**************************** |
|
559 | 559 | // DPU_SPACEWIRE_IF_STATISTICS |
|
560 | 560 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8); |
|
561 | 561 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received); |
|
562 | 562 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8); |
|
563 | 563 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent); |
|
564 | 564 | //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt; |
|
565 | 565 | //housekeeping_packet.hk_lfr_dpu_spw_last_timc; |
|
566 | 566 | |
|
567 | 567 | //****************************************** |
|
568 | 568 | // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY |
|
569 | 569 | housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err; |
|
570 | 570 | housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err; |
|
571 | 571 | housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err; |
|
572 | 572 | housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err; |
|
573 | 573 | housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err; |
|
574 | 574 | |
|
575 | 575 | //********************************************* |
|
576 | 576 | // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY |
|
577 | 577 | housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep; |
|
578 | 578 | housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address; |
|
579 | 579 | housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err; |
|
580 | 580 | housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated; |
|
581 | 581 | } |
|
582 | 582 | |
|
583 | 583 | void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ) |
|
584 | 584 | { |
|
585 | 585 | //if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) { |
|
586 | 586 | // printf("In timecode_irq_handler *** Error sending event to DUMB\n"); |
|
587 | 587 | //} |
|
588 | 588 | } |
|
589 | 589 | |
|
590 | 590 | rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ) |
|
591 | 591 | { |
|
592 | 592 | int linkStatus; |
|
593 | 593 | rtems_status_code status; |
|
594 | 594 | |
|
595 | 595 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
596 | 596 | |
|
597 | 597 | if ( linkStatus == 5) { |
|
598 | 598 | PRINTF("in spacewire_reset_link *** link is running\n") |
|
599 | 599 | status = RTEMS_SUCCESSFUL; |
|
600 | 600 | } |
|
601 | 601 | } |
@@ -1,417 +1,437 | |||
|
1 | 1 | /** Functions related to TeleCommand acceptance. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * A group of functions to handle TeleCommands parsing.\n |
|
7 | 7 | * |
|
8 | 8 | */ |
|
9 | 9 | |
|
10 | 10 | #include "tc_acceptance.h" |
|
11 | 11 | |
|
12 | 12 | unsigned int lookUpTableForCRC[256]; |
|
13 | 13 | |
|
14 | 14 | //********************** |
|
15 | 15 | // GENERAL USE FUNCTIONS |
|
16 | 16 | unsigned int Crc_opt( unsigned char D, unsigned int Chk) |
|
17 | 17 | { |
|
18 | 18 | /** This function generate the CRC for one byte and returns the value of the new syndrome. |
|
19 | 19 | * |
|
20 | 20 | * @param D is the current byte of data. |
|
21 | 21 | * @param Chk is the current syndrom value. |
|
22 | 22 | * |
|
23 | 23 | * @return the value of the new syndrome on two bytes. |
|
24 | 24 | * |
|
25 | 25 | */ |
|
26 | 26 | |
|
27 | 27 | return(((Chk << 8) & 0xff00)^lookUpTableForCRC [(((Chk >> 8)^D) & 0x00ff)]); |
|
28 | 28 | } |
|
29 | 29 | |
|
30 | 30 | void initLookUpTableForCRC( void ) |
|
31 | 31 | { |
|
32 | 32 | /** This function is used to initiates the look-up table for fast CRC computation. |
|
33 | 33 | * |
|
34 | 34 | * The global table lookUpTableForCRC[256] is initiated. |
|
35 | 35 | * |
|
36 | 36 | */ |
|
37 | 37 | |
|
38 | 38 | unsigned int i; |
|
39 | 39 | unsigned int tmp; |
|
40 | 40 | |
|
41 | 41 | for (i=0; i<256; i++) |
|
42 | 42 | { |
|
43 | 43 | tmp = 0; |
|
44 | 44 | if((i & 1) != 0) { |
|
45 | 45 | tmp = tmp ^ 0x1021; |
|
46 | 46 | } |
|
47 | 47 | if((i & 2) != 0) { |
|
48 | 48 | tmp = tmp ^ 0x2042; |
|
49 | 49 | } |
|
50 | 50 | if((i & 4) != 0) { |
|
51 | 51 | tmp = tmp ^ 0x4084; |
|
52 | 52 | } |
|
53 | 53 | if((i & 8) != 0) { |
|
54 | 54 | tmp = tmp ^ 0x8108; |
|
55 | 55 | } |
|
56 | 56 | if((i & 16) != 0) { |
|
57 | 57 | tmp = tmp ^ 0x1231; |
|
58 | 58 | } |
|
59 | 59 | if((i & 32) != 0) { |
|
60 | 60 | tmp = tmp ^ 0x2462; |
|
61 | 61 | } |
|
62 | 62 | if((i & 64) != 0) { |
|
63 | 63 | tmp = tmp ^ 0x48c4; |
|
64 | 64 | } |
|
65 | 65 | if((i & 128) != 0) { |
|
66 | 66 | tmp = tmp ^ 0x9188; |
|
67 | 67 | } |
|
68 | 68 | lookUpTableForCRC[i] = tmp; |
|
69 | 69 | } |
|
70 | 70 | } |
|
71 | 71 | |
|
72 | 72 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData) |
|
73 | 73 | { |
|
74 | 74 | /** This function calculates a two bytes Cyclic Redundancy Code. |
|
75 | 75 | * |
|
76 | 76 | * @param data points to a buffer containing the data on which to compute the CRC. |
|
77 | 77 | * @param crcAsTwoBytes points points to a two bytes buffer in which the CRC is stored. |
|
78 | 78 | * @param sizeOfData is the number of bytes of *data* used to compute the CRC. |
|
79 | 79 | * |
|
80 | 80 | * The specification of the Cyclic Redundancy Code is described in the following document: ECSS-E-70-41-A. |
|
81 | 81 | * |
|
82 | 82 | */ |
|
83 | 83 | |
|
84 | 84 | unsigned int Chk; |
|
85 | 85 | int j; |
|
86 | 86 | Chk = 0xffff; // reset the syndrom to all ones |
|
87 | 87 | for (j=0; j<sizeOfData; j++) { |
|
88 | 88 | Chk = Crc_opt(data[j], Chk); |
|
89 | 89 | } |
|
90 | 90 | crcAsTwoBytes[0] = (unsigned char) (Chk >> 8); |
|
91 | 91 | crcAsTwoBytes[1] = (unsigned char) (Chk & 0x00ff); |
|
92 | 92 | } |
|
93 | 93 | |
|
94 | 94 | //********************* |
|
95 | 95 | // ACCEPTANCE FUNCTIONS |
|
96 | 96 | int tc_parser(ccsdsTelecommandPacket_t * TCPacket, unsigned int TC_LEN_RCV, unsigned char *computed_CRC) |
|
97 | 97 | { |
|
98 | 98 | /** This function parses TeleCommands. |
|
99 | 99 | * |
|
100 | 100 | * @param TC points to the TeleCommand that will be parsed. |
|
101 | 101 | * @param TC_LEN_RCV is the received packet length. |
|
102 | 102 | * |
|
103 | 103 | * @return Status code of the parsing. |
|
104 | 104 | * |
|
105 | 105 | * The parsing checks: |
|
106 | 106 | * - process id |
|
107 | 107 | * - category |
|
108 | 108 | * - length: a global check is performed and a per subtype check also |
|
109 | 109 | * - type |
|
110 | 110 | * - subtype |
|
111 | 111 | * - crc |
|
112 | 112 | * |
|
113 | 113 | */ |
|
114 | 114 | |
|
115 | 115 | int status; |
|
116 | 116 | int status_crc; |
|
117 | 117 | unsigned char pid; |
|
118 | 118 | unsigned char category; |
|
119 | 119 | unsigned int length; |
|
120 | 120 | unsigned char packetType; |
|
121 | 121 | unsigned char packetSubtype; |
|
122 | 122 | unsigned char sid; |
|
123 | 123 | |
|
124 | 124 | status = CCSDS_TM_VALID; |
|
125 | 125 | |
|
126 | 126 | // APID check *** APID on 2 bytes |
|
127 | 127 | pid = ((TCPacket->packetID[0] & 0x07)<<4) + ( (TCPacket->packetID[1]>>4) & 0x0f ); // PID = 11 *** 7 bits xxxxx210 7654xxxx |
|
128 | 128 | category = (TCPacket->packetID[1] & 0x0f); // PACKET_CATEGORY = 12 *** 4 bits xxxxxxxx xxxx3210 |
|
129 | 129 | length = (TCPacket->packetLength[0] * 256) + TCPacket->packetLength[1]; |
|
130 | 130 | packetType = TCPacket->serviceType; |
|
131 | 131 | packetSubtype = TCPacket->serviceSubType; |
|
132 | 132 | sid = TCPacket->sourceID; |
|
133 | 133 | |
|
134 | 134 | if ( pid != CCSDS_PROCESS_ID ) // CHECK THE PROCESS ID |
|
135 | 135 | { |
|
136 | 136 | status = ILLEGAL_APID; |
|
137 | 137 | } |
|
138 | 138 | if (status == CCSDS_TM_VALID) // CHECK THE CATEGORY |
|
139 | 139 | { |
|
140 | 140 | if ( category != CCSDS_PACKET_CATEGORY ) |
|
141 | 141 | { |
|
142 | 142 | status = ILLEGAL_APID; |
|
143 | 143 | } |
|
144 | 144 | } |
|
145 | 145 | if (status == CCSDS_TM_VALID) // CHECK THE PACKET LENGTH FIELD AND THE ACTUAL LENGTH COMPLIANCE |
|
146 | 146 | { |
|
147 | 147 | if (length != TC_LEN_RCV ) { |
|
148 | 148 | status = WRONG_LEN_PKT; |
|
149 | 149 | } |
|
150 | 150 | } |
|
151 | 151 | if (status == CCSDS_TM_VALID) // CHECK THAT THE PACKET DOES NOT EXCEED THE MAX SIZE |
|
152 | 152 | { |
|
153 | 153 | if ( length >= CCSDS_TC_PKT_MAX_SIZE ) { |
|
154 | 154 | status = WRONG_LEN_PKT; |
|
155 | 155 | } |
|
156 | 156 | } |
|
157 | 157 | if (status == CCSDS_TM_VALID) // CHECK THE TYPE |
|
158 | 158 | { |
|
159 | 159 | status = tc_check_type( packetType ); |
|
160 | 160 | } |
|
161 | 161 | if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE |
|
162 | 162 | { |
|
163 | status = tc_check_subtype( packetSubtype ); | |
|
163 | status = tc_check_type_subtype( packetType, packetSubtype ); | |
|
164 | 164 | } |
|
165 | 165 | if (status == CCSDS_TM_VALID) // CHECK THE SID |
|
166 | 166 | { |
|
167 | 167 | status = tc_check_sid( sid ); |
|
168 | 168 | } |
|
169 | 169 | if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE AND LENGTH COMPLIANCE |
|
170 | 170 | { |
|
171 | 171 | status = tc_check_length( packetSubtype, length ); |
|
172 | 172 | } |
|
173 | 173 | status_crc = tc_check_crc( TCPacket, length, computed_CRC ); |
|
174 | 174 | if (status == CCSDS_TM_VALID ) // CHECK CRC |
|
175 | 175 | { |
|
176 | 176 | status = status_crc; |
|
177 | 177 | } |
|
178 | 178 | |
|
179 | 179 | return status; |
|
180 | 180 | } |
|
181 | 181 | |
|
182 | 182 | int tc_check_type( unsigned char packetType ) |
|
183 | 183 | { |
|
184 | 184 | /** This function checks that the type of a TeleCommand is valid. |
|
185 | 185 | * |
|
186 | 186 | * @param packetType is the type to check. |
|
187 | 187 | * |
|
188 | 188 | * @return Status code CCSDS_TM_VALID or ILL_TYPE. |
|
189 | 189 | * |
|
190 | 190 | */ |
|
191 | 191 | |
|
192 | 192 | int status; |
|
193 | 193 | |
|
194 | 194 | if ( (packetType == TC_TYPE_GEN) || (packetType == TC_TYPE_TIME)) |
|
195 | 195 | { |
|
196 | 196 | status = CCSDS_TM_VALID; |
|
197 | 197 | } |
|
198 | 198 | else |
|
199 | 199 | { |
|
200 | 200 | status = ILL_TYPE; |
|
201 | 201 | } |
|
202 | 202 | |
|
203 | 203 | return status; |
|
204 | 204 | } |
|
205 | 205 | |
|
206 | int tc_check_subtype( unsigned char packetSubType ) | |
|
206 | int tc_check_type_subtype( unsigned char packetType, unsigned char packetSubType ) | |
|
207 | 207 | { |
|
208 | /** This function checks that the subtype of a TeleCommand is valid. | |
|
208 | /** This function checks that the subtype of a TeleCommand is valid and coherent with the type. | |
|
209 | 209 | * |
|
210 | * @param packetType is the type of the TC. | |
|
210 | 211 | * @param packetSubType is the subtype to check. |
|
211 | 212 | * |
|
212 | 213 | * @return Status code CCSDS_TM_VALID or ILL_SUBTYPE. |
|
213 | 214 | * |
|
214 | 215 | */ |
|
215 | 216 | |
|
216 | 217 | int status; |
|
217 | 218 | |
|
218 | if ( (packetSubType == TC_SUBTYPE_RESET) | |
|
219 | || (packetSubType == TC_SUBTYPE_LOAD_COMM) | |
|
220 | || (packetSubType == TC_SUBTYPE_LOAD_NORM) || (packetSubType == TC_SUBTYPE_LOAD_BURST) | |
|
221 | || (packetSubType == TC_SUBTYPE_LOAD_SBM1) || (packetSubType == TC_SUBTYPE_LOAD_SBM2) | |
|
222 | || (packetSubType == TC_SUBTYPE_DUMP) | |
|
223 | || (packetSubType == TC_SUBTYPE_ENTER) | |
|
224 | || (packetSubType == TC_SUBTYPE_UPDT_INFO) || (packetSubType == TC_SUBTYPE_UPDT_TIME) | |
|
225 | || (packetSubType == TC_SUBTYPE_EN_CAL) || (packetSubType == TC_SUBTYPE_DIS_CAL) ) | |
|
219 | switch(packetType) | |
|
226 | 220 | { |
|
227 | status = CCSDS_TM_VALID; | |
|
228 | } | |
|
229 | else | |
|
230 | { | |
|
221 | case TC_TYPE_GEN: | |
|
222 | if ( (packetSubType == TC_SUBTYPE_RESET) | |
|
223 | || (packetSubType == TC_SUBTYPE_LOAD_COMM) | |
|
224 | || (packetSubType == TC_SUBTYPE_LOAD_NORM) || (packetSubType == TC_SUBTYPE_LOAD_BURST) | |
|
225 | || (packetSubType == TC_SUBTYPE_LOAD_SBM1) || (packetSubType == TC_SUBTYPE_LOAD_SBM2) | |
|
226 | || (packetSubType == TC_SUBTYPE_DUMP) | |
|
227 | || (packetSubType == TC_SUBTYPE_ENTER) | |
|
228 | || (packetSubType == TC_SUBTYPE_UPDT_INFO) | |
|
229 | || (packetSubType == TC_SUBTYPE_EN_CAL) || (packetSubType == TC_SUBTYPE_DIS_CAL) ) | |
|
230 | { | |
|
231 | status = CCSDS_TM_VALID; | |
|
232 | } | |
|
233 | else | |
|
234 | { | |
|
235 | status = ILL_SUBTYPE; | |
|
236 | } | |
|
237 | break; | |
|
238 | ||
|
239 | case TC_TYPE_TIME: | |
|
240 | if (packetSubType == TC_SUBTYPE_UPDT_TIME) | |
|
241 | { | |
|
242 | status = CCSDS_TM_VALID; | |
|
243 | } | |
|
244 | else | |
|
245 | { | |
|
246 | status = ILL_SUBTYPE; | |
|
247 | } | |
|
248 | break; | |
|
249 | ||
|
250 | default: | |
|
231 | 251 | status = ILL_SUBTYPE; |
|
252 | break; | |
|
232 | 253 | } |
|
233 | 254 | |
|
234 | 255 | return status; |
|
235 | 256 | } |
|
236 | 257 | |
|
237 | 258 | int tc_check_sid( unsigned char sid ) |
|
238 | 259 | { |
|
239 | 260 | /** This function checks that the sid of a TeleCommand is valid. |
|
240 | 261 | * |
|
241 | 262 | * @param sid is the sid to check. |
|
242 | 263 | * |
|
243 | 264 | * @return Status code CCSDS_TM_VALID or CORRUPTED. |
|
244 | 265 | * |
|
245 | 266 | */ |
|
246 | 267 | |
|
247 | 268 | int status; |
|
248 | 269 | |
|
249 | if ( (sid == SID_TC_GROUND) | |
|
250 | || (sid == SID_TC_MISSION_TIMELINE) || (sid == SID_TC_TC_SEQUENCES) || (sid == SID_TC_RECOVERY_ACTION_CMD) | |
|
270 | if ( (sid == SID_TC_MISSION_TIMELINE) || (sid == SID_TC_TC_SEQUENCES) || (sid == SID_TC_RECOVERY_ACTION_CMD) | |
|
251 | 271 | || (sid == SID_TC_BACKUP_MISSION_TIMELINE) |
|
252 | 272 | || (sid == SID_TC_DIRECT_CMD) || (sid == SID_TC_SPARE_GRD_SRC1) || (sid == SID_TC_SPARE_GRD_SRC2) |
|
253 | 273 | || (sid == SID_TC_OBCP) || (sid == SID_TC_SYSTEM_CONTROL) || (sid == SID_TC_AOCS) |
|
254 | 274 | || (sid == SID_TC_RPW_INTERNAL)) |
|
255 | 275 | { |
|
256 | 276 | status = CCSDS_TM_VALID; |
|
257 | 277 | } |
|
258 | 278 | else |
|
259 | 279 | { |
|
260 | 280 | status = WRONG_SRC_ID; |
|
261 | 281 | } |
|
262 | 282 | |
|
263 | 283 | return status; |
|
264 | 284 | } |
|
265 | 285 | |
|
266 | 286 | int tc_check_length( unsigned char packetSubType, unsigned int length ) |
|
267 | 287 | { |
|
268 | 288 | /** This function checks that the subtype and the length are compliant. |
|
269 | 289 | * |
|
270 | 290 | * @param packetSubType is the subtype to check. |
|
271 | 291 | * @param length is the length to check. |
|
272 | 292 | * |
|
273 | 293 | * @return Status code CCSDS_TM_VALID or ILL_TYPE. |
|
274 | 294 | * |
|
275 | 295 | */ |
|
276 | 296 | |
|
277 | 297 | int status; |
|
278 | 298 | |
|
279 | 299 | status = LFR_SUCCESSFUL; |
|
280 | 300 | |
|
281 | 301 | switch(packetSubType) |
|
282 | 302 | { |
|
283 | 303 | case TC_SUBTYPE_RESET: |
|
284 | 304 | if (length!=(TC_LEN_RESET-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
285 | 305 | status = WRONG_LEN_PKT; |
|
286 | 306 | } |
|
287 | 307 | else { |
|
288 | 308 | status = CCSDS_TM_VALID; |
|
289 | 309 | } |
|
290 | 310 | break; |
|
291 | 311 | case TC_SUBTYPE_LOAD_COMM: |
|
292 | 312 | if (length!=(TC_LEN_LOAD_COMM-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
293 | 313 | status = WRONG_LEN_PKT; |
|
294 | 314 | } |
|
295 | 315 | else { |
|
296 | 316 | status = CCSDS_TM_VALID; |
|
297 | 317 | } |
|
298 | 318 | break; |
|
299 | 319 | case TC_SUBTYPE_LOAD_NORM: |
|
300 | 320 | if (length!=(TC_LEN_LOAD_NORM-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
301 | 321 | status = WRONG_LEN_PKT; |
|
302 | 322 | } |
|
303 | 323 | else { |
|
304 | 324 | status = CCSDS_TM_VALID; |
|
305 | 325 | } |
|
306 | 326 | break; |
|
307 | 327 | case TC_SUBTYPE_LOAD_BURST: |
|
308 | 328 | if (length!=(TC_LEN_LOAD_BURST-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
309 | 329 | status = WRONG_LEN_PKT; |
|
310 | 330 | } |
|
311 | 331 | else { |
|
312 | 332 | status = CCSDS_TM_VALID; |
|
313 | 333 | } |
|
314 | 334 | break; |
|
315 | 335 | case TC_SUBTYPE_LOAD_SBM1: |
|
316 | 336 | if (length!=(TC_LEN_LOAD_SBM1-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
317 | 337 | status = WRONG_LEN_PKT; |
|
318 | 338 | } |
|
319 | 339 | else { |
|
320 | 340 | status = CCSDS_TM_VALID; |
|
321 | 341 | } |
|
322 | 342 | break; |
|
323 | 343 | case TC_SUBTYPE_LOAD_SBM2: |
|
324 | 344 | if (length!=(TC_LEN_LOAD_SBM2-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
325 | 345 | status = WRONG_LEN_PKT; |
|
326 | 346 | } |
|
327 | 347 | else { |
|
328 | 348 | status = CCSDS_TM_VALID; |
|
329 | 349 | } |
|
330 | 350 | break; |
|
331 | 351 | case TC_SUBTYPE_DUMP: |
|
332 | 352 | if (length!=(TC_LEN_DUMP-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
333 | 353 | status = WRONG_LEN_PKT; |
|
334 | 354 | } |
|
335 | 355 | else { |
|
336 | 356 | status = CCSDS_TM_VALID; |
|
337 | 357 | } |
|
338 | 358 | break; |
|
339 | 359 | case TC_SUBTYPE_ENTER: |
|
340 | 360 | if (length!=(TC_LEN_ENTER-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
341 | 361 | status = WRONG_LEN_PKT; |
|
342 | 362 | } |
|
343 | 363 | else { |
|
344 | 364 | status = CCSDS_TM_VALID; |
|
345 | 365 | } |
|
346 | 366 | break; |
|
347 | 367 | case TC_SUBTYPE_UPDT_INFO: |
|
348 | 368 | if (length!=(TC_LEN_UPDT_INFO-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
349 | 369 | status = WRONG_LEN_PKT; |
|
350 | 370 | } |
|
351 | 371 | else { |
|
352 | 372 | status = CCSDS_TM_VALID; |
|
353 | 373 | } |
|
354 | 374 | break; |
|
355 | 375 | case TC_SUBTYPE_EN_CAL: |
|
356 | 376 | if (length!=(TC_LEN_EN_CAL-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
357 | 377 | status = WRONG_LEN_PKT; |
|
358 | 378 | } |
|
359 | 379 | else { |
|
360 | 380 | status = CCSDS_TM_VALID; |
|
361 | 381 | } |
|
362 | 382 | break; |
|
363 | 383 | case TC_SUBTYPE_DIS_CAL: |
|
364 | 384 | if (length!=(TC_LEN_DIS_CAL-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
365 | 385 | status = WRONG_LEN_PKT; |
|
366 | 386 | } |
|
367 | 387 | else { |
|
368 | 388 | status = CCSDS_TM_VALID; |
|
369 | 389 | } |
|
370 | 390 | break; |
|
371 | 391 | case TC_SUBTYPE_UPDT_TIME: |
|
372 | 392 | if (length!=(TC_LEN_UPDT_TIME-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
373 | 393 | status = WRONG_LEN_PKT; |
|
374 | 394 | } |
|
375 | 395 | else { |
|
376 | 396 | status = CCSDS_TM_VALID; |
|
377 | 397 | } |
|
378 | 398 | break; |
|
379 | 399 | default: // if the subtype is not a legal value, return ILL_SUBTYPE |
|
380 | 400 | status = ILL_SUBTYPE; |
|
381 | 401 | break ; |
|
382 | 402 | } |
|
383 | 403 | |
|
384 | 404 | return status; |
|
385 | 405 | } |
|
386 | 406 | |
|
387 | 407 | int tc_check_crc( ccsdsTelecommandPacket_t * TCPacket, unsigned int length, unsigned char *computed_CRC ) |
|
388 | 408 | { |
|
389 | 409 | /** This function checks the CRC validity of the corresponding TeleCommand packet. |
|
390 | 410 | * |
|
391 | 411 | * @param TCPacket points to the TeleCommand packet to check. |
|
392 | 412 | * @param length is the length of the TC packet. |
|
393 | 413 | * |
|
394 | 414 | * @return Status code CCSDS_TM_VALID or INCOR_CHECKSUM. |
|
395 | 415 | * |
|
396 | 416 | */ |
|
397 | 417 | |
|
398 | 418 | int status; |
|
399 | 419 | unsigned char * CCSDSContent; |
|
400 | 420 | |
|
401 | 421 | CCSDSContent = (unsigned char*) TCPacket->packetID; |
|
402 | 422 | GetCRCAsTwoBytes(CCSDSContent, computed_CRC, length + CCSDS_TC_TM_PACKET_OFFSET - 2); // 2 CRC bytes removed from the calculation of the CRC |
|
403 | 423 | if (computed_CRC[0] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -2]) { |
|
404 | 424 | status = INCOR_CHECKSUM; |
|
405 | 425 | } |
|
406 | 426 | else if (computed_CRC[1] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -1]) { |
|
407 | 427 | status = INCOR_CHECKSUM; |
|
408 | 428 | } |
|
409 | 429 | else { |
|
410 | 430 | status = CCSDS_TM_VALID; |
|
411 | 431 | } |
|
412 | 432 | |
|
413 | 433 | return status; |
|
414 | 434 | } |
|
415 | 435 | |
|
416 | 436 | |
|
417 | 437 |
@@ -1,757 +1,765 | |||
|
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 |
close_action( &TC, result, queue_snd_id |
|
|
71 | close_action( &TC, result, queue_snd_id ); | |
|
72 | 72 | break; |
|
73 | 73 | // |
|
74 | 74 | case TC_SUBTYPE_LOAD_COMM: |
|
75 | 75 | result = action_load_common_par( &TC ); |
|
76 |
close_action( &TC, result, queue_snd_id |
|
|
76 | close_action( &TC, result, queue_snd_id ); | |
|
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 |
close_action( &TC, result, queue_snd_id |
|
|
81 | close_action( &TC, result, queue_snd_id ); | |
|
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 |
close_action( &TC, result, queue_snd_id |
|
|
86 | close_action( &TC, result, queue_snd_id ); | |
|
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 |
close_action( &TC, result, queue_snd_id |
|
|
91 | close_action( &TC, result, queue_snd_id ); | |
|
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 |
close_action( &TC, result, queue_snd_id |
|
|
96 | close_action( &TC, result, queue_snd_id ); | |
|
97 | 97 | break; |
|
98 | 98 | // |
|
99 | 99 | case TC_SUBTYPE_DUMP: |
|
100 | 100 | result = action_dump_par( queue_snd_id ); |
|
101 |
close_action( &TC, result, queue_snd_id |
|
|
101 | close_action( &TC, result, queue_snd_id ); | |
|
102 | 102 | break; |
|
103 | 103 | // |
|
104 | 104 | case TC_SUBTYPE_ENTER: |
|
105 | 105 | result = action_enter_mode( &TC, queue_snd_id, time ); |
|
106 |
close_action( &TC, result, queue_snd_id |
|
|
106 | close_action( &TC, result, queue_snd_id ); | |
|
107 | 107 | break; |
|
108 | 108 | // |
|
109 | 109 | case TC_SUBTYPE_UPDT_INFO: |
|
110 | 110 | result = action_update_info( &TC, queue_snd_id ); |
|
111 |
close_action( &TC, result, queue_snd_id |
|
|
111 | close_action( &TC, result, queue_snd_id ); | |
|
112 | 112 | break; |
|
113 | 113 | // |
|
114 | 114 | case TC_SUBTYPE_EN_CAL: |
|
115 | 115 | result = action_enable_calibration( &TC, queue_snd_id, time ); |
|
116 |
close_action( &TC, result, queue_snd_id |
|
|
116 | close_action( &TC, result, queue_snd_id ); | |
|
117 | 117 | break; |
|
118 | 118 | // |
|
119 | 119 | case TC_SUBTYPE_DIS_CAL: |
|
120 | 120 | result = action_disable_calibration( &TC, queue_snd_id, time ); |
|
121 |
close_action( &TC, result, queue_snd_id |
|
|
121 | close_action( &TC, result, queue_snd_id ); | |
|
122 | 122 | break; |
|
123 | 123 | // |
|
124 | 124 | case TC_SUBTYPE_UPDT_TIME: |
|
125 | 125 | result = action_update_time( &TC ); |
|
126 |
close_action( &TC, result, queue_snd_id |
|
|
126 | close_action( &TC, result, queue_snd_id ); | |
|
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 |
send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode |
|
|
171 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode ); | |
|
172 | 172 | } |
|
173 | 173 | else |
|
174 | 174 | { |
|
175 | 175 | printf("in action_enter_mode *** enter mode %d\n", requestedMode); |
|
176 | 176 | |
|
177 | 177 | status = transition_validation(requestedMode); |
|
178 | 178 | |
|
179 | 179 | if ( status == LFR_SUCCESSFUL ) { |
|
180 | 180 | if ( lfrCurrentMode != LFR_MODE_STANDBY) |
|
181 | 181 | { |
|
182 | 182 | status = stop_current_mode(); |
|
183 | 183 | } |
|
184 | 184 | if (status != RTEMS_SUCCESSFUL) |
|
185 | 185 | { |
|
186 | 186 | PRINTF("ERR *** in action_enter *** stop_current_mode\n") |
|
187 | 187 | } |
|
188 | 188 | status = enter_mode( requestedMode ); |
|
189 | 189 | } |
|
190 | 190 | else |
|
191 | 191 | { |
|
192 | 192 | PRINTF("ERR *** in action_enter *** transition rejected\n") |
|
193 |
send_tm_lfr_tc_exe_not_executable( TC, queue_id |
|
|
193 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
|
194 | 194 | } |
|
195 | 195 | } |
|
196 | 196 | |
|
197 | 197 | return status; |
|
198 | 198 | } |
|
199 | 199 | |
|
200 | 200 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
201 | 201 | { |
|
202 | 202 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. |
|
203 | 203 | * |
|
204 | 204 | * @param TC points to the TeleCommand packet that is being processed |
|
205 | 205 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
206 | 206 | * |
|
207 | 207 | * @return LFR directive status code: |
|
208 | 208 | * - LFR_DEFAULT |
|
209 | 209 | * - LFR_SUCCESSFUL |
|
210 | 210 | * |
|
211 | 211 | */ |
|
212 | 212 | |
|
213 | 213 | unsigned int val; |
|
214 | 214 | int result; |
|
215 | ||
|
216 | result = LFR_SUCCESSFUL; | |
|
215 | unsigned int status; | |
|
216 | unsigned char mode; | |
|
217 | 217 | |
|
218 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 | |
|
219 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; | |
|
220 | val++; | |
|
221 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); | |
|
222 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); | |
|
218 | // check LFR MODE | |
|
219 | mode = (TC->dataAndCRC[ BYTE_POS_HK_UPDATE_INFO_PAR_SET5 ] & 0x1e) >> 1; | |
|
220 | status = check_update_info_hk_lfr_mode( mode ); | |
|
221 | if (status != LFR_DEFAULT) // check TDS mode | |
|
222 | { | |
|
223 | mode = (TC->dataAndCRC[ BYTE_POS_HK_UPDATE_INFO_PAR_SET6 ] & 0xf0) >> 4; | |
|
224 | status = check_update_info_hk_tds_mode( mode ); | |
|
225 | } | |
|
226 | if (status != LFR_DEFAULT) // check THR mode | |
|
227 | { | |
|
228 | mode = (TC->dataAndCRC[ BYTE_POS_HK_UPDATE_INFO_PAR_SET6 ] & 0x0f); | |
|
229 | status = check_update_info_hk_thr_mode( mode ); | |
|
230 | } | |
|
231 | if (status != LFR_DEFAULT) // if the parameter check is successful | |
|
232 | { | |
|
233 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 | |
|
234 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; | |
|
235 | val++; | |
|
236 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); | |
|
237 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); | |
|
238 | } | |
|
239 | ||
|
240 | result = status; | |
|
223 | 241 | |
|
224 | 242 | return result; |
|
225 | 243 | } |
|
226 | 244 | |
|
227 | 245 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
228 | 246 | { |
|
229 | 247 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. |
|
230 | 248 | * |
|
231 | 249 | * @param TC points to the TeleCommand packet that is being processed |
|
232 | 250 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
233 | 251 | * |
|
234 | 252 | */ |
|
235 | 253 | |
|
236 | 254 | int result; |
|
237 | 255 | unsigned char lfrMode; |
|
238 | 256 | |
|
239 | 257 | result = LFR_DEFAULT; |
|
240 | 258 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
241 | 259 | |
|
242 | if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) { | |
|
243 | send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); | |
|
244 | result = LFR_DEFAULT; | |
|
245 | } | |
|
246 | else { | |
|
247 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
|
248 | result = LFR_DEFAULT; | |
|
249 | } | |
|
260 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
|
261 | result = LFR_DEFAULT; | |
|
262 | ||
|
250 | 263 | return result; |
|
251 | 264 | } |
|
252 | 265 | |
|
253 | 266 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
254 | 267 | { |
|
255 | 268 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. |
|
256 | 269 | * |
|
257 | 270 | * @param TC points to the TeleCommand packet that is being processed |
|
258 | 271 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
259 | 272 | * |
|
260 | 273 | */ |
|
261 | 274 | |
|
262 | 275 | int result; |
|
263 | 276 | unsigned char lfrMode; |
|
264 | 277 | |
|
265 | 278 | result = LFR_DEFAULT; |
|
266 | 279 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
267 | 280 | |
|
268 | if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) { | |
|
269 | send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); | |
|
270 | result = LFR_DEFAULT; | |
|
271 | } | |
|
272 | else { | |
|
273 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
|
274 | result = LFR_DEFAULT; | |
|
275 | } | |
|
281 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
|
282 | result = LFR_DEFAULT; | |
|
283 | ||
|
276 | 284 | return result; |
|
277 | 285 | } |
|
278 | 286 | |
|
279 | 287 | int action_update_time(ccsdsTelecommandPacket_t *TC) |
|
280 | 288 | { |
|
281 | 289 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. |
|
282 | 290 | * |
|
283 | 291 | * @param TC points to the TeleCommand packet that is being processed |
|
284 | 292 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
285 | 293 | * |
|
286 | 294 | * @return LFR_SUCCESSFUL |
|
287 | 295 | * |
|
288 | 296 | */ |
|
289 | 297 | |
|
290 | 298 | unsigned int val; |
|
291 | 299 | |
|
292 | 300 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) |
|
293 | 301 | + (TC->dataAndCRC[1] << 16) |
|
294 | 302 | + (TC->dataAndCRC[2] << 8) |
|
295 | 303 | + TC->dataAndCRC[3]; |
|
296 | 304 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 |
|
297 | 305 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; |
|
298 | 306 | val++; |
|
299 | 307 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); |
|
300 | 308 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); |
|
301 | 309 | time_management_regs->ctrl = time_management_regs->ctrl | 1; |
|
302 | 310 | |
|
303 | 311 | return LFR_SUCCESSFUL; |
|
304 | 312 | } |
|
305 | 313 | |
|
306 | 314 | //******************* |
|
307 | 315 | // ENTERING THE MODES |
|
308 | 316 | |
|
309 | 317 | int transition_validation(unsigned char requestedMode) |
|
310 | 318 | { |
|
311 | 319 | /** This function checks the validity of the transition requested by the TC_LFR_ENTER_MODE. |
|
312 | 320 | * |
|
313 | 321 | * @param requestedMode is the mode requested by the TC_LFR_ENTER_MODE |
|
314 | 322 | * |
|
315 | 323 | * @return LFR directive status codes: |
|
316 | 324 | * - LFR_SUCCESSFUL - the transition is authorized |
|
317 | 325 | * - LFR_DEFAULT - the transition is not authorized |
|
318 | 326 | * |
|
319 | 327 | */ |
|
320 | 328 | |
|
321 | 329 | int status; |
|
322 | 330 | |
|
323 | 331 | switch (requestedMode) |
|
324 | 332 | { |
|
325 | 333 | case LFR_MODE_STANDBY: |
|
326 | 334 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { |
|
327 | 335 | status = LFR_DEFAULT; |
|
328 | 336 | } |
|
329 | 337 | else |
|
330 | 338 | { |
|
331 | 339 | status = LFR_SUCCESSFUL; |
|
332 | 340 | } |
|
333 | 341 | break; |
|
334 | 342 | case LFR_MODE_NORMAL: |
|
335 | 343 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { |
|
336 | 344 | status = LFR_DEFAULT; |
|
337 | 345 | } |
|
338 | 346 | else { |
|
339 | 347 | status = LFR_SUCCESSFUL; |
|
340 | 348 | } |
|
341 | 349 | break; |
|
342 | 350 | case LFR_MODE_BURST: |
|
343 | 351 | if ( lfrCurrentMode == LFR_MODE_BURST ) { |
|
344 | 352 | status = LFR_DEFAULT; |
|
345 | 353 | } |
|
346 | 354 | else { |
|
347 | 355 | status = LFR_SUCCESSFUL; |
|
348 | 356 | } |
|
349 | 357 | break; |
|
350 | 358 | case LFR_MODE_SBM1: |
|
351 | 359 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { |
|
352 | 360 | status = LFR_DEFAULT; |
|
353 | 361 | } |
|
354 | 362 | else { |
|
355 | 363 | status = LFR_SUCCESSFUL; |
|
356 | 364 | } |
|
357 | 365 | break; |
|
358 | 366 | case LFR_MODE_SBM2: |
|
359 | 367 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { |
|
360 | 368 | status = LFR_DEFAULT; |
|
361 | 369 | } |
|
362 | 370 | else { |
|
363 | 371 | status = LFR_SUCCESSFUL; |
|
364 | 372 | } |
|
365 | 373 | break; |
|
366 | 374 | default: |
|
367 | 375 | status = LFR_DEFAULT; |
|
368 | 376 | break; |
|
369 | 377 | } |
|
370 | 378 | |
|
371 | 379 | return status; |
|
372 | 380 | } |
|
373 | 381 | |
|
374 | 382 | int stop_current_mode(void) |
|
375 | 383 | { |
|
376 | 384 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. |
|
377 | 385 | * |
|
378 | 386 | * @return RTEMS directive status codes: |
|
379 | 387 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
380 | 388 | * - RTEMS_INVALID_ID - task id invalid |
|
381 | 389 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
382 | 390 | * |
|
383 | 391 | */ |
|
384 | 392 | |
|
385 | 393 | rtems_status_code status; |
|
386 | 394 | |
|
387 | 395 | status = RTEMS_SUCCESSFUL; |
|
388 | 396 | |
|
389 | 397 | // (1) mask interruptions |
|
390 | 398 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt |
|
391 | 399 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
392 | 400 | |
|
393 | 401 | // (2) clear interruptions |
|
394 | 402 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt |
|
395 | 403 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
396 | 404 | |
|
397 | 405 | // (3) reset registers |
|
398 | 406 | reset_wfp_burst_enable(); // reset burst and enable bits |
|
399 | 407 | reset_wfp_status(); // reset all the status bits |
|
400 | 408 | disable_irq_on_new_ready_matrix(); // stop the spectral matrices |
|
401 | 409 | |
|
402 | 410 | // <Spectral Matrices simulator> |
|
403 | 411 | LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator |
|
404 | 412 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
405 | 413 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); // clear spectral matrix interrupt simulator |
|
406 | 414 | // </Spectral Matrices simulator> |
|
407 | 415 | |
|
408 | 416 | // suspend several tasks |
|
409 | 417 | if (lfrCurrentMode != LFR_MODE_STANDBY) { |
|
410 | 418 | status = suspend_science_tasks(); |
|
411 | 419 | } |
|
412 | 420 | |
|
413 | 421 | if (status != RTEMS_SUCCESSFUL) |
|
414 | 422 | { |
|
415 | 423 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
416 | 424 | } |
|
417 | 425 | |
|
418 | 426 | return status; |
|
419 | 427 | } |
|
420 | 428 | |
|
421 | 429 | int enter_mode(unsigned char mode ) |
|
422 | 430 | { |
|
423 | 431 | /** This function is launched after a mode transition validation. |
|
424 | 432 | * |
|
425 | 433 | * @param mode is the mode in which LFR will be put. |
|
426 | 434 | * |
|
427 | 435 | * @return RTEMS directive status codes: |
|
428 | 436 | * - RTEMS_SUCCESSFUL - the mode has been entered successfully |
|
429 | 437 | * - RTEMS_NOT_SATISFIED - the mode has not been entered successfully |
|
430 | 438 | * |
|
431 | 439 | */ |
|
432 | 440 | |
|
433 | 441 | rtems_status_code status; |
|
434 | 442 | |
|
435 | 443 | status = RTEMS_UNSATISFIED; |
|
436 | 444 | |
|
437 | 445 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d); |
|
438 | 446 | updateLFRCurrentMode(); |
|
439 | 447 | |
|
440 | 448 | if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST) |
|
441 | 449 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) ) |
|
442 | 450 | { |
|
443 | 451 | #ifdef PRINT_TASK_STATISTICS |
|
444 | 452 | rtems_cpu_usage_reset(); |
|
445 | 453 | maxCount = 0; |
|
446 | 454 | #endif |
|
447 | 455 | status = restart_science_tasks(); |
|
448 | 456 | launch_waveform_picker( mode ); |
|
449 | 457 | launch_spectral_matrix( mode ); |
|
450 | 458 | } |
|
451 | 459 | else if ( mode == LFR_MODE_STANDBY ) |
|
452 | 460 | { |
|
453 | 461 | #ifdef PRINT_TASK_STATISTICS |
|
454 | 462 | rtems_cpu_usage_report(); |
|
455 | 463 | #endif |
|
456 | 464 | |
|
457 | 465 | #ifdef PRINT_STACK_REPORT |
|
458 | 466 | rtems_stack_checker_report_usage(); |
|
459 | 467 | #endif |
|
460 | 468 | status = stop_current_mode(); |
|
461 | 469 | PRINTF1("maxCount = %d\n", maxCount) |
|
462 | 470 | } |
|
463 | 471 | else |
|
464 | 472 | { |
|
465 | 473 | status = RTEMS_UNSATISFIED; |
|
466 | 474 | } |
|
467 | 475 | |
|
468 | 476 | if (status != RTEMS_SUCCESSFUL) |
|
469 | 477 | { |
|
470 | 478 | PRINTF1("in enter_mode *** ERR = %d\n", status) |
|
471 | 479 | status = RTEMS_UNSATISFIED; |
|
472 | 480 | } |
|
473 | 481 | |
|
474 | 482 | return status; |
|
475 | 483 | } |
|
476 | 484 | |
|
477 | 485 | int restart_science_tasks() |
|
478 | 486 | { |
|
479 | 487 | /** This function is used to restart all science tasks. |
|
480 | 488 | * |
|
481 | 489 | * @return RTEMS directive status codes: |
|
482 | 490 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
483 | 491 | * - RTEMS_INVALID_ID - task id invalid |
|
484 | 492 | * - RTEMS_INCORRECT_STATE - task never started |
|
485 | 493 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task |
|
486 | 494 | * |
|
487 | 495 | * Science tasks are AVF0, BPF0, WFRM, CWF3, CW2, CWF1 |
|
488 | 496 | * |
|
489 | 497 | */ |
|
490 | 498 | |
|
491 | 499 | rtems_status_code status[6]; |
|
492 | 500 | rtems_status_code ret; |
|
493 | 501 | |
|
494 | 502 | ret = RTEMS_SUCCESSFUL; |
|
495 | 503 | |
|
496 | 504 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 ); |
|
497 | 505 | if (status[0] != RTEMS_SUCCESSFUL) |
|
498 | 506 | { |
|
499 | 507 | PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0]) |
|
500 | 508 | } |
|
501 | 509 | |
|
502 | 510 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); |
|
503 | 511 | if (status[2] != RTEMS_SUCCESSFUL) |
|
504 | 512 | { |
|
505 | 513 | PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2]) |
|
506 | 514 | } |
|
507 | 515 | |
|
508 | 516 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); |
|
509 | 517 | if (status[3] != RTEMS_SUCCESSFUL) |
|
510 | 518 | { |
|
511 | 519 | PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3]) |
|
512 | 520 | } |
|
513 | 521 | |
|
514 | 522 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); |
|
515 | 523 | if (status[4] != RTEMS_SUCCESSFUL) |
|
516 | 524 | { |
|
517 | 525 | PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4]) |
|
518 | 526 | } |
|
519 | 527 | |
|
520 | 528 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); |
|
521 | 529 | if (status[5] != RTEMS_SUCCESSFUL) |
|
522 | 530 | { |
|
523 | 531 | PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5]) |
|
524 | 532 | } |
|
525 | 533 | |
|
526 | 534 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || |
|
527 | 535 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) |
|
528 | 536 | { |
|
529 | 537 | ret = RTEMS_UNSATISFIED; |
|
530 | 538 | } |
|
531 | 539 | |
|
532 | 540 | return ret; |
|
533 | 541 | } |
|
534 | 542 | |
|
535 | 543 | int suspend_science_tasks() |
|
536 | 544 | { |
|
537 | 545 | /** This function suspends the science tasks. |
|
538 | 546 | * |
|
539 | 547 | * @return RTEMS directive status codes: |
|
540 | 548 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
541 | 549 | * - RTEMS_INVALID_ID - task id invalid |
|
542 | 550 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
543 | 551 | * |
|
544 | 552 | */ |
|
545 | 553 | |
|
546 | 554 | rtems_status_code status; |
|
547 | 555 | |
|
548 | 556 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); |
|
549 | 557 | if (status != RTEMS_SUCCESSFUL) |
|
550 | 558 | { |
|
551 | 559 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) |
|
552 | 560 | } |
|
553 | 561 | |
|
554 | 562 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM |
|
555 | 563 | { |
|
556 | 564 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
557 | 565 | if (status != RTEMS_SUCCESSFUL) |
|
558 | 566 | { |
|
559 | 567 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) |
|
560 | 568 | } |
|
561 | 569 | } |
|
562 | 570 | |
|
563 | 571 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 |
|
564 | 572 | { |
|
565 | 573 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); |
|
566 | 574 | if (status != RTEMS_SUCCESSFUL) |
|
567 | 575 | { |
|
568 | 576 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) |
|
569 | 577 | } |
|
570 | 578 | } |
|
571 | 579 | |
|
572 | 580 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 |
|
573 | 581 | { |
|
574 | 582 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); |
|
575 | 583 | if (status != RTEMS_SUCCESSFUL) |
|
576 | 584 | { |
|
577 | 585 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) |
|
578 | 586 | } |
|
579 | 587 | } |
|
580 | 588 | |
|
581 | 589 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 |
|
582 | 590 | { |
|
583 | 591 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
|
584 | 592 | if (status != RTEMS_SUCCESSFUL) |
|
585 | 593 | { |
|
586 | 594 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) |
|
587 | 595 | } |
|
588 | 596 | } |
|
589 | 597 | |
|
590 | 598 | return status; |
|
591 | 599 | } |
|
592 | 600 | |
|
593 | 601 | void launch_waveform_picker( unsigned char mode ) |
|
594 | 602 | { |
|
595 | 603 | int startDate; |
|
596 | 604 | |
|
597 | 605 | reset_current_ring_nodes(); |
|
598 | 606 | reset_waveform_picker_regs(); |
|
599 | 607 | set_wfp_burst_enable_register( mode ); |
|
600 | 608 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
601 | 609 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
602 | 610 | startDate = time_management_regs->coarse_time + 2; |
|
603 | 611 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] |
|
604 | 612 | waveform_picker_regs->start_date = startDate; |
|
605 | 613 | } |
|
606 | 614 | |
|
607 | 615 | void launch_spectral_matrix( unsigned char mode ) |
|
608 | 616 | { |
|
609 | 617 | reset_nb_sm_f0(); |
|
610 | 618 | reset_current_sm_ring_nodes(); |
|
611 | 619 | reset_spectral_matrix_regs(); |
|
612 | 620 | |
|
613 | 621 | enable_irq_on_new_ready_matrix(); |
|
614 | 622 | |
|
615 | 623 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
616 | 624 | LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX ); |
|
617 | 625 | } |
|
618 | 626 | |
|
619 | 627 | void enable_irq_on_new_ready_matrix( void ) |
|
620 | 628 | { |
|
621 | 629 | spectral_matrix_regs->config = spectral_matrix_regs->config | 0x01; |
|
622 | 630 | } |
|
623 | 631 | |
|
624 | 632 | void disable_irq_on_new_ready_matrix( void ) |
|
625 | 633 | { |
|
626 | 634 | spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffe; // 1110 |
|
627 | 635 | } |
|
628 | 636 | |
|
629 | 637 | |
|
630 | 638 | void launch_spectral_matrix_simu( unsigned char mode ) |
|
631 | 639 | { |
|
632 | 640 | reset_nb_sm_f0(); |
|
633 | 641 | reset_current_sm_ring_nodes(); |
|
634 | 642 | reset_spectral_matrix_regs(); |
|
635 | 643 | |
|
636 | 644 | // Spectral Matrices simulator |
|
637 | 645 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
638 | 646 | LEON_Clear_interrupt( IRQ_SM_SIMULATOR ); |
|
639 | 647 | LEON_Unmask_interrupt( IRQ_SM_SIMULATOR ); |
|
640 | 648 | set_local_nb_interrupt_f0_MAX(); |
|
641 | 649 | } |
|
642 | 650 | |
|
643 | 651 | //**************** |
|
644 | 652 | // CLOSING ACTIONS |
|
645 |
void update_last_TC_exe(ccsdsTelecommandPacket_t *TC |
|
|
653 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC) | |
|
646 | 654 | { |
|
647 | 655 | /** This function is used to update the HK packets statistics after a successful TC execution. |
|
648 | 656 | * |
|
649 | 657 | * @param TC points to the TC being processed |
|
650 | 658 | * @param time is the time used to date the TC execution |
|
651 | 659 | * |
|
652 | 660 | */ |
|
653 | 661 | |
|
654 | 662 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; |
|
655 | 663 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; |
|
656 | 664 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; |
|
657 | 665 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; |
|
658 | 666 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; |
|
659 | 667 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; |
|
660 |
housekeeping_packet.hk_lfr_last_exe_tc_time[0] = |
|
|
661 |
housekeeping_packet.hk_lfr_last_exe_tc_time[1] = |
|
|
662 |
housekeeping_packet.hk_lfr_last_exe_tc_time[2] = |
|
|
663 |
housekeeping_packet.hk_lfr_last_exe_tc_time[3] = |
|
|
664 |
housekeeping_packet.hk_lfr_last_exe_tc_time[4] = |
|
|
665 |
housekeeping_packet.hk_lfr_last_exe_tc_time[5] = |
|
|
668 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
|
669 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
|
670 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
|
671 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); | |
|
672 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
|
673 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = (unsigned char) (time_management_regs->fine_time); | |
|
666 | 674 | } |
|
667 | 675 | |
|
668 |
void update_last_TC_rej(ccsdsTelecommandPacket_t *TC |
|
|
676 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC ) | |
|
669 | 677 | { |
|
670 | 678 | /** This function is used to update the HK packets statistics after a TC rejection. |
|
671 | 679 | * |
|
672 | 680 | * @param TC points to the TC being processed |
|
673 | 681 | * @param time is the time used to date the TC rejection |
|
674 | 682 | * |
|
675 | 683 | */ |
|
676 | 684 | |
|
677 | 685 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; |
|
678 | 686 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; |
|
679 | 687 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; |
|
680 | 688 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; |
|
681 | 689 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; |
|
682 | 690 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; |
|
683 |
housekeeping_packet.hk_lfr_last_rej_tc_time[0] = |
|
|
684 |
housekeeping_packet.hk_lfr_last_rej_tc_time[1] = |
|
|
685 |
housekeeping_packet.hk_lfr_last_rej_tc_time[2] = |
|
|
686 |
housekeeping_packet.hk_lfr_last_rej_tc_time[3] = |
|
|
687 |
housekeeping_packet.hk_lfr_last_rej_tc_time[4] = |
|
|
688 |
housekeeping_packet.hk_lfr_last_rej_tc_time[5] = |
|
|
691 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
|
692 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
|
693 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
|
694 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); | |
|
695 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
|
696 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = (unsigned char) (time_management_regs->fine_time); | |
|
689 | 697 | } |
|
690 | 698 | |
|
691 |
void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id |
|
|
699 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ) | |
|
692 | 700 | { |
|
693 | 701 | /** This function is the last step of the TC execution workflow. |
|
694 | 702 | * |
|
695 | 703 | * @param TC points to the TC being processed |
|
696 | 704 | * @param result is the result of the TC execution (LFR_SUCCESSFUL / LFR_DEFAULT) |
|
697 | 705 | * @param queue_id is the id of the RTEMS message queue used to send TM packets |
|
698 | 706 | * @param time is the time used to date the TC execution |
|
699 | 707 | * |
|
700 | 708 | */ |
|
701 | 709 | |
|
702 | 710 | unsigned int val = 0; |
|
703 | 711 | |
|
704 | 712 | if (result == LFR_SUCCESSFUL) |
|
705 | 713 | { |
|
706 | 714 | if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
707 | 715 | && |
|
708 | 716 | !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
709 | 717 | ) |
|
710 | 718 | { |
|
711 |
send_tm_lfr_tc_exe_success( TC, queue_id |
|
|
719 | send_tm_lfr_tc_exe_success( TC, queue_id ); | |
|
712 | 720 | } |
|
713 |
update_last_TC_exe( TC |
|
|
721 | update_last_TC_exe( TC ); | |
|
714 | 722 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; |
|
715 | 723 | val++; |
|
716 | 724 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); |
|
717 | 725 | housekeeping_packet.hk_lfr_exe_tc_cnt[1] = (unsigned char) (val); |
|
718 | 726 | } |
|
719 | 727 | else |
|
720 | 728 | { |
|
721 |
update_last_TC_rej( TC |
|
|
729 | update_last_TC_rej( TC ); | |
|
722 | 730 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; |
|
723 | 731 | val++; |
|
724 | 732 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); |
|
725 | 733 | housekeeping_packet.hk_lfr_rej_tc_cnt[1] = (unsigned char) (val); |
|
726 | 734 | } |
|
727 | 735 | } |
|
728 | 736 | |
|
729 | 737 | //*************************** |
|
730 | 738 | // Interrupt Service Routines |
|
731 | 739 | rtems_isr commutation_isr1( rtems_vector_number vector ) |
|
732 | 740 | { |
|
733 | 741 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
734 | 742 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); |
|
735 | 743 | } |
|
736 | 744 | } |
|
737 | 745 | |
|
738 | 746 | rtems_isr commutation_isr2( rtems_vector_number vector ) |
|
739 | 747 | { |
|
740 | 748 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
741 | 749 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); |
|
742 | 750 | } |
|
743 | 751 | } |
|
744 | 752 | |
|
745 | 753 | //**************** |
|
746 | 754 | // OTHER FUNCTIONS |
|
747 | 755 | void updateLFRCurrentMode() |
|
748 | 756 | { |
|
749 | 757 | /** This function updates the value of the global variable lfrCurrentMode. |
|
750 | 758 | * |
|
751 | 759 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. |
|
752 | 760 | * |
|
753 | 761 | */ |
|
754 | 762 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure |
|
755 | 763 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
756 | 764 | } |
|
757 | 765 |
@@ -1,483 +1,539 | |||
|
1 | 1 | /** Functions to load and dump parameters in the LFR registers. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * A group of functions to handle TC related to parameter loading and dumping.\n |
|
7 | 7 | * TC_LFR_LOAD_COMMON_PAR\n |
|
8 | 8 | * TC_LFR_LOAD_NORMAL_PAR\n |
|
9 | 9 | * TC_LFR_LOAD_BURST_PAR\n |
|
10 | 10 | * TC_LFR_LOAD_SBM1_PAR\n |
|
11 | 11 | * TC_LFR_LOAD_SBM2_PAR\n |
|
12 | 12 | * |
|
13 | 13 | */ |
|
14 | 14 | |
|
15 | 15 | #include "tc_load_dump_parameters.h" |
|
16 | 16 | |
|
17 | 17 | int action_load_common_par(ccsdsTelecommandPacket_t *TC) |
|
18 | 18 | { |
|
19 | 19 | /** This function updates the LFR registers with the incoming common parameters. |
|
20 | 20 | * |
|
21 | 21 | * @param TC points to the TeleCommand packet that is being processed |
|
22 | 22 | * |
|
23 | 23 | * |
|
24 | 24 | */ |
|
25 | 25 | |
|
26 | 26 | parameter_dump_packet.unused0 = TC->dataAndCRC[0]; |
|
27 | 27 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = TC->dataAndCRC[1]; |
|
28 | 28 | set_wfp_data_shaping( ); |
|
29 | 29 | return LFR_SUCCESSFUL; |
|
30 | 30 | } |
|
31 | 31 | |
|
32 | 32 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
33 | 33 | { |
|
34 | 34 | /** This function updates the LFR registers with the incoming normal parameters. |
|
35 | 35 | * |
|
36 | 36 | * @param TC points to the TeleCommand packet that is being processed |
|
37 | 37 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
38 | 38 | * |
|
39 | 39 | */ |
|
40 | 40 | |
|
41 | 41 | int result; |
|
42 | 42 | int flag; |
|
43 | 43 | rtems_status_code status; |
|
44 | 44 | |
|
45 | 45 | flag = LFR_SUCCESSFUL; |
|
46 | 46 | |
|
47 | 47 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || |
|
48 | 48 | (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) { |
|
49 |
status = send_tm_lfr_tc_exe_not_executable( TC, queue_id |
|
|
49 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
|
50 | 50 | flag = LFR_DEFAULT; |
|
51 | 51 | } |
|
52 | 52 | |
|
53 | 53 | //*************** |
|
54 | 54 | // sy_lfr_n_swf_l |
|
55 | 55 | if (flag == LFR_SUCCESSFUL) |
|
56 | 56 | { |
|
57 | 57 | result = set_sy_lfr_n_swf_l( TC, queue_id, time ); |
|
58 | 58 | if (result != LFR_SUCCESSFUL) |
|
59 | 59 | { |
|
60 | 60 | flag = LFR_DEFAULT; |
|
61 | 61 | } |
|
62 | 62 | } |
|
63 | 63 | |
|
64 | 64 | //*************** |
|
65 | 65 | // sy_lfr_n_swf_p |
|
66 | 66 | if (flag == LFR_SUCCESSFUL) |
|
67 | 67 | { |
|
68 | 68 | result = set_sy_lfr_n_swf_p( TC, queue_id, time ); |
|
69 | 69 | if (result != LFR_SUCCESSFUL) |
|
70 | 70 | { |
|
71 | 71 | flag = LFR_DEFAULT; |
|
72 | 72 | } |
|
73 | 73 | } |
|
74 | 74 | |
|
75 | 75 | //*************** |
|
76 | 76 | // sy_lfr_n_asm_p |
|
77 | 77 | if (flag == LFR_SUCCESSFUL) |
|
78 | 78 | { |
|
79 | 79 | result = set_sy_lfr_n_asm_p( TC, queue_id ); |
|
80 | 80 | if (result != LFR_SUCCESSFUL) |
|
81 | 81 | { |
|
82 | 82 | flag = LFR_DEFAULT; |
|
83 | 83 | } |
|
84 | 84 | } |
|
85 | 85 | |
|
86 | 86 | //*************** |
|
87 | 87 | // sy_lfr_n_bp_p0 |
|
88 | 88 | if (flag == LFR_SUCCESSFUL) |
|
89 | 89 | { |
|
90 | 90 | result = set_sy_lfr_n_bp_p0( TC, queue_id ); |
|
91 | 91 | if (result != LFR_SUCCESSFUL) |
|
92 | 92 | { |
|
93 | 93 | flag = LFR_DEFAULT; |
|
94 | 94 | } |
|
95 | 95 | } |
|
96 | 96 | |
|
97 | 97 | //*************** |
|
98 | 98 | // sy_lfr_n_bp_p1 |
|
99 | 99 | if (flag == LFR_SUCCESSFUL) |
|
100 | 100 | { |
|
101 | 101 | result = set_sy_lfr_n_bp_p1( TC, queue_id ); |
|
102 | 102 | if (result != LFR_SUCCESSFUL) |
|
103 | 103 | { |
|
104 | 104 | flag = LFR_DEFAULT; |
|
105 | 105 | } |
|
106 | 106 | } |
|
107 | 107 | |
|
108 | 108 | //********************* |
|
109 | 109 | // sy_lfr_n_cwf_long_f3 |
|
110 | 110 | if (flag == LFR_SUCCESSFUL) |
|
111 | 111 | { |
|
112 | 112 | result = set_sy_lfr_n_cwf_long_f3( TC, queue_id ); |
|
113 | 113 | if (result != LFR_SUCCESSFUL) |
|
114 | 114 | { |
|
115 | 115 | flag = LFR_DEFAULT; |
|
116 | 116 | } |
|
117 | 117 | } |
|
118 | 118 | |
|
119 | 119 | return flag; |
|
120 | 120 | } |
|
121 | 121 | |
|
122 | 122 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
123 | 123 | { |
|
124 | 124 | /** This function updates the LFR registers with the incoming burst parameters. |
|
125 | 125 | * |
|
126 | 126 | * @param TC points to the TeleCommand packet that is being processed |
|
127 | 127 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
128 | 128 | * |
|
129 | 129 | */ |
|
130 | 130 | |
|
131 | 131 | int result; |
|
132 | 132 | unsigned char lfrMode; |
|
133 | 133 | rtems_status_code status; |
|
134 | 134 | |
|
135 | 135 | result = LFR_DEFAULT; |
|
136 | 136 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
137 | 137 | |
|
138 | 138 | if ( lfrMode == LFR_MODE_BURST ) { |
|
139 |
status = send_tm_lfr_tc_exe_not_executable( TC, queue_id |
|
|
139 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
|
140 | 140 | result = LFR_DEFAULT; |
|
141 | 141 | } |
|
142 | 142 | else { |
|
143 | 143 | parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[0]; |
|
144 | 144 | parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[1]; |
|
145 | 145 | |
|
146 | 146 | result = LFR_SUCCESSFUL; |
|
147 | 147 | } |
|
148 | 148 | |
|
149 | 149 | return result; |
|
150 | 150 | } |
|
151 | 151 | |
|
152 | 152 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
153 | 153 | { |
|
154 | 154 | /** This function updates the LFR registers with the incoming sbm1 parameters. |
|
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 related to this execution step |
|
158 | 158 | * |
|
159 | 159 | */ |
|
160 | 160 | int result; |
|
161 | 161 | unsigned char lfrMode; |
|
162 | 162 | rtems_status_code status; |
|
163 | 163 | |
|
164 | 164 | result = LFR_DEFAULT; |
|
165 | 165 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
166 | 166 | |
|
167 | 167 | if ( (lfrMode == LFR_MODE_SBM1) || (lfrMode == LFR_MODE_SBM2) ) { |
|
168 |
status = send_tm_lfr_tc_exe_not_executable( TC, queue_id |
|
|
168 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
|
169 | 169 | result = LFR_DEFAULT; |
|
170 | 170 | } |
|
171 | 171 | else { |
|
172 | 172 | parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[0]; |
|
173 | 173 | parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[1]; |
|
174 | 174 | |
|
175 | 175 | result = LFR_SUCCESSFUL; |
|
176 | 176 | } |
|
177 | 177 | |
|
178 | 178 | return result; |
|
179 | 179 | } |
|
180 | 180 | |
|
181 | 181 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time) |
|
182 | 182 | { |
|
183 | 183 | /** This function updates the LFR registers with the incoming sbm2 parameters. |
|
184 | 184 | * |
|
185 | 185 | * @param TC points to the TeleCommand packet that is being processed |
|
186 | 186 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
187 | 187 | * |
|
188 | 188 | */ |
|
189 | 189 | |
|
190 | 190 | int result; |
|
191 | 191 | unsigned char lfrMode; |
|
192 | 192 | rtems_status_code status; |
|
193 | 193 | |
|
194 | 194 | result = LFR_DEFAULT; |
|
195 | 195 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
196 | 196 | |
|
197 |
if ( (lfrMode == LFR_MODE_SBM |
|
|
198 |
status = send_tm_lfr_tc_exe_not_executable( TC, queue_id |
|
|
197 | if ( (lfrMode == LFR_MODE_SBM1) || (lfrMode == LFR_MODE_SBM2) ) { | |
|
198 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
|
199 | 199 | result = LFR_DEFAULT; |
|
200 | 200 | } |
|
201 | 201 | else { |
|
202 | 202 | parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[0]; |
|
203 | 203 | parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[1]; |
|
204 | 204 | |
|
205 | 205 | result = LFR_SUCCESSFUL; |
|
206 | 206 | } |
|
207 | 207 | |
|
208 | 208 | return result; |
|
209 | 209 | } |
|
210 | 210 | |
|
211 | 211 | int action_dump_par( rtems_id queue_id ) |
|
212 | 212 | { |
|
213 | 213 | /** This function dumps the LFR parameters by sending the appropriate TM packet to the dedicated RTEMS message queue. |
|
214 | 214 | * |
|
215 | 215 | * @param queue_id is the id of the queue which handles TM related to this execution step. |
|
216 | 216 | * |
|
217 | 217 | * @return RTEMS directive status codes: |
|
218 | 218 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
219 | 219 | * - RTEMS_INVALID_ID - invalid queue id |
|
220 | 220 | * - RTEMS_INVALID_SIZE - invalid message size |
|
221 | 221 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
222 | 222 | * - RTEMS_UNSATISFIED - out of message buffers |
|
223 | 223 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
224 | 224 | * |
|
225 | 225 | */ |
|
226 | 226 | |
|
227 | 227 | int status; |
|
228 | 228 | |
|
229 | 229 | // UPDATE TIME |
|
230 | 230 | increment_seq_counter( parameter_dump_packet.packetSequenceControl ); |
|
231 | 231 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
232 | 232 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
233 | 233 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
234 | 234 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
235 | 235 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
236 | 236 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
237 | 237 | // SEND DATA |
|
238 | 238 | status = rtems_message_queue_send( queue_id, ¶meter_dump_packet, |
|
239 | 239 | PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
240 | 240 | if (status != RTEMS_SUCCESSFUL) { |
|
241 | 241 | PRINTF1("in action_dump *** ERR sending packet, code %d", status) |
|
242 | 242 | } |
|
243 | 243 | |
|
244 | 244 | return status; |
|
245 | 245 | } |
|
246 | 246 | |
|
247 | 247 | //*********************** |
|
248 | 248 | // NORMAL MODE PARAMETERS |
|
249 | 249 | |
|
250 | 250 | int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ) |
|
251 | 251 | { |
|
252 | 252 | /** This function sets the number of points of a snapshot (sy_lfr_n_swf_l). |
|
253 | 253 | * |
|
254 | 254 | * @param TC points to the TeleCommand packet that is being processed |
|
255 | 255 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
256 | 256 | * |
|
257 | 257 | */ |
|
258 | 258 | |
|
259 | 259 | unsigned int tmp; |
|
260 | 260 | int result; |
|
261 | 261 | unsigned char msb; |
|
262 | 262 | unsigned char lsb; |
|
263 | 263 | rtems_status_code status; |
|
264 | 264 | |
|
265 | 265 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L ]; |
|
266 | 266 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L+1 ]; |
|
267 | 267 | |
|
268 | 268 | tmp = ( unsigned int ) floor( |
|
269 | 269 | ( ( msb*256 ) + lsb ) / 16 |
|
270 | 270 | ) * 16; |
|
271 | 271 | |
|
272 | 272 | if ( (tmp < 16) || (tmp > 2048) ) // the snapshot period is a multiple of 16 |
|
273 | 273 | { // 2048 is the maximum limit due to the size of the buffers |
|
274 |
status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_L+10, lsb |
|
|
274 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_L+10, lsb ); | |
|
275 | 275 | result = WRONG_APP_DATA; |
|
276 | 276 | } |
|
277 | 277 | else if (tmp != 2048) |
|
278 | 278 | { |
|
279 | 279 | status = send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
280 | 280 | result = FUNCT_NOT_IMPL; |
|
281 | 281 | } |
|
282 | 282 | else |
|
283 | 283 | { |
|
284 | 284 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (tmp >> 8); |
|
285 | 285 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (tmp ); |
|
286 | 286 | result = LFR_SUCCESSFUL; |
|
287 | 287 | } |
|
288 | 288 | |
|
289 | 289 | return result; |
|
290 | 290 | } |
|
291 | 291 | |
|
292 | 292 | int set_sy_lfr_n_swf_p(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time) |
|
293 | 293 | { |
|
294 | 294 | /** This function sets the time between two snapshots, in s (sy_lfr_n_swf_p). |
|
295 | 295 | * |
|
296 | 296 | * @param TC points to the TeleCommand packet that is being processed |
|
297 | 297 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
298 | 298 | * |
|
299 | 299 | */ |
|
300 | 300 | |
|
301 | 301 | unsigned int tmp; |
|
302 | 302 | int result; |
|
303 | 303 | unsigned char msb; |
|
304 | 304 | unsigned char lsb; |
|
305 | 305 | rtems_status_code status; |
|
306 | 306 | |
|
307 | 307 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P ]; |
|
308 | 308 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P+1 ]; |
|
309 | 309 | |
|
310 | 310 | tmp = msb * 256 + lsb; |
|
311 | 311 | |
|
312 | 312 | if ( tmp < 16 ) |
|
313 | 313 | { |
|
314 |
status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_P+10, lsb |
|
|
314 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_P+10, lsb ); | |
|
315 | 315 | result = WRONG_APP_DATA; |
|
316 | 316 | } |
|
317 | 317 | else |
|
318 | 318 | { |
|
319 | 319 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8); |
|
320 | 320 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp ); |
|
321 | 321 | result = LFR_SUCCESSFUL; |
|
322 | 322 | } |
|
323 | 323 | |
|
324 | 324 | return result; |
|
325 | 325 | } |
|
326 | 326 | |
|
327 | 327 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
328 | 328 | { |
|
329 | 329 | /** This function sets the time between two full spectral matrices transmission, in s (SY_LFR_N_ASM_P). |
|
330 | 330 | * |
|
331 | 331 | * @param TC points to the TeleCommand packet that is being processed |
|
332 | 332 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
333 | 333 | * |
|
334 | 334 | */ |
|
335 | 335 | |
|
336 | 336 | int result; |
|
337 | 337 | unsigned char msb; |
|
338 | 338 | unsigned char lsb; |
|
339 | 339 | |
|
340 | 340 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P ]; |
|
341 | 341 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P+1 ]; |
|
342 | 342 | |
|
343 | 343 | parameter_dump_packet.sy_lfr_n_asm_p[0] = msb; |
|
344 | 344 | parameter_dump_packet.sy_lfr_n_asm_p[1] = lsb; |
|
345 | 345 | result = LFR_SUCCESSFUL; |
|
346 | 346 | |
|
347 | 347 | return result; |
|
348 | 348 | } |
|
349 | 349 | |
|
350 | 350 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
351 | 351 | { |
|
352 | 352 | /** This function sets the time between two basic parameter sets, in s (SY_LFR_N_BP_P0). |
|
353 | 353 | * |
|
354 | 354 | * @param TC points to the TeleCommand packet that is being processed |
|
355 | 355 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
356 | 356 | * |
|
357 | 357 | */ |
|
358 | 358 | |
|
359 | 359 | int status; |
|
360 | 360 | |
|
361 | 361 | status = LFR_SUCCESSFUL; |
|
362 | 362 | |
|
363 | 363 | parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P0 ]; |
|
364 | 364 | |
|
365 | 365 | return status; |
|
366 | 366 | } |
|
367 | 367 | |
|
368 | 368 | int set_sy_lfr_n_bp_p1(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
369 | 369 | { |
|
370 | 370 | /** This function sets the time between two basic parameter sets (autocorrelation + crosscorrelation), in s (sy_lfr_n_bp_p1). |
|
371 | 371 | * |
|
372 | 372 | * @param TC points to the TeleCommand packet that is being processed |
|
373 | 373 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
374 | 374 | * |
|
375 | 375 | */ |
|
376 | 376 | |
|
377 | 377 | int status; |
|
378 | 378 | |
|
379 | 379 | status = LFR_SUCCESSFUL; |
|
380 | 380 | |
|
381 | 381 | parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P1 ]; |
|
382 | 382 | |
|
383 | 383 | return status; |
|
384 | 384 | } |
|
385 | 385 | |
|
386 | 386 | int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
387 | 387 | { |
|
388 | 388 | /** This function allows to switch from CWF_F3 packets to CWF_LONG_F3 packets. |
|
389 | 389 | * |
|
390 | 390 | * @param TC points to the TeleCommand packet that is being processed |
|
391 | 391 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
392 | 392 | * |
|
393 | 393 | */ |
|
394 | 394 | |
|
395 | 395 | int status; |
|
396 | 396 | |
|
397 | 397 | status = LFR_SUCCESSFUL; |
|
398 | 398 | |
|
399 | 399 | parameter_dump_packet.sy_lfr_n_cwf_long_f3 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_CWF_LONG_F3 ]; |
|
400 | 400 | |
|
401 | 401 | return status; |
|
402 | 402 | } |
|
403 | 403 | |
|
404 | 404 | //********************** |
|
405 | 405 | // BURST MODE PARAMETERS |
|
406 | 406 | |
|
407 | 407 | //********************* |
|
408 | 408 | // SBM1 MODE PARAMETERS |
|
409 | 409 | |
|
410 | 410 | //********************* |
|
411 | 411 | // SBM2 MODE PARAMETERS |
|
412 | 412 | |
|
413 | //******************* | |
|
414 | // TC_LFR_UPDATE_INFO | |
|
415 | unsigned int check_update_info_hk_lfr_mode( unsigned char mode ) | |
|
416 | { | |
|
417 | unsigned int status; | |
|
418 | ||
|
419 | if ( (mode == LFR_MODE_STANDBY) || (mode == LFR_MODE_NORMAL) | |
|
420 | || (mode = LFR_MODE_BURST) | |
|
421 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2)) | |
|
422 | { | |
|
423 | status = LFR_SUCCESSFUL; | |
|
424 | } | |
|
425 | else | |
|
426 | { | |
|
427 | status = LFR_DEFAULT; | |
|
428 | } | |
|
429 | ||
|
430 | return status; | |
|
431 | } | |
|
432 | ||
|
433 | unsigned int check_update_info_hk_tds_mode( unsigned char mode ) | |
|
434 | { | |
|
435 | unsigned int status; | |
|
436 | ||
|
437 | if ( (mode == TDS_MODE_STANDBY) || (mode == TDS_MODE_NORMAL) | |
|
438 | || (mode = TDS_MODE_BURST) | |
|
439 | || (mode == TDS_MODE_SBM1) || (mode == TDS_MODE_SBM2) | |
|
440 | || (mode == TDS_MODE_LFM)) | |
|
441 | { | |
|
442 | status = LFR_SUCCESSFUL; | |
|
443 | } | |
|
444 | else | |
|
445 | { | |
|
446 | status = LFR_DEFAULT; | |
|
447 | } | |
|
448 | ||
|
449 | return status; | |
|
450 | } | |
|
451 | ||
|
452 | unsigned int check_update_info_hk_thr_mode( unsigned char mode ) | |
|
453 | { | |
|
454 | unsigned int status; | |
|
455 | ||
|
456 | if ( (mode == THR_MODE_STANDBY) || (mode == THR_MODE_NORMAL) | |
|
457 | || (mode = THR_MODE_BURST)) | |
|
458 | { | |
|
459 | status = LFR_SUCCESSFUL; | |
|
460 | } | |
|
461 | else | |
|
462 | { | |
|
463 | status = LFR_DEFAULT; | |
|
464 | } | |
|
465 | ||
|
466 | return status; | |
|
467 | } | |
|
468 | ||
|
413 | 469 | //********** |
|
414 | 470 | // init dump |
|
415 | 471 | |
|
416 | 472 | void init_parameter_dump( void ) |
|
417 | 473 | { |
|
418 | 474 | /** This function initialize the parameter_dump_packet global variable with default values. |
|
419 | 475 | * |
|
420 | 476 | */ |
|
421 | 477 | |
|
422 | 478 | parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
423 | 479 | parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
424 | 480 | parameter_dump_packet.reserved = CCSDS_RESERVED; |
|
425 | 481 | parameter_dump_packet.userApplication = CCSDS_USER_APP; |
|
426 | 482 | parameter_dump_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_PARAMETER_DUMP >> 8); |
|
427 | 483 | parameter_dump_packet.packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP; |
|
428 | 484 | parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
429 | 485 | parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
430 | 486 | parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8); |
|
431 | 487 | parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP; |
|
432 | 488 | // DATA FIELD HEADER |
|
433 | 489 | parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2; |
|
434 | 490 | parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP; |
|
435 | 491 | parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP; |
|
436 | 492 | parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
437 | 493 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
438 | 494 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
439 | 495 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
440 | 496 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
441 | 497 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
442 | 498 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
443 | 499 | parameter_dump_packet.sid = SID_PARAMETER_DUMP; |
|
444 | 500 | |
|
445 | 501 | //****************** |
|
446 | 502 | // COMMON PARAMETERS |
|
447 | 503 | parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0; |
|
448 | 504 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1; |
|
449 | 505 | |
|
450 | 506 | //****************** |
|
451 | 507 | // NORMAL PARAMETERS |
|
452 | 508 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (SY_LFR_N_SWF_L >> 8); |
|
453 | 509 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (SY_LFR_N_SWF_L ); |
|
454 | 510 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (SY_LFR_N_SWF_P >> 8); |
|
455 | 511 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (SY_LFR_N_SWF_P ); |
|
456 | 512 | parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (SY_LFR_N_ASM_P >> 8); |
|
457 | 513 | parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (SY_LFR_N_ASM_P ); |
|
458 | 514 | parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) SY_LFR_N_BP_P0; |
|
459 | 515 | parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) SY_LFR_N_BP_P1; |
|
460 | 516 | parameter_dump_packet.sy_lfr_n_cwf_long_f3 = (unsigned char) SY_LFR_N_CWF_LONG_F3; |
|
461 | 517 | |
|
462 | 518 | //***************** |
|
463 | 519 | // BURST PARAMETERS |
|
464 | 520 | parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0; |
|
465 | 521 | parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1; |
|
466 | 522 | |
|
467 | 523 | //**************** |
|
468 | 524 | // SBM1 PARAMETERS |
|
469 | 525 | parameter_dump_packet.sy_lfr_s1_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P0; // min value is 0.25 s for the period |
|
470 | 526 | parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1; |
|
471 | 527 | |
|
472 | 528 | //**************** |
|
473 | 529 | // SBM2 PARAMETERS |
|
474 | 530 | parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0; |
|
475 | 531 | parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1; |
|
476 | 532 | } |
|
477 | 533 | |
|
478 | 534 | |
|
479 | 535 | |
|
480 | 536 | |
|
481 | 537 | |
|
482 | 538 | |
|
483 | 539 |
@@ -1,494 +1,493 | |||
|
1 | 1 | /** Functions to send TM packets related to TC parsing and execution. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * A group of functions to send appropriate TM packets after parsing and execution: |
|
7 | 7 | * - TM_LFR_TC_EXE_SUCCESS |
|
8 | 8 | * - TM_LFR_TC_EXE_INCONSISTENT |
|
9 | 9 | * - TM_LFR_TC_EXE_NOT_EXECUTABLE |
|
10 | 10 | * - TM_LFR_TC_EXE_NOT_IMPLEMENTED |
|
11 | 11 | * - TM_LFR_TC_EXE_ERROR |
|
12 | 12 | * - TM_LFR_TC_EXE_CORRUPTED |
|
13 | 13 | * |
|
14 | 14 | */ |
|
15 | 15 | |
|
16 | 16 | #include "tm_lfr_tc_exe.h" |
|
17 | 17 | |
|
18 |
int send_tm_lfr_tc_exe_success( ccsdsTelecommandPacket_t *TC, rtems_id queue_id |
|
|
18 | int send_tm_lfr_tc_exe_success( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) | |
|
19 | 19 | { |
|
20 | 20 | /** This function sends a TM_LFR_TC_EXE_SUCCESS packet in the dedicated RTEMS message queue. |
|
21 | 21 | * |
|
22 | 22 | * @param TC points to the TeleCommand packet that is being processed |
|
23 | 23 | * @param queue_id is the id of the queue which handles TM |
|
24 | 24 | * |
|
25 | 25 | * @return RTEMS directive status code: |
|
26 | 26 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
27 | 27 | * - RTEMS_INVALID_ID - invalid queue id |
|
28 | 28 | * - RTEMS_INVALID_SIZE - invalid message size |
|
29 | 29 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
30 | 30 | * - RTEMS_UNSATISFIED - out of message buffers |
|
31 | 31 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
32 | 32 | * |
|
33 | 33 | */ |
|
34 | 34 | |
|
35 | 35 | rtems_status_code status; |
|
36 | 36 | Packet_TM_LFR_TC_EXE_SUCCESS_t TM; |
|
37 | 37 | unsigned char messageSize; |
|
38 | 38 | |
|
39 | 39 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
40 | 40 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
41 | 41 | TM.reserved = DEFAULT_RESERVED; |
|
42 | 42 | TM.userApplication = CCSDS_USER_APP; |
|
43 | 43 | // PACKET HEADER |
|
44 | 44 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
45 | 45 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
46 | 46 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
47 | 47 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8); |
|
48 | 48 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS ); |
|
49 | 49 | // DATA FIELD HEADER |
|
50 | 50 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
51 | 51 | TM.serviceType = TM_TYPE_TC_EXE; |
|
52 | 52 | TM.serviceSubType = TM_SUBTYPE_EXE_OK; |
|
53 | 53 | TM.destinationID = TC->sourceID; |
|
54 | TM.time[0] = time[0]; | |
|
55 | TM.time[1] = time[1]; | |
|
56 | TM.time[2] = time[2]; | |
|
57 | TM.time[3] = time[3]; | |
|
58 | TM.time[4] = time[4]; | |
|
59 | TM.time[5] = time[5]; | |
|
54 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
|
55 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
|
56 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
|
57 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
|
58 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
|
59 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |
|
60 | 60 | // |
|
61 | 61 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
62 | 62 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
63 | 63 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
64 | 64 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
65 | 65 | |
|
66 | 66 | messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
67 | 67 | |
|
68 | 68 | // SEND DATA |
|
69 | 69 | status = rtems_message_queue_send( queue_id, &TM, messageSize); |
|
70 | 70 | if (status != RTEMS_SUCCESSFUL) { |
|
71 | 71 | PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n") |
|
72 | 72 | } |
|
73 | 73 | |
|
74 | 74 | return status; |
|
75 | 75 | } |
|
76 | 76 | |
|
77 | 77 | int send_tm_lfr_tc_exe_inconsistent( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
78 |
unsigned char byte_position, unsigned char rcv_value |
|
|
79 | unsigned char *time) | |
|
78 | unsigned char byte_position, unsigned char rcv_value ) | |
|
80 | 79 | { |
|
81 | 80 | /** This function sends a TM_LFR_TC_EXE_INCONSISTENT packet in the dedicated RTEMS message queue. |
|
82 | 81 | * |
|
83 | 82 | * @param TC points to the TeleCommand packet that is being processed |
|
84 | 83 | * @param queue_id is the id of the queue which handles TM |
|
85 | 84 | * @param byte_position is the byte position of the MSB of the parameter that has been seen as inconsistent |
|
86 | 85 | * @param rcv_value is the value of the LSB of the parameter that has been deteced as inconsistent |
|
87 | 86 | * |
|
88 | 87 | * @return RTEMS directive status code: |
|
89 | 88 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
90 | 89 | * - RTEMS_INVALID_ID - invalid queue id |
|
91 | 90 | * - RTEMS_INVALID_SIZE - invalid message size |
|
92 | 91 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
93 | 92 | * - RTEMS_UNSATISFIED - out of message buffers |
|
94 | 93 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
95 | 94 | * |
|
96 | 95 | */ |
|
97 | 96 | |
|
98 | 97 | rtems_status_code status; |
|
99 | 98 | Packet_TM_LFR_TC_EXE_INCONSISTENT_t TM; |
|
100 | 99 | unsigned char messageSize; |
|
101 | 100 | |
|
102 | 101 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
103 | 102 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
104 | 103 | TM.reserved = DEFAULT_RESERVED; |
|
105 | 104 | TM.userApplication = CCSDS_USER_APP; |
|
106 | 105 | // PACKET HEADER |
|
107 | 106 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
108 | 107 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
109 | 108 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
110 | 109 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8); |
|
111 | 110 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT ); |
|
112 | 111 | // DATA FIELD HEADER |
|
113 | 112 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
114 | 113 | TM.serviceType = TM_TYPE_TC_EXE; |
|
115 | 114 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
116 | 115 | TM.destinationID = TC->sourceID; |
|
117 | 116 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
118 | 117 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
119 | 118 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
120 | 119 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
121 | 120 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
122 | 121 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
123 | 122 | // |
|
124 | 123 | TM.tc_failure_code[0] = (char) (WRONG_APP_DATA >> 8); |
|
125 | 124 | TM.tc_failure_code[1] = (char) (WRONG_APP_DATA ); |
|
126 | 125 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
127 | 126 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
128 | 127 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
129 | 128 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
130 | 129 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
131 | 130 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
132 | 131 | TM.byte_position = byte_position; |
|
133 | 132 | TM.rcv_value = rcv_value; |
|
134 | 133 | |
|
135 | 134 | messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
136 | 135 | |
|
137 | 136 | // SEND DATA |
|
138 | 137 | status = rtems_message_queue_send( queue_id, &TM, messageSize); |
|
139 | 138 | if (status != RTEMS_SUCCESSFUL) { |
|
140 | 139 | PRINTF("in send_tm_lfr_tc_exe_inconsistent *** ERR\n") |
|
141 | 140 | } |
|
142 | 141 | |
|
143 | 142 | return status; |
|
144 | 143 | } |
|
145 | 144 | |
|
146 |
int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id |
|
|
145 | int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) | |
|
147 | 146 | { |
|
148 | 147 | /** This function sends a TM_LFR_TC_EXE_NOT_EXECUTABLE packet in the dedicated RTEMS message queue. |
|
149 | 148 | * |
|
150 | 149 | * @param TC points to the TeleCommand packet that is being processed |
|
151 | 150 | * @param queue_id is the id of the queue which handles TM |
|
152 | 151 | * |
|
153 | 152 | * @return RTEMS directive status code: |
|
154 | 153 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
155 | 154 | * - RTEMS_INVALID_ID - invalid queue id |
|
156 | 155 | * - RTEMS_INVALID_SIZE - invalid message size |
|
157 | 156 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
158 | 157 | * - RTEMS_UNSATISFIED - out of message buffers |
|
159 | 158 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
160 | 159 | * |
|
161 | 160 | */ |
|
162 | 161 | |
|
163 | 162 | rtems_status_code status; |
|
164 | 163 | Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t TM; |
|
165 | 164 | unsigned char messageSize; |
|
166 | 165 | |
|
167 | 166 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
168 | 167 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
169 | 168 | TM.reserved = DEFAULT_RESERVED; |
|
170 | 169 | TM.userApplication = CCSDS_USER_APP; |
|
171 | 170 | // PACKET HEADER |
|
172 | 171 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
173 | 172 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
174 | 173 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
175 | 174 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8); |
|
176 | 175 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE ); |
|
177 | 176 | // DATA FIELD HEADER |
|
178 | 177 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
179 | 178 | TM.serviceType = TM_TYPE_TC_EXE; |
|
180 | 179 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
181 | 180 | TM.destinationID = TC->sourceID; // default destination id |
|
182 | 181 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
183 | 182 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
184 | 183 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
185 | 184 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
186 | 185 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
187 | 186 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
188 | 187 | // |
|
189 | 188 | TM.tc_failure_code[0] = (char) (TC_NOT_EXE >> 8); |
|
190 | 189 | TM.tc_failure_code[1] = (char) (TC_NOT_EXE ); |
|
191 | 190 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
192 | 191 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
193 | 192 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
194 | 193 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
195 | 194 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
196 | 195 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
197 | 196 | TM.lfr_status_word[0] = housekeeping_packet.lfr_status_word[0]; |
|
198 | 197 | TM.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1]; |
|
199 | 198 | |
|
200 | 199 | messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
201 | 200 | |
|
202 | 201 | // SEND DATA |
|
203 | 202 | status = rtems_message_queue_send( queue_id, &TM, messageSize); |
|
204 | 203 | if (status != RTEMS_SUCCESSFUL) { |
|
205 | 204 | PRINTF("in send_tm_lfr_tc_exe_not_executable *** ERR\n") |
|
206 | 205 | } |
|
207 | 206 | |
|
208 | 207 | return status; |
|
209 | 208 | } |
|
210 | 209 | |
|
211 | 210 | int send_tm_lfr_tc_exe_not_implemented( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ) |
|
212 | 211 | { |
|
213 | 212 | /** This function sends a TM_LFR_TC_EXE_NOT_IMPLEMENTED packet in the dedicated RTEMS message queue. |
|
214 | 213 | * |
|
215 | 214 | * @param TC points to the TeleCommand packet that is being processed |
|
216 | 215 | * @param queue_id is the id of the queue which handles TM |
|
217 | 216 | * |
|
218 | 217 | * @return RTEMS directive status code: |
|
219 | 218 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
220 | 219 | * - RTEMS_INVALID_ID - invalid queue id |
|
221 | 220 | * - RTEMS_INVALID_SIZE - invalid message size |
|
222 | 221 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
223 | 222 | * - RTEMS_UNSATISFIED - out of message buffers |
|
224 | 223 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
225 | 224 | * |
|
226 | 225 | */ |
|
227 | 226 | |
|
228 | 227 | rtems_status_code status; |
|
229 | 228 | Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t TM; |
|
230 | 229 | unsigned char messageSize; |
|
231 | 230 | |
|
232 | 231 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
233 | 232 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
234 | 233 | TM.reserved = DEFAULT_RESERVED; |
|
235 | 234 | TM.userApplication = CCSDS_USER_APP; |
|
236 | 235 | // PACKET HEADER |
|
237 | 236 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
238 | 237 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
239 | 238 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
240 | 239 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8); |
|
241 | 240 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED ); |
|
242 | 241 | // DATA FIELD HEADER |
|
243 | 242 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
244 | 243 | TM.serviceType = TM_TYPE_TC_EXE; |
|
245 | 244 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
246 | 245 | TM.destinationID = TC->sourceID; // default destination id |
|
247 | 246 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
248 | 247 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
249 | 248 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
250 | 249 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
251 | 250 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
252 | 251 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
253 | 252 | // |
|
254 | 253 | TM.tc_failure_code[0] = (char) (FUNCT_NOT_IMPL >> 8); |
|
255 | 254 | TM.tc_failure_code[1] = (char) (FUNCT_NOT_IMPL ); |
|
256 | 255 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
257 | 256 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
258 | 257 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
259 | 258 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
260 | 259 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
261 | 260 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
262 | 261 | |
|
263 | 262 | messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
264 | 263 | |
|
265 | 264 | // SEND DATA |
|
266 | 265 | status = rtems_message_queue_send( queue_id, &TM, messageSize); |
|
267 | 266 | if (status != RTEMS_SUCCESSFUL) { |
|
268 | 267 | PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n") |
|
269 | 268 | } |
|
270 | 269 | |
|
271 | 270 | return status; |
|
272 | 271 | } |
|
273 | 272 | |
|
274 | 273 | int send_tm_lfr_tc_exe_error( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ) |
|
275 | 274 | { |
|
276 | 275 | /** This function sends a TM_LFR_TC_EXE_ERROR packet in the dedicated RTEMS message queue. |
|
277 | 276 | * |
|
278 | 277 | * @param TC points to the TeleCommand packet that is being processed |
|
279 | 278 | * @param queue_id is the id of the queue which handles TM |
|
280 | 279 | * |
|
281 | 280 | * @return RTEMS directive status code: |
|
282 | 281 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
283 | 282 | * - RTEMS_INVALID_ID - invalid queue id |
|
284 | 283 | * - RTEMS_INVALID_SIZE - invalid message size |
|
285 | 284 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
286 | 285 | * - RTEMS_UNSATISFIED - out of message buffers |
|
287 | 286 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
288 | 287 | * |
|
289 | 288 | */ |
|
290 | 289 | |
|
291 | 290 | rtems_status_code status; |
|
292 | 291 | Packet_TM_LFR_TC_EXE_ERROR_t TM; |
|
293 | 292 | unsigned char messageSize; |
|
294 | 293 | |
|
295 | 294 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
296 | 295 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
297 | 296 | TM.reserved = DEFAULT_RESERVED; |
|
298 | 297 | TM.userApplication = CCSDS_USER_APP; |
|
299 | 298 | // PACKET HEADER |
|
300 | 299 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
301 | 300 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
302 | 301 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
303 | 302 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8); |
|
304 | 303 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR ); |
|
305 | 304 | // DATA FIELD HEADER |
|
306 | 305 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
307 | 306 | TM.serviceType = TM_TYPE_TC_EXE; |
|
308 | 307 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
309 | 308 | TM.destinationID = TC->sourceID; // default destination id |
|
310 | 309 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
311 | 310 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
312 | 311 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
313 | 312 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
314 | 313 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
315 | 314 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
316 | 315 | // |
|
317 | 316 | TM.tc_failure_code[0] = (char) (FAIL_DETECTED >> 8); |
|
318 | 317 | TM.tc_failure_code[1] = (char) (FAIL_DETECTED ); |
|
319 | 318 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
320 | 319 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
321 | 320 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
322 | 321 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
323 | 322 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
324 | 323 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
325 | 324 | |
|
326 | 325 | messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
327 | 326 | |
|
328 | 327 | // SEND DATA |
|
329 | 328 | status = rtems_message_queue_send( queue_id, &TM, messageSize); |
|
330 | 329 | if (status != RTEMS_SUCCESSFUL) { |
|
331 | 330 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") |
|
332 | 331 | } |
|
333 | 332 | |
|
334 | 333 | return status; |
|
335 | 334 | } |
|
336 | 335 | |
|
337 | 336 | int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
338 | 337 | unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV, |
|
339 |
unsigned char destinationID |
|
|
338 | unsigned char destinationID ) | |
|
340 | 339 | { |
|
341 | 340 | /** This function sends a TM_LFR_TC_EXE_CORRUPTED packet in the dedicated RTEMS message queue. |
|
342 | 341 | * |
|
343 | 342 | * @param TC points to the TeleCommand packet that is being processed |
|
344 | 343 | * @param queue_id is the id of the queue which handles TM |
|
345 | 344 | * @param computed_CRC points to a buffer of two bytes containing the CRC computed during the parsing of the TeleCommand |
|
346 | 345 | * @param currentTC_LEN_RCV points to a buffer of two bytes containing a packet size field computed on the received data |
|
347 | 346 | * |
|
348 | 347 | * @return RTEMS directive status code: |
|
349 | 348 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
350 | 349 | * - RTEMS_INVALID_ID - invalid queue id |
|
351 | 350 | * - RTEMS_INVALID_SIZE - invalid message size |
|
352 | 351 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
353 | 352 | * - RTEMS_UNSATISFIED - out of message buffers |
|
354 | 353 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
355 | 354 | * |
|
356 | 355 | */ |
|
357 | 356 | |
|
358 | 357 | rtems_status_code status; |
|
359 | 358 | Packet_TM_LFR_TC_EXE_CORRUPTED_t TM; |
|
360 | 359 | unsigned char messageSize; |
|
361 | 360 | unsigned int packetLength; |
|
362 | 361 | unsigned char *packetDataField; |
|
363 | 362 | |
|
364 | 363 | packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1]; // compute the packet length parameter |
|
365 | 364 | packetDataField = (unsigned char *) &TC->headerFlag_pusVersion_Ack; // get the beginning of the data field |
|
366 | 365 | |
|
367 | 366 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
368 | 367 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
369 | 368 | TM.reserved = DEFAULT_RESERVED; |
|
370 | 369 | TM.userApplication = CCSDS_USER_APP; |
|
371 | 370 | // PACKET HEADER |
|
372 | 371 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
373 | 372 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
374 | 373 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); |
|
375 | 374 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8); |
|
376 | 375 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED ); |
|
377 | 376 | // DATA FIELD HEADER |
|
378 | 377 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
379 | 378 | TM.serviceType = TM_TYPE_TC_EXE; |
|
380 | 379 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
381 | 380 | TM.destinationID = destinationID; |
|
382 | 381 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
383 | 382 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
384 | 383 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
385 | 384 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
386 | 385 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
387 | 386 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
388 | 387 | // |
|
389 | 388 | TM.tc_failure_code[0] = (unsigned char) (CORRUPTED >> 8); |
|
390 | 389 | TM.tc_failure_code[1] = (unsigned char) (CORRUPTED ); |
|
391 | 390 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
392 | 391 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
393 | 392 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
394 | 393 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
395 | 394 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
396 | 395 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
397 | 396 | TM.pkt_len_rcv_value[0] = TC->packetLength[0]; |
|
398 | 397 | TM.pkt_len_rcv_value[1] = TC->packetLength[1]; |
|
399 | 398 | TM.pkt_datafieldsize_cnt[0] = currentTC_LEN_RCV[0]; |
|
400 | 399 | TM.pkt_datafieldsize_cnt[1] = currentTC_LEN_RCV[1]; |
|
401 | 400 | TM.rcv_crc[0] = packetDataField[ packetLength - 1 ]; |
|
402 | 401 | TM.rcv_crc[1] = packetDataField[ packetLength ]; |
|
403 | 402 | TM.computed_crc[0] = computed_CRC[0]; |
|
404 | 403 | TM.computed_crc[1] = computed_CRC[1]; |
|
405 | 404 | |
|
406 | 405 | messageSize = PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
407 | 406 | |
|
408 | 407 | // SEND DATA |
|
409 | 408 | status = rtems_message_queue_send( queue_id, &TM, messageSize); |
|
410 | 409 | if (status != RTEMS_SUCCESSFUL) { |
|
411 | 410 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") |
|
412 | 411 | } |
|
413 | 412 | |
|
414 | 413 | return status; |
|
415 | 414 | } |
|
416 | 415 | |
|
417 | 416 | void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id ) |
|
418 | 417 | { |
|
419 | 418 | /** This function increment the packet sequence control parameter of a TC, depending on its destination ID. |
|
420 | 419 | * |
|
421 | 420 | * @param packet_sequence_control points to the packet sequence control which will be incremented |
|
422 | 421 | * @param destination_id is the destination ID of the TM, there is one counter by destination ID |
|
423 | 422 | * |
|
424 | 423 | * If the destination ID is not known, a dedicated counter is incremented. |
|
425 | 424 | * |
|
426 | 425 | */ |
|
427 | 426 | |
|
428 | 427 | unsigned short sequence_cnt; |
|
429 | 428 | unsigned short segmentation_grouping_flag; |
|
430 | 429 | unsigned short new_packet_sequence_control; |
|
431 | 430 | unsigned char i; |
|
432 | 431 | |
|
433 | 432 | switch (destination_id) |
|
434 | 433 | { |
|
435 | 434 | case SID_TC_GROUND: |
|
436 | 435 | i = GROUND; |
|
437 | 436 | break; |
|
438 | 437 | case SID_TC_MISSION_TIMELINE: |
|
439 | 438 | i = MISSION_TIMELINE; |
|
440 | 439 | break; |
|
441 | 440 | case SID_TC_TC_SEQUENCES: |
|
442 | 441 | i = TC_SEQUENCES; |
|
443 | 442 | break; |
|
444 | 443 | case SID_TC_RECOVERY_ACTION_CMD: |
|
445 | 444 | i = RECOVERY_ACTION_CMD; |
|
446 | 445 | break; |
|
447 | 446 | case SID_TC_BACKUP_MISSION_TIMELINE: |
|
448 | 447 | i = BACKUP_MISSION_TIMELINE; |
|
449 | 448 | break; |
|
450 | 449 | case SID_TC_DIRECT_CMD: |
|
451 | 450 | i = DIRECT_CMD; |
|
452 | 451 | break; |
|
453 | 452 | case SID_TC_SPARE_GRD_SRC1: |
|
454 | 453 | i = SPARE_GRD_SRC1; |
|
455 | 454 | break; |
|
456 | 455 | case SID_TC_SPARE_GRD_SRC2: |
|
457 | 456 | i = SPARE_GRD_SRC2; |
|
458 | 457 | break; |
|
459 | 458 | case SID_TC_OBCP: |
|
460 | 459 | i = OBCP; |
|
461 | 460 | break; |
|
462 | 461 | case SID_TC_SYSTEM_CONTROL: |
|
463 | 462 | i = SYSTEM_CONTROL; |
|
464 | 463 | break; |
|
465 | 464 | case SID_TC_AOCS: |
|
466 | 465 | i = AOCS; |
|
467 | 466 | break; |
|
468 | 467 | case SID_TC_RPW_INTERNAL: |
|
469 | 468 | i = RPW_INTERNAL; |
|
470 | 469 | break; |
|
471 | 470 | default: |
|
472 | 471 | i = GROUND; |
|
473 | 472 | break; |
|
474 | 473 | } |
|
475 | 474 | |
|
475 | // increment the sequence counter | |
|
476 | if ( sequenceCounters_TC_EXE[ i ] < SEQ_CNT_MAX ) | |
|
477 | { | |
|
478 | sequenceCounters_TC_EXE[ i ] = sequenceCounters_TC_EXE[ i ] + 1; | |
|
479 | } | |
|
480 | else | |
|
481 | { | |
|
482 | sequenceCounters_TC_EXE[ i ] = 0; | |
|
483 | } | |
|
484 | ||
|
476 | 485 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; |
|
477 | 486 | sequence_cnt = sequenceCounters_TC_EXE[ i ] & 0x3fff; |
|
478 | 487 | |
|
479 | 488 | new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ; |
|
480 | 489 | |
|
481 | 490 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); |
|
482 | 491 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); |
|
483 | 492 | |
|
484 | // increment the sequence counter for the next packet | |
|
485 | if ( sequenceCounters_TC_EXE[ i ] < SEQ_CNT_MAX) | |
|
486 | { | |
|
487 | sequenceCounters_TC_EXE[ i ] = sequenceCounters_TC_EXE[ i ] + 1; | |
|
488 | } | |
|
489 | else | |
|
490 | { | |
|
491 | sequenceCounters_TC_EXE[ i ] = 0; | |
|
492 | } | |
|
493 | ||
|
494 | 493 | } |
General Comments 0
You need to be logged in to leave comments.
Login now