@@ -1,248 +1,248 | |||
|
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: Mon Nov 4 07:05:32 2013 | |
|
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=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4= |
|
|
13 | DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=20 -DPRINT_MESSAGES_ON_CONSOLE | |
|
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 |
|
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 | OBJECTS = obj/wf_handler.o \ |
|
57 | 57 | obj/tc_handler.o \ |
|
58 | 58 | obj/fsw_processing.o \ |
|
59 | 59 | obj/fsw_misc.o \ |
|
60 | 60 | obj/fsw_init.o \ |
|
61 | 61 | obj/fsw_globals.o \ |
|
62 | 62 | obj/fsw_spacewire.o \ |
|
63 | 63 | obj/tc_load_dump_parameters.o \ |
|
64 | 64 | obj/tm_lfr_tc_exe.o \ |
|
65 | 65 | obj/tc_acceptance.o |
|
66 | 66 | DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
67 | 67 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
68 | 68 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
69 | 69 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
70 | 70 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
71 | 71 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
72 | 72 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
73 | 73 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
74 | 74 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
75 | 75 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
76 | 76 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
77 | 77 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
78 | 78 | sparc.pri \ |
|
79 | 79 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
80 | 80 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
81 | 81 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
82 | 82 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
83 | 83 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
84 | 84 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
85 | 85 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
86 | 86 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
87 | 87 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
88 | 88 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \ |
|
89 | 89 | fsw-qt.pro |
|
90 | 90 | QMAKE_TARGET = fsw |
|
91 | 91 | DESTDIR = bin/ |
|
92 | 92 | TARGET = bin/fsw |
|
93 | 93 | |
|
94 | 94 | first: all |
|
95 | 95 | ####### Implicit rules |
|
96 | 96 | |
|
97 | 97 | .SUFFIXES: .o .c .cpp .cc .cxx .C |
|
98 | 98 | |
|
99 | 99 | .cpp.o: |
|
100 | 100 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
101 | 101 | |
|
102 | 102 | .cc.o: |
|
103 | 103 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
104 | 104 | |
|
105 | 105 | .cxx.o: |
|
106 | 106 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
107 | 107 | |
|
108 | 108 | .C.o: |
|
109 | 109 | $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" |
|
110 | 110 | |
|
111 | 111 | .c.o: |
|
112 | 112 | $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" |
|
113 | 113 | |
|
114 | 114 | ####### Build rules |
|
115 | 115 | |
|
116 | 116 | all: Makefile $(TARGET) |
|
117 | 117 | |
|
118 | 118 | $(TARGET): $(OBJECTS) |
|
119 | 119 | @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/ |
|
120 | 120 | $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS) |
|
121 | 121 | |
|
122 | 122 | Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \ |
|
123 | 123 | /usr/lib64/qt4/mkspecs/common/linux.conf \ |
|
124 | 124 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf \ |
|
125 | 125 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \ |
|
126 | 126 | /usr/lib64/qt4/mkspecs/common/g++-base.conf \ |
|
127 | 127 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf \ |
|
128 | 128 | /usr/lib64/qt4/mkspecs/qconfig.pri \ |
|
129 | 129 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \ |
|
130 | 130 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf \ |
|
131 | 131 | /usr/lib64/qt4/mkspecs/features/qt_config.prf \ |
|
132 | 132 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \ |
|
133 | 133 | /usr/lib64/qt4/mkspecs/features/default_pre.prf \ |
|
134 | 134 | sparc.pri \ |
|
135 | 135 | /usr/lib64/qt4/mkspecs/features/release.prf \ |
|
136 | 136 | /usr/lib64/qt4/mkspecs/features/default_post.prf \ |
|
137 | 137 | /usr/lib64/qt4/mkspecs/features/shared.prf \ |
|
138 | 138 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \ |
|
139 | 139 | /usr/lib64/qt4/mkspecs/features/warn_on.prf \ |
|
140 | 140 | /usr/lib64/qt4/mkspecs/features/resources.prf \ |
|
141 | 141 | /usr/lib64/qt4/mkspecs/features/uic.prf \ |
|
142 | 142 | /usr/lib64/qt4/mkspecs/features/yacc.prf \ |
|
143 | 143 | /usr/lib64/qt4/mkspecs/features/lex.prf \ |
|
144 | 144 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf |
|
145 | 145 | $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
146 | 146 | /usr/lib64/qt4/mkspecs/common/unix.conf: |
|
147 | 147 | /usr/lib64/qt4/mkspecs/common/linux.conf: |
|
148 | 148 | /usr/lib64/qt4/mkspecs/common/gcc-base.conf: |
|
149 | 149 | /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf: |
|
150 | 150 | /usr/lib64/qt4/mkspecs/common/g++-base.conf: |
|
151 | 151 | /usr/lib64/qt4/mkspecs/common/g++-unix.conf: |
|
152 | 152 | /usr/lib64/qt4/mkspecs/qconfig.pri: |
|
153 | 153 | /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri: |
|
154 | 154 | /usr/lib64/qt4/mkspecs/features/qt_functions.prf: |
|
155 | 155 | /usr/lib64/qt4/mkspecs/features/qt_config.prf: |
|
156 | 156 | /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf: |
|
157 | 157 | /usr/lib64/qt4/mkspecs/features/default_pre.prf: |
|
158 | 158 | sparc.pri: |
|
159 | 159 | /usr/lib64/qt4/mkspecs/features/release.prf: |
|
160 | 160 | /usr/lib64/qt4/mkspecs/features/default_post.prf: |
|
161 | 161 | /usr/lib64/qt4/mkspecs/features/shared.prf: |
|
162 | 162 | /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf: |
|
163 | 163 | /usr/lib64/qt4/mkspecs/features/warn_on.prf: |
|
164 | 164 | /usr/lib64/qt4/mkspecs/features/resources.prf: |
|
165 | 165 | /usr/lib64/qt4/mkspecs/features/uic.prf: |
|
166 | 166 | /usr/lib64/qt4/mkspecs/features/yacc.prf: |
|
167 | 167 | /usr/lib64/qt4/mkspecs/features/lex.prf: |
|
168 | 168 | /usr/lib64/qt4/mkspecs/features/include_source_dir.prf: |
|
169 | 169 | qmake: FORCE |
|
170 | 170 | @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
171 | 171 | |
|
172 | 172 | dist: |
|
173 | 173 | @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0 |
|
174 | 174 | $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0 |
|
175 | 175 | |
|
176 | 176 | |
|
177 | 177 | clean:compiler_clean |
|
178 | 178 | -$(DEL_FILE) $(OBJECTS) |
|
179 | 179 | -$(DEL_FILE) *~ core *.core |
|
180 | 180 | |
|
181 | 181 | |
|
182 | 182 | ####### Sub-libraries |
|
183 | 183 | |
|
184 | 184 | distclean: clean |
|
185 | 185 | -$(DEL_FILE) $(TARGET) |
|
186 | 186 | -$(DEL_FILE) Makefile |
|
187 | 187 | |
|
188 | 188 | |
|
189 | 189 | grmon: |
|
190 | 190 | cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u |
|
191 | 191 | |
|
192 | 192 | check: first |
|
193 | 193 | |
|
194 | 194 | compiler_rcc_make_all: |
|
195 | 195 | compiler_rcc_clean: |
|
196 | 196 | compiler_uic_make_all: |
|
197 | 197 | compiler_uic_clean: |
|
198 | 198 | compiler_image_collection_make_all: qmake_image_collection.cpp |
|
199 | 199 | compiler_image_collection_clean: |
|
200 | 200 | -$(DEL_FILE) qmake_image_collection.cpp |
|
201 | 201 | compiler_yacc_decl_make_all: |
|
202 | 202 | compiler_yacc_decl_clean: |
|
203 | 203 | compiler_yacc_impl_make_all: |
|
204 | 204 | compiler_yacc_impl_clean: |
|
205 | 205 | compiler_lex_make_all: |
|
206 | 206 | compiler_lex_clean: |
|
207 | 207 | compiler_clean: |
|
208 | 208 | |
|
209 | 209 | ####### Compile |
|
210 | 210 | |
|
211 | 211 | obj/wf_handler.o: ../src/wf_handler.c |
|
212 | 212 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c |
|
213 | 213 | |
|
214 | 214 | obj/tc_handler.o: ../src/tc_handler.c |
|
215 | 215 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c |
|
216 | 216 | |
|
217 | 217 | obj/fsw_processing.o: ../src/fsw_processing.c ../src/fsw_processing_globals.c |
|
218 | 218 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c |
|
219 | 219 | |
|
220 | 220 | obj/fsw_misc.o: ../src/fsw_misc.c |
|
221 | 221 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c |
|
222 | 222 | |
|
223 | 223 | obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c |
|
224 | 224 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c |
|
225 | 225 | |
|
226 | 226 | obj/fsw_globals.o: ../src/fsw_globals.c |
|
227 | 227 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c |
|
228 | 228 | |
|
229 | 229 | obj/fsw_spacewire.o: ../src/fsw_spacewire.c |
|
230 | 230 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c |
|
231 | 231 | |
|
232 | 232 | obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c |
|
233 | 233 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c |
|
234 | 234 | |
|
235 | 235 | obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c |
|
236 | 236 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c |
|
237 | 237 | |
|
238 | 238 | obj/tc_acceptance.o: ../src/tc_acceptance.c |
|
239 | 239 | $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c |
|
240 | 240 | |
|
241 | 241 | ####### Install |
|
242 | 242 | |
|
243 | 243 | install: FORCE |
|
244 | 244 | |
|
245 | 245 | uninstall: FORCE |
|
246 | 246 | |
|
247 | 247 | FORCE: |
|
248 | 248 |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -1,74 +1,74 | |||
|
1 | 1 | TEMPLATE = app |
|
2 | 2 | # CONFIG += console v8 sim |
|
3 | 3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** gsa |
|
4 | 4 | CONFIG += console verbose |
|
5 | 5 | CONFIG -= qt |
|
6 | 6 | |
|
7 | 7 | include(./sparc.pri) |
|
8 | 8 | |
|
9 | 9 | # flight software version |
|
10 |
SWVERSION=-0- |
|
|
10 | SWVERSION=-0-20 | |
|
11 | 11 | DEFINES += SW_VERSION_N1=0 |
|
12 | 12 | DEFINES += SW_VERSION_N2=0 |
|
13 | 13 | DEFINES += SW_VERSION_N3=0 |
|
14 |
DEFINES += SW_VERSION_N4= |
|
|
14 | DEFINES += SW_VERSION_N4=20 | |
|
15 | 15 | |
|
16 | 16 | contains( CONFIG, verbose ) { |
|
17 | 17 | DEFINES += PRINT_MESSAGES_ON_CONSOLE |
|
18 | 18 | } |
|
19 | 19 | |
|
20 | 20 | contains( CONFIG, cpu_usage_report ) { |
|
21 | 21 | DEFINES += PRINT_TASK_STATISTICS |
|
22 | 22 | } |
|
23 | 23 | |
|
24 | 24 | contains( CONFIG, stack_report ) { |
|
25 | 25 | DEFINES += PRINT_STACK_REPORT |
|
26 | 26 | } |
|
27 | 27 | |
|
28 | 28 | contains( CONFIG, boot_messages ) { |
|
29 | 29 | DEFINES += BOOT_MESSAGES |
|
30 | 30 | } |
|
31 | 31 | |
|
32 | 32 | #doxygen.target = doxygen |
|
33 | 33 | #doxygen.commands = doxygen ../doc/Doxyfile |
|
34 | 34 | #QMAKE_EXTRA_TARGETS += doxygen |
|
35 | 35 | |
|
36 | 36 | TARGET = fsw |
|
37 | 37 | contains( CONFIG, gsa ) { |
|
38 | 38 | DEFINES += GSA |
|
39 | 39 | TARGET = fsw-gsa |
|
40 | 40 | } |
|
41 | 41 | |
|
42 | 42 | INCLUDEPATH += \ |
|
43 | 43 | ../src \ |
|
44 | 44 | ../header |
|
45 | 45 | |
|
46 | 46 | SOURCES += \ |
|
47 | 47 | ../src/wf_handler.c \ |
|
48 | 48 | ../src/tc_handler.c \ |
|
49 | 49 | ../src/fsw_processing.c \ |
|
50 | 50 | ../src/fsw_misc.c \ |
|
51 | 51 | ../src/fsw_init.c \ |
|
52 | 52 | ../src/fsw_globals.c \ |
|
53 | 53 | ../src/fsw_spacewire.c \ |
|
54 | 54 | ../src/tc_load_dump_parameters.c \ |
|
55 | 55 | ../src/tm_lfr_tc_exe.c \ |
|
56 | 56 | ../src/tc_acceptance.c |
|
57 | 57 | |
|
58 | 58 | |
|
59 | 59 | HEADERS += \ |
|
60 | 60 | ../header/wf_handler.h \ |
|
61 | 61 | ../header/tc_handler.h \ |
|
62 | 62 | ../header/grlib_regs.h \ |
|
63 | 63 | ../header/fsw_processing.h \ |
|
64 | 64 | ../header/fsw_params.h \ |
|
65 | 65 | ../header/fsw_misc.h \ |
|
66 | 66 | ../header/fsw_init.h \ |
|
67 | 67 | ../header/ccsds_types.h \ |
|
68 | 68 | ../header/fsw_params_processing.h \ |
|
69 | 69 | ../header/fsw_spacewire.h \ |
|
70 | 70 | ../header/tm_byte_positions.h \ |
|
71 | 71 | ../header/tc_load_dump_parameters.h \ |
|
72 | 72 | ../header/tm_lfr_tc_exe.h \ |
|
73 | 73 | ../header/tc_acceptance.h |
|
74 | 74 |
@@ -1,305 +1,305 | |||
|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
|
2 | 2 | <!DOCTYPE QtCreatorProject> |
|
3 |
<!-- Written by QtCreator 2.8.0, 2013-1 |
|
|
3 | <!-- Written by QtCreator 2.8.0, 2013-11-04T07:04:49. --> | |
|
4 | 4 | <qtcreator> |
|
5 | 5 | <data> |
|
6 | 6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
7 | 7 | <value type="int">0</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="QString" 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="QString" 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">System</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-Qt 4.8.2 in PATH (System)</value> |
|
55 | 55 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value> |
|
56 | 56 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</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">1</value> |
|
60 | 60 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> |
|
61 | 61 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
62 | 62 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
63 | 63 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
64 | 64 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
65 | 65 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
66 | 66 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
67 | 67 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
68 | 68 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> |
|
69 | 69 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
70 | 70 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
71 | 71 | </valuemap> |
|
72 | 72 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
73 | 73 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
74 | 74 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
75 | 75 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
76 | 76 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
77 | 77 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
78 | 78 | <value type="QString">-w</value> |
|
79 | 79 | <value type="QString">-r</value> |
|
80 | 80 | </valuelist> |
|
81 | 81 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
82 | 82 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w -j 4</value> |
|
83 | 83 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
84 | 84 | </valuemap> |
|
85 | 85 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
86 | 86 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
87 | 87 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
88 | 88 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
89 | 89 | </valuemap> |
|
90 | 90 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
91 | 91 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
92 | 92 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
93 | 93 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
94 | 94 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
95 | 95 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
96 | 96 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
97 | 97 | <value type="QString">-w</value> |
|
98 | 98 | <value type="QString">-r</value> |
|
99 | 99 | </valuelist> |
|
100 | 100 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
101 | 101 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value> |
|
102 | 102 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
103 | 103 | </valuemap> |
|
104 | 104 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
105 | 105 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
106 | 106 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
107 | 107 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
108 | 108 | </valuemap> |
|
109 | 109 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
110 | 110 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
111 | 111 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
112 | 112 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value> |
|
113 | 113 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
114 | 114 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
115 | 115 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> |
|
116 | 116 | <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value> |
|
117 | 117 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value> |
|
118 | 118 | </valuemap> |
|
119 | 119 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> |
|
120 | 120 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
121 | 121 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
122 | 122 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
123 | 123 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value> |
|
124 | 124 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
125 | 125 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value> |
|
126 | 126 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value> |
|
127 | 127 | <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value> |
|
128 | 128 | <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value> |
|
129 | 129 | <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value> |
|
130 | 130 | </valuemap> |
|
131 | 131 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1"> |
|
132 | 132 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
133 | 133 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
134 | 134 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
135 | 135 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
136 | 136 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
137 | 137 | <value type="QString">-w</value> |
|
138 | 138 | <value type="QString">-r</value> |
|
139 | 139 | </valuelist> |
|
140 | 140 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value> |
|
141 | 141 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w </value> |
|
142 | 142 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
143 | 143 | </valuemap> |
|
144 | 144 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value> |
|
145 | 145 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value> |
|
146 | 146 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
147 | 147 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value> |
|
148 | 148 | </valuemap> |
|
149 | 149 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1"> |
|
150 | 150 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> |
|
151 | 151 | <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> |
|
152 | 152 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value> |
|
153 | 153 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
154 | 154 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value> |
|
155 | 155 | <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"> |
|
156 | 156 | <value type="QString">-w</value> |
|
157 | 157 | <value type="QString">-r</value> |
|
158 | 158 | </valuelist> |
|
159 | 159 | <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value> |
|
160 | 160 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value> |
|
161 | 161 | <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value> |
|
162 | 162 | </valuemap> |
|
163 | 163 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value> |
|
164 | 164 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value> |
|
165 | 165 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
166 | 166 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value> |
|
167 | 167 | </valuemap> |
|
168 | 168 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value> |
|
169 | 169 | <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value> |
|
170 | 170 | <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/> |
|
171 | 171 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value> |
|
172 | 172 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
173 | 173 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value> |
|
174 | 174 | <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> |
|
175 | 175 | <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value> |
|
176 | 176 | <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value> |
|
177 | 177 | </valuemap> |
|
178 | 178 | <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value> |
|
179 | 179 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0"> |
|
180 | 180 | <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> |
|
181 | 181 | <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value> |
|
182 | 182 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value> |
|
183 | 183 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
184 | 184 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value> |
|
185 | 185 | </valuemap> |
|
186 | 186 | <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value> |
|
187 | 187 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value> |
|
188 | 188 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
189 | 189 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value> |
|
190 | 190 | </valuemap> |
|
191 | 191 | <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value> |
|
192 | 192 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/> |
|
193 | 193 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0"> |
|
194 | 194 | <value type="bool" key="Analyzer.Project.UseGlobal">true</value> |
|
195 | 195 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
196 | 196 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
197 | 197 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
198 | 198 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
199 | 199 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
200 | 200 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
201 | 201 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
202 | 202 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
203 | 203 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
204 | 204 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
205 | 205 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
206 | 206 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
207 | 207 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
208 | 208 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
209 | 209 | <value type="int">0</value> |
|
210 | 210 | <value type="int">1</value> |
|
211 | 211 | <value type="int">2</value> |
|
212 | 212 | <value type="int">3</value> |
|
213 | 213 | <value type="int">4</value> |
|
214 | 214 | <value type="int">5</value> |
|
215 | 215 | <value type="int">6</value> |
|
216 | 216 | <value type="int">7</value> |
|
217 | 217 | <value type="int">8</value> |
|
218 | 218 | <value type="int">9</value> |
|
219 | 219 | <value type="int">10</value> |
|
220 | 220 | <value type="int">11</value> |
|
221 | 221 | <value type="int">12</value> |
|
222 | 222 | <value type="int">13</value> |
|
223 | 223 | <value type="int">14</value> |
|
224 | 224 | </valuelist> |
|
225 | 225 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
226 | 226 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
227 | 227 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value> |
|
228 | 228 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
229 | 229 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value> |
|
230 | 230 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value> |
|
231 | 231 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value> |
|
232 | 232 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value> |
|
233 | 233 | <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value> |
|
234 | 234 | <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value> |
|
235 | 235 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
236 | 236 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> |
|
237 | 237 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> |
|
238 | 238 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
239 | 239 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
240 | 240 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value> |
|
241 | 241 | </valuemap> |
|
242 | 242 | <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1"> |
|
243 | 243 | <value type="bool" key="Analyzer.Project.UseGlobal">true</value> |
|
244 | 244 | <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/> |
|
245 | 245 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value> |
|
246 | 246 | <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value> |
|
247 | 247 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value> |
|
248 | 248 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value> |
|
249 | 249 | <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value> |
|
250 | 250 | <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value> |
|
251 | 251 | <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value> |
|
252 | 252 | <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value> |
|
253 | 253 | <value type="int" key="Analyzer.Valgrind.NumCallers">25</value> |
|
254 | 254 | <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/> |
|
255 | 255 | <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value> |
|
256 | 256 | <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value> |
|
257 | 257 | <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds"> |
|
258 | 258 | <value type="int">0</value> |
|
259 | 259 | <value type="int">1</value> |
|
260 | 260 | <value type="int">2</value> |
|
261 | 261 | <value type="int">3</value> |
|
262 | 262 | <value type="int">4</value> |
|
263 | 263 | <value type="int">5</value> |
|
264 | 264 | <value type="int">6</value> |
|
265 | 265 | <value type="int">7</value> |
|
266 | 266 | <value type="int">8</value> |
|
267 | 267 | <value type="int">9</value> |
|
268 | 268 | <value type="int">10</value> |
|
269 | 269 | <value type="int">11</value> |
|
270 | 270 | <value type="int">12</value> |
|
271 | 271 | <value type="int">13</value> |
|
272 | 272 | <value type="int">14</value> |
|
273 | 273 | </valuelist> |
|
274 | 274 | <value type="int" key="PE.EnvironmentAspect.Base">2</value> |
|
275 | 275 | <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> |
|
276 | 276 | <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value> |
|
277 | 277 | <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">doxygen</value> |
|
278 | 278 | <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">true</value> |
|
279 | 279 | <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">/opt/DEV_PLE/doc</value> |
|
280 | 280 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run doxygen</value> |
|
281 | 281 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value> |
|
282 | 282 | <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value> |
|
283 | 283 | <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value> |
|
284 | 284 | <value type="bool" key="RunConfiguration.UseCppDebugger">true</value> |
|
285 | 285 | <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value> |
|
286 | 286 | <value type="bool" key="RunConfiguration.UseMultiProcess">false</value> |
|
287 | 287 | <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> |
|
288 | 288 | <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> |
|
289 | 289 | </valuemap> |
|
290 | 290 | <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">2</value> |
|
291 | 291 | </valuemap> |
|
292 | 292 | </data> |
|
293 | 293 | <data> |
|
294 | 294 | <variable>ProjectExplorer.Project.TargetCount</variable> |
|
295 | 295 | <value type="int">1</value> |
|
296 | 296 | </data> |
|
297 | 297 | <data> |
|
298 | 298 | <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable> |
|
299 | 299 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> |
|
300 | 300 | </data> |
|
301 | 301 | <data> |
|
302 | 302 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> |
|
303 | 303 | <value type="int">14</value> |
|
304 | 304 | </data> |
|
305 | 305 | </qtcreator> |
@@ -1,641 +1,643 | |||
|
1 | 1 | #ifndef CCSDS_TYPES_H_INCLUDED |
|
2 | 2 | #define CCSDS_TYPES_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #define CCSDS_PROTOCOLE_EXTRA_BYTES 4 |
|
5 | 5 | #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4 |
|
6 | 6 | #define CCSDS_TM_PKT_MAX_SIZE 4412 |
|
7 | 7 | #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4 |
|
8 | 8 | #define CCSDS_TC_PKT_MAX_SIZE 256 |
|
9 | 9 | #define CCSDS_TC_PKT_MIN_SIZE 16 |
|
10 | 10 | #define CCSDS_TC_TM_PACKET_OFFSET 7 |
|
11 | 11 | #define CCSDS_PROCESS_ID 76 |
|
12 | 12 | #define CCSDS_PACKET_CATEGORY 12 |
|
13 | 13 | #define CCSDS_NODE_ADDRESS 0xfe |
|
14 | 14 | #define CCSDS_USER_APP 0x00 |
|
15 | 15 | |
|
16 | 16 | #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10 |
|
17 | 17 | #define DEFAULT_RESERVED 0x00 |
|
18 | 18 | #define DEFAULT_HKBIA 0x1e // 0001 1110 |
|
19 | 19 | |
|
20 | 20 | // PACKET ID |
|
21 | 21 | #define TM_PACKET_ID_TC_EXE 0x0cc1 // PID 76 CAT 1 |
|
22 | 22 | #define TM_PACKET_ID_HK 0x0cc4 // PID 76 CAT 4 |
|
23 | 23 | #define TM_PACKET_ID_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9 |
|
24 | 24 | #define TM_PACKET_ID_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12 |
|
25 | 25 | #define TM_PACKET_ID_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12 |
|
26 | 26 | #define TM_PACKET_PID_DEFAULT 76 |
|
27 | 27 | #define TM_PACKET_PID_BURST_SBM1_SBM2 79 |
|
28 | 28 | #define TM_PACKET_CAT_TC_EXE 1 |
|
29 | 29 | #define TM_PACKET_CAT_HK 4 |
|
30 | 30 | #define TM_PACKET_CAT_PARAMETER_DUMP 9 |
|
31 | 31 | #define TM_PACKET_CAT_SCIENCE 12 |
|
32 | 32 | |
|
33 | 33 | // PACKET SEQUENCE CONTROL |
|
34 | 34 | #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000] |
|
35 | 35 | #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000] |
|
36 | 36 | #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000] |
|
37 | 37 | #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000] |
|
38 | 38 | #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000] |
|
39 | 39 | |
|
40 | 40 | // DESTINATION ID |
|
41 | 41 | #define TM_DESTINATION_ID_GROUND 0 |
|
42 | 42 | #define TM_DESTINATION_ID_MISSION_TIMELINE 110 |
|
43 | 43 | #define TM_DESTINATION_ID_TC_SEQUENCES 111 |
|
44 | 44 | #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112 |
|
45 | 45 | #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113 |
|
46 | 46 | #define TM_DESTINATION_ID_DIRECT_CMD 120 |
|
47 | 47 | #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121 |
|
48 | 48 | #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122 |
|
49 | 49 | #define TM_DESTINATION_ID_OBCP 15 |
|
50 | 50 | #define TM_DESTINATION_ID_SYSTEM_CONTROL 14 |
|
51 | 51 | #define TM_DESTINATION_ID_AOCS 11 |
|
52 | 52 | |
|
53 | 53 | #define CCSDS_DESTINATION_ID 0x01 |
|
54 | 54 | #define CCSDS_PROTOCOLE_ID 0x02 |
|
55 | 55 | #define CCSDS_RESERVED 0x00 |
|
56 | 56 | #define CCSDS_USER_APP 0x00 |
|
57 | 57 | |
|
58 | 58 | #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24 |
|
59 | 59 | #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32 |
|
60 | 60 | #define SIZE_HK_PARAMETERS 112 |
|
61 | 61 | |
|
62 | 62 | // TC TYPES |
|
63 | 63 | #define TC_TYPE_GEN 181 |
|
64 | 64 | #define TC_TYPE_TIME 9 |
|
65 | 65 | |
|
66 | 66 | // TC SUBTYPES |
|
67 | 67 | #define TC_SUBTYPE_RESET 1 |
|
68 | 68 | #define TC_SUBTYPE_LOAD_COMM 11 |
|
69 | 69 | #define TC_SUBTYPE_LOAD_NORM 13 |
|
70 | 70 | #define TC_SUBTYPE_LOAD_BURST 19 |
|
71 | 71 | #define TC_SUBTYPE_LOAD_SBM1 25 |
|
72 | 72 | #define TC_SUBTYPE_LOAD_SBM2 27 |
|
73 | 73 | #define TC_SUBTYPE_DUMP 31 |
|
74 | 74 | #define TC_SUBTYPE_ENTER 41 |
|
75 | 75 | #define TC_SUBTYPE_UPDT_INFO 51 |
|
76 | 76 | #define TC_SUBTYPE_EN_CAL 61 |
|
77 | 77 | #define TC_SUBTYPE_DIS_CAL 63 |
|
78 | 78 | #define TC_SUBTYPE_UPDT_TIME 129 |
|
79 | 79 | |
|
80 | 80 | // TC LEN |
|
81 | 81 | #define TC_LEN_RESET 12 |
|
82 | 82 | #define TC_LEN_LOAD_COMM 14 |
|
83 | 83 | #define TC_LEN_LOAD_NORM 20 |
|
84 | 84 | #define TC_LEN_LOAD_BURST 14 |
|
85 | 85 | #define TC_LEN_LOAD_SBM1 14 |
|
86 | 86 | #define TC_LEN_LOAD_SBM2 14 |
|
87 | 87 | #define TC_LEN_DUMP 12 |
|
88 | 88 | #define TC_LEN_ENTER 20 |
|
89 | 89 | #define TC_LEN_UPDT_INFO 48 |
|
90 | 90 | #define TC_LEN_EN_CAL 12 |
|
91 | 91 | #define TC_LEN_DIS_CAL 12 |
|
92 | 92 | #define TC_LEN_UPDT_TIME 18 |
|
93 | 93 | |
|
94 | 94 | // TM TYPES |
|
95 | 95 | #define TM_TYPE_TC_EXE 1 |
|
96 | 96 | #define TM_TYPE_HK 3 |
|
97 | 97 | #define TM_TYPE_PARAMETER_DUMP 3 |
|
98 | 98 | #define TM_TYPE_LFR_SCIENCE 21 |
|
99 | 99 | |
|
100 | 100 | // TM SUBTYPES |
|
101 | 101 | #define TM_SUBTYPE_EXE_OK 7 |
|
102 | 102 | #define TM_SUBTYPE_EXE_NOK 8 |
|
103 | 103 | #define TM_SUBTYPE_HK 25 |
|
104 | 104 | #define TM_SUBTYPE_PARAMETER_DUMP 25 |
|
105 | 105 | #define TM_SUBTYPE_SCIENCE 3 |
|
106 | 106 | #define TM_SUBTYPE_LFR_SCIENCE 3 |
|
107 | 107 | |
|
108 | 108 | // FAILURE CODES |
|
109 | 109 | #define ILLEGAL_APID 0 |
|
110 |
#define WRONG_LEN_P |
|
|
110 | #define WRONG_LEN_PKT 1 | |
|
111 | 111 | #define INCOR_CHECKSUM 2 |
|
112 | 112 | #define ILL_TYPE 3 |
|
113 | 113 | #define ILL_SUBTYPE 4 |
|
114 | 114 |
#define WRONG_APP_DATA 5 |
|
115 | // | |
|
116 | #define CCSDS_TM_VALID 7 | |
|
117 | 115 | #define TC_NOT_EXE 42000 // 0xa4 0x10 |
|
116 | #define WRONG_SRC_ID 42001 // 0xa4 0x11 | |
|
118 | 117 | #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12 |
|
119 | 118 | #define FAIL_DETECTED 42003 // 0xa4 0x13 |
|
119 | #define NOT_ALLOWED 42004 // 0xa4 0x14 | |
|
120 | 120 | #define CORRUPTED 42005 // 0xa4 0x15 |
|
121 | #define CCSDS_TM_VALID 7 | |
|
121 | 122 | |
|
123 | // TC SID | |
|
122 | 124 | #define SID_TC_DEFAULT 0 // the default SID for TC sent to the LFR |
|
123 | 125 | #define SID_TC_GROUND 0 |
|
124 | 126 | #define SID_TC_MISSION_TIMELINE 110 |
|
125 | 127 | #define SID_TC_TC_SEQUENCES 111 |
|
126 | 128 | #define SID_TC_RECOVERY_ACTION_CMD 112 |
|
127 | 129 | #define SID_TC_BACKUP_MISSION_TIMELINE 113 |
|
128 | 130 | #define SID_TC_DIRECT_CMD 120 |
|
129 | 131 | #define SID_TC_SPARE_GRD_SRC1 121 |
|
130 | 132 | #define SID_TC_SPARE_GRD_SRC2 122 |
|
131 | 133 | #define SID_TC_OBCP 15 |
|
132 | 134 | #define SID_TC_SYSTEM_CONTROL 14 |
|
133 | 135 | #define SID_TC_AOCS 11 |
|
134 | 136 | #define SID_TC_RPW_INTERNAL 254 |
|
135 | 137 | |
|
136 | 138 | // TM SID |
|
137 | 139 | #define SID_HK 1 |
|
138 | 140 | #define SID_PARAMETER_DUMP 10 |
|
139 | 141 | |
|
140 | 142 | #define SID_NORM_SWF_F0 3 |
|
141 | 143 | #define SID_NORM_SWF_F1 4 |
|
142 | 144 | #define SID_NORM_SWF_F2 5 |
|
143 | 145 | #define SID_NORM_CWF_F3 1 |
|
144 | 146 | #define SID_BURST_CWF_F2 2 |
|
145 | 147 | #define SID_SBM1_CWF_F1 24 |
|
146 | 148 | #define SID_SBM2_CWF_F2 25 |
|
147 | 149 | #define SID_NORM_ASM_F0 11 |
|
148 | 150 | #define SID_NORM_ASM_F1 12 |
|
149 | 151 | #define SID_NORM_ASM_F2 13 |
|
150 | 152 | #define SID_NORM_BP1_F0 14 |
|
151 | 153 | #define SID_NORM_BP1_F1 15 |
|
152 | 154 | #define SID_NORM_BP1_F2 16 |
|
153 | 155 | #define SID_NORM_BP2_F0 19 |
|
154 | 156 | #define SID_NORM_BP2_F1 20 |
|
155 | 157 | #define SID_NORM_BP2_F2 21 |
|
156 | 158 | #define SID_BURST_BP1_F0 17 |
|
157 | 159 | #define SID_BURST_BP2_F0 22 |
|
158 | 160 | #define SID_BURST_BP1_F1 18 |
|
159 | 161 | #define SID_BURST_BP2_F1 23 |
|
160 | 162 | #define SID_SBM1_BP1_F0 28 |
|
161 | 163 | #define SID_SBM1_BP2_F0 31 |
|
162 | 164 | #define SID_SBM2_BP1_F0 29 |
|
163 | 165 | #define SID_SBM2_BP2_F0 32 |
|
164 | 166 | #define SID_SBM2_BP1_F1 30 |
|
165 | 167 | #define SID_SBM2_BP2_F1 33 |
|
166 | 168 | |
|
167 | 169 | // LENGTH (BYTES) |
|
168 | 170 | #define LENGTH_TM_LFR_TC_EXE_MAX 32 |
|
169 | 171 | #define LENGTH_TM_LFR_HK 126 |
|
170 | 172 | |
|
171 | 173 | // HEADER_LENGTH |
|
172 | 174 | #define TM_HEADER_LEN 16 |
|
173 | 175 | #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28 |
|
174 | 176 | // PACKET_LENGTH |
|
175 | 177 | #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET) |
|
176 | 178 | #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET) |
|
177 | 179 | #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET) |
|
178 | 180 | #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET) |
|
179 | 181 | #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET) |
|
180 | 182 | #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET) |
|
181 | 183 | #define PACKET_LENGTH_HK (126 - CCSDS_TC_TM_PACKET_OFFSET) |
|
182 | 184 | #define PACKET_LENGTH_PARAMETER_DUMP (34 - CCSDS_TC_TM_PACKET_OFFSET) |
|
183 | 185 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM (TOTAL_SIZE_SM + HEADER_LENGTH_TM_LFR_SCIENCE_ASM - CCSDS_TC_TM_PACKET_OFFSET) |
|
184 | 186 | |
|
185 | 187 | #define SPARE1_PUSVERSION_SPARE2 0x10 |
|
186 | 188 | |
|
187 | 189 | #define LEN_TM_LFR_HK 130 // 126 + 4 |
|
188 | 190 | #define LEN_TM_LFR_TC_EXE_NOT_IMP 28 // 24 + 4 |
|
189 | 191 | |
|
190 | 192 | #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1 |
|
191 | 193 | #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1 |
|
192 | 194 | #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1 |
|
193 | 195 | #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1 |
|
194 | 196 | #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1 |
|
195 | 197 | #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1 |
|
196 | 198 | #define DEFAULT_PKTCNT 0x07 |
|
197 | 199 | #define BLK_NR_340 0x0154 |
|
198 | 200 | #define BLK_NR_8 0x0008 |
|
199 | 201 | |
|
200 | 202 | enum TM_TYPE{ |
|
201 | 203 | TM_LFR_TC_EXE_OK, |
|
202 | 204 | TM_LFR_TC_EXE_ERR, |
|
203 | 205 | TM_LFR_HK, |
|
204 | 206 | TM_LFR_SCI, |
|
205 | 207 | TM_LFR_SCI_SBM, |
|
206 | 208 | TM_LFR_PAR_DUMP |
|
207 | 209 | }; |
|
208 | 210 | |
|
209 | 211 | struct TMHeader_str |
|
210 | 212 | { |
|
211 | 213 | volatile unsigned char targetLogicalAddress; |
|
212 | 214 | volatile unsigned char protocolIdentifier; |
|
213 | 215 | volatile unsigned char reserved; |
|
214 | 216 | volatile unsigned char userApplication; |
|
215 | 217 | volatile unsigned char packetID[2]; |
|
216 | 218 | volatile unsigned char packetSequenceControl[2]; |
|
217 | 219 | volatile unsigned char packetLength[2]; |
|
218 | 220 | // DATA FIELD HEADER |
|
219 | 221 | volatile unsigned char spare1_pusVersion_spare2; |
|
220 | 222 | volatile unsigned char serviceType; |
|
221 | 223 | volatile unsigned char serviceSubType; |
|
222 | 224 | volatile unsigned char destinationID; |
|
223 | 225 | volatile unsigned char time[6]; |
|
224 | 226 | }; |
|
225 | 227 | typedef struct TMHeader_str TMHeader_t; |
|
226 | 228 | |
|
227 | 229 | struct Packet_TM_LFR_TC_EXE_str |
|
228 | 230 | { |
|
229 | 231 | volatile unsigned char targetLogicalAddress; |
|
230 | 232 | volatile unsigned char protocolIdentifier; |
|
231 | 233 | volatile unsigned char reserved; |
|
232 | 234 | volatile unsigned char userApplication; |
|
233 | 235 | volatile unsigned char packetID[2]; |
|
234 | 236 | volatile unsigned char packetSequenceControl[2]; |
|
235 | 237 | volatile unsigned char packetLength[2]; |
|
236 | 238 | // DATA FIELD HEADER |
|
237 | 239 | volatile unsigned char spare1_pusVersion_spare2; |
|
238 | 240 | volatile unsigned char serviceType; |
|
239 | 241 | volatile unsigned char serviceSubType; |
|
240 | 242 | volatile unsigned char destinationID; |
|
241 | 243 | volatile unsigned char time[6]; |
|
242 | 244 | volatile unsigned char data[LENGTH_TM_LFR_TC_EXE_MAX - 10 + 1]; |
|
243 | 245 | }; |
|
244 | 246 | typedef struct Packet_TM_LFR_TC_EXE_str Packet_TM_LFR_TC_EXE_t; |
|
245 | 247 | |
|
246 | 248 | struct Packet_TM_LFR_TC_EXE_SUCCESS_str |
|
247 | 249 | { |
|
248 | 250 | volatile unsigned char targetLogicalAddress; |
|
249 | 251 | volatile unsigned char protocolIdentifier; |
|
250 | 252 | volatile unsigned char reserved; |
|
251 | 253 | volatile unsigned char userApplication; |
|
252 | 254 | // PACKET HEADER |
|
253 | 255 | volatile unsigned char packetID[2]; |
|
254 | 256 | volatile unsigned char packetSequenceControl[2]; |
|
255 | 257 | volatile unsigned char packetLength[2]; |
|
256 | 258 | // DATA FIELD HEADER |
|
257 | 259 | volatile unsigned char spare1_pusVersion_spare2; |
|
258 | 260 | volatile unsigned char serviceType; |
|
259 | 261 | volatile unsigned char serviceSubType; |
|
260 | 262 | volatile unsigned char destinationID; |
|
261 | 263 | volatile unsigned char time[6]; |
|
262 | 264 | // |
|
263 | 265 | volatile unsigned char telecommand_pkt_id[2]; |
|
264 | 266 | volatile unsigned char pkt_seq_control[2]; |
|
265 | 267 | }; |
|
266 | 268 | typedef struct Packet_TM_LFR_TC_EXE_SUCCESS_str Packet_TM_LFR_TC_EXE_SUCCESS_t; |
|
267 | 269 | |
|
268 | 270 | struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str |
|
269 | 271 | { |
|
270 | 272 | volatile unsigned char targetLogicalAddress; |
|
271 | 273 | volatile unsigned char protocolIdentifier; |
|
272 | 274 | volatile unsigned char reserved; |
|
273 | 275 | volatile unsigned char userApplication; |
|
274 | 276 | // PACKET HEADER |
|
275 | 277 | volatile unsigned char packetID[2]; |
|
276 | 278 | volatile unsigned char packetSequenceControl[2]; |
|
277 | 279 | volatile unsigned char packetLength[2]; |
|
278 | 280 | // DATA FIELD HEADER |
|
279 | 281 | volatile unsigned char spare1_pusVersion_spare2; |
|
280 | 282 | volatile unsigned char serviceType; |
|
281 | 283 | volatile unsigned char serviceSubType; |
|
282 | 284 | volatile unsigned char destinationID; |
|
283 | 285 | volatile unsigned char time[6]; |
|
284 | 286 | // |
|
285 | 287 | volatile unsigned char tc_failure_code[2]; |
|
286 | 288 | volatile unsigned char telecommand_pkt_id[2]; |
|
287 | 289 | volatile unsigned char pkt_seq_control[2]; |
|
288 | 290 | volatile unsigned char tc_service; |
|
289 | 291 | volatile unsigned char tc_subtype; |
|
290 | 292 | volatile unsigned char byte_position; |
|
291 | 293 | volatile unsigned char rcv_value; |
|
292 | 294 | }; |
|
293 | 295 | typedef struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str Packet_TM_LFR_TC_EXE_INCONSISTENT_t; |
|
294 | 296 | |
|
295 | 297 | struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str |
|
296 | 298 | { |
|
297 | 299 | volatile unsigned char targetLogicalAddress; |
|
298 | 300 | volatile unsigned char protocolIdentifier; |
|
299 | 301 | volatile unsigned char reserved; |
|
300 | 302 | volatile unsigned char userApplication; |
|
301 | 303 | // PACKET HEADER |
|
302 | 304 | volatile unsigned char packetID[2]; |
|
303 | 305 | volatile unsigned char packetSequenceControl[2]; |
|
304 | 306 | volatile unsigned char packetLength[2]; |
|
305 | 307 | // DATA FIELD HEADER |
|
306 | 308 | volatile unsigned char spare1_pusVersion_spare2; |
|
307 | 309 | volatile unsigned char serviceType; |
|
308 | 310 | volatile unsigned char serviceSubType; |
|
309 | 311 | volatile unsigned char destinationID; |
|
310 | 312 | volatile unsigned char time[6]; |
|
311 | 313 | // |
|
312 | 314 | volatile unsigned char tc_failure_code[2]; |
|
313 | 315 | volatile unsigned char telecommand_pkt_id[2]; |
|
314 | 316 | volatile unsigned char pkt_seq_control[2]; |
|
315 | 317 | volatile unsigned char tc_service; |
|
316 | 318 | volatile unsigned char tc_subtype; |
|
317 | 319 | volatile unsigned char lfr_status_word[2]; |
|
318 | 320 | }; |
|
319 | 321 | typedef struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t; |
|
320 | 322 | |
|
321 | 323 | struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str |
|
322 | 324 | { |
|
323 | 325 | volatile unsigned char targetLogicalAddress; |
|
324 | 326 | volatile unsigned char protocolIdentifier; |
|
325 | 327 | volatile unsigned char reserved; |
|
326 | 328 | volatile unsigned char userApplication; |
|
327 | 329 | // PACKET HEADER |
|
328 | 330 | volatile unsigned char packetID[2]; |
|
329 | 331 | volatile unsigned char packetSequenceControl[2]; |
|
330 | 332 | volatile unsigned char packetLength[2]; |
|
331 | 333 | // DATA FIELD HEADER |
|
332 | 334 | volatile unsigned char spare1_pusVersion_spare2; |
|
333 | 335 | volatile unsigned char serviceType; |
|
334 | 336 | volatile unsigned char serviceSubType; |
|
335 | 337 | volatile unsigned char destinationID; |
|
336 | 338 | volatile unsigned char time[6]; |
|
337 | 339 | // |
|
338 | 340 | volatile unsigned char tc_failure_code[2]; |
|
339 | 341 | volatile unsigned char telecommand_pkt_id[2]; |
|
340 | 342 | volatile unsigned char pkt_seq_control[2]; |
|
341 | 343 | volatile unsigned char tc_service; |
|
342 | 344 | volatile unsigned char tc_subtype; |
|
343 | 345 | }; |
|
344 | 346 | typedef struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t; |
|
345 | 347 | |
|
346 | 348 | struct Packet_TM_LFR_TC_EXE_ERROR_str |
|
347 | 349 | { |
|
348 | 350 | volatile unsigned char targetLogicalAddress; |
|
349 | 351 | volatile unsigned char protocolIdentifier; |
|
350 | 352 | volatile unsigned char reserved; |
|
351 | 353 | volatile unsigned char userApplication; |
|
352 | 354 | // PACKET HEADER |
|
353 | 355 | volatile unsigned char packetID[2]; |
|
354 | 356 | volatile unsigned char packetSequenceControl[2]; |
|
355 | 357 | volatile unsigned char packetLength[2]; |
|
356 | 358 | // DATA FIELD HEADER |
|
357 | 359 | volatile unsigned char spare1_pusVersion_spare2; |
|
358 | 360 | volatile unsigned char serviceType; |
|
359 | 361 | volatile unsigned char serviceSubType; |
|
360 | 362 | volatile unsigned char destinationID; |
|
361 | 363 | volatile unsigned char time[6]; |
|
362 | 364 | // |
|
363 | 365 | volatile unsigned char tc_failure_code[2]; |
|
364 | 366 | volatile unsigned char telecommand_pkt_id[2]; |
|
365 | 367 | volatile unsigned char pkt_seq_control[2]; |
|
366 | 368 | volatile unsigned char tc_service; |
|
367 | 369 | volatile unsigned char tc_subtype; |
|
368 | 370 | }; |
|
369 | 371 | typedef struct Packet_TM_LFR_TC_EXE_ERROR_str Packet_TM_LFR_TC_EXE_ERROR_t; |
|
370 | 372 | |
|
371 | 373 | struct Packet_TM_LFR_TC_EXE_CORRUPTED_str |
|
372 | 374 | { |
|
373 | 375 | volatile unsigned char targetLogicalAddress; |
|
374 | 376 | volatile unsigned char protocolIdentifier; |
|
375 | 377 | volatile unsigned char reserved; |
|
376 | 378 | volatile unsigned char userApplication; |
|
377 | 379 | // PACKET HEADER |
|
378 | 380 | volatile unsigned char packetID[2]; |
|
379 | 381 | volatile unsigned char packetSequenceControl[2]; |
|
380 | 382 | volatile unsigned char packetLength[2]; |
|
381 | 383 | // DATA FIELD HEADER |
|
382 | 384 | volatile unsigned char spare1_pusVersion_spare2; |
|
383 | 385 | volatile unsigned char serviceType; |
|
384 | 386 | volatile unsigned char serviceSubType; |
|
385 | 387 | volatile unsigned char destinationID; |
|
386 | 388 | volatile unsigned char time[6]; |
|
387 | 389 | // |
|
388 | 390 | volatile unsigned char tc_failure_code[2]; |
|
389 | 391 | volatile unsigned char telecommand_pkt_id[2]; |
|
390 | 392 | volatile unsigned char pkt_seq_control[2]; |
|
391 | 393 | volatile unsigned char tc_service; |
|
392 | 394 | volatile unsigned char tc_subtype; |
|
393 | 395 | volatile unsigned char pkt_len_rcv_value[2]; |
|
394 | 396 | volatile unsigned char pkt_datafieldsize_cnt[2]; |
|
395 | 397 | volatile unsigned char rcv_crc[2]; |
|
396 | 398 | volatile unsigned char computed_crc[2]; |
|
397 | 399 | }; |
|
398 | 400 | typedef struct Packet_TM_LFR_TC_EXE_CORRUPTED_str Packet_TM_LFR_TC_EXE_CORRUPTED_t; |
|
399 | 401 | |
|
400 | 402 | struct Header_TM_LFR_SCIENCE_SWF_str |
|
401 | 403 | { |
|
402 | 404 | volatile unsigned char targetLogicalAddress; |
|
403 | 405 | volatile unsigned char protocolIdentifier; |
|
404 | 406 | volatile unsigned char reserved; |
|
405 | 407 | volatile unsigned char userApplication; |
|
406 | 408 | volatile unsigned char packetID[2]; |
|
407 | 409 | volatile unsigned char packetSequenceControl[2]; |
|
408 | 410 | volatile unsigned char packetLength[2]; |
|
409 | 411 | // DATA FIELD HEADER |
|
410 | 412 | volatile unsigned char spare1_pusVersion_spare2; |
|
411 | 413 | volatile unsigned char serviceType; |
|
412 | 414 | volatile unsigned char serviceSubType; |
|
413 | 415 | volatile unsigned char destinationID; |
|
414 | 416 | volatile unsigned char time[6]; |
|
415 | 417 | // AUXILIARY HEADER |
|
416 | 418 | volatile unsigned char sid; |
|
417 | 419 | volatile unsigned char hkBIA; |
|
418 | 420 | volatile unsigned char pktCnt; |
|
419 | 421 | volatile unsigned char pktNr; |
|
420 | 422 | volatile unsigned char acquisitionTime[6]; |
|
421 | 423 | volatile unsigned char blkNr[2]; |
|
422 | 424 | }; |
|
423 | 425 | typedef struct Header_TM_LFR_SCIENCE_SWF_str Header_TM_LFR_SCIENCE_SWF_t; |
|
424 | 426 | |
|
425 | 427 | struct Header_TM_LFR_SCIENCE_CWF_str |
|
426 | 428 | { |
|
427 | 429 | volatile unsigned char targetLogicalAddress; |
|
428 | 430 | volatile unsigned char protocolIdentifier; |
|
429 | 431 | volatile unsigned char reserved; |
|
430 | 432 | volatile unsigned char userApplication; |
|
431 | 433 | volatile unsigned char packetID[2]; |
|
432 | 434 | volatile unsigned char packetSequenceControl[2]; |
|
433 | 435 | volatile unsigned char packetLength[2]; |
|
434 | 436 | // DATA FIELD HEADER |
|
435 | 437 | volatile unsigned char spare1_pusVersion_spare2; |
|
436 | 438 | volatile unsigned char serviceType; |
|
437 | 439 | volatile unsigned char serviceSubType; |
|
438 | 440 | volatile unsigned char destinationID; |
|
439 | 441 | volatile unsigned char time[6]; |
|
440 | 442 | // AUXILIARY DATA HEADER |
|
441 | 443 | volatile unsigned char sid; |
|
442 | 444 | volatile unsigned char hkBIA; |
|
443 | 445 | volatile unsigned char acquisitionTime[6]; |
|
444 | 446 | volatile unsigned char blkNr[2]; |
|
445 | 447 | }; |
|
446 | 448 | typedef struct Header_TM_LFR_SCIENCE_CWF_str Header_TM_LFR_SCIENCE_CWF_t; |
|
447 | 449 | |
|
448 | 450 | struct Header_TM_LFR_SCIENCE_ASM_str |
|
449 | 451 | { |
|
450 | 452 | volatile unsigned char targetLogicalAddress; |
|
451 | 453 | volatile unsigned char protocolIdentifier; |
|
452 | 454 | volatile unsigned char reserved; |
|
453 | 455 | volatile unsigned char userApplication; |
|
454 | 456 | volatile unsigned char packetID[2]; |
|
455 | 457 | volatile unsigned char packetSequenceControl[2]; |
|
456 | 458 | volatile unsigned char packetLength[2]; |
|
457 | 459 | // DATA FIELD HEADER |
|
458 | 460 | volatile unsigned char spare1_pusVersion_spare2; |
|
459 | 461 | volatile unsigned char serviceType; |
|
460 | 462 | volatile unsigned char serviceSubType; |
|
461 | 463 | volatile unsigned char destinationID; |
|
462 | 464 | volatile unsigned char time[6]; |
|
463 | 465 | // AUXILIARY HEADER |
|
464 | 466 | volatile unsigned char sid; |
|
465 | 467 | volatile unsigned char biaStatusInfo; |
|
466 | 468 | volatile unsigned char cntASM; |
|
467 | 469 | volatile unsigned char nrASM; |
|
468 | 470 | volatile unsigned char acquisitionTime[6]; |
|
469 | 471 | volatile unsigned char blkNr[2]; |
|
470 | 472 | }; |
|
471 | 473 | typedef struct Header_TM_LFR_SCIENCE_ASM_str Header_TM_LFR_SCIENCE_ASM_t; |
|
472 | 474 | |
|
473 | 475 | struct ccsdsTelecommandPacket_str |
|
474 | 476 | { |
|
475 | 477 | //unsigned char targetLogicalAddress; // removed by the grspw module |
|
476 | 478 | volatile unsigned char protocolIdentifier; |
|
477 | 479 | volatile unsigned char reserved; |
|
478 | 480 | volatile unsigned char userApplication; |
|
479 | 481 | volatile unsigned char packetID[2]; |
|
480 | 482 | volatile unsigned char packetSequenceControl[2]; |
|
481 | 483 | volatile unsigned char packetLength[2]; |
|
482 | 484 | // DATA FIELD HEADER |
|
483 | 485 | volatile unsigned char headerFlag_pusVersion_Ack; |
|
484 | 486 | volatile unsigned char serviceType; |
|
485 | 487 | volatile unsigned char serviceSubType; |
|
486 | 488 | volatile unsigned char sourceID; |
|
487 | 489 | volatile unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10]; |
|
488 | 490 | }; |
|
489 | 491 | typedef struct ccsdsTelecommandPacket_str ccsdsTelecommandPacket_t; |
|
490 | 492 | |
|
491 | 493 | struct Packet_TM_LFR_HK_str |
|
492 | 494 | { |
|
493 | 495 | volatile unsigned char targetLogicalAddress; |
|
494 | 496 | volatile unsigned char protocolIdentifier; |
|
495 | 497 | volatile unsigned char reserved; |
|
496 | 498 | volatile unsigned char userApplication; |
|
497 | 499 | volatile unsigned char packetID[2]; |
|
498 | 500 | volatile unsigned char packetSequenceControl[2]; |
|
499 | 501 | volatile unsigned char packetLength[2]; |
|
500 | 502 | volatile unsigned char spare1_pusVersion_spare2; |
|
501 | 503 | volatile unsigned char serviceType; |
|
502 | 504 | volatile unsigned char serviceSubType; |
|
503 | 505 | volatile unsigned char destinationID; |
|
504 | 506 | volatile unsigned char time[6]; |
|
505 | 507 | volatile unsigned char sid; |
|
506 | 508 | |
|
507 | 509 | //************** |
|
508 | 510 | // HK PARAMETERS |
|
509 | 511 | unsigned char lfr_status_word[2]; |
|
510 | 512 | unsigned char lfr_sw_version[4]; |
|
511 | 513 | // tc statistics |
|
512 | 514 | unsigned char hk_lfr_update_info_tc_cnt[2]; |
|
513 | 515 | unsigned char hk_lfr_update_time_tc_cnt[2]; |
|
514 | 516 | unsigned char hk_dpu_exe_tc_lfr_cnt[2]; |
|
515 | 517 | unsigned char hk_dpu_rej_tc_lfr_cnt[2]; |
|
516 | 518 | unsigned char hk_lfr_last_exe_tc_id[2]; |
|
517 | 519 | unsigned char hk_lfr_last_exe_tc_type[2]; |
|
518 | 520 | unsigned char hk_lfr_last_exe_tc_subtype[2]; |
|
519 | 521 | unsigned char hk_lfr_last_exe_tc_time[6]; |
|
520 | 522 | unsigned char hk_lfr_last_rej_tc_id[2]; |
|
521 | 523 | unsigned char hk_lfr_last_rej_tc_type[2]; |
|
522 | 524 | unsigned char hk_lfr_last_rej_tc_subtype[2]; |
|
523 | 525 | unsigned char hk_lfr_last_rej_tc_time[6]; |
|
524 | 526 | // anomaly statistics |
|
525 | 527 | unsigned char hk_lfr_le_cnt[2]; |
|
526 | 528 | unsigned char hk_lfr_me_cnt[2]; |
|
527 | 529 | unsigned char hk_lfr_he_cnt[2]; |
|
528 | 530 | unsigned char hk_lfr_last_er_rid[2]; |
|
529 | 531 | unsigned char hk_lfr_last_er_code; |
|
530 | 532 | unsigned char hk_lfr_last_er_time[6]; |
|
531 | 533 | // vhdl_blk_status |
|
532 | 534 | unsigned char hk_lfr_vhdl_aa_sm; |
|
533 | 535 | unsigned char hk_lfr_vhdl_fft_sr; |
|
534 | 536 | unsigned char hk_lfr_vhdl_cic_hk; |
|
535 | 537 | unsigned char hk_lfr_vhdl_iir_cal; |
|
536 | 538 | // spacewire_if_statistics |
|
537 | 539 | unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2]; |
|
538 | 540 | unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2]; |
|
539 | 541 | unsigned char hk_lfr_dpu_spw_tick_out_cnt; |
|
540 | 542 | unsigned char hk_lfr_dpu_spw_last_timc; |
|
541 | 543 | // ahb error statistics |
|
542 | 544 | unsigned int hk_lfr_last_fail_addr; |
|
543 | 545 | // temperatures |
|
544 | 546 | unsigned char hk_lfr_temp_scm[2]; |
|
545 | 547 | unsigned char hk_lfr_temp_pcb[2]; |
|
546 | 548 | unsigned char hk_lfr_temp_fpga[2]; |
|
547 | 549 | // error counters |
|
548 | 550 | unsigned char hk_lfr_dpu_spw_parity; |
|
549 | 551 | unsigned char hk_lfr_dpu_spw_disconnect; |
|
550 | 552 | unsigned char hk_lfr_dpu_spw_escape; |
|
551 | 553 | unsigned char hk_lfr_dpu_spw_credit; |
|
552 | 554 | unsigned char hk_lfr_dpu_spw_write_sync; |
|
553 | 555 | unsigned char hk_lfr_dpu_spw_rx_ahb; |
|
554 | 556 | unsigned char hk_lfr_dpu_spw_tx_ahb; |
|
555 | 557 | unsigned char hk_lfr_dpu_spw_header_crc; |
|
556 | 558 | unsigned char hk_lfr_dpu_spw_data_crc; |
|
557 | 559 | unsigned char hk_lfr_dpu_spw_early_eop; |
|
558 | 560 | unsigned char hk_lfr_dpu_spw_invalid_addr; |
|
559 | 561 | unsigned char hk_lfr_dpu_spw_eep; |
|
560 | 562 | unsigned char hk_lfr_dpu_spw_rx_too_big; |
|
561 | 563 | // timecode |
|
562 | 564 | unsigned char hk_lfr_timecode_erroneous; |
|
563 | 565 | unsigned char hk_lfr_timecode_missing; |
|
564 | 566 | unsigned char hk_lfr_timecode_invalid; |
|
565 | 567 | // time |
|
566 | 568 | unsigned char hk_lfr_time_timecode_it; |
|
567 | 569 | unsigned char hk_lfr_time_not_synchro; |
|
568 | 570 | unsigned char hk_lfr_time_timecode_ctr; |
|
569 | 571 | // hk_lfr_buffer_dpu_ |
|
570 | 572 | unsigned char hk_lfr_buffer_dpu_tc_fifo; |
|
571 | 573 | unsigned char hk_lfr_buffer_dpu_tm_fifo; |
|
572 | 574 | // hk_lfr_ahb_ |
|
573 | 575 | unsigned char hk_lfr_ahb_correctable; |
|
574 | 576 | unsigned char hk_lfr_ahb_uncorrectable; |
|
575 | 577 | unsigned char hk_lfr_ahb_fails_trans; |
|
576 | 578 | // hk_lfr_adc_ |
|
577 | 579 | unsigned char hk_lfr_adc_failure; |
|
578 | 580 | unsigned char hk_lfr_adc_timeout; |
|
579 | 581 | unsigned char hk_lfr_toomany_err; |
|
580 | 582 | // hk_lfr_cpu_ |
|
581 | 583 | unsigned char hk_lfr_cpu_write_err; |
|
582 | 584 | unsigned char hk_lfr_cpu_ins_access_err; |
|
583 | 585 | unsigned char hk_lfr_cpu_illegal_ins; |
|
584 | 586 | unsigned char hk_lfr_cpu_privilegied_ins; |
|
585 | 587 | unsigned char hk_lfr_cpu_register_hw; |
|
586 | 588 | unsigned char hk_lfr_cpu_not_aligned; |
|
587 | 589 | unsigned char hk_lfr_cpu_data_exception; |
|
588 | 590 | unsigned char hk_lfr_cpu_div_exception; |
|
589 | 591 | unsigned char hk_lfr_cpu_arith_overflow; |
|
590 | 592 | }; |
|
591 | 593 | typedef struct Packet_TM_LFR_HK_str Packet_TM_LFR_HK_t; |
|
592 | 594 | |
|
593 | 595 | struct Packet_TM_LFR_PARAMETER_DUMP_str |
|
594 | 596 | { |
|
595 | 597 | volatile unsigned char targetLogicalAddress; |
|
596 | 598 | volatile unsigned char protocolIdentifier; |
|
597 | 599 | volatile unsigned char reserved; |
|
598 | 600 | volatile unsigned char userApplication; |
|
599 | 601 | volatile unsigned char packetID[2]; |
|
600 | 602 | volatile unsigned char packetSequenceControl[2]; |
|
601 | 603 | volatile unsigned char packetLength[2]; |
|
602 | 604 | // DATA FIELD HEADER |
|
603 | 605 | volatile unsigned char spare1_pusVersion_spare2; |
|
604 | 606 | volatile unsigned char serviceType; |
|
605 | 607 | volatile unsigned char serviceSubType; |
|
606 | 608 | volatile unsigned char destinationID; |
|
607 | 609 | volatile unsigned char time[6]; |
|
608 | 610 | volatile unsigned char sid; |
|
609 | 611 | |
|
610 | 612 | //****************** |
|
611 | 613 | // COMMON PARAMETERS |
|
612 | 614 | volatile unsigned char unused0; |
|
613 | 615 | volatile unsigned char bw_sp0_sp1_r0_r1; |
|
614 | 616 | |
|
615 | 617 | //****************** |
|
616 | 618 | // NORMAL PARAMETERS |
|
617 | 619 | volatile unsigned char sy_lfr_n_swf_l[2]; |
|
618 | 620 | volatile unsigned char sy_lfr_n_swf_p[2]; |
|
619 | 621 | volatile unsigned char sy_lfr_n_asm_p[2]; |
|
620 | 622 | volatile unsigned char sy_lfr_n_bp_p0; |
|
621 | 623 | volatile unsigned char sy_lfr_n_bp_p1; |
|
622 | 624 | |
|
623 | 625 | //***************** |
|
624 | 626 | // BURST PARAMETERS |
|
625 | 627 | volatile unsigned char sy_lfr_b_bp_p0; |
|
626 | 628 | volatile unsigned char sy_lfr_b_bp_p1; |
|
627 | 629 | |
|
628 | 630 | //**************** |
|
629 | 631 | // SBM1 PARAMETERS |
|
630 | 632 | volatile unsigned char sy_lfr_s1_bp_p0; |
|
631 | 633 | volatile unsigned char sy_lfr_s1_bp_p1; |
|
632 | 634 | |
|
633 | 635 | //**************** |
|
634 | 636 | // SBM2 PARAMETERS |
|
635 | 637 | volatile unsigned char sy_lfr_s2_bp_p0; |
|
636 | 638 | volatile unsigned char sy_lfr_s2_bp_p1; |
|
637 | 639 | }; |
|
638 | 640 | typedef struct Packet_TM_LFR_PARAMETER_DUMP_str Packet_TM_LFR_PARAMETER_DUMP_t; |
|
639 | 641 | |
|
640 | 642 | |
|
641 | 643 | #endif // CCSDS_TYPES_H_INCLUDED |
@@ -1,74 +1,93 | |||
|
1 | 1 | #ifndef GRLIB_REGS_H_INCLUDED |
|
2 | 2 | #define GRLIB_REGS_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #define NB_GPTIMER 3 |
|
5 | 5 | |
|
6 | 6 | struct apbuart_regs_str{ |
|
7 | 7 | volatile unsigned int data; |
|
8 | 8 | volatile unsigned int status; |
|
9 | 9 | volatile unsigned int ctrl; |
|
10 | 10 | volatile unsigned int scaler; |
|
11 | 11 | volatile unsigned int fifoDebug; |
|
12 | 12 | }; |
|
13 | 13 | |
|
14 | 14 | struct ahbuart_regs_str{ |
|
15 | 15 | volatile unsigned int unused; |
|
16 | 16 | volatile unsigned int status; |
|
17 | 17 | volatile unsigned int ctrl; |
|
18 | 18 | volatile unsigned int scaler; |
|
19 | 19 | }; |
|
20 | 20 | |
|
21 | 21 | struct timer_regs_str |
|
22 | 22 | { |
|
23 | 23 | volatile unsigned int counter; |
|
24 | 24 | volatile unsigned int reload; |
|
25 | 25 | volatile unsigned int ctrl; |
|
26 | 26 | volatile unsigned int unused; |
|
27 | 27 | }; |
|
28 | 28 | typedef struct timer_regs_str timer_regs_t; |
|
29 | 29 | |
|
30 | 30 | struct gptimer_regs_str |
|
31 | 31 | { |
|
32 | 32 | volatile unsigned int scaler_value; |
|
33 | 33 | volatile unsigned int scaler_reload; |
|
34 | 34 | volatile unsigned int conf; |
|
35 | 35 | volatile unsigned int unused0; |
|
36 | 36 | timer_regs_t timer[NB_GPTIMER]; |
|
37 | 37 | }; |
|
38 | 38 | typedef struct gptimer_regs_str gptimer_regs_t; |
|
39 | 39 | |
|
40 | 40 | struct time_management_regs_str{ |
|
41 | 41 | volatile int ctrl; // bit 0 forces the load of the coarse_time_load value and resets the fine_time |
|
42 | 42 | volatile int coarse_time_load; |
|
43 | 43 | volatile int coarse_time; |
|
44 | 44 | volatile int fine_time; |
|
45 | 45 | }; |
|
46 | 46 | typedef struct time_management_regs_str time_management_regs_t; |
|
47 | 47 | |
|
48 | 48 | struct waveform_picker_regs_str{ |
|
49 | 49 | volatile int data_shaping; // 0x00 00 *** R1 R0 SP1 SP0 BW |
|
50 | 50 | volatile int burst_enable; // 0x04 01 *** burst f2, f1, f0 enable f3, f2, f1, f0 |
|
51 | 51 | volatile int addr_data_f0; // 0x08 10 *** |
|
52 | 52 | volatile int addr_data_f1; // 0x0c 11 *** |
|
53 | 53 | volatile int addr_data_f2; // 0x10 100 *** |
|
54 | 54 | volatile int addr_data_f3; // 0x14 101 *** |
|
55 | 55 | volatile int status; // 0x18 110 *** |
|
56 | 56 | volatile int delta_snapshot; // 0x1c 111 *** |
|
57 | 57 | volatile int delta_f2_f1; // 0x20 0000 *** |
|
58 | 58 | volatile int delta_f2_f0; // 0x24 0001 *** |
|
59 | 59 | volatile int nb_burst_available;// 0x28 0010 *** |
|
60 | 60 | volatile int nb_snapshot_param; // 0x2c 0011 *** |
|
61 | 61 | }; |
|
62 | 62 | typedef struct waveform_picker_regs_str waveform_picker_regs_t; |
|
63 | 63 | |
|
64 | struct waveform_picker_regs_str_alt{ | |
|
65 | volatile int data_shaping; // 0x00 00 *** R1 R0 SP1 SP0 BW | |
|
66 | volatile int run_burst_enable; // 0x04 01 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] | |
|
67 | volatile int addr_data_f0; // 0x08 | |
|
68 | volatile int addr_data_f1; // 0x0c | |
|
69 | volatile int addr_data_f2; // 0x10 | |
|
70 | volatile int addr_data_f3; // 0x14 | |
|
71 | volatile int status; // 0x18 | |
|
72 | volatile int delta_snapshot; // 0x1c | |
|
73 | volatile int delta_f0; // 0x20 | |
|
74 | volatile int delta_f0_2; | |
|
75 | volatile int delta_f1; | |
|
76 | volatile int delta_f2; | |
|
77 | volatile int nb_data_by_buffer; | |
|
78 | volatile int snapshot_param; | |
|
79 | volatile int start_date; | |
|
80 | }; | |
|
81 | typedef struct waveform_picker_regs_str_alt waveform_picker_regs_t_alt; | |
|
82 | ||
|
64 | 83 | struct spectral_matrix_regs_str{ |
|
65 | 84 | volatile int config; |
|
66 | 85 | volatile int status; |
|
67 | 86 | volatile int matrixF0_Address0; |
|
68 | 87 | volatile int matrixFO_Address1; |
|
69 | 88 | volatile int matrixF1_Address; |
|
70 | 89 | volatile int matrixF2_Address; |
|
71 | 90 | }; |
|
72 | 91 | typedef struct spectral_matrix_regs_str spectral_matrix_regs_t; |
|
73 | 92 | |
|
74 | 93 | #endif // GRLIB_REGS_H_INCLUDED |
@@ -1,80 +1,81 | |||
|
1 | 1 | #ifndef WF_HANDLER_H_INCLUDED |
|
2 | 2 | #define WF_HANDLER_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include <rtems.h> |
|
5 | 5 | #include <grspw.h> |
|
6 | 6 | #include <stdio.h> |
|
7 | 7 | #include <math.h> |
|
8 | 8 | |
|
9 | 9 | #include "fsw_params.h" |
|
10 | 10 | |
|
11 | 11 | #define pi 3.1415 |
|
12 | 12 | |
|
13 | 13 | extern int fdSPW; |
|
14 | 14 | extern volatile int wf_snap_f0[ ]; |
|
15 | 15 | // |
|
16 | 16 | extern volatile int wf_snap_f1[ ]; |
|
17 | 17 | extern volatile int wf_snap_f1_bis[ ]; |
|
18 | 18 | extern volatile int wf_snap_f1_norm[ ]; |
|
19 | 19 | // |
|
20 | 20 | extern volatile int wf_snap_f2[ ]; |
|
21 | 21 | extern volatile int wf_snap_f2_bis[ ]; |
|
22 | 22 | extern volatile int wf_snap_f2_norm[ ]; |
|
23 | 23 | // |
|
24 | 24 | extern volatile int wf_cont_f3[ ]; |
|
25 | 25 | extern volatile int wf_cont_f3_bis[ ]; |
|
26 | 26 | extern char wf_cont_f3_light[ ]; |
|
27 | 27 | extern waveform_picker_regs_t *waveform_picker_regs; |
|
28 | extern waveform_picker_regs_t_alt *waveform_picker_regs_alt; | |
|
28 | 29 | extern time_management_regs_t *time_management_regs; |
|
29 | 30 | extern Packet_TM_LFR_HK_t housekeeping_packet; |
|
30 | 31 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
31 | 32 | extern struct param_local_str param_local; |
|
32 | 33 | |
|
33 | 34 | extern rtems_name misc_name[5]; |
|
34 | 35 | extern rtems_name Task_name[20]; /* array of task ids */ |
|
35 | 36 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
36 | 37 | |
|
37 | 38 | extern unsigned char lfrCurrentMode; |
|
38 | 39 | |
|
39 | 40 | rtems_isr waveforms_isr( rtems_vector_number vector ); |
|
40 | 41 | rtems_isr waveforms_simulator_isr( rtems_vector_number vector ); |
|
41 | 42 | rtems_task wfrm_task( rtems_task_argument argument ); |
|
42 | 43 | rtems_task cwf3_task( rtems_task_argument argument ); |
|
43 | 44 | rtems_task cwf2_task( rtems_task_argument argument ); |
|
44 | 45 | rtems_task cwf1_task( rtems_task_argument argument ); |
|
45 | 46 | |
|
46 | 47 | //****************** |
|
47 | 48 | // general functions |
|
48 | 49 | void init_waveforms( void ); |
|
49 | 50 | // |
|
50 | 51 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF ); |
|
51 | 52 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ); |
|
52 | 53 | int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ); |
|
53 | 54 | // |
|
54 | 55 | void reset_waveforms( void ); |
|
55 | 56 | // |
|
56 | 57 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ); |
|
57 | 58 | int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
58 | 59 | int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
59 | 60 | int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
60 | 61 | // |
|
61 | 62 | rtems_id get_pkts_queue_id( void ); |
|
62 | 63 | |
|
63 | 64 | //************** |
|
64 | 65 | // wfp registers |
|
65 | 66 | void set_wfp_data_shaping(); |
|
66 | 67 | char set_wfp_delta_snapshot(); |
|
67 | 68 | void set_wfp_burst_enable_register( unsigned char mode); |
|
68 | 69 | void reset_wfp_burst_enable(); |
|
69 | 70 | void reset_wfp_status(); |
|
70 | 71 | void reset_waveform_picker_regs(); |
|
71 | 72 | |
|
72 | 73 | //***************** |
|
73 | 74 | // local parameters |
|
74 | 75 | void set_local_sbm1_nb_cwf_max(); |
|
75 | 76 | void set_local_sbm2_nb_cwf_max(); |
|
76 | 77 | void set_local_nb_interrupt_f0_MAX(); |
|
77 | 78 | void reset_local_sbm1_nb_cwf_sent(); |
|
78 | 79 | void reset_local_sbm2_nb_cwf_sent(); |
|
79 | 80 | |
|
80 | 81 | #endif // WF_HANDLER_H_INCLUDED |
@@ -1,89 +1,90 | |||
|
1 | 1 | /** Global variables of the LFR flight software. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * Among global variables, there are: |
|
7 | 7 | * - RTEMS names and id. |
|
8 | 8 | * - APB configuration registers. |
|
9 | 9 | * - waveforms global buffers, used by the waveform picker hardware module to store data. |
|
10 | 10 | * - spectral matrices buffesr, used by the hardware module to store data. |
|
11 | 11 | * - variable related to LFR modes parameters. |
|
12 | 12 | * - the global HK packet buffer. |
|
13 | 13 | * - the global dump parameter buffer. |
|
14 | 14 | * |
|
15 | 15 | */ |
|
16 | 16 | |
|
17 | 17 | #include <rtems.h> |
|
18 | 18 | #include <grspw.h> |
|
19 | 19 | |
|
20 | 20 | #include "ccsds_types.h" |
|
21 | 21 | #include "grlib_regs.h" |
|
22 | 22 | #include "fsw_params.h" |
|
23 | 23 | |
|
24 | 24 | // RTEMS GLOBAL VARIABLES |
|
25 | 25 | rtems_name misc_name[5]; |
|
26 | 26 | rtems_id misc_id[5]; |
|
27 | 27 | rtems_name Task_name[20]; /* array of task names */ |
|
28 | 28 | rtems_id Task_id[20]; /* array of task ids */ |
|
29 | 29 | unsigned int maxCount; |
|
30 | 30 | int fdSPW = 0; |
|
31 | 31 | int fdUART = 0; |
|
32 | 32 | unsigned char lfrCurrentMode; |
|
33 | 33 | |
|
34 | 34 | // APB CONFIGURATION REGISTERS |
|
35 | 35 | time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT; |
|
36 | 36 | gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER; |
|
37 | 37 | #ifdef GSA |
|
38 | 38 | #else |
|
39 | 39 | waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER; |
|
40 | waveform_picker_regs_t_alt *waveform_picker_regs_alt = (waveform_picker_regs_t_alt*) REGS_ADDR_WAVEFORM_PICKER; | |
|
40 | 41 | #endif |
|
41 | 42 | spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX; |
|
42 | 43 | |
|
43 | 44 | // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes |
|
44 | 45 | volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
45 | 46 | // |
|
46 | 47 | volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
47 | 48 | volatile int wf_snap_f1_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
48 | 49 | volatile int wf_snap_f1_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
49 | 50 | // |
|
50 | 51 | volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
51 | 52 | volatile int wf_snap_f2_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
52 | 53 | volatile int wf_snap_f2_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
53 | 54 | // |
|
54 | 55 | volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
55 | 56 | volatile int wf_cont_f3_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
56 | 57 | char wf_cont_f3_light[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_CWF3_LIGHT_BLK ]; |
|
57 | 58 | |
|
58 | 59 | // SPECTRAL MATRICES GLOBAL VARIABLES |
|
59 | 60 | volatile int spec_mat_f0_0[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
60 | 61 | volatile int spec_mat_f0_1[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
61 | 62 | volatile int spec_mat_f0_a[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
62 | 63 | volatile int spec_mat_f0_b[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
63 | 64 | volatile int spec_mat_f0_c[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
64 | 65 | volatile int spec_mat_f0_d[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
65 | 66 | volatile int spec_mat_f0_e[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
66 | 67 | volatile int spec_mat_f0_f[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
67 | 68 | volatile int spec_mat_f0_g[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
68 | 69 | volatile int spec_mat_f0_h[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
69 | 70 | volatile int spec_mat_f0_0_bis[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
70 | 71 | volatile int spec_mat_f0_1_bis[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
71 | 72 | // |
|
72 | 73 | volatile int spec_mat_f1[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
73 | 74 | volatile int spec_mat_f1_bis[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
74 | 75 | // |
|
75 | 76 | volatile int spec_mat_f2[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
76 | 77 | volatile int spec_mat_f2_bis[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
77 | 78 | |
|
78 | 79 | // MODE PARAMETERS |
|
79 | 80 | Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
80 | 81 | struct param_local_str param_local; |
|
81 | 82 | |
|
82 | 83 | // HK PACKETS |
|
83 | 84 | Packet_TM_LFR_HK_t housekeeping_packet; |
|
84 | 85 | // sequence counters are incremented by APID (PID + CAT) and destination ID |
|
85 | 86 | unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID]; |
|
86 | 87 | spw_stats spacewire_stats; |
|
87 | 88 | spw_stats spacewire_stats_backup; |
|
88 | 89 | |
|
89 | 90 |
@@ -1,596 +1,590 | |||
|
1 | 1 | /** This is the RTEMS initialization module. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * This module contains two very different information: |
|
7 | 7 | * - specific instructions to configure the compilation of the RTEMS executive |
|
8 | 8 | * - functions related to the fligth softwre initialization, especially the INIT RTEMS task |
|
9 | 9 | * |
|
10 | 10 | */ |
|
11 | 11 | |
|
12 | 12 | //************************* |
|
13 | 13 | // GPL reminder to be added |
|
14 | 14 | //************************* |
|
15 | 15 | |
|
16 | 16 | #include <rtems.h> |
|
17 | 17 | |
|
18 | 18 | /* configuration information */ |
|
19 | 19 | |
|
20 | 20 | #define CONFIGURE_INIT |
|
21 | 21 | |
|
22 | 22 | #include <bsp.h> /* for device driver prototypes */ |
|
23 | 23 | |
|
24 | 24 | /* configuration information */ |
|
25 | 25 | |
|
26 | 26 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
27 | 27 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
28 | 28 | |
|
29 | 29 | #define CONFIGURE_MAXIMUM_TASKS 20 |
|
30 | 30 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
|
31 | 31 | #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) |
|
32 | 32 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 |
|
33 | 33 | #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100 |
|
34 | 34 | #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT) |
|
35 | 35 | #define CONFIGURE_MAXIMUM_DRIVERS 16 |
|
36 | 36 | #define CONFIGURE_MAXIMUM_PERIODS 5 |
|
37 | 37 | #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s) |
|
38 | 38 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2 |
|
39 | 39 | #ifdef PRINT_STACK_REPORT |
|
40 | 40 | #define CONFIGURE_STACK_CHECKER_ENABLED |
|
41 | 41 | #endif |
|
42 | 42 | |
|
43 | 43 | #include <rtems/confdefs.h> |
|
44 | 44 | |
|
45 | 45 | /* If --drvmgr was enabled during the configuration of the RTEMS kernel */ |
|
46 | 46 | #ifdef RTEMS_DRVMGR_STARTUP |
|
47 | 47 | #ifdef LEON3 |
|
48 | 48 | /* Add Timer and UART Driver */ |
|
49 | 49 | #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
50 | 50 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER |
|
51 | 51 | #endif |
|
52 | 52 | #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
53 | 53 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART |
|
54 | 54 | #endif |
|
55 | 55 | #endif |
|
56 | 56 | #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */ |
|
57 | 57 | #include <drvmgr/drvmgr_confdefs.h> |
|
58 | 58 | #endif |
|
59 | 59 | |
|
60 | 60 | #include "fsw_init.h" |
|
61 | 61 | #include "fsw_config.c" |
|
62 | 62 | |
|
63 | 63 | rtems_task Init( rtems_task_argument ignored ) |
|
64 | 64 | { |
|
65 | 65 | /** This is the RTEMS INIT taks, it the first task launched by the system. |
|
66 | 66 | * |
|
67 | 67 | * @param unused is the starting argument of the RTEMS task |
|
68 | 68 | * |
|
69 | 69 | * The INIT task create and run all other RTEMS tasks. |
|
70 | 70 | * |
|
71 | 71 | */ |
|
72 | 72 | |
|
73 | 73 | |
|
74 | 74 | rtems_status_code status; |
|
75 | 75 | rtems_status_code status_spw; |
|
76 | 76 | rtems_isr_entry old_isr_handler; |
|
77 | 77 | |
|
78 | 78 | BOOT_PRINTF("\n\n\n\n\n") |
|
79 | 79 | BOOT_PRINTF("***************************\n") |
|
80 | 80 | BOOT_PRINTF("** START Flight Software **\n") |
|
81 | 81 | BOOT_PRINTF("***************************\n") |
|
82 | 82 | BOOT_PRINTF("\n\n") |
|
83 | 83 | |
|
84 | 84 | //send_console_outputs_on_apbuart_port(); |
|
85 | 85 | set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE); |
|
86 | 86 | |
|
87 | 87 | init_parameter_dump(); |
|
88 | 88 | init_local_mode_parameters(); |
|
89 | 89 | init_housekeeping_parameters(); |
|
90 | 90 | |
|
91 | 91 | updateLFRCurrentMode(); |
|
92 | 92 | |
|
93 | 93 | BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) |
|
94 | 94 | |
|
95 | 95 | create_names(); // create all names |
|
96 | 96 | |
|
97 | 97 | status = create_message_queues(); // create message queues |
|
98 | 98 | if (status != RTEMS_SUCCESSFUL) |
|
99 | 99 | { |
|
100 | 100 | PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) |
|
101 | 101 | } |
|
102 | 102 | |
|
103 | 103 | status = create_all_tasks(); // create all tasks |
|
104 | 104 | if (status != RTEMS_SUCCESSFUL) |
|
105 | 105 | { |
|
106 | 106 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status) |
|
107 | 107 | } |
|
108 | 108 | |
|
109 | 109 | // ************************** |
|
110 | 110 | // <SPACEWIRE INITIALIZATION> |
|
111 | 111 | grspw_timecode_callback = &timecode_irq_handler; |
|
112 | 112 | |
|
113 | 113 | status_spw = spacewire_open_link(); // (1) open the link |
|
114 | 114 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
115 | 115 | { |
|
116 | 116 | PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) |
|
117 | 117 | } |
|
118 | 118 | |
|
119 | 119 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link |
|
120 | 120 | { |
|
121 | 121 | status_spw = spacewire_configure_link( fdSPW ); |
|
122 | 122 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
123 | 123 | { |
|
124 | 124 | PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) |
|
125 | 125 | } |
|
126 | 126 | } |
|
127 | 127 | |
|
128 | 128 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link |
|
129 | 129 | { |
|
130 | 130 | status_spw = spacewire_start_link( fdSPW ); |
|
131 | 131 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
132 | 132 | { |
|
133 | 133 | PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) |
|
134 | 134 | } |
|
135 | 135 | } |
|
136 | 136 | // </SPACEWIRE INITIALIZATION> |
|
137 | 137 | // *************************** |
|
138 | 138 | |
|
139 | 139 | status = start_all_tasks(); // start all tasks |
|
140 | 140 | if (status != RTEMS_SUCCESSFUL) |
|
141 | 141 | { |
|
142 | 142 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) |
|
143 | 143 | } |
|
144 | 144 | |
|
145 | 145 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization |
|
146 | 146 | status = start_recv_send_tasks(); |
|
147 | 147 | if ( status != RTEMS_SUCCESSFUL ) |
|
148 | 148 | { |
|
149 | 149 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) |
|
150 | 150 | } |
|
151 | 151 | |
|
152 | 152 | // suspend science tasks. they will be restarted later depending on the mode |
|
153 | 153 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) |
|
154 | 154 | if (status != RTEMS_SUCCESSFUL) |
|
155 | 155 | { |
|
156 | 156 | PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
157 | 157 | } |
|
158 | 158 | |
|
159 | status = stop_current_mode(); // go in STANDBY mode | |
|
160 | if (status != RTEMS_SUCCESSFUL) | |
|
161 | { | |
|
162 | PRINTF1("in INIT *** ERR in stop_current_mode, code %d", status) | |
|
163 | } | |
|
164 | ||
|
165 | 159 | #ifdef GSA |
|
166 | 160 | // mask IRQ lines |
|
167 | 161 | LEON_Mask_interrupt( IRQ_SM ); |
|
168 | 162 | LEON_Mask_interrupt( IRQ_WF ); |
|
169 | 163 | // Spectral Matrices simulator |
|
170 | 164 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, |
|
171 | 165 | IRQ_SPARC_SM, spectral_matrices_isr ); |
|
172 | 166 | // WaveForms |
|
173 | 167 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR, |
|
174 | 168 | IRQ_SPARC_WF, waveforms_simulator_isr ); |
|
175 | 169 | #else |
|
176 | 170 | // configure IRQ handling for the waveform picker unit |
|
177 | 171 | status = rtems_interrupt_catch( waveforms_isr, |
|
178 | 172 | IRQ_SPARC_WAVEFORM_PICKER, |
|
179 | 173 | &old_isr_handler) ; |
|
180 | 174 | #endif |
|
181 | 175 | |
|
182 | 176 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery |
|
183 | 177 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
184 | 178 | { |
|
185 | 179 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); |
|
186 | 180 | if ( status != RTEMS_SUCCESSFUL ) { |
|
187 | 181 | PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) |
|
188 | 182 | } |
|
189 | 183 | } |
|
190 | 184 | |
|
191 | 185 | BOOT_PRINTF("delete INIT\n") |
|
192 | 186 | |
|
193 | 187 | status = rtems_task_delete(RTEMS_SELF); |
|
194 | 188 | |
|
195 | 189 | } |
|
196 | 190 | |
|
197 | 191 | void init_local_mode_parameters( void ) |
|
198 | 192 | { |
|
199 | 193 | /** This function initialize the param_local global variable with default values. |
|
200 | 194 | * |
|
201 | 195 | */ |
|
202 | 196 | |
|
203 | 197 | unsigned int i; |
|
204 | 198 | unsigned int j; |
|
205 | 199 | unsigned int k; |
|
206 | 200 | |
|
207 | 201 | // LOCAL PARAMETERS |
|
208 | 202 | set_local_sbm1_nb_cwf_max(); |
|
209 | 203 | set_local_sbm2_nb_cwf_max(); |
|
210 | 204 | set_local_nb_interrupt_f0_MAX(); |
|
211 | 205 | |
|
212 | 206 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
213 | 207 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
214 | 208 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
215 | 209 | |
|
216 | 210 | reset_local_sbm1_nb_cwf_sent(); |
|
217 | 211 | reset_local_sbm2_nb_cwf_sent(); |
|
218 | 212 | |
|
219 | 213 | // init sequence counters |
|
220 | 214 | for (i = 0; i<SEQ_CNT_NB_PID; i++) |
|
221 | 215 | { |
|
222 | 216 | for(j = 0; j<SEQ_CNT_NB_CAT; j++) |
|
223 | 217 | { |
|
224 | 218 | for(k = 0; k<SEQ_CNT_NB_DEST_ID; k++) |
|
225 | 219 | { |
|
226 | 220 | sequenceCounters[i][j][k] = 0x00; |
|
227 | 221 | } |
|
228 | 222 | } |
|
229 | 223 | } |
|
230 | 224 | } |
|
231 | 225 | |
|
232 | 226 | void create_names( void ) // create all names for tasks and queues |
|
233 | 227 | { |
|
234 | 228 | /** This function creates all RTEMS names used in the software for tasks and queues. |
|
235 | 229 | * |
|
236 | 230 | * @return RTEMS directive status codes: |
|
237 | 231 | * - RTEMS_SUCCESSFUL - successful completion |
|
238 | 232 | * |
|
239 | 233 | */ |
|
240 | 234 | |
|
241 | 235 | // task names |
|
242 | 236 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); |
|
243 | 237 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); |
|
244 | 238 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
|
245 | 239 | Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' ); |
|
246 | 240 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); |
|
247 | 241 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); |
|
248 | 242 | Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' ); |
|
249 | 243 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
250 | 244 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); |
|
251 | 245 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
252 | 246 | Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' ); |
|
253 | 247 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); |
|
254 | 248 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); |
|
255 | 249 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); |
|
256 | 250 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); |
|
257 | 251 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); |
|
258 | 252 | |
|
259 | 253 | // rate monotonic period names |
|
260 | 254 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
261 | 255 | |
|
262 | 256 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
263 | 257 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
264 | 258 | } |
|
265 | 259 | |
|
266 | 260 | int create_all_tasks( void ) // create all tasks which run in the software |
|
267 | 261 | { |
|
268 | 262 | /** This function creates all RTEMS tasks used in the software. |
|
269 | 263 | * |
|
270 | 264 | * @return RTEMS directive status codes: |
|
271 | 265 | * - RTEMS_SUCCESSFUL - task created successfully |
|
272 | 266 | * - RTEMS_INVALID_ADDRESS - id is NULL |
|
273 | 267 | * - RTEMS_INVALID_NAME - invalid task name |
|
274 | 268 | * - RTEMS_INVALID_PRIORITY - invalid task priority |
|
275 | 269 | * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured |
|
276 | 270 | * - RTEMS_TOO_MANY - too many tasks created |
|
277 | 271 | * - RTEMS_UNSATISFIED - not enough memory for stack/FP context |
|
278 | 272 | * - RTEMS_TOO_MANY - too many global objects |
|
279 | 273 | * |
|
280 | 274 | */ |
|
281 | 275 | |
|
282 | 276 | rtems_status_code status; |
|
283 | 277 | |
|
284 | 278 | // RECV |
|
285 | 279 | status = rtems_task_create( |
|
286 | 280 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, |
|
287 | 281 | RTEMS_DEFAULT_MODES, |
|
288 | 282 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] |
|
289 | 283 | ); |
|
290 | 284 | |
|
291 | 285 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
292 | 286 | { |
|
293 | 287 | status = rtems_task_create( |
|
294 | 288 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, |
|
295 | 289 | RTEMS_DEFAULT_MODES, |
|
296 | 290 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] |
|
297 | 291 | ); |
|
298 | 292 | } |
|
299 | 293 | if (status == RTEMS_SUCCESSFUL) // SPIQ |
|
300 | 294 | { |
|
301 | 295 | status = rtems_task_create( |
|
302 | 296 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
303 | 297 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
304 | 298 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] |
|
305 | 299 | ); |
|
306 | 300 | } |
|
307 | 301 | if (status == RTEMS_SUCCESSFUL) // SMIQ |
|
308 | 302 | { |
|
309 | 303 | status = rtems_task_create( |
|
310 | 304 | Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
311 | 305 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
312 | 306 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ] |
|
313 | 307 | ); |
|
314 | 308 | } |
|
315 | 309 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
316 | 310 | { |
|
317 | 311 | status = rtems_task_create( |
|
318 | 312 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, |
|
319 | 313 | RTEMS_DEFAULT_MODES, |
|
320 | 314 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] |
|
321 | 315 | ); |
|
322 | 316 | } |
|
323 | 317 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
324 | 318 | { |
|
325 | 319 | status = rtems_task_create( |
|
326 | 320 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, |
|
327 | 321 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
328 | 322 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] |
|
329 | 323 | ); |
|
330 | 324 | } |
|
331 | 325 | if (status == RTEMS_SUCCESSFUL) // BPF0 |
|
332 | 326 | { |
|
333 | 327 | status = rtems_task_create( |
|
334 | 328 | Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE, |
|
335 | 329 | RTEMS_DEFAULT_MODES, |
|
336 | 330 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0] |
|
337 | 331 | ); |
|
338 | 332 | } |
|
339 | 333 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
340 | 334 | { |
|
341 | 335 | status = rtems_task_create( |
|
342 | 336 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, |
|
343 | 337 | RTEMS_DEFAULT_MODES, |
|
344 | 338 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] |
|
345 | 339 | ); |
|
346 | 340 | } |
|
347 | 341 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
348 | 342 | { |
|
349 | 343 | status = rtems_task_create( |
|
350 | 344 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, |
|
351 | 345 | RTEMS_DEFAULT_MODES, |
|
352 | 346 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] |
|
353 | 347 | ); |
|
354 | 348 | } |
|
355 | 349 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
356 | 350 | { |
|
357 | 351 | status = rtems_task_create( |
|
358 | 352 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, |
|
359 | 353 | RTEMS_DEFAULT_MODES, |
|
360 | 354 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] |
|
361 | 355 | ); |
|
362 | 356 | } |
|
363 | 357 | if (status == RTEMS_SUCCESSFUL) // MATR |
|
364 | 358 | { |
|
365 | 359 | status = rtems_task_create( |
|
366 | 360 | Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE, |
|
367 | 361 | RTEMS_DEFAULT_MODES, |
|
368 | 362 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR] |
|
369 | 363 | ); |
|
370 | 364 | } |
|
371 | 365 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
372 | 366 | { |
|
373 | 367 | status = rtems_task_create( |
|
374 | 368 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, |
|
375 | 369 | RTEMS_DEFAULT_MODES, |
|
376 | 370 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3] |
|
377 | 371 | ); |
|
378 | 372 | } |
|
379 | 373 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
380 | 374 | { |
|
381 | 375 | status = rtems_task_create( |
|
382 | 376 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, |
|
383 | 377 | RTEMS_DEFAULT_MODES, |
|
384 | 378 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2] |
|
385 | 379 | ); |
|
386 | 380 | } |
|
387 | 381 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
388 | 382 | { |
|
389 | 383 | status = rtems_task_create( |
|
390 | 384 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, |
|
391 | 385 | RTEMS_DEFAULT_MODES, |
|
392 | 386 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1] |
|
393 | 387 | ); |
|
394 | 388 | } |
|
395 | 389 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
396 | 390 | { |
|
397 | 391 | status = rtems_task_create( |
|
398 | 392 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, |
|
399 | 393 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
400 | 394 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] |
|
401 | 395 | ); |
|
402 | 396 | } |
|
403 | 397 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
404 | 398 | { |
|
405 | 399 | status = rtems_task_create( |
|
406 | 400 | Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE, |
|
407 | 401 | RTEMS_DEFAULT_MODES, |
|
408 | 402 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG] |
|
409 | 403 | ); |
|
410 | 404 | } |
|
411 | 405 | |
|
412 | 406 | return status; |
|
413 | 407 | } |
|
414 | 408 | |
|
415 | 409 | int start_recv_send_tasks( void ) |
|
416 | 410 | { |
|
417 | 411 | rtems_status_code status; |
|
418 | 412 | |
|
419 | 413 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); |
|
420 | 414 | if (status!=RTEMS_SUCCESSFUL) { |
|
421 | 415 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") |
|
422 | 416 | } |
|
423 | 417 | |
|
424 | 418 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
425 | 419 | { |
|
426 | 420 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); |
|
427 | 421 | if (status!=RTEMS_SUCCESSFUL) { |
|
428 | 422 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") |
|
429 | 423 | } |
|
430 | 424 | } |
|
431 | 425 | |
|
432 | 426 | return status; |
|
433 | 427 | } |
|
434 | 428 | |
|
435 | 429 | int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS |
|
436 | 430 | { |
|
437 | 431 | /** This function starts all RTEMS tasks used in the software. |
|
438 | 432 | * |
|
439 | 433 | * @return RTEMS directive status codes: |
|
440 | 434 | * - RTEMS_SUCCESSFUL - ask started successfully |
|
441 | 435 | * - RTEMS_INVALID_ADDRESS - invalid task entry point |
|
442 | 436 | * - RTEMS_INVALID_ID - invalid task id |
|
443 | 437 | * - RTEMS_INCORRECT_STATE - task not in the dormant state |
|
444 | 438 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task |
|
445 | 439 | * |
|
446 | 440 | */ |
|
447 | 441 | // starts all the tasks fot eh flight software |
|
448 | 442 | |
|
449 | 443 | rtems_status_code status; |
|
450 | 444 | |
|
451 | 445 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); |
|
452 | 446 | if (status!=RTEMS_SUCCESSFUL) { |
|
453 | 447 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") |
|
454 | 448 | } |
|
455 | 449 | |
|
456 | 450 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
457 | 451 | { |
|
458 | 452 | status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 ); |
|
459 | 453 | if (status!=RTEMS_SUCCESSFUL) { |
|
460 | 454 | BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n") |
|
461 | 455 | } |
|
462 | 456 | } |
|
463 | 457 | |
|
464 | 458 | if (status == RTEMS_SUCCESSFUL) // SMIQ |
|
465 | 459 | { |
|
466 | 460 | status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 ); |
|
467 | 461 | if (status!=RTEMS_SUCCESSFUL) { |
|
468 | 462 | BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n") |
|
469 | 463 | } |
|
470 | 464 | } |
|
471 | 465 | |
|
472 | 466 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
473 | 467 | { |
|
474 | 468 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); |
|
475 | 469 | if (status!=RTEMS_SUCCESSFUL) { |
|
476 | 470 | BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") |
|
477 | 471 | } |
|
478 | 472 | } |
|
479 | 473 | |
|
480 | 474 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
481 | 475 | { |
|
482 | 476 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); |
|
483 | 477 | if (status!=RTEMS_SUCCESSFUL) { |
|
484 | 478 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") |
|
485 | 479 | } |
|
486 | 480 | } |
|
487 | 481 | |
|
488 | 482 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
489 | 483 | { |
|
490 | 484 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 ); |
|
491 | 485 | if (status!=RTEMS_SUCCESSFUL) { |
|
492 | 486 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") |
|
493 | 487 | } |
|
494 | 488 | } |
|
495 | 489 | |
|
496 | 490 | if (status == RTEMS_SUCCESSFUL) // BPF0 |
|
497 | 491 | { |
|
498 | 492 | status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 ); |
|
499 | 493 | if (status!=RTEMS_SUCCESSFUL) { |
|
500 | 494 | BOOT_PRINTF("in INIT *** Error starting TASK_BPF0\n") |
|
501 | 495 | } |
|
502 | 496 | } |
|
503 | 497 | |
|
504 | 498 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
505 | 499 | { |
|
506 | 500 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); |
|
507 | 501 | if (status!=RTEMS_SUCCESSFUL) { |
|
508 | 502 | BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") |
|
509 | 503 | } |
|
510 | 504 | } |
|
511 | 505 | |
|
512 | 506 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
513 | 507 | { |
|
514 | 508 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); |
|
515 | 509 | if (status!=RTEMS_SUCCESSFUL) { |
|
516 | 510 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") |
|
517 | 511 | } |
|
518 | 512 | } |
|
519 | 513 | |
|
520 | 514 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
521 | 515 | { |
|
522 | 516 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); |
|
523 | 517 | if (status!=RTEMS_SUCCESSFUL) { |
|
524 | 518 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") |
|
525 | 519 | } |
|
526 | 520 | } |
|
527 | 521 | |
|
528 | 522 | if (status == RTEMS_SUCCESSFUL) // MATR |
|
529 | 523 | { |
|
530 | 524 | status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 ); |
|
531 | 525 | if (status!=RTEMS_SUCCESSFUL) { |
|
532 | 526 | BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n") |
|
533 | 527 | } |
|
534 | 528 | } |
|
535 | 529 | |
|
536 | 530 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
537 | 531 | { |
|
538 | 532 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); |
|
539 | 533 | if (status!=RTEMS_SUCCESSFUL) { |
|
540 | 534 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") |
|
541 | 535 | } |
|
542 | 536 | } |
|
543 | 537 | |
|
544 | 538 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
545 | 539 | { |
|
546 | 540 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); |
|
547 | 541 | if (status!=RTEMS_SUCCESSFUL) { |
|
548 | 542 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") |
|
549 | 543 | } |
|
550 | 544 | } |
|
551 | 545 | |
|
552 | 546 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
553 | 547 | { |
|
554 | 548 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); |
|
555 | 549 | if (status!=RTEMS_SUCCESSFUL) { |
|
556 | 550 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") |
|
557 | 551 | } |
|
558 | 552 | } |
|
559 | 553 | return status; |
|
560 | 554 | } |
|
561 | 555 | |
|
562 | 556 | rtems_status_code create_message_queues( void ) // create the two message queues used in the software |
|
563 | 557 | { |
|
564 | 558 | rtems_status_code status_recv; |
|
565 | 559 | rtems_status_code status_send; |
|
566 | 560 | rtems_status_code ret; |
|
567 | 561 | rtems_id queue_id; |
|
568 | 562 | |
|
569 | 563 | // create the queue for handling valid TCs |
|
570 | 564 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], |
|
571 | 565 | ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE, |
|
572 | 566 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
573 | 567 | if ( status_recv != RTEMS_SUCCESSFUL ) { |
|
574 | 568 | PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) |
|
575 | 569 | } |
|
576 | 570 | |
|
577 | 571 | // create the queue for handling TM packet sending |
|
578 | 572 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], |
|
579 | 573 | ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE, |
|
580 | 574 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
581 | 575 | if ( status_send != RTEMS_SUCCESSFUL ) { |
|
582 | 576 | PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) |
|
583 | 577 | } |
|
584 | 578 | |
|
585 | 579 | if ( status_recv != RTEMS_SUCCESSFUL ) |
|
586 | 580 | { |
|
587 | 581 | ret = status_recv; |
|
588 | 582 | } |
|
589 | 583 | else |
|
590 | 584 | { |
|
591 | 585 | ret = status_send; |
|
592 | 586 | } |
|
593 | 587 | |
|
594 | 588 | return ret; |
|
595 | 589 | } |
|
596 | 590 |
@@ -1,293 +1,292 | |||
|
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 | char *DumbMessages[6] = {"in DUMB *** default", // RTEMS_EVENT_0 |
|
11 | 11 | "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1 |
|
12 | 12 | "in DUMB *** waveforms_isr", // RTEMS_EVENT_2 |
|
13 | 13 | "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3 |
|
14 | 14 | "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4 |
|
15 | 15 | "in DUMB *** waveforms_simulator_isr" // RTEMS_EVENT_5 |
|
16 | 16 | }; |
|
17 | 17 | |
|
18 | 18 | int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, |
|
19 | 19 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) |
|
20 | 20 | { |
|
21 | 21 | /** This function configures a GPTIMER timer instantiated in the VHDL design. |
|
22 | 22 | * |
|
23 | 23 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
24 | 24 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
25 | 25 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. |
|
26 | 26 | * @param interrupt_level is the interrupt level that the timer drives. |
|
27 | 27 | * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer. |
|
28 | 28 | * |
|
29 | 29 | * @return |
|
30 | 30 | * |
|
31 | 31 | * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76 |
|
32 | 32 | * |
|
33 | 33 | */ |
|
34 | 34 | |
|
35 | 35 | rtems_status_code status; |
|
36 | 36 | rtems_isr_entry old_isr_handler; |
|
37 | 37 | |
|
38 | 38 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels |
|
39 | 39 | if (status!=RTEMS_SUCCESSFUL) |
|
40 | 40 | { |
|
41 | 41 | PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n") |
|
42 | 42 | } |
|
43 | 43 | |
|
44 | 44 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); |
|
45 | 45 | |
|
46 | 46 | return 1; |
|
47 | 47 | } |
|
48 | 48 | |
|
49 | 49 | int timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
50 | 50 | { |
|
51 | 51 | /** This function starts a GPTIMER timer. |
|
52 | 52 | * |
|
53 | 53 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
54 | 54 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
55 | 55 | * |
|
56 | 56 | * @return 1 |
|
57 | 57 | * |
|
58 | 58 | */ |
|
59 | 59 | |
|
60 | 60 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
61 | 61 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register |
|
62 | 62 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer |
|
63 | 63 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart |
|
64 | 64 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable |
|
65 | 65 | |
|
66 | 66 | return 1; |
|
67 | 67 | } |
|
68 | 68 | |
|
69 | 69 | int timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
70 | 70 | { |
|
71 | 71 | /** This function stops 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 | * |
|
76 | 76 | * @return 1 |
|
77 | 77 | * |
|
78 | 78 | */ |
|
79 | 79 | |
|
80 | 80 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer |
|
81 | 81 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable |
|
82 | 82 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
83 | 83 | |
|
84 | 84 | return 1; |
|
85 | 85 | } |
|
86 | 86 | |
|
87 | 87 | int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider) |
|
88 | 88 | { |
|
89 | 89 | /** This function sets the clock divider of a GPTIMER timer. |
|
90 | 90 | * |
|
91 | 91 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
92 | 92 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
93 | 93 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. |
|
94 | 94 | * |
|
95 | 95 | * @return 1 |
|
96 | 96 | * |
|
97 | 97 | */ |
|
98 | 98 | |
|
99 | 99 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz |
|
100 | 100 | |
|
101 | 101 | return 1; |
|
102 | 102 | } |
|
103 | 103 | |
|
104 | 104 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port |
|
105 | 105 | { |
|
106 | 106 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
107 | 107 | |
|
108 | 108 | apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB; |
|
109 | 109 | PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") |
|
110 | 110 | |
|
111 | 111 | return 0; |
|
112 | 112 | } |
|
113 | 113 | |
|
114 | 114 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) |
|
115 | 115 | { |
|
116 | 116 | /** This function sets the scaler reload register of the apbuart module |
|
117 | 117 | * |
|
118 | 118 | * @param regs is the address of the apbuart registers in memory |
|
119 | 119 | * @param value is the value that will be stored in the scaler register |
|
120 | 120 | * |
|
121 | 121 | * The value shall be set by the software to get data on the serial interface. |
|
122 | 122 | * |
|
123 | 123 | */ |
|
124 | 124 | |
|
125 | 125 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; |
|
126 | 126 | |
|
127 | 127 | apbuart_regs->scaler = value; |
|
128 | 128 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) |
|
129 | 129 | } |
|
130 | 130 | |
|
131 | 131 | //************ |
|
132 | 132 | // RTEMS TASKS |
|
133 | 133 | |
|
134 | 134 | rtems_task stat_task(rtems_task_argument argument) |
|
135 | 135 | { |
|
136 | 136 | int i; |
|
137 | 137 | int j; |
|
138 | 138 | i = 0; |
|
139 | 139 | j = 0; |
|
140 | 140 | BOOT_PRINTF("in STAT *** \n") |
|
141 | 141 | while(1){ |
|
142 | 142 | rtems_task_wake_after(1000); |
|
143 | 143 | PRINTF1("%d\n", j) |
|
144 | 144 | if (i == CPU_USAGE_REPORT_PERIOD) { |
|
145 | 145 | // #ifdef PRINT_TASK_STATISTICS |
|
146 | 146 | // rtems_cpu_usage_report(); |
|
147 | 147 | // rtems_cpu_usage_reset(); |
|
148 | 148 | // #endif |
|
149 | 149 | i = 0; |
|
150 | 150 | } |
|
151 | 151 | else i++; |
|
152 | 152 | j++; |
|
153 | 153 | } |
|
154 | 154 | } |
|
155 | 155 | |
|
156 | 156 | rtems_task hous_task(rtems_task_argument argument) |
|
157 | 157 | { |
|
158 | 158 | rtems_status_code status; |
|
159 | 159 | rtems_id queue_id; |
|
160 | 160 | |
|
161 | 161 | status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id ); |
|
162 | 162 | if (status != RTEMS_SUCCESSFUL) |
|
163 | 163 | { |
|
164 | 164 | PRINTF1("in HOUS *** ERR %d\n", status) |
|
165 | 165 | } |
|
166 | 166 | |
|
167 | 167 | BOOT_PRINTF("in HOUS ***\n") |
|
168 | 168 | |
|
169 | 169 | if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) { |
|
170 | 170 | status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id ); |
|
171 | 171 | if( status != RTEMS_SUCCESSFUL ) { |
|
172 | 172 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) |
|
173 | 173 | } |
|
174 | 174 | } |
|
175 | 175 | |
|
176 | 176 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
177 | 177 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
178 | 178 | housekeeping_packet.reserved = DEFAULT_RESERVED; |
|
179 | 179 | housekeeping_packet.userApplication = CCSDS_USER_APP; |
|
180 | 180 | housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8); |
|
181 | 181 | housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK); |
|
182 | 182 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
183 | 183 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
184 | 184 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
185 | 185 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
186 | 186 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
187 | 187 | housekeeping_packet.serviceType = TM_TYPE_HK; |
|
188 | 188 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; |
|
189 | 189 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
190 | 190 | |
|
191 | 191 | status = rtems_rate_monotonic_cancel(HK_id); |
|
192 | 192 | if( status != RTEMS_SUCCESSFUL ) { |
|
193 | 193 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) |
|
194 | 194 | } |
|
195 | 195 | else { |
|
196 | 196 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") |
|
197 | 197 | } |
|
198 | 198 | |
|
199 | 199 | while(1){ // launch the rate monotonic task |
|
200 | 200 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); |
|
201 | 201 | if ( status != RTEMS_SUCCESSFUL ) { |
|
202 | 202 | PRINTF1( "in HOUS *** ERR period: %d\n", status); |
|
203 | 203 | } |
|
204 | 204 | else { |
|
205 | 205 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
206 | 206 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
207 | 207 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
208 | 208 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
209 | 209 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
210 | 210 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
211 | 211 | housekeeping_packet.sid = SID_HK; |
|
212 | 212 | |
|
213 | 213 | spacewire_update_statistics(); |
|
214 | 214 | |
|
215 | 215 | // SEND PACKET |
|
216 | 216 | status = rtems_message_queue_send( queue_id, &housekeeping_packet, |
|
217 | 217 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
218 | 218 | if (status != RTEMS_SUCCESSFUL) { |
|
219 | 219 | PRINTF1("in HOUS *** ERR send: %d\n", status) |
|
220 | 220 | } |
|
221 | 221 | } |
|
222 | 222 | } |
|
223 | 223 | |
|
224 | 224 | PRINTF("in HOUS *** deleting task\n") |
|
225 | 225 | |
|
226 | 226 | status = rtems_task_delete( RTEMS_SELF ); // should not return |
|
227 | 227 | printf( "rtems_task_delete returned with status of %d.\n", status ); |
|
228 | 228 | return; |
|
229 | 229 | } |
|
230 | 230 | |
|
231 | 231 | rtems_task dumb_task( rtems_task_argument unused ) |
|
232 | 232 | { |
|
233 | 233 | /** This RTEMS taks is used to print messages without affecting the general behaviour of the software. |
|
234 | 234 | * |
|
235 | 235 | * @param unused is the starting argument of the RTEMS task |
|
236 | 236 | * |
|
237 | 237 | * The DUMB taks waits for RTEMS events and print messages depending on the incoming events. |
|
238 | 238 | * |
|
239 | 239 | */ |
|
240 | 240 | |
|
241 | 241 | unsigned int i; |
|
242 | 242 | unsigned int intEventOut; |
|
243 | 243 | unsigned int coarse_time = 0; |
|
244 | 244 | unsigned int fine_time = 0; |
|
245 | 245 | rtems_event_set event_out; |
|
246 | 246 | |
|
247 | 247 | BOOT_PRINTF("in DUMB *** \n") |
|
248 | 248 | |
|
249 | 249 | while(1){ |
|
250 | 250 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | RTEMS_EVENT_4 | RTEMS_EVENT_5, |
|
251 | 251 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT |
|
252 | 252 | intEventOut = (unsigned int) event_out; |
|
253 | 253 | for ( i=0; i<32; i++) |
|
254 | 254 | { |
|
255 | 255 | if ( ((intEventOut >> i) & 0x0001) != 0) |
|
256 | 256 | { |
|
257 | 257 | coarse_time = time_management_regs->coarse_time; |
|
258 | 258 | fine_time = time_management_regs->fine_time; |
|
259 | 259 | printf("in DUMB *** time = coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); |
|
260 | 260 | } |
|
261 | 261 | } |
|
262 | 262 | } |
|
263 | 263 | } |
|
264 | 264 | |
|
265 | 265 | //***************************** |
|
266 | 266 | // init housekeeping parameters |
|
267 | 267 | |
|
268 | 268 | void init_housekeeping_parameters( void ) |
|
269 | 269 | { |
|
270 | 270 | /** This function initialize the housekeeping_packet global variable with default values. |
|
271 | 271 | * |
|
272 | 272 | */ |
|
273 | 273 | |
|
274 | 274 | unsigned int i = 0; |
|
275 | 275 | char *parameters; |
|
276 | 276 | |
|
277 | 277 | parameters = (char*) &housekeeping_packet.lfr_status_word; |
|
278 | 278 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) |
|
279 | 279 | { |
|
280 | 280 | parameters[i] = 0x00; |
|
281 | 281 | } |
|
282 | 282 | // init status word |
|
283 | 283 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; |
|
284 | 284 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; |
|
285 | 285 | // init software version |
|
286 | 286 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
287 | 287 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
288 | 288 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
289 | 289 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
290 | 290 | |
|
291 | updateLFRCurrentMode(); | |
|
292 | 291 | } |
|
293 | 292 |
@@ -1,590 +1,602 | |||
|
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 | char *lstates[6] = {"Error-reset", |
|
17 | 17 | "Error-wait", |
|
18 | 18 | "Ready", |
|
19 | 19 | "Started", |
|
20 | 20 | "Connecting", |
|
21 | 21 | "Run" |
|
22 | 22 | }; |
|
23 | 23 | |
|
24 | 24 | //*********** |
|
25 | 25 | // RTEMS TASK |
|
26 | 26 | rtems_task spiq_task(rtems_task_argument unused) |
|
27 | 27 | { |
|
28 | 28 | /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver. |
|
29 | 29 | * |
|
30 | 30 | * @param unused is the starting argument of the RTEMS task |
|
31 | 31 | * |
|
32 | 32 | */ |
|
33 | 33 | |
|
34 | 34 | rtems_event_set event_out; |
|
35 | 35 | rtems_status_code status; |
|
36 | 36 | int linkStatus; |
|
37 | 37 | |
|
38 | 38 | BOOT_PRINTF("in SPIQ *** \n") |
|
39 | 39 | |
|
40 | 40 | while(true){ |
|
41 | 41 | rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT |
|
42 | 42 | PRINTF("in SPIQ *** got SPW_LINKERR_EVENT\n") |
|
43 | 43 | |
|
44 |
// [0] SUSPEND RECV A |
|
|
44 | // [0] SUSPEND RECV AND SEND TASKS | |
|
45 | 45 | rtems_task_suspend( Task_id[ TASKID_RECV ] ); |
|
46 | 46 | rtems_task_suspend( Task_id[ TASKID_SEND ] ); |
|
47 | 47 | |
|
48 | 48 | // [1] CHECK THE LINK |
|
49 | 49 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1) |
|
50 | 50 | if ( linkStatus != 5) { |
|
51 | 51 | PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus) |
|
52 | 52 | rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms |
|
53 | 53 | } |
|
54 | 54 | |
|
55 | 55 | // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT |
|
56 | 56 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2) |
|
57 | 57 | if ( linkStatus != 5 ) // [2.a] not in run state, reset the link |
|
58 | 58 | { |
|
59 | 59 | spacewire_compute_stats_offsets(); |
|
60 | 60 | status = spacewire_reset_link( ); |
|
61 | 61 | } |
|
62 | 62 | else // [2.b] in run state, start the link |
|
63 | 63 | { |
|
64 | 64 | status = spacewire_stop_start_link( fdSPW ); // start the link |
|
65 | 65 | if ( status != RTEMS_SUCCESSFUL) |
|
66 | 66 | { |
|
67 | 67 | PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status) |
|
68 | 68 | } |
|
69 | 69 | } |
|
70 | 70 | |
|
71 | 71 | // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS |
|
72 | 72 | if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully |
|
73 | 73 | { |
|
74 | 74 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); |
|
75 | 75 | if ( status != RTEMS_SUCCESSFUL ) { |
|
76 | 76 | PRINTF("in SPIQ *** ERR resuming SEND Task\n") |
|
77 | 77 | } |
|
78 | 78 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); |
|
79 | 79 | if ( status != RTEMS_SUCCESSFUL ) { |
|
80 | 80 | PRINTF("in SPIQ *** ERR resuming RECV Task\n") |
|
81 | 81 | } |
|
82 | 82 | } |
|
83 | 83 | else // [3.b] the link is not in run state, go in STANDBY mode |
|
84 | 84 | { |
|
85 | status = enter_mode( LFR_MODE_STANDBY, NULL ); // enter the STANDBY mode | |
|
85 | status = stop_current_mode(); | |
|
86 | 86 | if ( status != RTEMS_SUCCESSFUL ) { |
|
87 |
PRINTF1("in SPIQ *** ERR ent |
|
|
87 | PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status) | |
|
88 | } | |
|
89 | status = enter_standby_mode(); | |
|
90 | if ( status != RTEMS_SUCCESSFUL ) { | |
|
91 | PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status) | |
|
88 | 92 | } |
|
89 | 93 | // wake the WTDG task up to wait for the link recovery |
|
90 | 94 | status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 ); |
|
91 | 95 | rtems_task_suspend( RTEMS_SELF ); |
|
92 | 96 | } |
|
93 | 97 | } |
|
94 | 98 | } |
|
95 | 99 | |
|
96 | 100 | rtems_task recv_task( rtems_task_argument unused ) |
|
97 | 101 | { |
|
98 | 102 | /** This RTEMS task is dedicated to the reception of incoming TeleCommands. |
|
99 | 103 | * |
|
100 | 104 | * @param unused is the starting argument of the RTEMS task |
|
101 | 105 | * |
|
102 | 106 | * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked: |
|
103 | 107 | * 1. It reads the incoming data. |
|
104 | 108 | * 2. Launches the acceptance procedure. |
|
105 | 109 | * 3. If the Telecommand is valid, sends it to a dedicated RTEMS message queue. |
|
106 | 110 | * |
|
107 | 111 | */ |
|
108 | 112 | |
|
109 | 113 | int len; |
|
110 | 114 | ccsdsTelecommandPacket_t currentTC; |
|
111 | 115 | unsigned char computed_CRC[ 2 ]; |
|
112 | 116 | unsigned char currentTC_LEN_RCV[ 2 ]; |
|
113 | 117 | unsigned int currentTC_LEN_RCV_AsUnsignedInt; |
|
114 | 118 | unsigned int parserCode; |
|
115 | 119 | rtems_status_code status; |
|
116 | 120 | rtems_id queue_recv_id; |
|
117 | 121 | rtems_id queue_send_id; |
|
118 | 122 | |
|
119 | 123 | initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes |
|
120 | 124 | |
|
121 | 125 | status = rtems_message_queue_ident( misc_name[QUEUE_RECV], 0, &queue_recv_id ); |
|
122 | 126 | if (status != RTEMS_SUCCESSFUL) |
|
123 | 127 | { |
|
124 | 128 | PRINTF1("in RECV *** ERR getting QUEUE_RECV id, %d\n", status) |
|
125 | 129 | } |
|
126 | 130 | |
|
127 | 131 | status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_send_id ); |
|
128 | 132 | if (status != RTEMS_SUCCESSFUL) |
|
129 | 133 | { |
|
130 | 134 | PRINTF1("in RECV *** ERR getting QUEUE_SEND id, %d\n", status) |
|
131 | 135 | } |
|
132 | 136 | |
|
133 | 137 | BOOT_PRINTF("in RECV *** \n") |
|
134 | 138 | |
|
135 | 139 | while(1) |
|
136 | 140 | { |
|
137 | 141 | len = read( fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking |
|
138 | 142 | if (len == -1){ // error during the read call |
|
139 | 143 | PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno) |
|
140 | 144 | } |
|
141 | 145 | else { |
|
142 | 146 | if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) { |
|
143 | 147 | PRINTF("in RECV *** packet lenght too short\n") |
|
144 | 148 | } |
|
145 | 149 | else { |
|
146 | 150 | currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes |
|
147 | 151 | currentTC_LEN_RCV[ 0 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt >> 8); |
|
148 | 152 | currentTC_LEN_RCV[ 1 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt ); |
|
149 | 153 | // CHECK THE TC |
|
150 | 154 | parserCode = tc_parser( ¤tTC, currentTC_LEN_RCV_AsUnsignedInt, computed_CRC ) ; |
|
151 |
if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_P |
|
|
152 | | (parserCode == ILL_TYPE) || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA) ) | |
|
155 | if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT) | |
|
156 | || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE) | |
|
157 | || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA) | |
|
158 | || (parserCode == WRONG_SRC_ID) ) | |
|
153 | 159 | { // send TM_LFR_TC_EXE_CORRUPTED |
|
160 | if ( !( (currentTC.serviceType==TC_TYPE_TIME) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_TIME) ) | |
|
161 | && | |
|
162 | !( (currentTC.serviceType==TC_TYPE_GEN) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_INFO)) | |
|
163 | ) | |
|
164 | { | |
|
154 | 165 | send_tm_lfr_tc_exe_corrupted( ¤tTC, queue_send_id, computed_CRC, currentTC_LEN_RCV ); |
|
155 | 166 | } |
|
167 | } | |
|
156 | 168 | else |
|
157 | 169 | { // send valid TC to the action launcher |
|
158 | 170 | status = rtems_message_queue_send( queue_recv_id, ¤tTC, |
|
159 | 171 | currentTC_LEN_RCV_AsUnsignedInt + CCSDS_TC_TM_PACKET_OFFSET + 3); |
|
160 | 172 | } |
|
161 | 173 | } |
|
162 | 174 | } |
|
163 | 175 | } |
|
164 | 176 | } |
|
165 | 177 | |
|
166 | 178 | rtems_task send_task( rtems_task_argument argument) |
|
167 | 179 | { |
|
168 | 180 | /** This RTEMS task is dedicated to the transmission of TeleMetry packets. |
|
169 | 181 | * |
|
170 | 182 | * @param unused is the starting argument of the RTEMS task |
|
171 | 183 | * |
|
172 | 184 | * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives: |
|
173 | 185 | * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call. |
|
174 | 186 | * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After |
|
175 | 187 | * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the |
|
176 | 188 | * data it contains. |
|
177 | 189 | * |
|
178 | 190 | */ |
|
179 | 191 | |
|
180 | 192 | rtems_status_code status; // RTEMS status code |
|
181 | 193 | char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer |
|
182 | 194 | spw_ioctl_pkt_send *spw_ioctl_send; |
|
183 | 195 | size_t size; // size of the incoming TC packet |
|
184 | 196 | u_int32_t count; |
|
185 | 197 | rtems_id queue_id; |
|
186 | 198 | |
|
187 | 199 | status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id ); |
|
188 | 200 | if (status != RTEMS_SUCCESSFUL) |
|
189 | 201 | { |
|
190 | 202 | PRINTF1("in SEND *** ERR getting queue id, %d\n", status) |
|
191 | 203 | } |
|
192 | 204 | |
|
193 | 205 | BOOT_PRINTF("in SEND *** \n") |
|
194 | 206 | |
|
195 | 207 | while(1) |
|
196 | 208 | { |
|
197 | 209 | status = rtems_message_queue_receive( queue_id, incomingData, &size, |
|
198 | 210 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); |
|
199 | 211 | |
|
200 | 212 | if (status!=RTEMS_SUCCESSFUL) |
|
201 | 213 | { |
|
202 | 214 | PRINTF1("in SEND *** (1) ERR = %d\n", status) |
|
203 | 215 | } |
|
204 | 216 | else |
|
205 | 217 | { |
|
206 | 218 | if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet |
|
207 | 219 | { |
|
208 | 220 | status = write( fdSPW, incomingData, size ); |
|
209 | 221 | if (status == -1){ |
|
210 | 222 | PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size) |
|
211 | 223 | } |
|
212 | 224 | } |
|
213 | 225 | else // the incoming message is a spw_ioctl_pkt_send structure |
|
214 | 226 | { |
|
215 | 227 | spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData; |
|
216 | 228 | if (spw_ioctl_send->hlen == 0) |
|
217 | 229 | { |
|
218 | 230 | status = write( fdSPW, spw_ioctl_send->data, spw_ioctl_send->dlen ); |
|
219 | 231 | if (status == -1){ |
|
220 | 232 | PRINTF2("in SEND *** (2.b) ERRNO = %d, dlen = %d\n", errno, spw_ioctl_send->dlen) |
|
221 | 233 | } |
|
222 | 234 | } |
|
223 | 235 | else |
|
224 | 236 | { |
|
225 | 237 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send ); |
|
226 | 238 | if (status == -1){ |
|
227 | 239 | PRINTF2("in SEND *** (2.c) ERRNO = %d, dlen = %d\n", errno, spw_ioctl_send->dlen) |
|
228 | 240 | PRINTF1(" hlen = %d\n", spw_ioctl_send->hlen) |
|
229 | 241 | } |
|
230 | 242 | } |
|
231 | 243 | } |
|
232 | 244 | } |
|
233 | 245 | |
|
234 | 246 | status = rtems_message_queue_get_number_pending( queue_id, &count ); |
|
235 | 247 | if (status != RTEMS_SUCCESSFUL) |
|
236 | 248 | { |
|
237 | 249 | PRINTF1("in SEND *** (3) ERR = %d\n", status) |
|
238 | 250 | } |
|
239 | 251 | else |
|
240 | 252 | { |
|
241 | 253 | if (count > maxCount) |
|
242 | 254 | { |
|
243 | 255 | maxCount = count; |
|
244 | 256 | } |
|
245 | 257 | } |
|
246 | 258 | } |
|
247 | 259 | } |
|
248 | 260 | |
|
249 | 261 | rtems_task wtdg_task( rtems_task_argument argument ) |
|
250 | 262 | { |
|
251 | 263 | rtems_event_set event_out; |
|
252 | 264 | rtems_status_code status; |
|
253 | 265 | int linkStatus; |
|
254 | 266 | |
|
255 | 267 | BOOT_PRINTF("in WTDG ***\n") |
|
256 | 268 | |
|
257 | 269 | while(1) |
|
258 | 270 | { |
|
259 | 271 | // wait for an RTEMS_EVENT |
|
260 | 272 | rtems_event_receive( RTEMS_EVENT_0, |
|
261 | 273 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
262 | 274 | PRINTF("in WTDG *** wait for the link\n") |
|
263 | 275 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
264 | 276 | while( linkStatus != 5) // wait for the link |
|
265 | 277 | { |
|
266 | 278 | rtems_task_wake_after( 10 ); |
|
267 | 279 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
268 | 280 | } |
|
269 | 281 | |
|
270 | 282 | status = spacewire_stop_start_link( fdSPW ); |
|
271 | 283 | |
|
272 | 284 | if (status != RTEMS_SUCCESSFUL) |
|
273 | 285 | { |
|
274 | 286 | PRINTF1("in WTDG *** ERR link not started %d\n", status) |
|
275 | 287 | } |
|
276 | 288 | else |
|
277 | 289 | { |
|
278 | 290 | PRINTF("in WTDG *** OK link started\n") |
|
279 | 291 | } |
|
280 | 292 | |
|
281 | 293 | // restart the SPIQ task |
|
282 | 294 | status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 ); |
|
283 | 295 | if ( status != RTEMS_SUCCESSFUL ) { |
|
284 | 296 | PRINTF("in SPIQ *** ERR restarting SPIQ Task\n") |
|
285 | 297 | } |
|
286 | 298 | |
|
287 | 299 | // restart RECV and SEND |
|
288 | 300 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); |
|
289 | 301 | if ( status != RTEMS_SUCCESSFUL ) { |
|
290 | 302 | PRINTF("in SPIQ *** ERR restarting SEND Task\n") |
|
291 | 303 | } |
|
292 | 304 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); |
|
293 | 305 | if ( status != RTEMS_SUCCESSFUL ) { |
|
294 | 306 | PRINTF("in SPIQ *** ERR restarting RECV Task\n") |
|
295 | 307 | } |
|
296 | 308 | } |
|
297 | 309 | } |
|
298 | 310 | |
|
299 | 311 | //**************** |
|
300 | 312 | // OTHER FUNCTIONS |
|
301 | 313 | int spacewire_open_link( void ) |
|
302 | 314 | { |
|
303 | 315 | /** This function opens the SpaceWire link. |
|
304 | 316 | * |
|
305 | 317 | * @return a valid file descriptor in case of success, -1 in case of a failure |
|
306 | 318 | * |
|
307 | 319 | */ |
|
308 | 320 | rtems_status_code status; |
|
309 | 321 | |
|
310 | 322 | fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware |
|
311 | 323 | if ( fdSPW < 0 ) { |
|
312 | 324 | PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno) |
|
313 | 325 | } |
|
314 | 326 | else |
|
315 | 327 | { |
|
316 | 328 | status = RTEMS_SUCCESSFUL; |
|
317 | 329 | } |
|
318 | 330 | |
|
319 | 331 | return status; |
|
320 | 332 | } |
|
321 | 333 | |
|
322 | 334 | int spacewire_start_link( int fd ) |
|
323 | 335 | { |
|
324 | 336 | rtems_status_code status; |
|
325 | 337 | |
|
326 | 338 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started |
|
327 | 339 | // -1 default hardcoded driver timeout |
|
328 | 340 | |
|
329 | 341 | return status; |
|
330 | 342 | } |
|
331 | 343 | |
|
332 | 344 | int spacewire_stop_start_link( int fd ) |
|
333 | 345 | { |
|
334 | 346 | rtems_status_code status; |
|
335 | 347 | |
|
336 | 348 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0 |
|
337 | 349 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started |
|
338 | 350 | // -1 default hardcoded driver timeout |
|
339 | 351 | |
|
340 | 352 | return status; |
|
341 | 353 | } |
|
342 | 354 | |
|
343 | 355 | int spacewire_configure_link( int fd ) |
|
344 | 356 | { |
|
345 | 357 | /** This function configures the SpaceWire link. |
|
346 | 358 | * |
|
347 | 359 | * @return GR-RTEMS-DRIVER directive status codes: |
|
348 | 360 | * - 22 EINVAL - Null pointer or an out of range value was given as the argument. |
|
349 | 361 | * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode. |
|
350 | 362 | * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used. |
|
351 | 363 | * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up. |
|
352 | 364 | * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers. |
|
353 | 365 | * - 5 EIO - Error when writing to grswp hardware registers. |
|
354 | 366 | * - 2 ENOENT - No such file or directory |
|
355 | 367 | */ |
|
356 | 368 | |
|
357 | 369 | rtems_status_code status; |
|
358 | 370 | |
|
359 | 371 | spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force |
|
360 | 372 | spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration |
|
361 | 373 | |
|
362 | 374 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception |
|
363 | 375 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n") |
|
364 | 376 | // |
|
365 | 377 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a |
|
366 | 378 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs |
|
367 | 379 | // |
|
368 | 380 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts |
|
369 | 381 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n") |
|
370 | 382 | // |
|
371 | 383 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit |
|
372 | 384 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n") |
|
373 | 385 | // |
|
374 | 386 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks |
|
375 | 387 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n") |
|
376 | 388 | // |
|
377 | 389 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available |
|
378 | 390 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n") |
|
379 | 391 | // |
|
380 | 392 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ] |
|
381 | 393 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n") |
|
382 | 394 | |
|
383 | 395 | return status; |
|
384 | 396 | } |
|
385 | 397 | |
|
386 | 398 | int spacewire_reset_link( void ) |
|
387 | 399 | { |
|
388 | 400 | /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver. |
|
389 | 401 | * |
|
390 | 402 | * @return RTEMS directive status code: |
|
391 | 403 | * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s. |
|
392 | 404 | * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout. |
|
393 | 405 | * |
|
394 | 406 | */ |
|
395 | 407 | |
|
396 | 408 | rtems_status_code status_spw; |
|
397 | 409 | int i; |
|
398 | 410 | |
|
399 | 411 | for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ ) |
|
400 | 412 | { |
|
401 | 413 | PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i); |
|
402 | 414 | |
|
403 | 415 | // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM |
|
404 | 416 | |
|
405 | 417 | status_spw = spacewire_stop_start_link( fdSPW ); |
|
406 | 418 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
407 | 419 | { |
|
408 | 420 | PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw) |
|
409 | 421 | } |
|
410 | 422 | |
|
411 | 423 | if ( status_spw == RTEMS_SUCCESSFUL) |
|
412 | 424 | { |
|
413 | 425 | break; |
|
414 | 426 | } |
|
415 | 427 | } |
|
416 | 428 | |
|
417 | 429 | return status_spw; |
|
418 | 430 | } |
|
419 | 431 | |
|
420 | 432 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force |
|
421 | 433 | { |
|
422 | 434 | /** This function sets the [N]o [P]ort force bit of the GRSPW control register. |
|
423 | 435 | * |
|
424 | 436 | * @param val is the value, 0 or 1, used to set the value of the NP bit. |
|
425 | 437 | * @param regAddr is the address of the GRSPW control register. |
|
426 | 438 | * |
|
427 | 439 | * NP is the bit 20 of the GRSPW control register. |
|
428 | 440 | * |
|
429 | 441 | */ |
|
430 | 442 | |
|
431 | 443 | unsigned int *spwptr = (unsigned int*) regAddr; |
|
432 | 444 | |
|
433 | 445 | if (val == 1) { |
|
434 | 446 | *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit |
|
435 | 447 | } |
|
436 | 448 | if (val== 0) { |
|
437 | 449 | *spwptr = *spwptr & 0xffdfffff; |
|
438 | 450 | } |
|
439 | 451 | } |
|
440 | 452 | |
|
441 | 453 | void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable |
|
442 | 454 | { |
|
443 | 455 | /** This function sets the [R]MAP [E]nable bit of the GRSPW control register. |
|
444 | 456 | * |
|
445 | 457 | * @param val is the value, 0 or 1, used to set the value of the RE bit. |
|
446 | 458 | * @param regAddr is the address of the GRSPW control register. |
|
447 | 459 | * |
|
448 | 460 | * RE is the bit 16 of the GRSPW control register. |
|
449 | 461 | * |
|
450 | 462 | */ |
|
451 | 463 | |
|
452 | 464 | unsigned int *spwptr = (unsigned int*) regAddr; |
|
453 | 465 | |
|
454 | 466 | if (val == 1) |
|
455 | 467 | { |
|
456 | 468 | *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit |
|
457 | 469 | } |
|
458 | 470 | if (val== 0) |
|
459 | 471 | { |
|
460 | 472 | *spwptr = *spwptr & 0xfffdffff; |
|
461 | 473 | } |
|
462 | 474 | } |
|
463 | 475 | |
|
464 | 476 | void spacewire_compute_stats_offsets( void ) |
|
465 | 477 | { |
|
466 | 478 | /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising. |
|
467 | 479 | * |
|
468 | 480 | * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics |
|
469 | 481 | * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it |
|
470 | 482 | * during the open systel call). |
|
471 | 483 | * |
|
472 | 484 | */ |
|
473 | 485 | |
|
474 | 486 | spw_stats spacewire_stats_grspw; |
|
475 | 487 | rtems_status_code status; |
|
476 | 488 | |
|
477 | 489 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); |
|
478 | 490 | |
|
479 | 491 | spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received |
|
480 | 492 | + spacewire_stats.packets_received; |
|
481 | 493 | spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent |
|
482 | 494 | + spacewire_stats.packets_sent; |
|
483 | 495 | spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err |
|
484 | 496 | + spacewire_stats.parity_err; |
|
485 | 497 | spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err |
|
486 | 498 | + spacewire_stats.disconnect_err; |
|
487 | 499 | spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err |
|
488 | 500 | + spacewire_stats.escape_err; |
|
489 | 501 | spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err |
|
490 | 502 | + spacewire_stats.credit_err; |
|
491 | 503 | spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err |
|
492 | 504 | + spacewire_stats.write_sync_err; |
|
493 | 505 | spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err |
|
494 | 506 | + spacewire_stats.rx_rmap_header_crc_err; |
|
495 | 507 | spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err |
|
496 | 508 | + spacewire_stats.rx_rmap_data_crc_err; |
|
497 | 509 | spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep |
|
498 | 510 | + spacewire_stats.early_ep; |
|
499 | 511 | spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address |
|
500 | 512 | + spacewire_stats.invalid_address; |
|
501 | 513 | spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err |
|
502 | 514 | + spacewire_stats.rx_eep_err; |
|
503 | 515 | spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated |
|
504 | 516 | + spacewire_stats.rx_truncated; |
|
505 | 517 | } |
|
506 | 518 | |
|
507 | 519 | void spacewire_update_statistics( void ) |
|
508 | 520 | { |
|
509 | 521 | rtems_status_code status; |
|
510 | 522 | spw_stats spacewire_stats_grspw; |
|
511 | 523 | |
|
512 | 524 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); |
|
513 | 525 | |
|
514 | 526 | spacewire_stats.packets_received = spacewire_stats_backup.packets_received |
|
515 | 527 | + spacewire_stats_grspw.packets_received; |
|
516 | 528 | spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent |
|
517 | 529 | + spacewire_stats_grspw.packets_sent; |
|
518 | 530 | spacewire_stats.parity_err = spacewire_stats_backup.parity_err |
|
519 | 531 | + spacewire_stats_grspw.parity_err; |
|
520 | 532 | spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err |
|
521 | 533 | + spacewire_stats_grspw.disconnect_err; |
|
522 | 534 | spacewire_stats.escape_err = spacewire_stats_backup.escape_err |
|
523 | 535 | + spacewire_stats_grspw.escape_err; |
|
524 | 536 | spacewire_stats.credit_err = spacewire_stats_backup.credit_err |
|
525 | 537 | + spacewire_stats_grspw.credit_err; |
|
526 | 538 | spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err |
|
527 | 539 | + spacewire_stats_grspw.write_sync_err; |
|
528 | 540 | spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err |
|
529 | 541 | + spacewire_stats_grspw.rx_rmap_header_crc_err; |
|
530 | 542 | spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err |
|
531 | 543 | + spacewire_stats_grspw.rx_rmap_data_crc_err; |
|
532 | 544 | spacewire_stats.early_ep = spacewire_stats_backup.early_ep |
|
533 | 545 | + spacewire_stats_grspw.early_ep; |
|
534 | 546 | spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address |
|
535 | 547 | + spacewire_stats_grspw.invalid_address; |
|
536 | 548 | spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err |
|
537 | 549 | + spacewire_stats_grspw.rx_eep_err; |
|
538 | 550 | spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated |
|
539 | 551 | + spacewire_stats_grspw.rx_truncated; |
|
540 | 552 | //spacewire_stats.tx_link_err; |
|
541 | 553 | |
|
542 | 554 | //**************************** |
|
543 | 555 | // DPU_SPACEWIRE_IF_STATISTICS |
|
544 | 556 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8); |
|
545 | 557 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received); |
|
546 | 558 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8); |
|
547 | 559 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent); |
|
548 | 560 | //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt; |
|
549 | 561 | //housekeeping_packet.hk_lfr_dpu_spw_last_timc; |
|
550 | 562 | |
|
551 | 563 | //****************************************** |
|
552 | 564 | // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY |
|
553 | 565 | housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err; |
|
554 | 566 | housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err; |
|
555 | 567 | housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err; |
|
556 | 568 | housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err; |
|
557 | 569 | housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err; |
|
558 | 570 | // housekeeping_packet.hk_lfr_dpu_spw_rx_ahb; |
|
559 | 571 | // housekeeping_packet.hk_lfr_dpu_spw_tx_ahb; |
|
560 | 572 | housekeeping_packet.hk_lfr_dpu_spw_header_crc = (unsigned char) spacewire_stats.rx_rmap_header_crc_err; |
|
561 | 573 | housekeeping_packet.hk_lfr_dpu_spw_data_crc = (unsigned char) spacewire_stats.rx_rmap_data_crc_err; |
|
562 | 574 | |
|
563 | 575 | //********************************************* |
|
564 | 576 | // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY |
|
565 | 577 | housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep; |
|
566 | 578 | housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address; |
|
567 | 579 | housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err; |
|
568 | 580 | housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated; |
|
569 | 581 | |
|
570 | 582 | } |
|
571 | 583 | |
|
572 | 584 | void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ) |
|
573 | 585 | { |
|
574 | 586 | //if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) { |
|
575 | 587 | // printf("In timecode_irq_handler *** Error sending event to DUMB\n"); |
|
576 | 588 | //} |
|
577 | 589 | } |
|
578 | 590 | |
|
579 | 591 | rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ) |
|
580 | 592 | { |
|
581 | 593 | int linkStatus; |
|
582 | 594 | rtems_status_code status; |
|
583 | 595 | |
|
584 | 596 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
585 | 597 | |
|
586 | 598 | if ( linkStatus == 5) { |
|
587 | 599 | PRINTF("in spacewire_reset_link *** link is running\n") |
|
588 | 600 | status = RTEMS_SUCCESSFUL; |
|
589 | 601 | } |
|
590 | 602 | } |
@@ -1,414 +1,415 | |||
|
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 | * @return the value of the new syndrome on two bytes. |
|
23 | 24 | * |
|
24 | 25 | */ |
|
25 | 26 | |
|
26 | 27 | return(((Chk << 8) & 0xff00)^lookUpTableForCRC [(((Chk >> 8)^D) & 0x00ff)]); |
|
27 | 28 | } |
|
28 | 29 | |
|
29 | 30 | void initLookUpTableForCRC( void ) |
|
30 | 31 | { |
|
31 | 32 | /** This function is used to initiates the look-up table for fast CRC computation. |
|
32 | 33 | * |
|
33 | 34 | * The global table lookUpTableForCRC[256] is initiated. |
|
34 | 35 | * |
|
35 | 36 | */ |
|
36 | 37 | |
|
37 | 38 | unsigned int i; |
|
38 | 39 | unsigned int tmp; |
|
39 | 40 | |
|
40 | 41 | for (i=0; i<256; i++) |
|
41 | 42 | { |
|
42 | 43 | tmp = 0; |
|
43 | 44 | if((i & 1) != 0) { |
|
44 | 45 | tmp = tmp ^ 0x1021; |
|
45 | 46 | } |
|
46 | 47 | if((i & 2) != 0) { |
|
47 | 48 | tmp = tmp ^ 0x2042; |
|
48 | 49 | } |
|
49 | 50 | if((i & 4) != 0) { |
|
50 | 51 | tmp = tmp ^ 0x4084; |
|
51 | 52 | } |
|
52 | 53 | if((i & 8) != 0) { |
|
53 | 54 | tmp = tmp ^ 0x8108; |
|
54 | 55 | } |
|
55 | 56 | if((i & 16) != 0) { |
|
56 | 57 | tmp = tmp ^ 0x1231; |
|
57 | 58 | } |
|
58 | 59 | if((i & 32) != 0) { |
|
59 | 60 | tmp = tmp ^ 0x2462; |
|
60 | 61 | } |
|
61 | 62 | if((i & 64) != 0) { |
|
62 | 63 | tmp = tmp ^ 0x48c4; |
|
63 | 64 | } |
|
64 | 65 | if((i & 128) != 0) { |
|
65 | 66 | tmp = tmp ^ 0x9188; |
|
66 | 67 | } |
|
67 | 68 | lookUpTableForCRC[i] = tmp; |
|
68 | 69 | } |
|
69 | 70 | } |
|
70 | 71 | |
|
71 | 72 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData) |
|
72 | 73 | { |
|
73 | 74 | /** This function calculates a two bytes Cyclic Redundancy Code. |
|
74 | 75 | * |
|
75 | 76 | * @param data points to a buffer containing the data on which to compute the CRC. |
|
76 | 77 | * @param crcAsTwoBytes points points to a two bytes buffer in which the CRC is stored. |
|
77 | 78 | * @param sizeOfData is the number of bytes of *data* used to compute the CRC. |
|
78 | 79 | * |
|
79 | 80 | * The specification of the Cyclic Redundancy Code is described in the following document: ECSS-E-70-41-A. |
|
80 | 81 | * |
|
81 | 82 | */ |
|
82 | 83 | |
|
83 | 84 | unsigned int Chk; |
|
84 | 85 | int j; |
|
85 | 86 | Chk = 0xffff; // reset the syndrom to all ones |
|
86 | 87 | for (j=0; j<sizeOfData; j++) { |
|
87 | 88 | Chk = Crc_opt(data[j], Chk); |
|
88 | 89 | } |
|
89 | 90 | crcAsTwoBytes[0] = (unsigned char) (Chk >> 8); |
|
90 | 91 | crcAsTwoBytes[1] = (unsigned char) (Chk & 0x00ff); |
|
91 | 92 | } |
|
92 | 93 | |
|
93 | 94 | //********************* |
|
94 | 95 | // ACCEPTANCE FUNCTIONS |
|
95 | 96 | int tc_parser(ccsdsTelecommandPacket_t * TCPacket, unsigned int TC_LEN_RCV, unsigned char *computed_CRC) |
|
96 | 97 | { |
|
97 | 98 | /** This function parses TeleCommands. |
|
98 | 99 | * |
|
99 | 100 | * @param TC points to the TeleCommand that will be parsed. |
|
100 | 101 | * @param TC_LEN_RCV is the received packet length. |
|
101 | 102 | * |
|
102 | 103 | * @return Status code of the parsing. |
|
103 | 104 | * |
|
104 | 105 | * The parsing checks: |
|
105 | 106 | * - process id |
|
106 | 107 | * - category |
|
107 | 108 | * - length: a global check is performed and a per subtype check also |
|
108 | 109 | * - type |
|
109 | 110 | * - subtype |
|
110 | 111 | * - crc |
|
111 | 112 | * |
|
112 | 113 | */ |
|
113 | 114 | |
|
114 | 115 | int status; |
|
115 | 116 | unsigned char pid; |
|
116 | 117 | unsigned char category; |
|
117 | 118 | unsigned int length; |
|
118 | 119 | unsigned char packetType; |
|
119 | 120 | unsigned char packetSubtype; |
|
120 | 121 | unsigned char sid; |
|
121 | 122 | |
|
122 | 123 | status = CCSDS_TM_VALID; |
|
123 | 124 | |
|
124 | 125 | // APID check *** APID on 2 bytes |
|
125 | 126 | pid = ((TCPacket->packetID[0] & 0x07)<<4) + ( (TCPacket->packetID[1]>>4) & 0x0f ); // PID = 11 *** 7 bits xxxxx210 7654xxxx |
|
126 | 127 | category = (TCPacket->packetID[1] & 0x0f); // PACKET_CATEGORY = 12 *** 4 bits xxxxxxxx xxxx3210 |
|
127 | 128 | length = (TCPacket->packetLength[0] * 256) + TCPacket->packetLength[1]; |
|
128 | 129 | packetType = TCPacket->serviceType; |
|
129 | 130 | packetSubtype = TCPacket->serviceSubType; |
|
130 | 131 | sid = TCPacket->sourceID; |
|
131 | 132 | |
|
132 | 133 | if ( pid != CCSDS_PROCESS_ID ) // CHECK THE PROCESS ID |
|
133 | 134 | { |
|
134 | 135 | status = ILLEGAL_APID; |
|
135 | 136 | } |
|
136 | 137 | if (status == CCSDS_TM_VALID) // CHECK THE CATEGORY |
|
137 | 138 | { |
|
138 | 139 | if ( category != CCSDS_PACKET_CATEGORY ) |
|
139 | 140 | { |
|
140 | 141 | status = ILLEGAL_APID; |
|
141 | 142 | } |
|
142 | 143 | } |
|
143 | 144 | if (status == CCSDS_TM_VALID) // CHECK THE PACKET LENGTH FIELD AND THE ACTUAL LENGTH COMPLIANCE |
|
144 | 145 | { |
|
145 | 146 | if (length != TC_LEN_RCV ) { |
|
146 |
status = WRONG_LEN_P |
|
|
147 | status = WRONG_LEN_PKT; | |
|
147 | 148 | } |
|
148 | 149 | } |
|
149 | 150 | if (status == CCSDS_TM_VALID) // CHECK THAT THE PACKET DOES NOT EXCEED THE MAX SIZE |
|
150 | 151 | { |
|
151 | 152 | if ( length >= CCSDS_TC_PKT_MAX_SIZE ) { |
|
152 |
status = WRONG_LEN_P |
|
|
153 | status = WRONG_LEN_PKT; | |
|
153 | 154 | } |
|
154 | 155 | } |
|
155 | 156 | if (status == CCSDS_TM_VALID) // CHECK THE TYPE |
|
156 | 157 | { |
|
157 | 158 | status = tc_check_type( packetType ); |
|
158 | 159 | } |
|
159 | 160 | if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE |
|
160 | 161 | { |
|
161 | 162 | status = tc_check_subtype( packetSubtype ); |
|
162 | 163 | } |
|
163 | 164 | if (status == CCSDS_TM_VALID) // CHECK THE SID |
|
164 | 165 | { |
|
165 | 166 | status = tc_check_sid( sid ); |
|
166 | 167 | } |
|
167 | 168 | if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE AND LENGTH COMPLIANCE |
|
168 | 169 | { |
|
169 | 170 | status = tc_check_length( packetSubtype, length ); |
|
170 | 171 | } |
|
171 | 172 | if (status == CCSDS_TM_VALID ) // CHECK CRC |
|
172 | 173 | { |
|
173 | 174 | status = tc_check_crc( TCPacket, length, computed_CRC ); |
|
174 | 175 | } |
|
175 | 176 | |
|
176 | 177 | return status; |
|
177 | 178 | } |
|
178 | 179 | |
|
179 | 180 | int tc_check_type( unsigned char packetType ) |
|
180 | 181 | { |
|
181 | 182 | /** This function checks that the type of a TeleCommand is valid. |
|
182 | 183 | * |
|
183 | 184 | * @param packetType is the type to check. |
|
184 | 185 | * |
|
185 | 186 | * @return Status code CCSDS_TM_VALID or ILL_TYPE. |
|
186 | 187 | * |
|
187 | 188 | */ |
|
188 | 189 | |
|
189 | 190 | int status; |
|
190 | 191 | |
|
191 | 192 | if ( (packetType == TC_TYPE_GEN) || (packetType == TC_TYPE_TIME)) |
|
192 | 193 | { |
|
193 | 194 | status = CCSDS_TM_VALID; |
|
194 | 195 | } |
|
195 | 196 | else |
|
196 | 197 | { |
|
197 | 198 | status = ILL_TYPE; |
|
198 | 199 | } |
|
199 | 200 | |
|
200 | 201 | return status; |
|
201 | 202 | } |
|
202 | 203 | |
|
203 | 204 | int tc_check_subtype( unsigned char packetSubType ) |
|
204 | 205 | { |
|
205 | 206 | /** This function checks that the subtype of a TeleCommand is valid. |
|
206 | 207 | * |
|
207 | 208 | * @param packetSubType is the subtype to check. |
|
208 | 209 | * |
|
209 | 210 | * @return Status code CCSDS_TM_VALID or ILL_SUBTYPE. |
|
210 | 211 | * |
|
211 | 212 | */ |
|
212 | 213 | |
|
213 | 214 | int status; |
|
214 | 215 | |
|
215 | 216 | if ( (packetSubType == TC_SUBTYPE_RESET) |
|
216 | 217 | || (packetSubType == TC_SUBTYPE_LOAD_COMM) |
|
217 | 218 | || (packetSubType == TC_SUBTYPE_LOAD_NORM) || (packetSubType == TC_SUBTYPE_LOAD_BURST) |
|
218 | 219 | || (packetSubType == TC_SUBTYPE_LOAD_SBM1) || (packetSubType == TC_SUBTYPE_LOAD_SBM2) |
|
219 | 220 | || (packetSubType == TC_SUBTYPE_DUMP) |
|
220 | 221 | || (packetSubType == TC_SUBTYPE_ENTER) |
|
221 | 222 | || (packetSubType == TC_SUBTYPE_UPDT_INFO) || (packetSubType == TC_SUBTYPE_UPDT_TIME) |
|
222 | 223 | || (packetSubType == TC_SUBTYPE_EN_CAL) || (packetSubType == TC_SUBTYPE_DIS_CAL) ) |
|
223 | 224 | { |
|
224 | 225 | status = CCSDS_TM_VALID; |
|
225 | 226 | } |
|
226 | 227 | else |
|
227 | 228 | { |
|
228 | status = ILL_TYPE; | |
|
229 | status = ILL_SUBTYPE; | |
|
229 | 230 | } |
|
230 | 231 | |
|
231 | 232 | return status; |
|
232 | 233 | } |
|
233 | 234 | |
|
234 | 235 | int tc_check_sid( unsigned char sid ) |
|
235 | 236 | { |
|
236 | 237 | /** This function checks that the sid of a TeleCommand is valid. |
|
237 | 238 | * |
|
238 | 239 | * @param sid is the sid to check. |
|
239 | 240 | * |
|
240 | 241 | * @return Status code CCSDS_TM_VALID or CORRUPTED. |
|
241 | 242 | * |
|
242 | 243 | */ |
|
243 | 244 | |
|
244 | 245 | int status; |
|
245 | 246 | |
|
246 | 247 | if ( (sid == SID_TC_GROUND) |
|
247 | 248 | || (sid == SID_TC_MISSION_TIMELINE) || (sid == SID_TC_TC_SEQUENCES) || (sid == SID_TC_RECOVERY_ACTION_CMD) |
|
248 | 249 | || (sid == SID_TC_BACKUP_MISSION_TIMELINE) |
|
249 | 250 | || (sid == SID_TC_DIRECT_CMD) || (sid == SID_TC_SPARE_GRD_SRC1) || (sid == SID_TC_SPARE_GRD_SRC2) |
|
250 | 251 | || (sid == SID_TC_OBCP) || (sid == SID_TC_SYSTEM_CONTROL) || (sid == SID_TC_AOCS) |
|
251 | 252 | || (sid == SID_TC_RPW_INTERNAL)) |
|
252 | 253 | { |
|
253 | 254 | status = CCSDS_TM_VALID; |
|
254 | 255 | } |
|
255 | 256 | else |
|
256 | 257 | { |
|
257 |
status = |
|
|
258 | status = WRONG_SRC_ID; | |
|
258 | 259 | } |
|
259 | 260 | |
|
260 | 261 | return status; |
|
261 | 262 | } |
|
262 | 263 | |
|
263 | 264 | int tc_check_length( unsigned char packetSubType, unsigned int length ) |
|
264 | 265 | { |
|
265 | 266 | /** This function checks that the subtype and the length are compliant. |
|
266 | 267 | * |
|
267 | 268 | * @param packetSubType is the subtype to check. |
|
268 | 269 | * @param length is the length to check. |
|
269 | 270 | * |
|
270 | 271 | * @return Status code CCSDS_TM_VALID or ILL_TYPE. |
|
271 | 272 | * |
|
272 | 273 | */ |
|
273 | 274 | |
|
274 | 275 | int status; |
|
275 | 276 | |
|
276 | 277 | status = LFR_SUCCESSFUL; |
|
277 | 278 | |
|
278 | 279 | switch(packetSubType) |
|
279 | 280 | { |
|
280 | 281 | case TC_SUBTYPE_RESET: |
|
281 | 282 | if (length!=(TC_LEN_RESET-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
282 |
status = WRONG_LEN_P |
|
|
283 | status = WRONG_LEN_PKT; | |
|
283 | 284 | } |
|
284 | 285 | else { |
|
285 | 286 | status = CCSDS_TM_VALID; |
|
286 | 287 | } |
|
287 | 288 | break; |
|
288 | 289 | case TC_SUBTYPE_LOAD_COMM: |
|
289 | 290 | if (length!=(TC_LEN_LOAD_COMM-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
290 |
status = WRONG_LEN_P |
|
|
291 | status = WRONG_LEN_PKT; | |
|
291 | 292 | } |
|
292 | 293 | else { |
|
293 | 294 | status = CCSDS_TM_VALID; |
|
294 | 295 | } |
|
295 | 296 | break; |
|
296 | 297 | case TC_SUBTYPE_LOAD_NORM: |
|
297 | 298 | if (length!=(TC_LEN_LOAD_NORM-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
298 |
status = WRONG_LEN_P |
|
|
299 | status = WRONG_LEN_PKT; | |
|
299 | 300 | } |
|
300 | 301 | else { |
|
301 | 302 | status = CCSDS_TM_VALID; |
|
302 | 303 | } |
|
303 | 304 | break; |
|
304 | 305 | case TC_SUBTYPE_LOAD_BURST: |
|
305 | 306 | if (length!=(TC_LEN_LOAD_BURST-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
306 |
status = WRONG_LEN_P |
|
|
307 | status = WRONG_LEN_PKT; | |
|
307 | 308 | } |
|
308 | 309 | else { |
|
309 | 310 | status = CCSDS_TM_VALID; |
|
310 | 311 | } |
|
311 | 312 | break; |
|
312 | 313 | case TC_SUBTYPE_LOAD_SBM1: |
|
313 | 314 | if (length!=(TC_LEN_LOAD_SBM1-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
314 |
status = WRONG_LEN_P |
|
|
315 | status = WRONG_LEN_PKT; | |
|
315 | 316 | } |
|
316 | 317 | else { |
|
317 | 318 | status = CCSDS_TM_VALID; |
|
318 | 319 | } |
|
319 | 320 | break; |
|
320 | 321 | case TC_SUBTYPE_LOAD_SBM2: |
|
321 | 322 | if (length!=(TC_LEN_LOAD_SBM2-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
322 |
status = WRONG_LEN_P |
|
|
323 | status = WRONG_LEN_PKT; | |
|
323 | 324 | } |
|
324 | 325 | else { |
|
325 | 326 | status = CCSDS_TM_VALID; |
|
326 | 327 | } |
|
327 | 328 | break; |
|
328 | 329 | case TC_SUBTYPE_DUMP: |
|
329 | 330 | if (length!=(TC_LEN_DUMP-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
330 |
status = WRONG_LEN_P |
|
|
331 | status = WRONG_LEN_PKT; | |
|
331 | 332 | } |
|
332 | 333 | else { |
|
333 | 334 | status = CCSDS_TM_VALID; |
|
334 | 335 | } |
|
335 | 336 | break; |
|
336 | 337 | case TC_SUBTYPE_ENTER: |
|
337 | 338 | if (length!=(TC_LEN_ENTER-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
338 |
status = WRONG_LEN_P |
|
|
339 | status = WRONG_LEN_PKT; | |
|
339 | 340 | } |
|
340 | 341 | else { |
|
341 | 342 | status = CCSDS_TM_VALID; |
|
342 | 343 | } |
|
343 | 344 | break; |
|
344 | 345 | case TC_SUBTYPE_UPDT_INFO: |
|
345 | 346 | if (length!=(TC_LEN_UPDT_INFO-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
346 |
status = WRONG_LEN_P |
|
|
347 | status = WRONG_LEN_PKT; | |
|
347 | 348 | } |
|
348 | 349 | else { |
|
349 | 350 | status = CCSDS_TM_VALID; |
|
350 | 351 | } |
|
351 | 352 | break; |
|
352 | 353 | case TC_SUBTYPE_EN_CAL: |
|
353 | 354 | if (length!=(TC_LEN_EN_CAL-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
354 |
status = WRONG_LEN_P |
|
|
355 | status = WRONG_LEN_PKT; | |
|
355 | 356 | } |
|
356 | 357 | else { |
|
357 | 358 | status = CCSDS_TM_VALID; |
|
358 | 359 | } |
|
359 | 360 | break; |
|
360 | 361 | case TC_SUBTYPE_DIS_CAL: |
|
361 | 362 | if (length!=(TC_LEN_DIS_CAL-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
362 |
status = WRONG_LEN_P |
|
|
363 | status = WRONG_LEN_PKT; | |
|
363 | 364 | } |
|
364 | 365 | else { |
|
365 | 366 | status = CCSDS_TM_VALID; |
|
366 | 367 | } |
|
367 | 368 | break; |
|
368 | 369 | case TC_SUBTYPE_UPDT_TIME: |
|
369 | 370 | if (length!=(TC_LEN_UPDT_TIME-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
370 |
status = WRONG_LEN_P |
|
|
371 | status = WRONG_LEN_PKT; | |
|
371 | 372 | } |
|
372 | 373 | else { |
|
373 | 374 | status = CCSDS_TM_VALID; |
|
374 | 375 | } |
|
375 | 376 | break; |
|
376 | 377 | default: // if the subtype is not a legal value, return ILL_SUBTYPE |
|
377 | 378 | status = ILL_SUBTYPE; |
|
378 | 379 | break ; |
|
379 | 380 | } |
|
380 | 381 | |
|
381 | 382 | return status; |
|
382 | 383 | } |
|
383 | 384 | |
|
384 | 385 | int tc_check_crc( ccsdsTelecommandPacket_t * TCPacket, unsigned int length, unsigned char *computed_CRC ) |
|
385 | 386 | { |
|
386 | 387 | /** This function checks the CRC validity of the corresponding TeleCommand packet. |
|
387 | 388 | * |
|
388 | 389 | * @param TCPacket points to the TeleCommand packet to check. |
|
389 | 390 | * @param length is the length of the TC packet. |
|
390 | 391 | * |
|
391 | 392 | * @return Status code CCSDS_TM_VALID or INCOR_CHECKSUM. |
|
392 | 393 | * |
|
393 | 394 | */ |
|
394 | 395 | |
|
395 | 396 | int status; |
|
396 | 397 | unsigned char * CCSDSContent; |
|
397 | 398 | |
|
398 | 399 | CCSDSContent = (unsigned char*) TCPacket->packetID; |
|
399 | 400 | GetCRCAsTwoBytes(CCSDSContent, computed_CRC, length + CCSDS_TC_TM_PACKET_OFFSET - 2); // 2 CRC bytes removed from the calculation of the CRC |
|
400 | 401 | if (computed_CRC[0] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -2]) { |
|
401 | 402 | status = INCOR_CHECKSUM; |
|
402 | 403 | } |
|
403 | 404 | else if (computed_CRC[1] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -1]) { |
|
404 | 405 | status = INCOR_CHECKSUM; |
|
405 | 406 | } |
|
406 | 407 | else { |
|
407 | 408 | status = CCSDS_TM_VALID; |
|
408 | 409 | } |
|
409 | 410 | |
|
410 | 411 | return status; |
|
411 | 412 | } |
|
412 | 413 | |
|
413 | 414 | |
|
414 | 415 |
@@ -1,770 +1,768 | |||
|
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 | rtems_id queue_rcv_id; |
|
35 | 35 | rtems_id queue_snd_id; |
|
36 | 36 | |
|
37 | 37 | status = rtems_message_queue_ident( misc_name[QUEUE_RECV], 0, &queue_rcv_id ); |
|
38 | 38 | if (status != RTEMS_SUCCESSFUL) |
|
39 | 39 | { |
|
40 | 40 | PRINTF1("in ACTN *** ERR getting queue_rcv_id %d\n", status) |
|
41 | 41 | } |
|
42 | 42 | |
|
43 | 43 | status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_snd_id ); |
|
44 | 44 | if (status != RTEMS_SUCCESSFUL) |
|
45 | 45 | { |
|
46 | 46 | PRINTF1("in ACTN *** ERR getting queue_snd_id %d\n", status) |
|
47 | 47 | } |
|
48 | 48 | |
|
49 | 49 | result = LFR_SUCCESSFUL; |
|
50 | 50 | subtype = 0; // subtype of the current TC packet |
|
51 | 51 | |
|
52 | 52 | BOOT_PRINTF("in ACTN *** \n") |
|
53 | 53 | |
|
54 | 54 | while(1) |
|
55 | 55 | { |
|
56 | 56 | status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size, |
|
57 | 57 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); |
|
58 | 58 | if (status!=RTEMS_SUCCESSFUL) PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status) |
|
59 | 59 | else |
|
60 | 60 | { |
|
61 | 61 | subtype = TC.serviceSubType; |
|
62 | 62 | switch(subtype) |
|
63 | 63 | { |
|
64 | 64 | case TC_SUBTYPE_RESET: |
|
65 | 65 | result = action_reset( &TC, queue_snd_id ); |
|
66 | 66 | close_action( &TC, result, queue_snd_id ); |
|
67 | 67 | break; |
|
68 | 68 | // |
|
69 | 69 | case TC_SUBTYPE_LOAD_COMM: |
|
70 | 70 | result = action_load_common_par( &TC ); |
|
71 | 71 | close_action( &TC, result, queue_snd_id ); |
|
72 | 72 | break; |
|
73 | 73 | // |
|
74 | 74 | case TC_SUBTYPE_LOAD_NORM: |
|
75 | 75 | result = action_load_normal_par( &TC, queue_snd_id ); |
|
76 | 76 | close_action( &TC, result, queue_snd_id ); |
|
77 | 77 | break; |
|
78 | 78 | // |
|
79 | 79 | case TC_SUBTYPE_LOAD_BURST: |
|
80 | 80 | result = action_load_burst_par( &TC, queue_snd_id ); |
|
81 | 81 | close_action( &TC, result, queue_snd_id ); |
|
82 | 82 | break; |
|
83 | 83 | // |
|
84 | 84 | case TC_SUBTYPE_LOAD_SBM1: |
|
85 | 85 | result = action_load_sbm1_par( &TC, queue_snd_id ); |
|
86 | 86 | close_action( &TC, result, queue_snd_id ); |
|
87 | 87 | break; |
|
88 | 88 | // |
|
89 | 89 | case TC_SUBTYPE_LOAD_SBM2: |
|
90 | 90 | result = action_load_sbm2_par( &TC, queue_snd_id ); |
|
91 | 91 | close_action( &TC, result, queue_snd_id ); |
|
92 | 92 | break; |
|
93 | 93 | // |
|
94 | 94 | case TC_SUBTYPE_DUMP: |
|
95 | 95 | result = action_dump_par( queue_snd_id ); |
|
96 | 96 | close_action( &TC, result, queue_snd_id ); |
|
97 | 97 | break; |
|
98 | 98 | // |
|
99 | 99 | case TC_SUBTYPE_ENTER: |
|
100 | 100 | result = action_enter_mode( &TC, queue_snd_id ); |
|
101 | 101 | close_action( &TC, result, queue_snd_id ); |
|
102 | 102 | break; |
|
103 | 103 | // |
|
104 | 104 | case TC_SUBTYPE_UPDT_INFO: |
|
105 | 105 | result = action_update_info( &TC, queue_snd_id ); |
|
106 | 106 | close_action( &TC, result, queue_snd_id ); |
|
107 | 107 | break; |
|
108 | 108 | // |
|
109 | 109 | case TC_SUBTYPE_EN_CAL: |
|
110 | 110 | result = action_enable_calibration( &TC, queue_snd_id ); |
|
111 | 111 | close_action( &TC, result, queue_snd_id ); |
|
112 | 112 | break; |
|
113 | 113 | // |
|
114 | 114 | case TC_SUBTYPE_DIS_CAL: |
|
115 | 115 | result = action_disable_calibration( &TC, queue_snd_id ); |
|
116 | 116 | close_action( &TC, result, queue_snd_id ); |
|
117 | 117 | break; |
|
118 | 118 | // |
|
119 | 119 | case TC_SUBTYPE_UPDT_TIME: |
|
120 | 120 | result = action_update_time( &TC ); |
|
121 | 121 | close_action( &TC, result, queue_snd_id ); |
|
122 | 122 | break; |
|
123 | 123 | // |
|
124 | 124 | default: |
|
125 | 125 | break; |
|
126 | 126 | } |
|
127 | 127 | } |
|
128 | 128 | } |
|
129 | 129 | } |
|
130 | 130 | |
|
131 | 131 | //*********** |
|
132 | 132 | // TC ACTIONS |
|
133 | 133 | |
|
134 | 134 | int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
135 | 135 | { |
|
136 | 136 | /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received. |
|
137 | 137 | * |
|
138 | 138 | * @param TC points to the TeleCommand packet that is being processed |
|
139 | 139 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
140 | 140 | * |
|
141 | 141 | */ |
|
142 | 142 | |
|
143 | 143 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); |
|
144 | 144 | return LFR_DEFAULT; |
|
145 | 145 | } |
|
146 | 146 | |
|
147 | 147 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
148 | 148 | { |
|
149 | 149 | /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received. |
|
150 | 150 | * |
|
151 | 151 | * @param TC points to the TeleCommand packet that is being processed |
|
152 | 152 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
153 | 153 | * |
|
154 | 154 | */ |
|
155 | 155 | |
|
156 | 156 | rtems_status_code status; |
|
157 | 157 | unsigned char requestedMode; |
|
158 | 158 | |
|
159 | 159 | requestedMode = TC->dataAndCRC[1]; |
|
160 | 160 | |
|
161 | 161 | if ( (requestedMode != LFR_MODE_STANDBY) |
|
162 | 162 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) |
|
163 | 163 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) |
|
164 | 164 | { |
|
165 | 165 | status = RTEMS_UNSATISFIED; |
|
166 | 166 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode ); |
|
167 | 167 | } |
|
168 | 168 | else |
|
169 | 169 | { |
|
170 | 170 | printf("try to enter mode %d\n", requestedMode); |
|
171 | 171 | |
|
172 | 172 | #ifdef PRINT_TASK_STATISTICS |
|
173 | 173 | if (requestedMode != LFR_MODE_STANDBY) |
|
174 | 174 | { |
|
175 | 175 | rtems_cpu_usage_reset(); |
|
176 | 176 | maxCount = 0; |
|
177 | 177 | } |
|
178 | 178 | #endif |
|
179 | 179 | |
|
180 | 180 | status = transition_validation(requestedMode); |
|
181 | 181 | |
|
182 | 182 | if ( status == LFR_SUCCESSFUL ) { |
|
183 | 183 | if ( lfrCurrentMode != LFR_MODE_STANDBY) |
|
184 | 184 | { |
|
185 | 185 | status = stop_current_mode(); |
|
186 | 186 | } |
|
187 | 187 | if (status != RTEMS_SUCCESSFUL) |
|
188 | 188 | { |
|
189 | 189 | PRINTF("ERR *** in action_enter *** stop_current_mode\n") |
|
190 | 190 | } |
|
191 | 191 | status = enter_mode(requestedMode, TC); |
|
192 | 192 | } |
|
193 | 193 | else |
|
194 | 194 | { |
|
195 | 195 | PRINTF("ERR *** in action_enter *** transition rejected\n") |
|
196 | 196 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
197 | 197 | } |
|
198 | 198 | } |
|
199 | 199 | |
|
200 | 200 | return status; |
|
201 | 201 | } |
|
202 | 202 | |
|
203 | 203 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
204 | 204 | { |
|
205 | 205 | /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received. |
|
206 | 206 | * |
|
207 | 207 | * @param TC points to the TeleCommand packet that is being processed |
|
208 | 208 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
209 | 209 | * |
|
210 | 210 | * @return LFR directive status code: |
|
211 | 211 | * - LFR_DEFAULT |
|
212 | 212 | * - LFR_SUCCESSFUL |
|
213 | 213 | * |
|
214 | 214 | */ |
|
215 | 215 | |
|
216 | 216 | unsigned int val; |
|
217 | 217 | int result; |
|
218 | 218 | |
|
219 | 219 | result = LFR_DEFAULT; |
|
220 | 220 | |
|
221 | 221 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 |
|
222 | 222 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; |
|
223 | 223 | val++; |
|
224 | 224 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); |
|
225 | 225 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); |
|
226 | 226 | |
|
227 | 227 | return result; |
|
228 | 228 | } |
|
229 | 229 | |
|
230 | 230 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
231 | 231 | { |
|
232 | 232 | /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received. |
|
233 | 233 | * |
|
234 | 234 | * @param TC points to the TeleCommand packet that is being processed |
|
235 | 235 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
236 | 236 | * |
|
237 | 237 | */ |
|
238 | 238 | |
|
239 | 239 | int result; |
|
240 | 240 | unsigned char lfrMode; |
|
241 | 241 | |
|
242 | 242 | result = LFR_DEFAULT; |
|
243 | 243 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
244 | 244 | |
|
245 | if ( (lfrMode == LFR_MODE_STANDBY) | (lfrMode == LFR_MODE_BURST) | (lfrMode == LFR_MODE_SBM2) ) { | |
|
245 | if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) { | |
|
246 | 246 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
247 | 247 | result = LFR_DEFAULT; |
|
248 | 248 | } |
|
249 | 249 | else { |
|
250 | 250 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); |
|
251 | 251 | result = LFR_DEFAULT; |
|
252 | 252 | } |
|
253 | 253 | return result; |
|
254 | 254 | } |
|
255 | 255 | |
|
256 | 256 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
257 | 257 | { |
|
258 | 258 | /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received. |
|
259 | 259 | * |
|
260 | 260 | * @param TC points to the TeleCommand packet that is being processed |
|
261 | 261 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
262 | 262 | * |
|
263 | 263 | */ |
|
264 | 264 | |
|
265 | 265 | int result; |
|
266 | 266 | unsigned char lfrMode; |
|
267 | 267 | |
|
268 | 268 | result = LFR_DEFAULT; |
|
269 | 269 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
270 | 270 | |
|
271 | if ( (lfrMode == LFR_MODE_STANDBY) | (lfrMode == LFR_MODE_BURST) | (lfrMode == LFR_MODE_SBM2) ) { | |
|
271 | if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) { | |
|
272 | 272 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
273 | 273 | result = LFR_DEFAULT; |
|
274 | 274 | } |
|
275 | 275 | else { |
|
276 | 276 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); |
|
277 | 277 | result = LFR_DEFAULT; |
|
278 | 278 | } |
|
279 | 279 | return result; |
|
280 | 280 | } |
|
281 | 281 | |
|
282 | 282 | int action_update_time(ccsdsTelecommandPacket_t *TC) |
|
283 | 283 | { |
|
284 | 284 | /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received. |
|
285 | 285 | * |
|
286 | 286 | * @param TC points to the TeleCommand packet that is being processed |
|
287 | 287 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
288 | 288 | * |
|
289 | 289 | * @return LFR_SUCCESSFUL |
|
290 | 290 | * |
|
291 | 291 | */ |
|
292 | 292 | |
|
293 | 293 | unsigned int val; |
|
294 | 294 | |
|
295 | 295 | time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24) |
|
296 | 296 | + (TC->dataAndCRC[1] << 16) |
|
297 | 297 | + (TC->dataAndCRC[2] << 8) |
|
298 | 298 | + TC->dataAndCRC[3]; |
|
299 | 299 | val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256 |
|
300 | 300 | + housekeeping_packet.hk_lfr_update_time_tc_cnt[1]; |
|
301 | 301 | val++; |
|
302 | 302 | housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8); |
|
303 | 303 | housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val); |
|
304 | 304 | time_management_regs->ctrl = time_management_regs->ctrl | 1; |
|
305 | 305 | |
|
306 | 306 | return LFR_SUCCESSFUL; |
|
307 | 307 | } |
|
308 | 308 | |
|
309 | 309 | //******************* |
|
310 | 310 | // ENTERING THE MODES |
|
311 | 311 | |
|
312 | 312 | int transition_validation(unsigned char requestedMode) |
|
313 | 313 | { |
|
314 | 314 | int status; |
|
315 | 315 | |
|
316 | 316 | switch (requestedMode) |
|
317 | 317 | { |
|
318 | 318 | case LFR_MODE_STANDBY: |
|
319 | 319 | if ( lfrCurrentMode == LFR_MODE_STANDBY ) { |
|
320 | 320 | status = LFR_DEFAULT; |
|
321 | 321 | } |
|
322 | 322 | else |
|
323 | 323 | { |
|
324 | 324 | status = LFR_SUCCESSFUL; |
|
325 | 325 | } |
|
326 | 326 | break; |
|
327 | 327 | case LFR_MODE_NORMAL: |
|
328 | 328 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { |
|
329 | 329 | status = LFR_DEFAULT; |
|
330 | 330 | } |
|
331 | 331 | else { |
|
332 | 332 | status = LFR_SUCCESSFUL; |
|
333 | 333 | } |
|
334 | 334 | break; |
|
335 | 335 | case LFR_MODE_BURST: |
|
336 | 336 | if ( lfrCurrentMode == LFR_MODE_BURST ) { |
|
337 | 337 | status = LFR_DEFAULT; |
|
338 | 338 | } |
|
339 | 339 | else { |
|
340 | 340 | status = LFR_SUCCESSFUL; |
|
341 | 341 | } |
|
342 | 342 | break; |
|
343 | 343 | case LFR_MODE_SBM1: |
|
344 | 344 | if ( lfrCurrentMode == LFR_MODE_SBM1 ) { |
|
345 | 345 | status = LFR_DEFAULT; |
|
346 | 346 | } |
|
347 | 347 | else { |
|
348 | 348 | status = LFR_SUCCESSFUL; |
|
349 | 349 | } |
|
350 | 350 | break; |
|
351 | 351 | case LFR_MODE_SBM2: |
|
352 | 352 | if ( lfrCurrentMode == LFR_MODE_SBM2 ) { |
|
353 | 353 | status = LFR_DEFAULT; |
|
354 | 354 | } |
|
355 | 355 | else { |
|
356 | 356 | status = LFR_SUCCESSFUL; |
|
357 | 357 | } |
|
358 | 358 | break; |
|
359 | 359 | default: |
|
360 | 360 | status = LFR_DEFAULT; |
|
361 | 361 | break; |
|
362 | 362 | } |
|
363 | 363 | |
|
364 | 364 | return status; |
|
365 | 365 | } |
|
366 | 366 | |
|
367 | 367 | int stop_current_mode() |
|
368 | 368 | { |
|
369 | 369 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. |
|
370 | 370 | * |
|
371 | 371 | * @return RTEMS directive status codes: |
|
372 | 372 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
373 | 373 | * - RTEMS_INVALID_ID - task id invalid |
|
374 | 374 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
375 | 375 | * |
|
376 | 376 | */ |
|
377 | 377 | |
|
378 | 378 | rtems_status_code status; |
|
379 | 379 | |
|
380 | 380 | status = RTEMS_SUCCESSFUL; |
|
381 | 381 | |
|
382 | 382 | #ifdef GSA |
|
383 | 383 | LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP) |
|
384 | 384 | LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP) |
|
385 | 385 | timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR ); |
|
386 | 386 | #else |
|
387 | 387 | // mask interruptions |
|
388 | 388 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt |
|
389 | 389 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt |
|
390 | 390 | // reset registers |
|
391 | 391 | reset_wfp_burst_enable(); // reset burst and enable bits |
|
392 | 392 | reset_wfp_status(); // reset all the status bits |
|
393 | 393 | // creal interruptions |
|
394 | 394 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt |
|
395 | 395 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectarl matrix interrupt |
|
396 | 396 | #endif |
|
397 | 397 | //********************** |
|
398 | 398 | // suspend several tasks |
|
399 | 399 | if (lfrCurrentMode != LFR_MODE_STANDBY) { |
|
400 | 400 | status = suspend_science_tasks(); |
|
401 | 401 | } |
|
402 | 402 | |
|
403 | 403 | if (status != RTEMS_SUCCESSFUL) |
|
404 | 404 | { |
|
405 | 405 | PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
406 | 406 | } |
|
407 | 407 | |
|
408 | 408 | return status; |
|
409 | 409 | } |
|
410 | 410 | |
|
411 | 411 | int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC ) |
|
412 | 412 | { |
|
413 | 413 | rtems_status_code status; |
|
414 | 414 | |
|
415 | 415 | status = RTEMS_UNSATISFIED; |
|
416 | 416 | |
|
417 | 417 | housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d); |
|
418 |
|
|
|
418 | updateLFRCurrentMode(); | |
|
419 | 419 | |
|
420 | 420 | switch(mode){ |
|
421 | 421 | case LFR_MODE_STANDBY: |
|
422 |
status = enter_standby_mode( |
|
|
422 | status = enter_standby_mode( ); | |
|
423 | 423 | break; |
|
424 | 424 | case LFR_MODE_NORMAL: |
|
425 |
status = enter_normal_mode( |
|
|
425 | status = enter_normal_mode( ); | |
|
426 | 426 | break; |
|
427 | 427 | case LFR_MODE_BURST: |
|
428 |
status = enter_burst_mode( |
|
|
428 | status = enter_burst_mode( ); | |
|
429 | 429 | break; |
|
430 | 430 | case LFR_MODE_SBM1: |
|
431 |
status = enter_sbm1_mode( |
|
|
431 | status = enter_sbm1_mode( ); | |
|
432 | 432 | break; |
|
433 | 433 | case LFR_MODE_SBM2: |
|
434 |
status = enter_sbm2_mode( |
|
|
434 | status = enter_sbm2_mode( ); | |
|
435 | 435 | break; |
|
436 | 436 | default: |
|
437 | 437 | status = RTEMS_UNSATISFIED; |
|
438 | 438 | } |
|
439 | 439 | |
|
440 | 440 | if (status != RTEMS_SUCCESSFUL) |
|
441 | 441 | { |
|
442 | 442 | PRINTF("in enter_mode *** ERR\n") |
|
443 | 443 | status = RTEMS_UNSATISFIED; |
|
444 | 444 | } |
|
445 | 445 | |
|
446 | 446 | return status; |
|
447 | 447 | } |
|
448 | 448 | |
|
449 | 449 | int enter_standby_mode() |
|
450 | 450 | { |
|
451 | reset_waveform_picker_regs(); | |
|
452 | ||
|
453 | 451 | PRINTF1("maxCount = %d\n", maxCount) |
|
454 | 452 | |
|
455 | 453 | #ifdef PRINT_TASK_STATISTICS |
|
456 | 454 | rtems_cpu_usage_report(); |
|
457 | 455 | #endif |
|
458 | 456 | |
|
459 | 457 | #ifdef PRINT_STACK_REPORT |
|
460 | 458 | rtems_stack_checker_report_usage(); |
|
461 | 459 | #endif |
|
462 | 460 | |
|
463 | 461 | return LFR_SUCCESSFUL; |
|
464 | 462 | } |
|
465 | 463 | |
|
466 | 464 | int enter_normal_mode() |
|
467 | 465 | { |
|
468 | 466 | rtems_status_code status; |
|
469 | 467 | |
|
470 | 468 | status = restart_science_tasks(); |
|
471 | 469 | |
|
472 | 470 | #ifdef GSA |
|
473 | 471 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR ); |
|
474 | 472 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
475 | 473 | LEON_Clear_interrupt( IRQ_WF ); |
|
476 | 474 | LEON_Unmask_interrupt( IRQ_WF ); |
|
477 | 475 | // |
|
478 | 476 | set_local_nb_interrupt_f0_MAX(); |
|
479 | 477 | LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board |
|
480 | 478 | LEON_Unmask_interrupt( IRQ_SM ); |
|
481 | 479 | #else |
|
482 | 480 | //**************** |
|
483 | 481 | // waveform picker |
|
484 | 482 | reset_waveform_picker_regs(); |
|
485 | 483 | set_wfp_burst_enable_register(LFR_MODE_NORMAL); |
|
486 | 484 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
487 | 485 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
488 | 486 | //**************** |
|
489 | 487 | // spectral matrix |
|
490 | 488 | #endif |
|
491 | 489 | |
|
492 | 490 | return status; |
|
493 | 491 | } |
|
494 | 492 | |
|
495 | 493 | int enter_burst_mode() |
|
496 | 494 | { |
|
497 | 495 | rtems_status_code status; |
|
498 | 496 | |
|
499 | 497 | status = restart_science_tasks(); |
|
500 | 498 | |
|
501 | 499 | #ifdef GSA |
|
502 | 500 | LEON_Unmask_interrupt( IRQ_SM ); |
|
503 | 501 | #else |
|
504 | 502 | reset_waveform_picker_regs(); |
|
505 | 503 | set_wfp_burst_enable_register(LFR_MODE_BURST); |
|
506 | 504 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
507 | 505 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
508 | 506 | #endif |
|
509 | 507 | |
|
510 | 508 | return status; |
|
511 | 509 | } |
|
512 | 510 | |
|
513 | 511 | int enter_sbm1_mode() |
|
514 | 512 | { |
|
515 | 513 | rtems_status_code status; |
|
516 | 514 | |
|
517 | 515 | status = restart_science_tasks(); |
|
518 | 516 | |
|
519 | 517 | set_local_sbm1_nb_cwf_max(); |
|
520 | 518 | |
|
521 | 519 | reset_local_sbm1_nb_cwf_sent(); |
|
522 | 520 | |
|
523 | 521 | #ifdef GSA |
|
524 | 522 | LEON_Unmask_interrupt( IRQ_SM ); |
|
525 | 523 | #else |
|
526 | 524 | reset_waveform_picker_regs(); |
|
527 | 525 | set_wfp_burst_enable_register(LFR_MODE_SBM1); |
|
528 | 526 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
529 | 527 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
530 | 528 | // SM simulation |
|
531 | 529 | // timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); |
|
532 | 530 | // LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board |
|
533 | 531 | // LEON_Unmask_interrupt( IRQ_SM ); |
|
534 | 532 | #endif |
|
535 | 533 | |
|
536 | 534 | return status; |
|
537 | 535 | } |
|
538 | 536 | |
|
539 | 537 | int enter_sbm2_mode() |
|
540 | 538 | { |
|
541 | 539 | rtems_status_code status; |
|
542 | 540 | |
|
543 | 541 | status = restart_science_tasks(); |
|
544 | 542 | |
|
545 | 543 | set_local_sbm2_nb_cwf_max(); |
|
546 | 544 | |
|
547 | 545 | reset_local_sbm2_nb_cwf_sent(); |
|
548 | 546 | |
|
549 | 547 | #ifdef GSA |
|
550 | 548 | LEON_Unmask_interrupt( IRQ_SM ); |
|
551 | 549 | #else |
|
552 | 550 | reset_waveform_picker_regs(); |
|
553 | 551 | set_wfp_burst_enable_register(LFR_MODE_SBM2); |
|
554 | 552 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
555 | 553 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
556 | 554 | #endif |
|
557 | 555 | |
|
558 | 556 | return status; |
|
559 | 557 | } |
|
560 | 558 | |
|
561 | 559 | int restart_science_tasks() |
|
562 | 560 | { |
|
563 | 561 | rtems_status_code status[6]; |
|
564 | 562 | rtems_status_code ret; |
|
565 | 563 | |
|
566 | 564 | ret = RTEMS_SUCCESSFUL; |
|
567 | 565 | |
|
568 | 566 | status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 ); |
|
569 | 567 | if (status[0] != RTEMS_SUCCESSFUL) |
|
570 | 568 | { |
|
571 | 569 | PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0]) |
|
572 | 570 | } |
|
573 | 571 | |
|
574 | 572 | status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 ); |
|
575 | 573 | if (status[1] != RTEMS_SUCCESSFUL) |
|
576 | 574 | { |
|
577 | 575 | PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1]) |
|
578 | 576 | } |
|
579 | 577 | |
|
580 | 578 | status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 ); |
|
581 | 579 | if (status[2] != RTEMS_SUCCESSFUL) |
|
582 | 580 | { |
|
583 | 581 | PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2]) |
|
584 | 582 | } |
|
585 | 583 | |
|
586 | 584 | status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 ); |
|
587 | 585 | if (status[3] != RTEMS_SUCCESSFUL) |
|
588 | 586 | { |
|
589 | 587 | PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3]) |
|
590 | 588 | } |
|
591 | 589 | |
|
592 | 590 | status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 ); |
|
593 | 591 | if (status[4] != RTEMS_SUCCESSFUL) |
|
594 | 592 | { |
|
595 | 593 | PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4]) |
|
596 | 594 | } |
|
597 | 595 | |
|
598 | 596 | status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 ); |
|
599 | 597 | if (status[5] != RTEMS_SUCCESSFUL) |
|
600 | 598 | { |
|
601 | 599 | PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5]) |
|
602 | 600 | } |
|
603 | 601 | |
|
604 | 602 | if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) || |
|
605 | 603 | (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) ) |
|
606 | 604 | { |
|
607 | 605 | ret = RTEMS_UNSATISFIED; |
|
608 | 606 | } |
|
609 | 607 | |
|
610 | 608 | return ret; |
|
611 | 609 | } |
|
612 | 610 | |
|
613 | 611 | int suspend_science_tasks() |
|
614 | 612 | { |
|
615 | 613 | /** This function suspends the science tasks. |
|
616 | 614 | * |
|
617 | 615 | * @return RTEMS directive status codes: |
|
618 | 616 | * - RTEMS_SUCCESSFUL - task restarted successfully |
|
619 | 617 | * - RTEMS_INVALID_ID - task id invalid |
|
620 | 618 | * - RTEMS_ALREADY_SUSPENDED - task already suspended |
|
621 | 619 | * |
|
622 | 620 | */ |
|
623 | 621 | |
|
624 | 622 | rtems_status_code status; |
|
625 | 623 | |
|
626 | 624 | status = rtems_task_suspend( Task_id[TASKID_AVF0] ); |
|
627 | 625 | if (status != RTEMS_SUCCESSFUL) |
|
628 | 626 | { |
|
629 | 627 | PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status) |
|
630 | 628 | } |
|
631 | 629 | |
|
632 | 630 | if (status == RTEMS_SUCCESSFUL) // suspend BPF0 |
|
633 | 631 | { |
|
634 | 632 | status = rtems_task_suspend( Task_id[TASKID_BPF0] ); |
|
635 | 633 | if (status != RTEMS_SUCCESSFUL) |
|
636 | 634 | { |
|
637 | 635 | PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status) |
|
638 | 636 | } |
|
639 | 637 | } |
|
640 | 638 | |
|
641 | 639 | if (status == RTEMS_SUCCESSFUL) // suspend WFRM |
|
642 | 640 | { |
|
643 | 641 | status = rtems_task_suspend( Task_id[TASKID_WFRM] ); |
|
644 | 642 | if (status != RTEMS_SUCCESSFUL) |
|
645 | 643 | { |
|
646 | 644 | PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status) |
|
647 | 645 | } |
|
648 | 646 | } |
|
649 | 647 | |
|
650 | 648 | if (status == RTEMS_SUCCESSFUL) // suspend CWF3 |
|
651 | 649 | { |
|
652 | 650 | status = rtems_task_suspend( Task_id[TASKID_CWF3] ); |
|
653 | 651 | if (status != RTEMS_SUCCESSFUL) |
|
654 | 652 | { |
|
655 | 653 | PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status) |
|
656 | 654 | } |
|
657 | 655 | } |
|
658 | 656 | |
|
659 | 657 | if (status == RTEMS_SUCCESSFUL) // suspend CWF2 |
|
660 | 658 | { |
|
661 | 659 | status = rtems_task_suspend( Task_id[TASKID_CWF2] ); |
|
662 | 660 | if (status != RTEMS_SUCCESSFUL) |
|
663 | 661 | { |
|
664 | 662 | PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status) |
|
665 | 663 | } |
|
666 | 664 | } |
|
667 | 665 | |
|
668 | 666 | if (status == RTEMS_SUCCESSFUL) // suspend CWF1 |
|
669 | 667 | { |
|
670 | 668 | status = rtems_task_suspend( Task_id[TASKID_CWF1] ); |
|
671 | 669 | if (status != RTEMS_SUCCESSFUL) |
|
672 | 670 | { |
|
673 | 671 | PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status) |
|
674 | 672 | } |
|
675 | 673 | } |
|
676 | 674 | |
|
677 | 675 | return status; |
|
678 | 676 | } |
|
679 | 677 | |
|
680 | 678 | //**************** |
|
681 | 679 | // CLOSING ACTIONS |
|
682 | 680 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC) |
|
683 | 681 | { |
|
684 | 682 | housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0]; |
|
685 | 683 | housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1]; |
|
686 | 684 | housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00; |
|
687 | 685 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; |
|
688 | 686 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; |
|
689 | 687 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; |
|
690 | 688 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
691 | 689 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
692 | 690 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
693 | 691 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
694 | 692 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
695 | 693 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = (unsigned char) (time_management_regs->fine_time); |
|
696 | 694 | } |
|
697 | 695 | |
|
698 | 696 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC) |
|
699 | 697 | { |
|
700 | 698 | housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0]; |
|
701 | 699 | housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1]; |
|
702 | 700 | housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00; |
|
703 | 701 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; |
|
704 | 702 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; |
|
705 | 703 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; |
|
706 | 704 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
707 | 705 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
708 | 706 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
709 | 707 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
710 | 708 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
711 | 709 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = (unsigned char) (time_management_regs->fine_time); |
|
712 | 710 | } |
|
713 | 711 | |
|
714 | 712 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id) |
|
715 | 713 | { |
|
716 | 714 | unsigned int val = 0; |
|
717 | 715 | if (result == LFR_SUCCESSFUL) |
|
718 | 716 | { |
|
719 | 717 | if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
720 | 718 | && |
|
721 | 719 | !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
722 | 720 | ) |
|
723 | 721 | { |
|
724 | 722 | send_tm_lfr_tc_exe_success( TC, queue_id ); |
|
725 | 723 | } |
|
726 | 724 | update_last_TC_exe( TC ); |
|
727 | 725 | val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1]; |
|
728 | 726 | val++; |
|
729 | 727 | housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8); |
|
730 | 728 | housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val); |
|
731 | 729 | } |
|
732 | 730 | else |
|
733 | 731 | { |
|
734 | 732 | update_last_TC_rej( TC ); |
|
735 | 733 | val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1]; |
|
736 | 734 | val++; |
|
737 | 735 | housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8); |
|
738 | 736 | housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val); |
|
739 | 737 | } |
|
740 | 738 | } |
|
741 | 739 | |
|
742 | 740 | //*************************** |
|
743 | 741 | // Interrupt Service Routines |
|
744 | 742 | rtems_isr commutation_isr1( rtems_vector_number vector ) |
|
745 | 743 | { |
|
746 | 744 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
747 | 745 | printf("In commutation_isr1 *** Error sending event to DUMB\n"); |
|
748 | 746 | } |
|
749 | 747 | } |
|
750 | 748 | |
|
751 | 749 | rtems_isr commutation_isr2( rtems_vector_number vector ) |
|
752 | 750 | { |
|
753 | 751 | if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
754 | 752 | printf("In commutation_isr2 *** Error sending event to DUMB\n"); |
|
755 | 753 | } |
|
756 | 754 | } |
|
757 | 755 | |
|
758 | 756 | //**************** |
|
759 | 757 | // OTHER FUNCTIONS |
|
760 | 758 | void updateLFRCurrentMode() |
|
761 | 759 | { |
|
762 | 760 | /** This function updates the value of the global variable lfrCurrentMode. |
|
763 | 761 | * |
|
764 | 762 | * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running. |
|
765 | 763 | * |
|
766 | 764 | */ |
|
767 | 765 | // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure |
|
768 | 766 | lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
769 | 767 | } |
|
770 | 768 |
@@ -1,448 +1,448 | |||
|
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(parameter_dump_packet.bw_sp0_sp1_r0_r1); |
|
29 | 29 | return LFR_SUCCESSFUL; |
|
30 | 30 | } |
|
31 | 31 | |
|
32 | 32 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
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 | |
|
44 | 44 | flag = LFR_SUCCESSFUL; |
|
45 | 45 | result = LFR_SUCCESSFUL; |
|
46 | 46 | |
|
47 | 47 | if ( lfrCurrentMode == LFR_MODE_NORMAL ) { |
|
48 | 48 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
49 | 49 | flag = LFR_DEFAULT; |
|
50 | 50 | } |
|
51 | 51 | |
|
52 | 52 | //*************** |
|
53 | 53 | // sy_lfr_n_swf_l |
|
54 | 54 | if (flag == LFR_SUCCESSFUL) |
|
55 | 55 | { |
|
56 | 56 | result = set_sy_lfr_n_swf_l( TC, queue_id ); |
|
57 | 57 | if (result != LFR_SUCCESSFUL) |
|
58 | 58 | { |
|
59 | 59 | flag = LFR_DEFAULT; |
|
60 | 60 | } |
|
61 | 61 | } |
|
62 | 62 | |
|
63 | 63 | //*************** |
|
64 | 64 | // sy_lfr_n_swf_p |
|
65 | 65 | if (flag == LFR_SUCCESSFUL) |
|
66 | 66 | { |
|
67 | 67 | result = set_sy_lfr_n_swf_p( TC, queue_id ); |
|
68 | 68 | if (result != LFR_SUCCESSFUL) |
|
69 | 69 | { |
|
70 | 70 | flag = LFR_DEFAULT; |
|
71 | 71 | } |
|
72 | 72 | } |
|
73 | 73 | |
|
74 | 74 | //*************** |
|
75 | 75 | // SY_LFR_N_ASM_P |
|
76 | 76 | if (flag == LFR_SUCCESSFUL) |
|
77 | 77 | { |
|
78 | 78 | result = set_sy_lfr_n_asm_p( TC, queue_id ); |
|
79 | 79 | if (result != LFR_SUCCESSFUL) |
|
80 | 80 | { |
|
81 | 81 | flag = LFR_DEFAULT; |
|
82 | 82 | } |
|
83 | 83 | } |
|
84 | 84 | |
|
85 | 85 | //*************** |
|
86 | 86 | // SY_LFR_N_BP_P0 |
|
87 | 87 | if (flag == LFR_SUCCESSFUL) |
|
88 | 88 | { |
|
89 | 89 | result = set_sy_lfr_n_bp_p0( TC, queue_id ); |
|
90 | 90 | if (result != LFR_SUCCESSFUL) |
|
91 | 91 | { |
|
92 | 92 | flag = LFR_DEFAULT; |
|
93 | 93 | } |
|
94 | 94 | } |
|
95 | 95 | |
|
96 | 96 | //*************** |
|
97 | 97 | // sy_lfr_n_bp_p1 |
|
98 | 98 | if (flag == LFR_SUCCESSFUL) |
|
99 | 99 | { |
|
100 | 100 | result = set_sy_lfr_n_bp_p1( TC, queue_id ); |
|
101 | 101 | if (result != LFR_SUCCESSFUL) |
|
102 | 102 | { |
|
103 | 103 | flag = LFR_DEFAULT; |
|
104 | 104 | } |
|
105 | 105 | } |
|
106 | 106 | |
|
107 | 107 | return result; |
|
108 | 108 | } |
|
109 | 109 | |
|
110 | 110 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
111 | 111 | { |
|
112 | 112 | /** This function updates the LFR registers with the incoming burst parameters. |
|
113 | 113 | * |
|
114 | 114 | * @param TC points to the TeleCommand packet that is being processed |
|
115 | 115 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
116 | 116 | * |
|
117 | 117 | */ |
|
118 | 118 | |
|
119 | 119 | int result; |
|
120 | 120 | unsigned char lfrMode; |
|
121 | 121 | |
|
122 | 122 | result = LFR_DEFAULT; |
|
123 | 123 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
124 | 124 | |
|
125 | 125 | if ( lfrMode == LFR_MODE_BURST ) { |
|
126 | 126 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
127 | 127 | result = LFR_DEFAULT; |
|
128 | 128 | } |
|
129 | 129 | else { |
|
130 | 130 | parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[0]; |
|
131 | 131 | parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[1]; |
|
132 | 132 | |
|
133 | 133 | result = LFR_SUCCESSFUL; |
|
134 | 134 | } |
|
135 | 135 | |
|
136 | 136 | return result; |
|
137 | 137 | } |
|
138 | 138 | |
|
139 | 139 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
140 | 140 | { |
|
141 | 141 | /** This function updates the LFR registers with the incoming sbm1 parameters. |
|
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 related to this execution step |
|
145 | 145 | * |
|
146 | 146 | */ |
|
147 | 147 | int result; |
|
148 | 148 | unsigned char lfrMode; |
|
149 | 149 | |
|
150 | 150 | result = LFR_DEFAULT; |
|
151 | 151 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
152 | 152 | |
|
153 | if ( lfrMode == LFR_MODE_SBM1 ) { | |
|
153 | if ( (lfrMode == LFR_MODE_SBM1) || (lfrMode == LFR_MODE_SBM2) ) { | |
|
154 | 154 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
155 | 155 | result = LFR_DEFAULT; |
|
156 | 156 | } |
|
157 | 157 | else { |
|
158 | 158 | parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[0]; |
|
159 | 159 | parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[1]; |
|
160 | 160 | |
|
161 | 161 | result = LFR_SUCCESSFUL; |
|
162 | 162 | } |
|
163 | 163 | |
|
164 | 164 | return result; |
|
165 | 165 | } |
|
166 | 166 | |
|
167 | 167 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
168 | 168 | { |
|
169 | 169 | /** This function updates the LFR registers with the incoming sbm2 parameters. |
|
170 | 170 | * |
|
171 | 171 | * @param TC points to the TeleCommand packet that is being processed |
|
172 | 172 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
173 | 173 | * |
|
174 | 174 | */ |
|
175 | 175 | |
|
176 | 176 | int result; |
|
177 | 177 | unsigned char lfrMode; |
|
178 | 178 | |
|
179 | 179 | result = LFR_DEFAULT; |
|
180 | 180 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
181 | 181 | |
|
182 | if ( lfrMode == LFR_MODE_SBM2 ) { | |
|
182 | if ( (lfrMode == LFR_MODE_SBM2) || (lfrMode == LFR_MODE_SBM2) ) { | |
|
183 | 183 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
184 | 184 | result = LFR_DEFAULT; |
|
185 | 185 | } |
|
186 | 186 | else { |
|
187 | 187 | parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[0]; |
|
188 | 188 | parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[1]; |
|
189 | 189 | |
|
190 | 190 | result = LFR_SUCCESSFUL; |
|
191 | 191 | } |
|
192 | 192 | |
|
193 | 193 | return result; |
|
194 | 194 | } |
|
195 | 195 | |
|
196 | 196 | int action_dump_par( rtems_id queue_id ) |
|
197 | 197 | { |
|
198 | 198 | /** This function dumps the LFR parameters by sending the appropriate TM packet to the dedicated RTEMS message queue. |
|
199 | 199 | * |
|
200 | 200 | * @param queue_id is the id of the queue which handles TM related to this execution step. |
|
201 | 201 | * |
|
202 | 202 | * @return RTEMS directive status codes: |
|
203 | 203 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
204 | 204 | * - RTEMS_INVALID_ID - invalid queue id |
|
205 | 205 | * - RTEMS_INVALID_SIZE - invalid message size |
|
206 | 206 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
207 | 207 | * - RTEMS_UNSATISFIED - out of message buffers |
|
208 | 208 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
209 | 209 | * |
|
210 | 210 | */ |
|
211 | 211 | |
|
212 | 212 | int status; |
|
213 | 213 | |
|
214 | 214 | // UPDATE TIME |
|
215 | 215 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
216 | 216 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
217 | 217 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
218 | 218 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
219 | 219 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
220 | 220 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
221 | 221 | // SEND DATA |
|
222 | 222 | status = rtems_message_queue_send( queue_id, ¶meter_dump_packet, |
|
223 | 223 | PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
224 | 224 | if (status != RTEMS_SUCCESSFUL) { |
|
225 | 225 | PRINTF1("in action_dump *** ERR sending packet, code %d", status) |
|
226 | 226 | } |
|
227 | 227 | |
|
228 | 228 | return status; |
|
229 | 229 | } |
|
230 | 230 | |
|
231 | 231 | //*********************** |
|
232 | 232 | // NORMAL MODE PARAMETERS |
|
233 | 233 | |
|
234 | 234 | int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
235 | 235 | { |
|
236 | 236 | /** This function sets the number of points of a snapshot (sy_lfr_n_swf_l). |
|
237 | 237 | * |
|
238 | 238 | * @param TC points to the TeleCommand packet that is being processed |
|
239 | 239 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
240 | 240 | * |
|
241 | 241 | */ |
|
242 | 242 | |
|
243 | 243 | unsigned int tmp; |
|
244 | 244 | int result; |
|
245 | 245 | unsigned char msb; |
|
246 | 246 | unsigned char lsb; |
|
247 | 247 | |
|
248 | 248 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L ]; |
|
249 | 249 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L+1 ]; |
|
250 | 250 | |
|
251 | 251 | tmp = ( unsigned int ) floor( |
|
252 | 252 | ( ( msb*256 ) + lsb ) / 16 |
|
253 | 253 | ) * 16; |
|
254 | 254 | |
|
255 | 255 | if ( (tmp < 16) || (tmp > 2048) ) // the snapshot period is a multiple of 16 |
|
256 | 256 | { // 2048 is the maximum limit due to the size of the buffers |
|
257 | 257 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_L+10, lsb ); |
|
258 | 258 | result = WRONG_APP_DATA; |
|
259 | 259 | } |
|
260 | 260 | else if (tmp != 2048) |
|
261 | 261 | { |
|
262 | 262 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); |
|
263 | 263 | result = FUNCT_NOT_IMPL; |
|
264 | 264 | } |
|
265 | 265 | else |
|
266 | 266 | { |
|
267 | 267 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (tmp >> 8); |
|
268 | 268 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (tmp ); |
|
269 | 269 | result = LFR_SUCCESSFUL; |
|
270 | 270 | } |
|
271 | 271 | |
|
272 | 272 | return result; |
|
273 | 273 | } |
|
274 | 274 | |
|
275 | 275 | int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
276 | 276 | { |
|
277 | 277 | /** This function sets the time between two snapshots, in s (sy_lfr_n_swf_p). |
|
278 | 278 | * |
|
279 | 279 | * @param TC points to the TeleCommand packet that is being processed |
|
280 | 280 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
281 | 281 | * |
|
282 | 282 | */ |
|
283 | 283 | |
|
284 | 284 | unsigned int tmp; |
|
285 | 285 | int result; |
|
286 | 286 | unsigned char msb; |
|
287 | 287 | unsigned char lsb; |
|
288 | 288 | |
|
289 | 289 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P ]; |
|
290 | 290 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P+1 ]; |
|
291 | 291 | |
|
292 | 292 | tmp = ( unsigned int ) floor( |
|
293 | 293 | ( ( msb*256 ) + lsb ) / 8 |
|
294 | 294 | ) * 8; |
|
295 | 295 | |
|
296 | 296 | if ( (tmp < 16) || (tmp > 65528) ) |
|
297 | 297 | { |
|
298 | 298 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_P+10, lsb ); |
|
299 | 299 | result = WRONG_APP_DATA; |
|
300 | 300 | } |
|
301 | 301 | else |
|
302 | 302 | { |
|
303 | 303 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8); |
|
304 | 304 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp ); |
|
305 | 305 | result = LFR_SUCCESSFUL; |
|
306 | 306 | } |
|
307 | 307 | |
|
308 | 308 | return result; |
|
309 | 309 | } |
|
310 | 310 | |
|
311 | 311 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
312 | 312 | { |
|
313 | 313 | /** This function sets the time between two full spectral matrices transmission, in s (SY_LFR_N_ASM_P). |
|
314 | 314 | * |
|
315 | 315 | * @param TC points to the TeleCommand packet that is being processed |
|
316 | 316 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
317 | 317 | * |
|
318 | 318 | */ |
|
319 | 319 | |
|
320 | 320 | int result; |
|
321 | 321 | unsigned char msb; |
|
322 | 322 | unsigned char lsb; |
|
323 | 323 | |
|
324 | 324 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P ]; |
|
325 | 325 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P+1 ]; |
|
326 | 326 | |
|
327 | 327 | parameter_dump_packet.sy_lfr_n_asm_p[0] = msb; |
|
328 | 328 | parameter_dump_packet.sy_lfr_n_asm_p[1] = lsb; |
|
329 | 329 | result = LFR_SUCCESSFUL; |
|
330 | 330 | |
|
331 | 331 | return result; |
|
332 | 332 | } |
|
333 | 333 | |
|
334 | 334 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
335 | 335 | { |
|
336 | 336 | /** This function sets the time between two basic parameter sets, in s (SY_LFR_N_BP_P0). |
|
337 | 337 | * |
|
338 | 338 | * @param TC points to the TeleCommand packet that is being processed |
|
339 | 339 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
340 | 340 | * |
|
341 | 341 | */ |
|
342 | 342 | |
|
343 | 343 | int status; |
|
344 | 344 | |
|
345 | 345 | status = LFR_SUCCESSFUL; |
|
346 | 346 | |
|
347 | 347 | parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P0 ]; |
|
348 | 348 | |
|
349 | 349 | return status; |
|
350 | 350 | } |
|
351 | 351 | |
|
352 | 352 | int set_sy_lfr_n_bp_p1(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
353 | 353 | { |
|
354 | 354 | /** This function sets the time between two basic parameter sets (autocorrelation + crosscorrelation), in s (sy_lfr_n_bp_p1). |
|
355 | 355 | * |
|
356 | 356 | * @param TC points to the TeleCommand packet that is being processed |
|
357 | 357 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
358 | 358 | * |
|
359 | 359 | */ |
|
360 | 360 | |
|
361 | 361 | int status; |
|
362 | 362 | |
|
363 | 363 | status = LFR_SUCCESSFUL; |
|
364 | 364 | |
|
365 | 365 | parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P1 ]; |
|
366 | 366 | |
|
367 | 367 | return status; |
|
368 | 368 | } |
|
369 | 369 | |
|
370 | 370 | //********************** |
|
371 | 371 | // BURST MODE PARAMETERS |
|
372 | 372 | |
|
373 | 373 | //********************* |
|
374 | 374 | // SBM1 MODE PARAMETERS |
|
375 | 375 | |
|
376 | 376 | //********************* |
|
377 | 377 | // SBM2 MODE PARAMETERS |
|
378 | 378 | |
|
379 | 379 | //********** |
|
380 | 380 | // init dump |
|
381 | 381 | |
|
382 | 382 | void init_parameter_dump( void ) |
|
383 | 383 | { |
|
384 | 384 | /** This function initialize the parameter_dump_packet global variable with default values. |
|
385 | 385 | * |
|
386 | 386 | */ |
|
387 | 387 | |
|
388 | 388 | parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
389 | 389 | parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
390 | 390 | parameter_dump_packet.reserved = CCSDS_RESERVED; |
|
391 | 391 | parameter_dump_packet.userApplication = CCSDS_USER_APP; |
|
392 | 392 | parameter_dump_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_PARAMETER_DUMP >> 8); |
|
393 | 393 | parameter_dump_packet.packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP; |
|
394 | 394 | parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
395 | 395 | parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
396 | 396 | parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8); |
|
397 | 397 | parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP; |
|
398 | 398 | // DATA FIELD HEADER |
|
399 | 399 | parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2; |
|
400 | 400 | parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP; |
|
401 | 401 | parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP; |
|
402 | 402 | parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
403 | 403 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
404 | 404 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
405 | 405 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
406 | 406 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
407 | 407 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
408 | 408 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
409 | 409 | parameter_dump_packet.sid = SID_PARAMETER_DUMP; |
|
410 | 410 | |
|
411 | 411 | //****************** |
|
412 | 412 | // COMMON PARAMETERS |
|
413 | 413 | parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0; |
|
414 | 414 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1; |
|
415 | 415 | |
|
416 | 416 | //****************** |
|
417 | 417 | // NORMAL PARAMETERS |
|
418 | 418 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (SY_LFR_N_SWF_L >> 8); |
|
419 | 419 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (SY_LFR_N_SWF_L ); |
|
420 | 420 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (SY_LFR_N_SWF_P >> 8); |
|
421 | 421 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (SY_LFR_N_SWF_P ); |
|
422 | 422 | parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (SY_LFR_N_ASM_P >> 8); |
|
423 | 423 | parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (SY_LFR_N_ASM_P ); |
|
424 | 424 | parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) SY_LFR_N_BP_P0; |
|
425 | 425 | parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) SY_LFR_N_BP_P1; |
|
426 | 426 | |
|
427 | 427 | //***************** |
|
428 | 428 | // BURST PARAMETERS |
|
429 | 429 | parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0; |
|
430 | 430 | parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1; |
|
431 | 431 | |
|
432 | 432 | //**************** |
|
433 | 433 | // SBM1 PARAMETERS |
|
434 | 434 | parameter_dump_packet.sy_lfr_s1_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P0; // min value is 0.25 s for the period |
|
435 | 435 | parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1; |
|
436 | 436 | |
|
437 | 437 | //**************** |
|
438 | 438 | // SBM2 PARAMETERS |
|
439 | 439 | parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0; |
|
440 | 440 | parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1; |
|
441 | 441 | } |
|
442 | 442 | |
|
443 | 443 | |
|
444 | 444 | |
|
445 | 445 | |
|
446 | 446 | |
|
447 | 447 | |
|
448 | 448 |
@@ -1,419 +1,419 | |||
|
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 | 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 | TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
47 | 47 | TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
48 | 48 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8); |
|
49 | 49 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS ); |
|
50 | 50 | // DATA FIELD HEADER |
|
51 | 51 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
52 | 52 | TM.serviceType = TM_TYPE_TC_EXE; |
|
53 | 53 | TM.serviceSubType = TM_SUBTYPE_EXE_OK; |
|
54 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id | |
|
54 | TM.destinationID = TC->sourceID; | |
|
55 | 55 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
56 | 56 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
57 | 57 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
58 | 58 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
59 | 59 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
60 | 60 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
61 | 61 | // |
|
62 | 62 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
63 | 63 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
64 | 64 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
65 | 65 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
66 | 66 | |
|
67 | 67 | messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
68 | 68 | |
|
69 | 69 | // SEND DATA |
|
70 | 70 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); |
|
71 | 71 | if (status != RTEMS_SUCCESSFUL) { |
|
72 | 72 | PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n") |
|
73 | 73 | } |
|
74 | 74 | |
|
75 | 75 | return status; |
|
76 | 76 | } |
|
77 | 77 | |
|
78 | 78 | int send_tm_lfr_tc_exe_inconsistent( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
79 | 79 | unsigned char byte_position, unsigned char rcv_value ) |
|
80 | 80 | { |
|
81 | 81 | /** This function sends a TM_LFR_TC_EXE_INCONSISTENT packet in the dedicated RTEMS message queue. |
|
82 | 82 | * |
|
83 | 83 | * @param TC points to the TeleCommand packet that is being processed |
|
84 | 84 | * @param queue_id is the id of the queue which handles TM |
|
85 | 85 | * @param byte_position is the byte position of the MSB of the parameter that has been seen as inconsistent |
|
86 | 86 | * @param rcv_value is the value of the LSB of the parameter that has been deteced as inconsistent |
|
87 | 87 | * |
|
88 | 88 | * @return RTEMS directive status code: |
|
89 | 89 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
90 | 90 | * - RTEMS_INVALID_ID - invalid queue id |
|
91 | 91 | * - RTEMS_INVALID_SIZE - invalid message size |
|
92 | 92 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
93 | 93 | * - RTEMS_UNSATISFIED - out of message buffers |
|
94 | 94 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
95 | 95 | * |
|
96 | 96 | */ |
|
97 | 97 | |
|
98 | 98 | rtems_status_code status; |
|
99 | 99 | Packet_TM_LFR_TC_EXE_INCONSISTENT_t TM; |
|
100 | 100 | unsigned char messageSize; |
|
101 | 101 | |
|
102 | 102 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
103 | 103 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
104 | 104 | TM.reserved = DEFAULT_RESERVED; |
|
105 | 105 | TM.userApplication = CCSDS_USER_APP; |
|
106 | 106 | // PACKET HEADER |
|
107 | 107 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
108 | 108 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
109 | 109 | TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
110 | 110 | TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
111 | 111 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8); |
|
112 | 112 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT ); |
|
113 | 113 | // DATA FIELD HEADER |
|
114 | 114 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
115 | 115 | TM.serviceType = TM_TYPE_TC_EXE; |
|
116 | 116 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
117 | 117 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id |
|
118 | 118 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
119 | 119 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
120 | 120 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
121 | 121 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
122 | 122 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
123 | 123 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
124 | 124 | // |
|
125 | 125 | TM.tc_failure_code[0] = (char) (WRONG_APP_DATA >> 8); |
|
126 | 126 | TM.tc_failure_code[1] = (char) (WRONG_APP_DATA ); |
|
127 | 127 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
128 | 128 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
129 | 129 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
130 | 130 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
131 | 131 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
132 | 132 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
133 | 133 | TM.byte_position = byte_position; |
|
134 | 134 | TM.rcv_value = rcv_value; |
|
135 | 135 | |
|
136 | 136 | messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
137 | 137 | |
|
138 | 138 | // SEND DATA |
|
139 | 139 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); |
|
140 | 140 | if (status != RTEMS_SUCCESSFUL) { |
|
141 | 141 | PRINTF("in send_tm_lfr_tc_exe_inconsistent *** ERR\n") |
|
142 | 142 | } |
|
143 | 143 | |
|
144 | 144 | return status; |
|
145 | 145 | } |
|
146 | 146 | |
|
147 | 147 | int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
148 | 148 | { |
|
149 | 149 | /** This function sends a TM_LFR_TC_EXE_NOT_EXECUTABLE packet in the dedicated RTEMS message queue. |
|
150 | 150 | * |
|
151 | 151 | * @param TC points to the TeleCommand packet that is being processed |
|
152 | 152 | * @param queue_id is the id of the queue which handles TM |
|
153 | 153 | * |
|
154 | 154 | * @return RTEMS directive status code: |
|
155 | 155 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
156 | 156 | * - RTEMS_INVALID_ID - invalid queue id |
|
157 | 157 | * - RTEMS_INVALID_SIZE - invalid message size |
|
158 | 158 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
159 | 159 | * - RTEMS_UNSATISFIED - out of message buffers |
|
160 | 160 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
161 | 161 | * |
|
162 | 162 | */ |
|
163 | 163 | |
|
164 | 164 | rtems_status_code status; |
|
165 | 165 | Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t TM; |
|
166 | 166 | unsigned char messageSize; |
|
167 | 167 | |
|
168 | 168 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
169 | 169 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
170 | 170 | TM.reserved = DEFAULT_RESERVED; |
|
171 | 171 | TM.userApplication = CCSDS_USER_APP; |
|
172 | 172 | // PACKET HEADER |
|
173 | 173 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
174 | 174 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
175 | 175 | TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
176 | 176 | TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
177 | 177 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8); |
|
178 | 178 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE ); |
|
179 | 179 | // DATA FIELD HEADER |
|
180 | 180 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
181 | 181 | TM.serviceType = TM_TYPE_TC_EXE; |
|
182 | 182 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
183 | 183 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id |
|
184 | 184 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
185 | 185 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
186 | 186 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
187 | 187 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
188 | 188 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
189 | 189 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
190 | 190 | // |
|
191 | 191 | TM.tc_failure_code[0] = (char) (TC_NOT_EXE >> 8); |
|
192 | 192 | TM.tc_failure_code[1] = (char) (TC_NOT_EXE ); |
|
193 | 193 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
194 | 194 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
195 | 195 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
196 | 196 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
197 | 197 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
198 | 198 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
199 | 199 | TM.lfr_status_word[0] = housekeeping_packet.lfr_status_word[0]; |
|
200 | 200 | TM.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1]; |
|
201 | 201 | |
|
202 | 202 | messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
203 | 203 | |
|
204 | 204 | // SEND DATA |
|
205 | 205 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); |
|
206 | 206 | if (status != RTEMS_SUCCESSFUL) { |
|
207 | 207 | PRINTF("in send_tm_lfr_tc_exe_not_executable *** ERR\n") |
|
208 | 208 | } |
|
209 | 209 | |
|
210 | 210 | return status; |
|
211 | 211 | } |
|
212 | 212 | |
|
213 | 213 | int send_tm_lfr_tc_exe_not_implemented( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
214 | 214 | { |
|
215 | 215 | /** This function sends a TM_LFR_TC_EXE_NOT_IMPLEMENTED packet in the dedicated RTEMS message queue. |
|
216 | 216 | * |
|
217 | 217 | * @param TC points to the TeleCommand packet that is being processed |
|
218 | 218 | * @param queue_id is the id of the queue which handles TM |
|
219 | 219 | * |
|
220 | 220 | * @return RTEMS directive status code: |
|
221 | 221 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
222 | 222 | * - RTEMS_INVALID_ID - invalid queue id |
|
223 | 223 | * - RTEMS_INVALID_SIZE - invalid message size |
|
224 | 224 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
225 | 225 | * - RTEMS_UNSATISFIED - out of message buffers |
|
226 | 226 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
227 | 227 | * |
|
228 | 228 | */ |
|
229 | 229 | |
|
230 | 230 | rtems_status_code status; |
|
231 | 231 | Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t TM; |
|
232 | 232 | unsigned char messageSize; |
|
233 | 233 | |
|
234 | 234 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
235 | 235 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
236 | 236 | TM.reserved = DEFAULT_RESERVED; |
|
237 | 237 | TM.userApplication = CCSDS_USER_APP; |
|
238 | 238 | // PACKET HEADER |
|
239 | 239 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
240 | 240 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
241 | 241 | TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
242 | 242 | TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
243 | 243 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8); |
|
244 | 244 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED ); |
|
245 | 245 | // DATA FIELD HEADER |
|
246 | 246 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
247 | 247 | TM.serviceType = TM_TYPE_TC_EXE; |
|
248 | 248 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
249 | 249 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id |
|
250 | 250 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
251 | 251 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
252 | 252 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
253 | 253 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
254 | 254 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
255 | 255 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
256 | 256 | // |
|
257 | 257 | TM.tc_failure_code[0] = (char) (FUNCT_NOT_IMPL >> 8); |
|
258 | 258 | TM.tc_failure_code[1] = (char) (FUNCT_NOT_IMPL ); |
|
259 | 259 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
260 | 260 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
261 | 261 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
262 | 262 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
263 | 263 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
264 | 264 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
265 | 265 | |
|
266 | 266 | messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
267 | 267 | |
|
268 | 268 | // SEND DATA |
|
269 | 269 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); |
|
270 | 270 | if (status != RTEMS_SUCCESSFUL) { |
|
271 | 271 | PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n") |
|
272 | 272 | } |
|
273 | 273 | |
|
274 | 274 | return status; |
|
275 | 275 | } |
|
276 | 276 | |
|
277 | 277 | int send_tm_lfr_tc_exe_error( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
278 | 278 | { |
|
279 | 279 | /** This function sends a TM_LFR_TC_EXE_ERROR packet in the dedicated RTEMS message queue. |
|
280 | 280 | * |
|
281 | 281 | * @param TC points to the TeleCommand packet that is being processed |
|
282 | 282 | * @param queue_id is the id of the queue which handles TM |
|
283 | 283 | * |
|
284 | 284 | * @return RTEMS directive status code: |
|
285 | 285 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
286 | 286 | * - RTEMS_INVALID_ID - invalid queue id |
|
287 | 287 | * - RTEMS_INVALID_SIZE - invalid message size |
|
288 | 288 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
289 | 289 | * - RTEMS_UNSATISFIED - out of message buffers |
|
290 | 290 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
291 | 291 | * |
|
292 | 292 | */ |
|
293 | 293 | |
|
294 | 294 | rtems_status_code status; |
|
295 | 295 | Packet_TM_LFR_TC_EXE_ERROR_t TM; |
|
296 | 296 | unsigned char messageSize; |
|
297 | 297 | |
|
298 | 298 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
299 | 299 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
300 | 300 | TM.reserved = DEFAULT_RESERVED; |
|
301 | 301 | TM.userApplication = CCSDS_USER_APP; |
|
302 | 302 | // PACKET HEADER |
|
303 | 303 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
304 | 304 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
305 | 305 | TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
306 | 306 | TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
307 | 307 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8); |
|
308 | 308 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR ); |
|
309 | 309 | // DATA FIELD HEADER |
|
310 | 310 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
311 | 311 | TM.serviceType = TM_TYPE_TC_EXE; |
|
312 | 312 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
313 | 313 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id |
|
314 | 314 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
315 | 315 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
316 | 316 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
317 | 317 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
318 | 318 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
319 | 319 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
320 | 320 | // |
|
321 | 321 | TM.tc_failure_code[0] = (char) (FAIL_DETECTED >> 8); |
|
322 | 322 | TM.tc_failure_code[1] = (char) (FAIL_DETECTED ); |
|
323 | 323 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
324 | 324 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
325 | 325 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
326 | 326 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
327 | 327 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
328 | 328 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
329 | 329 | |
|
330 | 330 | messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
331 | 331 | |
|
332 | 332 | // SEND DATA |
|
333 | 333 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); |
|
334 | 334 | if (status != RTEMS_SUCCESSFUL) { |
|
335 | 335 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") |
|
336 | 336 | } |
|
337 | 337 | |
|
338 | 338 | return status; |
|
339 | 339 | } |
|
340 | 340 | |
|
341 | 341 | int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
342 | 342 | unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV ) |
|
343 | 343 | { |
|
344 | 344 | /** This function sends a TM_LFR_TC_EXE_CORRUPTED packet in the dedicated RTEMS message queue. |
|
345 | 345 | * |
|
346 | 346 | * @param TC points to the TeleCommand packet that is being processed |
|
347 | 347 | * @param queue_id is the id of the queue which handles TM |
|
348 | 348 | * @param computed_CRC points to a buffer of two bytes containing the CRC computed during the parsing of the TeleCommand |
|
349 | 349 | * @param currentTC_LEN_RCV points to a buffer of two bytes containing a packet size field computed on the received data |
|
350 | 350 | * |
|
351 | 351 | * @return RTEMS directive status code: |
|
352 | 352 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
353 | 353 | * - RTEMS_INVALID_ID - invalid queue id |
|
354 | 354 | * - RTEMS_INVALID_SIZE - invalid message size |
|
355 | 355 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
356 | 356 | * - RTEMS_UNSATISFIED - out of message buffers |
|
357 | 357 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
358 | 358 | * |
|
359 | 359 | */ |
|
360 | 360 | |
|
361 | 361 | rtems_status_code status; |
|
362 | 362 | Packet_TM_LFR_TC_EXE_CORRUPTED_t TM; |
|
363 | 363 | unsigned char messageSize; |
|
364 | 364 | unsigned int packetLength; |
|
365 | 365 | unsigned char *packetDataField; |
|
366 | 366 | |
|
367 | 367 | packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1]; // compute the packet length parameter |
|
368 | 368 | packetDataField = (unsigned char *) &TC->headerFlag_pusVersion_Ack; // get the beginning of the data field |
|
369 | 369 | |
|
370 | 370 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
371 | 371 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
372 | 372 | TM.reserved = DEFAULT_RESERVED; |
|
373 | 373 | TM.userApplication = CCSDS_USER_APP; |
|
374 | 374 | // PACKET HEADER |
|
375 | 375 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
376 | 376 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
377 | 377 | TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
378 | 378 | TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
379 | 379 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8); |
|
380 | 380 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED ); |
|
381 | 381 | // DATA FIELD HEADER |
|
382 | 382 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
383 | 383 | TM.serviceType = TM_TYPE_TC_EXE; |
|
384 | 384 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
385 | 385 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id |
|
386 | 386 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
387 | 387 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
388 | 388 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
389 | 389 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
390 | 390 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
391 | 391 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
392 | 392 | // |
|
393 | 393 | TM.tc_failure_code[0] = (unsigned char) (CORRUPTED >> 8); |
|
394 | 394 | TM.tc_failure_code[1] = (unsigned char) (CORRUPTED ); |
|
395 | 395 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
396 | 396 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
397 | 397 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
398 | 398 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
399 | 399 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
400 | 400 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
401 | 401 | TM.pkt_len_rcv_value[0] = TC->packetLength[0]; |
|
402 | 402 | TM.pkt_len_rcv_value[1] = TC->packetLength[1]; |
|
403 | 403 | TM.pkt_datafieldsize_cnt[0] = currentTC_LEN_RCV[0]; |
|
404 | 404 | TM.pkt_datafieldsize_cnt[1] = currentTC_LEN_RCV[1]; |
|
405 | 405 | TM.rcv_crc[0] = packetDataField[ packetLength - 1 ]; |
|
406 | 406 | TM.rcv_crc[1] = packetDataField[ packetLength ]; |
|
407 | 407 | TM.computed_crc[0] = computed_CRC[0]; |
|
408 | 408 | TM.computed_crc[1] = computed_CRC[1]; |
|
409 | 409 | |
|
410 | 410 | messageSize = PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
411 | 411 | |
|
412 | 412 | // SEND DATA |
|
413 | 413 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); |
|
414 | 414 | if (status != RTEMS_SUCCESSFUL) { |
|
415 | 415 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") |
|
416 | 416 | } |
|
417 | 417 | |
|
418 | 418 | return status; |
|
419 | 419 | } |
@@ -1,1170 +1,1191 | |||
|
1 | 1 | /** Functions and tasks related to waveform packet generation. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * A group of functions to handle waveforms, in snapshot or continuous format.\n |
|
7 | 7 | * |
|
8 | 8 | */ |
|
9 | 9 | |
|
10 | 10 | #include "wf_handler.h" |
|
11 | 11 | |
|
12 | 12 | // SWF |
|
13 | 13 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7]; |
|
14 | 14 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7]; |
|
15 | 15 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7]; |
|
16 | 16 | // CWF |
|
17 | 17 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7]; |
|
18 | 18 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7]; |
|
19 | 19 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7]; |
|
20 | 20 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7]; |
|
21 | 21 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[7]; |
|
22 | 22 | |
|
23 | 23 | unsigned char doubleSendCWF1 = 0; |
|
24 | 24 | unsigned char doubleSendCWF2 = 0; |
|
25 | 25 | |
|
26 | 26 | rtems_isr waveforms_isr( rtems_vector_number vector ) |
|
27 | 27 | { |
|
28 | 28 | /** This is the interrupt sub routine called by the waveform picker core. |
|
29 | 29 | * |
|
30 | 30 | * This ISR launch different actions depending mainly on two pieces of information: |
|
31 | 31 | * 1. the values read in the registers of the waveform picker. |
|
32 | 32 | * 2. the current LFR mode. |
|
33 | 33 | * |
|
34 | 34 | */ |
|
35 | 35 | |
|
36 | 36 | #ifdef GSA |
|
37 | 37 | #else |
|
38 | 38 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) |
|
39 | 39 | || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) |
|
40 | 40 | { // in modes other than STANDBY and BURST, send the CWF_F3 data |
|
41 | 41 | if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full |
|
42 | 42 | // (1) change the receiving buffer for the waveform picker |
|
43 | 43 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) { |
|
44 | 44 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_bis); |
|
45 | 45 | } |
|
46 | 46 | else { |
|
47 | 47 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); |
|
48 | 48 | } |
|
49 | 49 | // (2) send an event for the waveforms transmission |
|
50 | 50 | if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
51 | 51 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
52 | 52 | } |
|
53 | 53 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111] |
|
54 | 54 | } |
|
55 | 55 | } |
|
56 | 56 | #endif |
|
57 | 57 | |
|
58 | 58 | switch(lfrCurrentMode) |
|
59 | 59 | { |
|
60 | 60 | //******** |
|
61 | 61 | // STANDBY |
|
62 | 62 | case(LFR_MODE_STANDBY): |
|
63 | 63 | break; |
|
64 | 64 | |
|
65 | 65 | //****** |
|
66 | 66 | // NORMAL |
|
67 | 67 | case(LFR_MODE_NORMAL): |
|
68 | 68 | #ifdef GSA |
|
69 | 69 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") |
|
70 | 70 | #else |
|
71 | 71 | if ( (waveform_picker_regs->burst_enable & 0x7) == 0x0 ){ // if no channel is enable |
|
72 | 72 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
73 | 73 | } |
|
74 | 74 | else { |
|
75 | 75 | if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full |
|
76 | 76 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable & 0x08; |
|
77 | 77 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
78 | 78 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
79 | 79 | } |
|
80 | 80 | // waveform_picker_regs->status = waveform_picker_regs->status & 0x00; |
|
81 | 81 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff888; |
|
82 | 82 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x07; // [0111] enable f2 f1 f0 |
|
83 | 83 | } |
|
84 | 84 | } |
|
85 | 85 | #endif |
|
86 | 86 | break; |
|
87 | 87 | |
|
88 | 88 | //****** |
|
89 | 89 | // BURST |
|
90 | 90 | case(LFR_MODE_BURST): |
|
91 | 91 | #ifdef GSA |
|
92 | 92 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") |
|
93 | 93 | #else |
|
94 | 94 | if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit |
|
95 | 95 | // (1) change the receiving buffer for the waveform picker |
|
96 | 96 | if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { |
|
97 | 97 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis); |
|
98 | 98 | } |
|
99 | 99 | else { |
|
100 | 100 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); |
|
101 | 101 | } |
|
102 | 102 | // (2) send an event for the waveforms transmission |
|
103 | 103 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) { |
|
104 | 104 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
105 | 105 | } |
|
106 | 106 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0 |
|
107 | 107 | } |
|
108 | 108 | #endif |
|
109 | 109 | break; |
|
110 | 110 | |
|
111 | 111 | //***** |
|
112 | 112 | // SBM1 |
|
113 | 113 | case(LFR_MODE_SBM1): |
|
114 | 114 | #ifdef GSA |
|
115 | 115 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") |
|
116 | 116 | #else |
|
117 | 117 | if ((waveform_picker_regs->status & 0x02) == 0x02){ // [0010] check the f1 full bit |
|
118 | 118 | // (1) change the receiving buffer for the waveform picker |
|
119 | 119 | if ( param_local.local_sbm1_nb_cwf_sent == (param_local.local_sbm1_nb_cwf_max-1) ) |
|
120 | 120 | { |
|
121 | 121 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_norm); |
|
122 | 122 | } |
|
123 | 123 | else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1_norm ) |
|
124 | 124 | { |
|
125 | 125 | doubleSendCWF1 = 1; |
|
126 | 126 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); |
|
127 | 127 | } |
|
128 | 128 | else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1 ) { |
|
129 | 129 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis); |
|
130 | 130 | } |
|
131 | 131 | else { |
|
132 | 132 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); |
|
133 | 133 | } |
|
134 | 134 | // (2) send an event for the waveforms transmission |
|
135 | 135 | if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) { |
|
136 | 136 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
137 | 137 | } |
|
138 | 138 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0 |
|
139 | 139 | } |
|
140 | 140 | if ( ( (waveform_picker_regs->status & 0x05) == 0x05 ) ) { // [0101] check the f2 and f0 full bit |
|
141 | 141 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
142 | 142 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
143 | 143 | } |
|
144 | 144 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0 |
|
145 | 145 | reset_local_sbm1_nb_cwf_sent(); |
|
146 | 146 | } |
|
147 | 147 | |
|
148 | 148 | #endif |
|
149 | 149 | break; |
|
150 | 150 | |
|
151 | 151 | //***** |
|
152 | 152 | // SBM2 |
|
153 | 153 | case(LFR_MODE_SBM2): |
|
154 | 154 | #ifdef GSA |
|
155 | 155 | PRINTF("in waveform_isr *** unexpected waveform picker interruption\n") |
|
156 | 156 | #else |
|
157 | 157 | if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit |
|
158 | 158 | // (1) change the receiving buffer for the waveform picker |
|
159 | 159 | if ( param_local.local_sbm2_nb_cwf_sent == (param_local.local_sbm2_nb_cwf_max-1) ) |
|
160 | 160 | { |
|
161 | 161 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_norm); |
|
162 | 162 | } |
|
163 | 163 | else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2_norm ) { |
|
164 | 164 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); |
|
165 | 165 | doubleSendCWF2 = 1; |
|
166 | 166 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2_WFRM ) != RTEMS_SUCCESSFUL) { |
|
167 | 167 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
168 | 168 | } |
|
169 | 169 | reset_local_sbm2_nb_cwf_sent(); |
|
170 | 170 | } |
|
171 | 171 | else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2 ) { |
|
172 | 172 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis); |
|
173 | 173 | } |
|
174 | 174 | else { |
|
175 | 175 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); |
|
176 | 176 | } |
|
177 | 177 | // (2) send an event for the waveforms transmission |
|
178 | 178 | if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { |
|
179 | 179 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
180 | 180 | } |
|
181 | 181 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
182 | 182 | } |
|
183 | 183 | if ( ( (waveform_picker_regs->status & 0x03) == 0x03 ) ) { // [0011] f3 f2 f1 f0, f1 and f0 are full |
|
184 | 184 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) { |
|
185 | 185 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
186 | 186 | } |
|
187 | 187 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 |
|
188 | 188 | } |
|
189 | 189 | #endif |
|
190 | 190 | break; |
|
191 | 191 | |
|
192 | 192 | //******** |
|
193 | 193 | // DEFAULT |
|
194 | 194 | default: |
|
195 | 195 | break; |
|
196 | 196 | } |
|
197 | 197 | } |
|
198 | 198 | |
|
199 | 199 | rtems_isr waveforms_simulator_isr( rtems_vector_number vector ) |
|
200 | 200 | { |
|
201 | 201 | /** This is the interrupt sub routine called by the waveform picker simulator. |
|
202 | 202 | * |
|
203 | 203 | * This ISR is for debug purpose only. |
|
204 | 204 | * |
|
205 | 205 | */ |
|
206 | 206 | |
|
207 | 207 | unsigned char lfrMode; |
|
208 | 208 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
209 | 209 | |
|
210 | 210 | switch(lfrMode) { |
|
211 | 211 | case (LFR_MODE_STANDBY): |
|
212 | 212 | break; |
|
213 | 213 | case (LFR_MODE_NORMAL): |
|
214 | 214 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
215 | 215 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_5 ); |
|
216 | 216 | } |
|
217 | 217 | break; |
|
218 | 218 | case (LFR_MODE_BURST): |
|
219 | 219 | break; |
|
220 | 220 | case (LFR_MODE_SBM1): |
|
221 | 221 | break; |
|
222 | 222 | case (LFR_MODE_SBM2): |
|
223 | 223 | break; |
|
224 | 224 | } |
|
225 | 225 | } |
|
226 | 226 | |
|
227 | 227 | rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
228 | 228 | { |
|
229 | 229 | /** This RTEMS task is dedicated to the transmission of snapshots of the NORMAL mode. |
|
230 | 230 | * |
|
231 | 231 | * @param unused is the starting argument of the RTEMS task |
|
232 | 232 | * |
|
233 | 233 | * The following data packets are sent by this task: |
|
234 | 234 | * - TM_LFR_SCIENCE_NORMAL_SWF_F0 |
|
235 | 235 | * - TM_LFR_SCIENCE_NORMAL_SWF_F1 |
|
236 | 236 | * - TM_LFR_SCIENCE_NORMAL_SWF_F2 |
|
237 | 237 | * |
|
238 | 238 | */ |
|
239 | 239 | |
|
240 | 240 | rtems_event_set event_out; |
|
241 | 241 | rtems_id queue_id; |
|
242 | 242 | |
|
243 | 243 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); |
|
244 | 244 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); |
|
245 | 245 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); |
|
246 | 246 | |
|
247 | 247 | init_waveforms(); |
|
248 | 248 | |
|
249 | 249 | queue_id = get_pkts_queue_id(); |
|
250 | 250 | |
|
251 | 251 | BOOT_PRINTF("in WFRM ***\n") |
|
252 | 252 | |
|
253 | 253 | while(1){ |
|
254 | 254 | // wait for an RTEMS_EVENT |
|
255 | 255 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 |
|
256 | 256 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, |
|
257 | 257 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
258 | 258 | |
|
259 | 259 | if (event_out == RTEMS_EVENT_MODE_NORMAL) |
|
260 | 260 | { |
|
261 | 261 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
262 | 262 | send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
263 | 263 | send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
264 | 264 | #ifdef GSA |
|
265 | 265 | waveform_picker_regs->status = waveform_picker_regs->status & 0xf888; // [1111 1000 1000 1000] f2, f1, f0 bits =0 |
|
266 | 266 | #endif |
|
267 | 267 | } |
|
268 | 268 | else if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
269 | 269 | { |
|
270 | 270 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
271 | 271 | send_waveform_SWF(wf_snap_f1_norm, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
272 | 272 | send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
273 | 273 | #ifdef GSA |
|
274 | 274 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2, f0 bits = 0 |
|
275 | 275 | #endif |
|
276 | 276 | } |
|
277 | 277 | else if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
278 | 278 | { |
|
279 | 279 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id); |
|
280 | 280 | send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id); |
|
281 | 281 | #ifdef GSA |
|
282 | 282 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 |
|
283 | 283 | #endif |
|
284 | 284 | } |
|
285 | 285 | else if (event_out == RTEMS_EVENT_MODE_SBM2_WFRM) |
|
286 | 286 | { |
|
287 | 287 | send_waveform_SWF(wf_snap_f2_norm, SID_NORM_SWF_F2, headerSWF_F2, queue_id); |
|
288 | 288 | } |
|
289 | 289 | else |
|
290 | 290 | { |
|
291 | 291 | PRINTF("in WFRM *** unexpected event") |
|
292 | 292 | } |
|
293 | 293 | |
|
294 | 294 | |
|
295 | 295 | #ifdef GSA |
|
296 | 296 | // irq processed, reset the related register of the timer unit |
|
297 | 297 | gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl = gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl | 0x00000010; |
|
298 | 298 | // clear the interruption |
|
299 | 299 | LEON_Unmask_interrupt( IRQ_WF ); |
|
300 | 300 | #endif |
|
301 | 301 | } |
|
302 | 302 | } |
|
303 | 303 | |
|
304 | 304 | rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP |
|
305 | 305 | { |
|
306 | 306 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f3. |
|
307 | 307 | * |
|
308 | 308 | * @param unused is the starting argument of the RTEMS task |
|
309 | 309 | * |
|
310 | 310 | * The following data packet is sent by this task: |
|
311 | 311 | * - TM_LFR_SCIENCE_NORMAL_CWF_F3 |
|
312 | 312 | * |
|
313 | 313 | */ |
|
314 | 314 | |
|
315 | 315 | rtems_event_set event_out; |
|
316 | 316 | rtems_id queue_id; |
|
317 | 317 | |
|
318 | 318 | init_header_continuous_wf_table( SID_NORM_CWF_F3, headerCWF_F3 ); |
|
319 | 319 | init_header_continuous_wf3_light_table( headerCWF_F3_light ); |
|
320 | 320 | |
|
321 | 321 | queue_id = get_pkts_queue_id(); |
|
322 | 322 | |
|
323 | 323 | BOOT_PRINTF("in CWF3 ***\n") |
|
324 | 324 | |
|
325 | 325 | while(1){ |
|
326 | 326 | // wait for an RTEMS_EVENT |
|
327 | 327 | rtems_event_receive( RTEMS_EVENT_0, |
|
328 | 328 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
329 | 329 | PRINTF("send CWF F3 \n") |
|
330 | 330 | #ifdef GSA |
|
331 | 331 | #else |
|
332 | 332 | if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) { |
|
333 | 333 | send_waveform_CWF3_light( wf_cont_f3_bis, headerCWF_F3_light, queue_id ); |
|
334 | 334 | } |
|
335 | 335 | else { |
|
336 | 336 | send_waveform_CWF3_light( wf_cont_f3, headerCWF_F3_light, queue_id ); |
|
337 | 337 | } |
|
338 | 338 | #endif |
|
339 | 339 | } |
|
340 | 340 | } |
|
341 | 341 | |
|
342 | 342 | rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2 |
|
343 | 343 | { |
|
344 | 344 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f2. |
|
345 | 345 | * |
|
346 | 346 | * @param unused is the starting argument of the RTEMS task |
|
347 | 347 | * |
|
348 | 348 | * The following data packet is sent by this function: |
|
349 | 349 | * - TM_LFR_SCIENCE_BURST_CWF_F2 |
|
350 | 350 | * - TM_LFR_SCIENCE_SBM2_CWF_F2 |
|
351 | 351 | * |
|
352 | 352 | */ |
|
353 | 353 | |
|
354 | 354 | rtems_event_set event_out; |
|
355 | 355 | rtems_id queue_id; |
|
356 | 356 | |
|
357 | 357 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); |
|
358 | 358 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); |
|
359 | 359 | |
|
360 | 360 | queue_id = get_pkts_queue_id(); |
|
361 | 361 | |
|
362 | 362 | BOOT_PRINTF("in CWF2 ***\n") |
|
363 | 363 | |
|
364 | 364 | while(1){ |
|
365 | 365 | // wait for an RTEMS_EVENT |
|
366 | 366 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, |
|
367 | 367 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
368 | 368 | |
|
369 | 369 | if (event_out == RTEMS_EVENT_MODE_BURST) |
|
370 | 370 | { |
|
371 | 371 | // F2 |
|
372 | 372 | #ifdef GSA |
|
373 | 373 | #else |
|
374 | 374 | if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { |
|
375 | 375 | send_waveform_CWF( wf_snap_f2_bis, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); |
|
376 | 376 | } |
|
377 | 377 | else { |
|
378 | 378 | send_waveform_CWF( wf_snap_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id ); |
|
379 | 379 | } |
|
380 | 380 | #endif |
|
381 | 381 | } |
|
382 | 382 | |
|
383 | 383 | else if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
384 | 384 | { |
|
385 | 385 | #ifdef GSA |
|
386 | 386 | #else |
|
387 | 387 | if (doubleSendCWF2 == 1) |
|
388 | 388 | { |
|
389 | 389 | doubleSendCWF2 = 0; |
|
390 | 390 | send_waveform_CWF( wf_snap_f2_norm, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
391 | 391 | } |
|
392 | 392 | else if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { |
|
393 | 393 | send_waveform_CWF( wf_snap_f2_bis, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
394 | 394 | } |
|
395 | 395 | else { |
|
396 | 396 | send_waveform_CWF( wf_snap_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
397 | 397 | } |
|
398 | 398 | param_local.local_sbm2_nb_cwf_sent ++; |
|
399 | 399 | #endif |
|
400 | 400 | } |
|
401 | 401 | else |
|
402 | 402 | { |
|
403 | 403 | PRINTF1("in CWF2 *** ERR mode = %d\n", lfrCurrentMode) |
|
404 | 404 | } |
|
405 | 405 | } |
|
406 | 406 | } |
|
407 | 407 | |
|
408 | 408 | rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1 |
|
409 | 409 | { |
|
410 | 410 | /** This RTEMS task is dedicated to the transmission of continuous waveforms at f1. |
|
411 | 411 | * |
|
412 | 412 | * @param unused is the starting argument of the RTEMS task |
|
413 | 413 | * |
|
414 | 414 | * The following data packet is sent by this function: |
|
415 | 415 | * - TM_LFR_SCIENCE_SBM1_CWF_F1 |
|
416 | 416 | * |
|
417 | 417 | */ |
|
418 | 418 | |
|
419 | 419 | rtems_event_set event_out; |
|
420 | 420 | rtems_id queue_id; |
|
421 | 421 | |
|
422 | 422 | init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 ); |
|
423 | 423 | |
|
424 | 424 | queue_id = get_pkts_queue_id(); |
|
425 | 425 | |
|
426 | 426 | BOOT_PRINTF("in CWF1 ***\n") |
|
427 | 427 | |
|
428 | 428 | while(1){ |
|
429 | 429 | // wait for an RTEMS_EVENT |
|
430 | 430 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, |
|
431 | 431 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
432 | 432 | if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
433 | 433 | { |
|
434 | 434 | #ifdef GSA |
|
435 | 435 | #else |
|
436 | 436 | if (doubleSendCWF1 == 1) |
|
437 | 437 | { |
|
438 | 438 | doubleSendCWF1 = 0; |
|
439 | 439 | send_waveform_CWF( wf_snap_f1_norm, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
440 | 440 | } |
|
441 | 441 | else if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) { |
|
442 | 442 | send_waveform_CWF( wf_snap_f1_bis, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
443 | 443 | } |
|
444 | 444 | else { |
|
445 | 445 | send_waveform_CWF( wf_snap_f1, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
446 | 446 | } |
|
447 | 447 | param_local.local_sbm1_nb_cwf_sent ++; |
|
448 | 448 | #endif |
|
449 | 449 | } |
|
450 | 450 | else |
|
451 | 451 | { |
|
452 | 452 | PRINTF1("in CWF1 *** ERR mode = %d\n", lfrCurrentMode) |
|
453 | 453 | } |
|
454 | 454 | } |
|
455 | 455 | } |
|
456 | 456 | |
|
457 | 457 | //****************** |
|
458 | 458 | // general functions |
|
459 | 459 | void init_waveforms( void ) |
|
460 | 460 | { |
|
461 | 461 | int i = 0; |
|
462 | 462 | |
|
463 | 463 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
464 | 464 | { |
|
465 | 465 | //*** |
|
466 | 466 | // F0 |
|
467 | 467 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; // |
|
468 | 468 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; // |
|
469 | 469 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; // |
|
470 | 470 | |
|
471 | 471 | //*** |
|
472 | 472 | // F1 |
|
473 | 473 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111; |
|
474 | 474 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333; |
|
475 | 475 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; |
|
476 | 476 | |
|
477 | 477 | //*** |
|
478 | 478 | // F2 |
|
479 | 479 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333; |
|
480 | 480 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; |
|
481 | 481 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000; |
|
482 | 482 | |
|
483 | 483 | //*** |
|
484 | 484 | // F3 |
|
485 | 485 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1; |
|
486 | 486 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2; |
|
487 | 487 | //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000; |
|
488 | 488 | } |
|
489 | 489 | } |
|
490 | 490 | |
|
491 | 491 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) |
|
492 | 492 | { |
|
493 | 493 | unsigned char i; |
|
494 | 494 | |
|
495 | 495 | for (i=0; i<7; i++) |
|
496 | 496 | { |
|
497 | 497 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
498 | 498 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
499 | 499 | headerSWF[ i ].reserved = DEFAULT_RESERVED; |
|
500 | 500 | headerSWF[ i ].userApplication = CCSDS_USER_APP; |
|
501 | 501 | headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
502 | 502 | headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
503 | 503 | if (i == 0) |
|
504 | 504 | { |
|
505 | 505 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; |
|
506 | 506 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8); |
|
507 | 507 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 ); |
|
508 | 508 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
509 | 509 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
510 | 510 | } |
|
511 | 511 | else if (i == 6) |
|
512 | 512 | { |
|
513 | 513 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; |
|
514 | 514 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_8 >> 8); |
|
515 | 515 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_8 ); |
|
516 | 516 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); |
|
517 | 517 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); |
|
518 | 518 | } |
|
519 | 519 | else |
|
520 | 520 | { |
|
521 | 521 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; |
|
522 | 522 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8); |
|
523 | 523 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 ); |
|
524 | 524 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
525 | 525 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
526 | 526 | } |
|
527 | 527 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
528 | 528 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT |
|
529 | 529 | headerSWF[ i ].pktNr = i+1; // PKT_NR |
|
530 | 530 | // DATA FIELD HEADER |
|
531 | 531 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
532 | 532 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
533 | 533 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
534 | 534 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
535 | 535 | // AUXILIARY DATA HEADER |
|
536 | 536 | headerSWF[ i ].sid = sid; |
|
537 | 537 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
538 | 538 | headerSWF[ i ].time[0] = 0x00; |
|
539 | 539 | headerSWF[ i ].time[0] = 0x00; |
|
540 | 540 | headerSWF[ i ].time[0] = 0x00; |
|
541 | 541 | headerSWF[ i ].time[0] = 0x00; |
|
542 | 542 | headerSWF[ i ].time[0] = 0x00; |
|
543 | 543 | headerSWF[ i ].time[0] = 0x00; |
|
544 | 544 | } |
|
545 | 545 | return LFR_SUCCESSFUL; |
|
546 | 546 | } |
|
547 | 547 | |
|
548 | 548 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
549 | 549 | { |
|
550 | 550 | unsigned int i; |
|
551 | 551 | |
|
552 | 552 | for (i=0; i<7; i++) |
|
553 | 553 | { |
|
554 | 554 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
555 | 555 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
556 | 556 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
557 | 557 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
558 | 558 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) |
|
559 | 559 | { |
|
560 | 560 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8); |
|
561 | 561 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2); |
|
562 | 562 | } |
|
563 | 563 | else |
|
564 | 564 | { |
|
565 | 565 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
566 | 566 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
567 | 567 | } |
|
568 | 568 | if (i == 0) |
|
569 | 569 | { |
|
570 | 570 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; |
|
571 | 571 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8); |
|
572 | 572 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 ); |
|
573 | 573 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
574 | 574 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
575 | 575 | } |
|
576 | 576 | else if (i == 6) |
|
577 | 577 | { |
|
578 | 578 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; |
|
579 | 579 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8); |
|
580 | 580 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 ); |
|
581 | 581 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); |
|
582 | 582 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); |
|
583 | 583 | } |
|
584 | 584 | else |
|
585 | 585 | { |
|
586 | 586 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; |
|
587 | 587 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8); |
|
588 | 588 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 ); |
|
589 | 589 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
590 | 590 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
591 | 591 | } |
|
592 | 592 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
593 | 593 | // PKT_CNT |
|
594 | 594 | // PKT_NR |
|
595 | 595 | // DATA FIELD HEADER |
|
596 | 596 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
597 | 597 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
598 | 598 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
599 | 599 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
600 | 600 | // AUXILIARY DATA HEADER |
|
601 | 601 | headerCWF[ i ].sid = sid; |
|
602 | 602 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
603 | 603 | headerCWF[ i ].time[0] = 0x00; |
|
604 | 604 | headerCWF[ i ].time[0] = 0x00; |
|
605 | 605 | headerCWF[ i ].time[0] = 0x00; |
|
606 | 606 | headerCWF[ i ].time[0] = 0x00; |
|
607 | 607 | headerCWF[ i ].time[0] = 0x00; |
|
608 | 608 | headerCWF[ i ].time[0] = 0x00; |
|
609 | 609 | } |
|
610 | 610 | return LFR_SUCCESSFUL; |
|
611 | 611 | } |
|
612 | 612 | |
|
613 | 613 | int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ) |
|
614 | 614 | { |
|
615 | 615 | unsigned int i; |
|
616 | 616 | |
|
617 | 617 | for (i=0; i<7; i++) |
|
618 | 618 | { |
|
619 | 619 | headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
620 | 620 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
621 | 621 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
622 | 622 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
623 | 623 | |
|
624 | 624 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
625 | 625 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
626 | 626 | if (i == 0) |
|
627 | 627 | { |
|
628 | 628 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; |
|
629 | 629 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8); |
|
630 | 630 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 ); |
|
631 | 631 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
632 | 632 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
633 | 633 | } |
|
634 | 634 | else if (i == 6) |
|
635 | 635 | { |
|
636 | 636 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; |
|
637 | 637 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 >> 8); |
|
638 | 638 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 ); |
|
639 | 639 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); |
|
640 | 640 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); |
|
641 | 641 | } |
|
642 | 642 | else |
|
643 | 643 | { |
|
644 | 644 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; |
|
645 | 645 | headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8); |
|
646 | 646 | headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 ); |
|
647 | 647 | headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); |
|
648 | 648 | headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); |
|
649 | 649 | } |
|
650 | 650 | headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
651 | 651 | // DATA FIELD HEADER |
|
652 | 652 | headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
653 | 653 | headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
654 | 654 | headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
655 | 655 | headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; |
|
656 | 656 | // AUXILIARY DATA HEADER |
|
657 | 657 | headerCWF[ i ].sid = SID_NORM_CWF_F3; |
|
658 | 658 | headerCWF[ i ].hkBIA = DEFAULT_HKBIA; |
|
659 | 659 | headerCWF[ i ].time[0] = 0x00; |
|
660 | 660 | headerCWF[ i ].time[0] = 0x00; |
|
661 | 661 | headerCWF[ i ].time[0] = 0x00; |
|
662 | 662 | headerCWF[ i ].time[0] = 0x00; |
|
663 | 663 | headerCWF[ i ].time[0] = 0x00; |
|
664 | 664 | headerCWF[ i ].time[0] = 0x00; |
|
665 | 665 | } |
|
666 | 666 | return LFR_SUCCESSFUL; |
|
667 | 667 | } |
|
668 | 668 | |
|
669 | 669 | void reset_waveforms( void ) |
|
670 | 670 | { |
|
671 | 671 | int i = 0; |
|
672 | 672 | |
|
673 | 673 | for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++) |
|
674 | 674 | { |
|
675 | 675 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000; |
|
676 | 676 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000; |
|
677 | 677 | wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000; |
|
678 | 678 | |
|
679 | 679 | //*** |
|
680 | 680 | // F1 |
|
681 | 681 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000; |
|
682 | 682 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000; |
|
683 | 683 | wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000; |
|
684 | 684 | |
|
685 | 685 | //*** |
|
686 | 686 | // F2 |
|
687 | 687 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000; |
|
688 | 688 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000; |
|
689 | 689 | wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000; |
|
690 | 690 | |
|
691 | 691 | //*** |
|
692 | 692 | // F3 |
|
693 | 693 | /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1 |
|
694 | 694 | wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1 |
|
695 | 695 | wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/ |
|
696 | 696 | } |
|
697 | 697 | } |
|
698 | 698 | |
|
699 | 699 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, |
|
700 | 700 | Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ) |
|
701 | 701 | { |
|
702 | 702 | /** This function sends SWF CCSDS packets (F2, F1 or F0). |
|
703 | 703 | * |
|
704 | 704 | * @param waveform points to the buffer containing the data that will be send. |
|
705 | 705 | * @param sid is the source identifier of the data that will be sent. |
|
706 | 706 | * @param headerSWF points to a table of headers that have been prepared for the data transmission. |
|
707 | 707 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
708 | 708 | * contain information to setup the transmission of the data packets. |
|
709 | 709 | * |
|
710 | 710 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
711 | 711 | * |
|
712 | 712 | */ |
|
713 | 713 | |
|
714 | 714 | unsigned int i; |
|
715 | 715 | int ret; |
|
716 | 716 | rtems_status_code status; |
|
717 | 717 | spw_ioctl_pkt_send spw_ioctl_send_SWF; |
|
718 | 718 | |
|
719 | 719 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header |
|
720 | 720 | spw_ioctl_send_SWF.options = 0; |
|
721 | 721 | |
|
722 | 722 | ret = LFR_DEFAULT; |
|
723 | 723 | |
|
724 | 724 | for (i=0; i<7; i++) // send waveform |
|
725 | 725 | { |
|
726 | 726 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; |
|
727 | 727 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; |
|
728 | 728 | // BUILD THE DATA |
|
729 | 729 | if (i==6) { |
|
730 | 730 | spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK; |
|
731 | 731 | } |
|
732 | 732 | else { |
|
733 | 733 | spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK; |
|
734 | 734 | } |
|
735 | 735 | // SET PACKET TIME |
|
736 | 736 | headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
737 | 737 | headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
738 | 738 | headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
739 | 739 | headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); |
|
740 | 740 | headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
741 | 741 | headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); |
|
742 | 742 | headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
743 | 743 | headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
744 | 744 | headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
745 | 745 | headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
746 | 746 | headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
747 | 747 | headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); |
|
748 | 748 | // SEND PACKET |
|
749 | 749 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
750 | 750 | if (status != RTEMS_SUCCESSFUL) { |
|
751 | 751 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
752 | 752 | ret = LFR_DEFAULT; |
|
753 | 753 | } |
|
754 | 754 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds |
|
755 | 755 | } |
|
756 | 756 | |
|
757 | 757 | return ret; |
|
758 | 758 | } |
|
759 | 759 | |
|
760 | 760 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, |
|
761 | 761 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
762 | 762 | { |
|
763 | 763 | /** This function sends CWF CCSDS packets (F2, F1 or F0). |
|
764 | 764 | * |
|
765 | 765 | * @param waveform points to the buffer containing the data that will be send. |
|
766 | 766 | * @param sid is the source identifier of the data that will be sent. |
|
767 | 767 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
768 | 768 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
769 | 769 | * contain information to setup the transmission of the data packets. |
|
770 | 770 | * |
|
771 | 771 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
772 | 772 | * |
|
773 | 773 | */ |
|
774 | 774 | |
|
775 | 775 | unsigned int i; |
|
776 | 776 | int ret; |
|
777 | 777 | rtems_status_code status; |
|
778 | 778 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
779 | 779 | |
|
780 | 780 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
781 | 781 | spw_ioctl_send_CWF.options = 0; |
|
782 | 782 | |
|
783 | 783 | ret = LFR_DEFAULT; |
|
784 | 784 | |
|
785 | 785 | for (i=0; i<7; i++) // send waveform |
|
786 | 786 | { |
|
787 | 787 | int coarseTime = 0x00; |
|
788 | 788 | int fineTime = 0x00; |
|
789 | 789 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; |
|
790 | 790 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
791 | 791 | // BUILD THE DATA |
|
792 | 792 | if (i==6) { |
|
793 | 793 | spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK; |
|
794 | 794 | } |
|
795 | 795 | else { |
|
796 | 796 | spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK; |
|
797 | 797 | } |
|
798 | 798 | // SET PACKET TIME |
|
799 | 799 | coarseTime = time_management_regs->coarse_time; |
|
800 | 800 | fineTime = time_management_regs->fine_time; |
|
801 | 801 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); |
|
802 | 802 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); |
|
803 | 803 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); |
|
804 | 804 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); |
|
805 | 805 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); |
|
806 | 806 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); |
|
807 | 807 | headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24); |
|
808 | 808 | headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16); |
|
809 | 809 | headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8); |
|
810 | 810 | headerCWF[ i ].time[3] = (unsigned char) (coarseTime); |
|
811 | 811 | headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8); |
|
812 | 812 | headerCWF[ i ].time[5] = (unsigned char) (fineTime); |
|
813 | 813 | // SEND PACKET |
|
814 | 814 | if (sid == SID_NORM_CWF_F3) |
|
815 | 815 | { |
|
816 | 816 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
817 | 817 | if (status != RTEMS_SUCCESSFUL) { |
|
818 | 818 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
819 | 819 | ret = LFR_DEFAULT; |
|
820 | 820 | } |
|
821 | 821 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
822 | 822 | } |
|
823 | 823 | else |
|
824 | 824 | { |
|
825 | 825 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
826 | 826 | if (status != RTEMS_SUCCESSFUL) { |
|
827 | 827 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
828 | 828 | ret = LFR_DEFAULT; |
|
829 | 829 | } |
|
830 | 830 | } |
|
831 | 831 | } |
|
832 | 832 | |
|
833 | 833 | return ret; |
|
834 | 834 | } |
|
835 | 835 | |
|
836 | 836 | int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
837 | 837 | { |
|
838 | 838 | /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data. |
|
839 | 839 | * |
|
840 | 840 | * @param waveform points to the buffer containing the data that will be send. |
|
841 | 841 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
842 | 842 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
843 | 843 | * contain information to setup the transmission of the data packets. |
|
844 | 844 | * |
|
845 | 845 | * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer |
|
846 | 846 | * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks. |
|
847 | 847 | * |
|
848 | 848 | */ |
|
849 | 849 | |
|
850 | 850 | unsigned int i; |
|
851 | 851 | int ret; |
|
852 | 852 | rtems_status_code status; |
|
853 | 853 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
854 | 854 | char *sample; |
|
855 | 855 | |
|
856 | 856 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
857 | 857 | spw_ioctl_send_CWF.options = 0; |
|
858 | 858 | |
|
859 | 859 | ret = LFR_DEFAULT; |
|
860 | 860 | |
|
861 | 861 | //********************** |
|
862 | 862 | // BUILD CWF3_light DATA |
|
863 | 863 | for ( i=0; i< 2048; i++) |
|
864 | 864 | { |
|
865 | 865 | sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ]; |
|
866 | 866 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ]; |
|
867 | 867 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ]; |
|
868 | 868 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ]; |
|
869 | 869 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ]; |
|
870 | 870 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ]; |
|
871 | 871 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ]; |
|
872 | 872 | } |
|
873 | 873 | |
|
874 | 874 | //********************* |
|
875 | 875 | // SEND CWF3_light DATA |
|
876 | 876 | |
|
877 | 877 | for (i=0; i<7; i++) // send waveform |
|
878 | 878 | { |
|
879 | 879 | int coarseTime = 0x00; |
|
880 | 880 | int fineTime = 0x00; |
|
881 | 881 | spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * 340 * NB_BYTES_CWF3_LIGHT_BLK) ]; |
|
882 | 882 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
883 | 883 | // BUILD THE DATA |
|
884 | 884 | if ( i == WFRM_INDEX_OF_LAST_PACKET ) { |
|
885 | 885 | spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_CWF3_LIGHT_BLK; |
|
886 | 886 | } |
|
887 | 887 | else { |
|
888 | 888 | spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK; |
|
889 | 889 | } |
|
890 | 890 | // SET PACKET TIME |
|
891 | 891 | coarseTime = time_management_regs->coarse_time; |
|
892 | 892 | fineTime = time_management_regs->fine_time; |
|
893 | 893 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); |
|
894 | 894 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); |
|
895 | 895 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); |
|
896 | 896 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); |
|
897 | 897 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); |
|
898 | 898 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); |
|
899 | 899 | headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24); |
|
900 | 900 | headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16); |
|
901 | 901 | headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8); |
|
902 | 902 | headerCWF[ i ].time[3] = (unsigned char) (coarseTime); |
|
903 | 903 | headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8); |
|
904 | 904 | headerCWF[ i ].time[5] = (unsigned char) (fineTime); |
|
905 | 905 | // SEND PACKET |
|
906 | 906 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
907 | 907 | if (status != RTEMS_SUCCESSFUL) { |
|
908 | 908 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); |
|
909 | 909 | ret = LFR_DEFAULT; |
|
910 | 910 | } |
|
911 | 911 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
912 | 912 | } |
|
913 | 913 | |
|
914 | 914 | return ret; |
|
915 | 915 | } |
|
916 | 916 | |
|
917 | 917 | |
|
918 | 918 | //************** |
|
919 | 919 | // wfp registers |
|
920 | 920 | void set_wfp_data_shaping() |
|
921 | 921 | { |
|
922 | 922 | /** This function sets the data_shaping register of the waveform picker module. |
|
923 | 923 | * |
|
924 | 924 | * The value is read from one field of the parameter_dump_packet structure:\n |
|
925 | 925 | * bw_sp0_sp1_r0_r1 |
|
926 | 926 | * |
|
927 | 927 | */ |
|
928 | 928 | |
|
929 | 929 | unsigned char data_shaping; |
|
930 | 930 | |
|
931 | 931 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register |
|
932 | 932 | // waveform picker : [R1 R0 SP1 SP0 BW] |
|
933 | 933 | |
|
934 | 934 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; |
|
935 | 935 | |
|
936 | 936 | #ifdef GSA |
|
937 | 937 | #else |
|
938 | 938 | waveform_picker_regs->data_shaping = |
|
939 | 939 | ( (data_shaping & 0x10) >> 4 ) // BW |
|
940 | 940 | + ( (data_shaping & 0x08) >> 2 ) // SP0 |
|
941 | 941 | + ( (data_shaping & 0x04) ) // SP1 |
|
942 | 942 | + ( (data_shaping & 0x02) << 2 ) // R0 |
|
943 | 943 | + ( (data_shaping & 0x01) << 4 ); // R1 |
|
944 | 944 | #endif |
|
945 | 945 | } |
|
946 | 946 | |
|
947 | 947 | char set_wfp_delta_snapshot() |
|
948 | 948 | { |
|
949 | 949 | /** This function sets the delta_snapshot register of the waveform picker module. |
|
950 | 950 | * |
|
951 | 951 | * The value is read from two (unsigned char) of the parameter_dump_packet structure: |
|
952 | 952 | * - sy_lfr_n_swf_p[0] |
|
953 | 953 | * - sy_lfr_n_swf_p[1] |
|
954 | 954 | * |
|
955 | 955 | */ |
|
956 | 956 | |
|
957 | 957 | char ret; |
|
958 | 958 | unsigned int delta_snapshot; |
|
959 | 959 | unsigned int aux; |
|
960 | 960 | |
|
961 | 961 | aux = 0; |
|
962 | 962 | ret = LFR_DEFAULT; |
|
963 | 963 | |
|
964 | 964 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 |
|
965 | 965 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; |
|
966 | 966 | |
|
967 | 967 | #ifdef GSA |
|
968 | 968 | #else |
|
969 | 969 | if ( delta_snapshot < MIN_DELTA_SNAPSHOT ) |
|
970 | 970 | { |
|
971 | 971 | aux = MIN_DELTA_SNAPSHOT; |
|
972 | 972 | ret = LFR_DEFAULT; |
|
973 | 973 | } |
|
974 | 974 | else |
|
975 | 975 | { |
|
976 | 976 | aux = delta_snapshot ; |
|
977 | 977 | ret = LFR_SUCCESSFUL; |
|
978 | 978 | } |
|
979 | 979 | waveform_picker_regs->delta_snapshot = aux - 1; // max 2 bytes |
|
980 | 980 | #endif |
|
981 | 981 | |
|
982 | 982 | return ret; |
|
983 | 983 | } |
|
984 | 984 | |
|
985 | 985 | void set_wfp_burst_enable_register( unsigned char mode) |
|
986 | 986 | { |
|
987 | 987 | /** This function sets the waveform picker burst_enable register depending on the mode. |
|
988 | 988 | * |
|
989 | 989 | * @param mode is the LFR mode to launch. |
|
990 | 990 | * |
|
991 | 991 | * The burst bits shall be before the enable bits. |
|
992 | 992 | * |
|
993 | 993 | */ |
|
994 | 994 | |
|
995 | 995 | #ifdef GSA |
|
996 | 996 | #else |
|
997 | 997 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 |
|
998 | 998 | // the burst bits shall be set first, before the enable bits |
|
999 | 999 | switch(mode) { |
|
1000 | 1000 | case(LFR_MODE_NORMAL): |
|
1001 | 1001 | waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enable |
|
1002 | 1002 | waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 |
|
1003 | 1003 | break; |
|
1004 | 1004 | case(LFR_MODE_BURST): |
|
1005 | 1005 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1006 | 1006 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2 |
|
1007 | 1007 | break; |
|
1008 | 1008 | case(LFR_MODE_SBM1): |
|
1009 | 1009 | waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled |
|
1010 | 1010 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1011 | 1011 | break; |
|
1012 | 1012 | case(LFR_MODE_SBM2): |
|
1013 | 1013 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1014 | 1014 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1015 | 1015 | break; |
|
1016 | 1016 | default: |
|
1017 | 1017 | waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled |
|
1018 | 1018 | break; |
|
1019 | 1019 | } |
|
1020 | 1020 | #endif |
|
1021 | 1021 | } |
|
1022 | 1022 | |
|
1023 | 1023 | void reset_wfp_burst_enable() |
|
1024 | 1024 | { |
|
1025 | 1025 | /** This function resets the waveform picker burst_enable register. |
|
1026 | 1026 | * |
|
1027 | 1027 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. |
|
1028 | 1028 | * |
|
1029 | 1029 | */ |
|
1030 | 1030 | |
|
1031 | 1031 | #ifdef GSA |
|
1032 | 1032 | #else |
|
1033 | 1033 | waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1034 | 1034 | #endif |
|
1035 | 1035 | } |
|
1036 | 1036 | |
|
1037 | 1037 | void reset_wfp_status() |
|
1038 | 1038 | { |
|
1039 | 1039 | /** This function resets the waveform picker status register. |
|
1040 | 1040 | * |
|
1041 | 1041 | * All status bits are set to 0 [new_err full_err full]. |
|
1042 | 1042 | * |
|
1043 | 1043 | */ |
|
1044 | 1044 | |
|
1045 | 1045 | #ifdef GSA |
|
1046 | 1046 | #else |
|
1047 | 1047 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1048 | 1048 | #endif |
|
1049 | 1049 | } |
|
1050 | 1050 | |
|
1051 | 1051 | void reset_waveform_picker_regs() |
|
1052 | 1052 | { |
|
1053 | 1053 | /** This function resets the waveform picker module registers. |
|
1054 | 1054 | * |
|
1055 | 1055 | * The registers affected by this function are located at the following offset addresses: |
|
1056 | 1056 | * - 0x00 data_shaping |
|
1057 | 1057 | * - 0x04 burst_enable |
|
1058 | 1058 | * - 0x08 addr_data_f0 |
|
1059 | 1059 | * - 0x0C addr_data_f1 |
|
1060 | 1060 | * - 0x10 addr_data_f2 |
|
1061 | 1061 | * - 0x14 addr_data_f3 |
|
1062 | 1062 | * - 0x18 status |
|
1063 | 1063 | * - 0x1C delta_snapshot |
|
1064 | 1064 | * - 0x20 delta_f2_f1 |
|
1065 | 1065 | * - 0x24 delta_f2_f0 |
|
1066 | 1066 | * - 0x28 nb_burst |
|
1067 | 1067 | * - 0x2C nb_snapshot |
|
1068 | 1068 | * |
|
1069 | 1069 | */ |
|
1070 | 1070 | |
|
1071 | 1071 | #ifdef GSA |
|
1072 | 1072 | #else |
|
1073 | 1073 | reset_wfp_burst_enable(); |
|
1074 |
set_wfp_ |
|
|
1074 | reset_wfp_status(); | |
|
1075 | // set buffer addresses | |
|
1075 | 1076 | waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // |
|
1076 | 1077 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); // |
|
1077 | 1078 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); // |
|
1078 | 1079 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); // |
|
1080 | // set other parameters | |
|
1081 | set_wfp_data_shaping(); | |
|
1079 | 1082 | set_wfp_delta_snapshot(); // time in seconds between two snapshots |
|
1080 | 1083 | waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes) |
|
1081 | 1084 | waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes) |
|
1082 | 1085 | waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets) |
|
1083 | 1086 | waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1 |
|
1084 | reset_wfp_status(); | |
|
1085 | 1087 | #endif |
|
1086 | 1088 | } |
|
1087 | 1089 | |
|
1090 | void reset_waveform_picker_regs_alt() | |
|
1091 | { | |
|
1092 | waveform_picker_regs_alt->data_shaping = 0x01; // 0x00 00 *** R1 R0 SP1 SP0 BW | |
|
1093 | waveform_picker_regs_alt->run_burst_enable = 0x00; // 0x04 01 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] | |
|
1094 | waveform_picker_regs_alt->addr_data_f0 = (int) (wf_snap_f0); // 0x08 | |
|
1095 | waveform_picker_regs_alt->addr_data_f1 = (int) (wf_snap_f1); // 0x0c | |
|
1096 | waveform_picker_regs_alt->addr_data_f2 = (int) (wf_snap_f2); // 0x10 | |
|
1097 | waveform_picker_regs_alt->addr_data_f3 = (int) (wf_cont_f3); // 0x14 | |
|
1098 | waveform_picker_regs_alt->status = 0x00; // 0x18 | |
|
1099 | waveform_picker_regs_alt->delta_snapshot = 0x12800; // 0x1c | |
|
1100 | waveform_picker_regs_alt->delta_f0 = 0x3f5; // 0x20 *** 1013 | |
|
1101 | waveform_picker_regs_alt->delta_f0_2 = 0x7; // 0x24 *** 7 | |
|
1102 | waveform_picker_regs_alt->delta_f1 = 0x3c0; // 0x28 *** 960 | |
|
1103 | waveform_picker_regs_alt->delta_f2 = 0x12200; // 0x2c *** 74240 | |
|
1104 | waveform_picker_regs_alt->nb_data_by_buffer = 0x1802; // 0x30 *** 2048 * 3 + 2 | |
|
1105 | waveform_picker_regs_alt->snapshot_param = 0x7ff; // 0x34 *** 2048 -1 | |
|
1106 | waveform_picker_regs_alt->start_date = 0x00; | |
|
1107 | } | |
|
1108 | ||
|
1088 | 1109 | //***************** |
|
1089 | 1110 | // local parameters |
|
1090 | 1111 | void set_local_sbm1_nb_cwf_max() |
|
1091 | 1112 | { |
|
1092 | 1113 | /** This function sets the value of the sbm1_nb_cwf_max local parameter. |
|
1093 | 1114 | * |
|
1094 | 1115 | * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n |
|
1095 | 1116 | * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.\n\n |
|
1096 | 1117 | * (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot) |
|
1097 | 1118 | * |
|
1098 | 1119 | */ |
|
1099 | 1120 | param_local.local_sbm1_nb_cwf_max = 2 * |
|
1100 | 1121 | (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256 |
|
1101 | 1122 | + parameter_dump_packet.sy_lfr_n_swf_p[1]) - 8; // 16 CWF1 parts during 1 SWF2 |
|
1102 | 1123 | } |
|
1103 | 1124 | |
|
1104 | 1125 | void set_local_sbm2_nb_cwf_max() |
|
1105 | 1126 | { |
|
1106 | 1127 | /** This function sets the value of the sbm1_nb_cwf_max local parameter. |
|
1107 | 1128 | * |
|
1108 | 1129 | * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n |
|
1109 | 1130 | * This parameter is used to send CWF_F2 data as normal data when the SBM2 is active.\n\n |
|
1110 | 1131 | * (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz) |
|
1111 | 1132 | * |
|
1112 | 1133 | */ |
|
1113 | 1134 | |
|
1114 | 1135 | param_local.local_sbm2_nb_cwf_max = (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256 |
|
1115 | 1136 | + parameter_dump_packet.sy_lfr_n_swf_p[1]) / 8; |
|
1116 | 1137 | } |
|
1117 | 1138 | |
|
1118 | 1139 | void set_local_nb_interrupt_f0_MAX() |
|
1119 | 1140 | { |
|
1120 | 1141 | /** This function sets the value of the nb_interrupt_f0_MAX local parameter. |
|
1121 | 1142 | * |
|
1122 | 1143 | * This parameter is used for the SM validation only.\n |
|
1123 | 1144 | * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices |
|
1124 | 1145 | * module before launching a basic processing. |
|
1125 | 1146 | * |
|
1126 | 1147 | */ |
|
1127 | 1148 | |
|
1128 | 1149 | param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256 |
|
1129 | 1150 | + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100; |
|
1130 | 1151 | } |
|
1131 | 1152 | |
|
1132 | 1153 | void reset_local_sbm1_nb_cwf_sent() |
|
1133 | 1154 | { |
|
1134 | 1155 | /** This function resets the value of the sbm1_nb_cwf_sent local parameter. |
|
1135 | 1156 | * |
|
1136 | 1157 | * The sbm1_nb_cwf_sent parameter counts the number of CWF_F1 records that have been sent.\n |
|
1137 | 1158 | * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active. |
|
1138 | 1159 | * |
|
1139 | 1160 | */ |
|
1140 | 1161 | |
|
1141 | 1162 | param_local.local_sbm1_nb_cwf_sent = 0; |
|
1142 | 1163 | } |
|
1143 | 1164 | |
|
1144 | 1165 | void reset_local_sbm2_nb_cwf_sent() |
|
1145 | 1166 | { |
|
1146 | 1167 | /** This function resets the value of the sbm2_nb_cwf_sent local parameter. |
|
1147 | 1168 | * |
|
1148 | 1169 | * The sbm2_nb_cwf_sent parameter counts the number of CWF_F2 records that have been sent.\n |
|
1149 | 1170 | * This parameter is used to send CWF_F2 data as normal data when the SBM2 mode is active. |
|
1150 | 1171 | * |
|
1151 | 1172 | */ |
|
1152 | 1173 | |
|
1153 | 1174 | param_local.local_sbm2_nb_cwf_sent = 0; |
|
1154 | 1175 | } |
|
1155 | 1176 | |
|
1156 | 1177 | rtems_id get_pkts_queue_id( void ) |
|
1157 | 1178 | { |
|
1158 | 1179 | rtems_id queue_id; |
|
1159 | 1180 | rtems_status_code status; |
|
1160 | 1181 | rtems_name queue_send_name; |
|
1161 | 1182 | |
|
1162 | 1183 | queue_send_name = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
1163 | 1184 | |
|
1164 | 1185 | status = rtems_message_queue_ident( queue_send_name, 0, &queue_id ); |
|
1165 | 1186 | if (status != RTEMS_SUCCESSFUL) |
|
1166 | 1187 | { |
|
1167 | 1188 | PRINTF1("in get_pkts_queue_id *** ERR %d\n", status) |
|
1168 | 1189 | } |
|
1169 | 1190 | return queue_id; |
|
1170 | 1191 | } |
General Comments 0
You need to be logged in to leave comments.
Login now