@@ -1,248 +1,248 | |||
|
1 | 1 | ############################################################################# |
|
2 | 2 | # Makefile for building: bin/fsw |
|
3 |
# Generated by qmake (2.01a) (Qt 4.8.5) on: T |
|
|
3 | # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Nov 7 08:03:44 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 | 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,305 +1,305 | |||
|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
|
2 | 2 | <!DOCTYPE QtCreatorProject> |
|
3 |
<!-- Written by QtCreator 2.8.1, 2013-11-0 |
|
|
3 | <!-- Written by QtCreator 2.8.1, 2013-11-08T07:03:44. --> | |
|
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,643 +1,661 | |||
|
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 | 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 // 0x00 0x05 |
|
115 | 115 | #define TC_NOT_EXE 42000 // 0xa4 0x10 |
|
116 | 116 | #define WRONG_SRC_ID 42001 // 0xa4 0x11 |
|
117 | 117 | #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12 |
|
118 | 118 | #define FAIL_DETECTED 42003 // 0xa4 0x13 |
|
119 | 119 | #define NOT_ALLOWED 42004 // 0xa4 0x14 |
|
120 | 120 | #define CORRUPTED 42005 // 0xa4 0x15 |
|
121 | 121 | #define CCSDS_TM_VALID 7 |
|
122 | 122 | |
|
123 | 123 | // TC SID |
|
124 | #define SID_TC_DEFAULT 0 // the default SID for TC sent to the LFR | |
|
125 | 124 | #define SID_TC_GROUND 0 |
|
126 | 125 | #define SID_TC_MISSION_TIMELINE 110 |
|
127 | 126 | #define SID_TC_TC_SEQUENCES 111 |
|
128 | 127 | #define SID_TC_RECOVERY_ACTION_CMD 112 |
|
129 | 128 | #define SID_TC_BACKUP_MISSION_TIMELINE 113 |
|
130 | 129 | #define SID_TC_DIRECT_CMD 120 |
|
131 | 130 | #define SID_TC_SPARE_GRD_SRC1 121 |
|
132 | 131 | #define SID_TC_SPARE_GRD_SRC2 122 |
|
133 | 132 | #define SID_TC_OBCP 15 |
|
134 | 133 | #define SID_TC_SYSTEM_CONTROL 14 |
|
135 | 134 | #define SID_TC_AOCS 11 |
|
136 | 135 | #define SID_TC_RPW_INTERNAL 254 |
|
137 | 136 | |
|
137 | enum apid_destid{ | |
|
138 | GROUND, | |
|
139 | MISSION_TIMELINE, | |
|
140 | TC_SEQUENCES, | |
|
141 | RECOVERY_ACTION_CMD, | |
|
142 | BACKUP_MISSION_TIMELINE, | |
|
143 | DIRECT_CMD, | |
|
144 | SPARE_GRD_SRC1, | |
|
145 | SPARE_GRD_SRC2, | |
|
146 | OBCP, | |
|
147 | SYSTEM_CONTROL, | |
|
148 | AOCS, | |
|
149 | RPW_INTERNAL, | |
|
150 | UNKNOWN | |
|
151 | }; | |
|
152 | // SEQUENCE COUNTERS | |
|
153 | #define SEQ_CNT_MAX 16383 | |
|
154 | #define SEQ_CNT_NB_DEST_ID 12 | |
|
155 | ||
|
138 | 156 | // TM SID |
|
139 | 157 | #define SID_HK 1 |
|
140 | 158 | #define SID_PARAMETER_DUMP 10 |
|
141 | 159 | |
|
142 | 160 | #define SID_NORM_SWF_F0 3 |
|
143 | 161 | #define SID_NORM_SWF_F1 4 |
|
144 | 162 | #define SID_NORM_SWF_F2 5 |
|
145 | 163 | #define SID_NORM_CWF_F3 1 |
|
146 | 164 | #define SID_BURST_CWF_F2 2 |
|
147 | 165 | #define SID_SBM1_CWF_F1 24 |
|
148 | 166 | #define SID_SBM2_CWF_F2 25 |
|
149 | 167 | #define SID_NORM_ASM_F0 11 |
|
150 | 168 | #define SID_NORM_ASM_F1 12 |
|
151 | 169 | #define SID_NORM_ASM_F2 13 |
|
152 | 170 | #define SID_NORM_BP1_F0 14 |
|
153 | 171 | #define SID_NORM_BP1_F1 15 |
|
154 | 172 | #define SID_NORM_BP1_F2 16 |
|
155 | 173 | #define SID_NORM_BP2_F0 19 |
|
156 | 174 | #define SID_NORM_BP2_F1 20 |
|
157 | 175 | #define SID_NORM_BP2_F2 21 |
|
158 | 176 | #define SID_BURST_BP1_F0 17 |
|
159 | 177 | #define SID_BURST_BP2_F0 22 |
|
160 | 178 | #define SID_BURST_BP1_F1 18 |
|
161 | 179 | #define SID_BURST_BP2_F1 23 |
|
162 | 180 | #define SID_SBM1_BP1_F0 28 |
|
163 | 181 | #define SID_SBM1_BP2_F0 31 |
|
164 | 182 | #define SID_SBM2_BP1_F0 29 |
|
165 | 183 | #define SID_SBM2_BP2_F0 32 |
|
166 | 184 | #define SID_SBM2_BP1_F1 30 |
|
167 | 185 | #define SID_SBM2_BP2_F1 33 |
|
168 | 186 | |
|
169 | 187 | // LENGTH (BYTES) |
|
170 | 188 | #define LENGTH_TM_LFR_TC_EXE_MAX 32 |
|
171 | 189 | #define LENGTH_TM_LFR_HK 126 |
|
172 | 190 | |
|
173 | 191 | // HEADER_LENGTH |
|
174 | 192 | #define TM_HEADER_LEN 16 |
|
175 | 193 | #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28 |
|
176 | 194 | // PACKET_LENGTH |
|
177 | 195 | #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET) |
|
178 | 196 | #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET) |
|
179 | 197 | #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET) |
|
180 | 198 | #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET) |
|
181 | 199 | #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET) |
|
182 | 200 | #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET) |
|
183 | 201 | #define PACKET_LENGTH_HK (126 - CCSDS_TC_TM_PACKET_OFFSET) |
|
184 | 202 | #define PACKET_LENGTH_PARAMETER_DUMP (34 - CCSDS_TC_TM_PACKET_OFFSET) |
|
185 | 203 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM (TOTAL_SIZE_SM + HEADER_LENGTH_TM_LFR_SCIENCE_ASM - CCSDS_TC_TM_PACKET_OFFSET) |
|
186 | 204 | |
|
187 | 205 | #define SPARE1_PUSVERSION_SPARE2 0x10 |
|
188 | 206 | |
|
189 | 207 | #define LEN_TM_LFR_HK 130 // 126 + 4 |
|
190 | 208 | #define LEN_TM_LFR_TC_EXE_NOT_IMP 28 // 24 + 4 |
|
191 | 209 | |
|
192 | 210 | #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1 |
|
193 | 211 | #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1 |
|
194 | 212 | #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1 |
|
195 | 213 | #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1 |
|
196 | 214 | #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1 |
|
197 | 215 | #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1 |
|
198 | 216 | #define DEFAULT_PKTCNT 0x07 |
|
199 | 217 | #define BLK_NR_340 0x0154 |
|
200 | 218 | #define BLK_NR_8 0x0008 |
|
201 | 219 | |
|
202 | 220 | enum TM_TYPE{ |
|
203 | 221 | TM_LFR_TC_EXE_OK, |
|
204 | 222 | TM_LFR_TC_EXE_ERR, |
|
205 | 223 | TM_LFR_HK, |
|
206 | 224 | TM_LFR_SCI, |
|
207 | 225 | TM_LFR_SCI_SBM, |
|
208 | 226 | TM_LFR_PAR_DUMP |
|
209 | 227 | }; |
|
210 | 228 | |
|
211 | 229 | struct TMHeader_str |
|
212 | 230 | { |
|
213 |
|
|
|
214 |
|
|
|
215 |
|
|
|
216 |
|
|
|
217 |
|
|
|
218 |
|
|
|
219 |
|
|
|
231 | unsigned char targetLogicalAddress; | |
|
232 | unsigned char protocolIdentifier; | |
|
233 | unsigned char reserved; | |
|
234 | unsigned char userApplication; | |
|
235 | unsigned char packetID[2]; | |
|
236 | unsigned char packetSequenceControl[2]; | |
|
237 | unsigned char packetLength[2]; | |
|
220 | 238 | // DATA FIELD HEADER |
|
221 |
|
|
|
222 |
|
|
|
223 |
|
|
|
224 |
|
|
|
225 |
|
|
|
239 | unsigned char spare1_pusVersion_spare2; | |
|
240 | unsigned char serviceType; | |
|
241 | unsigned char serviceSubType; | |
|
242 | unsigned char destinationID; | |
|
243 | unsigned char time[6]; | |
|
226 | 244 | }; |
|
227 | 245 | typedef struct TMHeader_str TMHeader_t; |
|
228 | 246 | |
|
229 | 247 | struct Packet_TM_LFR_TC_EXE_str |
|
230 | 248 | { |
|
231 |
|
|
|
232 |
|
|
|
233 |
|
|
|
234 |
|
|
|
235 |
|
|
|
236 |
|
|
|
237 |
|
|
|
249 | unsigned char targetLogicalAddress; | |
|
250 | unsigned char protocolIdentifier; | |
|
251 | unsigned char reserved; | |
|
252 | unsigned char userApplication; | |
|
253 | unsigned char packetID[2]; | |
|
254 | unsigned char packetSequenceControl[2]; | |
|
255 | unsigned char packetLength[2]; | |
|
238 | 256 | // DATA FIELD HEADER |
|
239 |
|
|
|
240 |
|
|
|
241 |
|
|
|
242 |
|
|
|
243 |
|
|
|
244 |
|
|
|
257 | unsigned char spare1_pusVersion_spare2; | |
|
258 | unsigned char serviceType; | |
|
259 | unsigned char serviceSubType; | |
|
260 | unsigned char destinationID; | |
|
261 | unsigned char time[6]; | |
|
262 | unsigned char data[LENGTH_TM_LFR_TC_EXE_MAX - 10 + 1]; | |
|
245 | 263 | }; |
|
246 | 264 | typedef struct Packet_TM_LFR_TC_EXE_str Packet_TM_LFR_TC_EXE_t; |
|
247 | 265 | |
|
248 | 266 | struct Packet_TM_LFR_TC_EXE_SUCCESS_str |
|
249 | 267 | { |
|
250 |
|
|
|
251 |
|
|
|
252 |
|
|
|
253 |
|
|
|
268 | unsigned char targetLogicalAddress; | |
|
269 | unsigned char protocolIdentifier; | |
|
270 | unsigned char reserved; | |
|
271 | unsigned char userApplication; | |
|
254 | 272 | // PACKET HEADER |
|
255 |
|
|
|
256 |
|
|
|
257 |
|
|
|
273 | unsigned char packetID[2]; | |
|
274 | unsigned char packetSequenceControl[2]; | |
|
275 | unsigned char packetLength[2]; | |
|
258 | 276 | // DATA FIELD HEADER |
|
259 |
|
|
|
260 |
|
|
|
261 |
|
|
|
262 |
|
|
|
263 |
|
|
|
277 | unsigned char spare1_pusVersion_spare2; | |
|
278 | unsigned char serviceType; | |
|
279 | unsigned char serviceSubType; | |
|
280 | unsigned char destinationID; | |
|
281 | unsigned char time[6]; | |
|
264 | 282 | // |
|
265 |
|
|
|
266 |
|
|
|
283 | unsigned char telecommand_pkt_id[2]; | |
|
284 | unsigned char pkt_seq_control[2]; | |
|
267 | 285 | }; |
|
268 | 286 | typedef struct Packet_TM_LFR_TC_EXE_SUCCESS_str Packet_TM_LFR_TC_EXE_SUCCESS_t; |
|
269 | 287 | |
|
270 | 288 | struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str |
|
271 | 289 | { |
|
272 |
|
|
|
273 |
|
|
|
274 |
|
|
|
275 |
|
|
|
290 | unsigned char targetLogicalAddress; | |
|
291 | unsigned char protocolIdentifier; | |
|
292 | unsigned char reserved; | |
|
293 | unsigned char userApplication; | |
|
276 | 294 | // PACKET HEADER |
|
277 |
|
|
|
278 |
|
|
|
279 |
|
|
|
295 | unsigned char packetID[2]; | |
|
296 | unsigned char packetSequenceControl[2]; | |
|
297 | unsigned char packetLength[2]; | |
|
280 | 298 | // DATA FIELD HEADER |
|
281 |
|
|
|
282 |
|
|
|
283 |
|
|
|
284 |
|
|
|
285 |
|
|
|
299 | unsigned char spare1_pusVersion_spare2; | |
|
300 | unsigned char serviceType; | |
|
301 | unsigned char serviceSubType; | |
|
302 | unsigned char destinationID; | |
|
303 | unsigned char time[6]; | |
|
286 | 304 | // |
|
287 |
|
|
|
288 |
|
|
|
289 |
|
|
|
290 |
|
|
|
291 |
|
|
|
292 |
|
|
|
293 |
|
|
|
305 | unsigned char tc_failure_code[2]; | |
|
306 | unsigned char telecommand_pkt_id[2]; | |
|
307 | unsigned char pkt_seq_control[2]; | |
|
308 | unsigned char tc_service; | |
|
309 | unsigned char tc_subtype; | |
|
310 | unsigned char byte_position; | |
|
311 | unsigned char rcv_value; | |
|
294 | 312 | }; |
|
295 | 313 | typedef struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str Packet_TM_LFR_TC_EXE_INCONSISTENT_t; |
|
296 | 314 | |
|
297 | 315 | struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str |
|
298 | 316 | { |
|
299 |
|
|
|
300 |
|
|
|
301 |
|
|
|
302 |
|
|
|
317 | unsigned char targetLogicalAddress; | |
|
318 | unsigned char protocolIdentifier; | |
|
319 | unsigned char reserved; | |
|
320 | unsigned char userApplication; | |
|
303 | 321 | // PACKET HEADER |
|
304 |
|
|
|
305 |
|
|
|
306 |
|
|
|
322 | unsigned char packetID[2]; | |
|
323 | unsigned char packetSequenceControl[2]; | |
|
324 | unsigned char packetLength[2]; | |
|
307 | 325 | // DATA FIELD HEADER |
|
308 |
|
|
|
309 |
|
|
|
310 |
|
|
|
311 |
|
|
|
312 |
|
|
|
326 | unsigned char spare1_pusVersion_spare2; | |
|
327 | unsigned char serviceType; | |
|
328 | unsigned char serviceSubType; | |
|
329 | unsigned char destinationID; | |
|
330 | unsigned char time[6]; | |
|
313 | 331 | // |
|
314 |
|
|
|
315 |
|
|
|
316 |
|
|
|
317 |
|
|
|
318 |
|
|
|
319 |
|
|
|
332 | unsigned char tc_failure_code[2]; | |
|
333 | unsigned char telecommand_pkt_id[2]; | |
|
334 | unsigned char pkt_seq_control[2]; | |
|
335 | unsigned char tc_service; | |
|
336 | unsigned char tc_subtype; | |
|
337 | unsigned char lfr_status_word[2]; | |
|
320 | 338 | }; |
|
321 | 339 | typedef struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t; |
|
322 | 340 | |
|
323 | 341 | struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str |
|
324 | 342 | { |
|
325 |
|
|
|
326 |
|
|
|
327 |
|
|
|
328 |
|
|
|
343 | unsigned char targetLogicalAddress; | |
|
344 | unsigned char protocolIdentifier; | |
|
345 | unsigned char reserved; | |
|
346 | unsigned char userApplication; | |
|
329 | 347 | // PACKET HEADER |
|
330 |
|
|
|
331 |
|
|
|
332 |
|
|
|
348 | unsigned char packetID[2]; | |
|
349 | unsigned char packetSequenceControl[2]; | |
|
350 | unsigned char packetLength[2]; | |
|
333 | 351 | // DATA FIELD HEADER |
|
334 |
|
|
|
335 |
|
|
|
336 |
|
|
|
337 |
|
|
|
338 |
|
|
|
352 | unsigned char spare1_pusVersion_spare2; | |
|
353 | unsigned char serviceType; | |
|
354 | unsigned char serviceSubType; | |
|
355 | unsigned char destinationID; | |
|
356 | unsigned char time[6]; | |
|
339 | 357 | // |
|
340 |
|
|
|
341 |
|
|
|
342 |
|
|
|
343 |
|
|
|
344 |
|
|
|
358 | unsigned char tc_failure_code[2]; | |
|
359 | unsigned char telecommand_pkt_id[2]; | |
|
360 | unsigned char pkt_seq_control[2]; | |
|
361 | unsigned char tc_service; | |
|
362 | unsigned char tc_subtype; | |
|
345 | 363 | }; |
|
346 | 364 | typedef struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t; |
|
347 | 365 | |
|
348 | 366 | struct Packet_TM_LFR_TC_EXE_ERROR_str |
|
349 | 367 | { |
|
350 |
|
|
|
351 |
|
|
|
352 |
|
|
|
353 |
|
|
|
368 | unsigned char targetLogicalAddress; | |
|
369 | unsigned char protocolIdentifier; | |
|
370 | unsigned char reserved; | |
|
371 | unsigned char userApplication; | |
|
354 | 372 | // PACKET HEADER |
|
355 |
|
|
|
356 |
|
|
|
357 |
|
|
|
373 | unsigned char packetID[2]; | |
|
374 | unsigned char packetSequenceControl[2]; | |
|
375 | unsigned char packetLength[2]; | |
|
358 | 376 | // DATA FIELD HEADER |
|
359 |
|
|
|
360 |
|
|
|
361 |
|
|
|
362 |
|
|
|
363 |
|
|
|
377 | unsigned char spare1_pusVersion_spare2; | |
|
378 | unsigned char serviceType; | |
|
379 | unsigned char serviceSubType; | |
|
380 | unsigned char destinationID; | |
|
381 | unsigned char time[6]; | |
|
364 | 382 | // |
|
365 |
|
|
|
366 |
|
|
|
367 |
|
|
|
368 |
|
|
|
369 |
|
|
|
383 | unsigned char tc_failure_code[2]; | |
|
384 | unsigned char telecommand_pkt_id[2]; | |
|
385 | unsigned char pkt_seq_control[2]; | |
|
386 | unsigned char tc_service; | |
|
387 | unsigned char tc_subtype; | |
|
370 | 388 | }; |
|
371 | 389 | typedef struct Packet_TM_LFR_TC_EXE_ERROR_str Packet_TM_LFR_TC_EXE_ERROR_t; |
|
372 | 390 | |
|
373 | 391 | struct Packet_TM_LFR_TC_EXE_CORRUPTED_str |
|
374 | 392 | { |
|
375 |
|
|
|
376 |
|
|
|
377 |
|
|
|
378 |
|
|
|
393 | unsigned char targetLogicalAddress; | |
|
394 | unsigned char protocolIdentifier; | |
|
395 | unsigned char reserved; | |
|
396 | unsigned char userApplication; | |
|
379 | 397 | // PACKET HEADER |
|
380 |
|
|
|
381 |
|
|
|
382 |
|
|
|
398 | unsigned char packetID[2]; | |
|
399 | unsigned char packetSequenceControl[2]; | |
|
400 | unsigned char packetLength[2]; | |
|
383 | 401 | // DATA FIELD HEADER |
|
384 |
|
|
|
385 |
|
|
|
386 |
|
|
|
387 |
|
|
|
388 |
|
|
|
402 | unsigned char spare1_pusVersion_spare2; | |
|
403 | unsigned char serviceType; | |
|
404 | unsigned char serviceSubType; | |
|
405 | unsigned char destinationID; | |
|
406 | unsigned char time[6]; | |
|
389 | 407 | // |
|
390 |
|
|
|
391 |
|
|
|
392 |
|
|
|
393 |
|
|
|
394 |
|
|
|
395 |
|
|
|
396 |
|
|
|
397 |
|
|
|
398 |
|
|
|
408 | unsigned char tc_failure_code[2]; | |
|
409 | unsigned char telecommand_pkt_id[2]; | |
|
410 | unsigned char pkt_seq_control[2]; | |
|
411 | unsigned char tc_service; | |
|
412 | unsigned char tc_subtype; | |
|
413 | unsigned char pkt_len_rcv_value[2]; | |
|
414 | unsigned char pkt_datafieldsize_cnt[2]; | |
|
415 | unsigned char rcv_crc[2]; | |
|
416 | unsigned char computed_crc[2]; | |
|
399 | 417 | }; |
|
400 | 418 | typedef struct Packet_TM_LFR_TC_EXE_CORRUPTED_str Packet_TM_LFR_TC_EXE_CORRUPTED_t; |
|
401 | 419 | |
|
402 | 420 | struct Header_TM_LFR_SCIENCE_SWF_str |
|
403 | 421 | { |
|
404 |
|
|
|
405 |
|
|
|
406 |
|
|
|
407 |
|
|
|
408 |
|
|
|
409 |
|
|
|
410 |
|
|
|
422 | unsigned char targetLogicalAddress; | |
|
423 | unsigned char protocolIdentifier; | |
|
424 | unsigned char reserved; | |
|
425 | unsigned char userApplication; | |
|
426 | unsigned char packetID[2]; | |
|
427 | unsigned char packetSequenceControl[2]; | |
|
428 | unsigned char packetLength[2]; | |
|
411 | 429 | // DATA FIELD HEADER |
|
412 |
|
|
|
413 |
|
|
|
414 |
|
|
|
415 |
|
|
|
416 |
|
|
|
430 | unsigned char spare1_pusVersion_spare2; | |
|
431 | unsigned char serviceType; | |
|
432 | unsigned char serviceSubType; | |
|
433 | unsigned char destinationID; | |
|
434 | unsigned char time[6]; | |
|
417 | 435 | // AUXILIARY HEADER |
|
418 |
|
|
|
419 |
|
|
|
420 |
|
|
|
421 |
|
|
|
422 |
|
|
|
423 |
|
|
|
436 | unsigned char sid; | |
|
437 | unsigned char hkBIA; | |
|
438 | unsigned char pktCnt; | |
|
439 | unsigned char pktNr; | |
|
440 | unsigned char acquisitionTime[6]; | |
|
441 | unsigned char blkNr[2]; | |
|
424 | 442 | }; |
|
425 | 443 | typedef struct Header_TM_LFR_SCIENCE_SWF_str Header_TM_LFR_SCIENCE_SWF_t; |
|
426 | 444 | |
|
427 | 445 | struct Header_TM_LFR_SCIENCE_CWF_str |
|
428 | 446 | { |
|
429 |
|
|
|
430 |
|
|
|
431 |
|
|
|
432 |
|
|
|
433 |
|
|
|
434 |
|
|
|
435 |
|
|
|
447 | unsigned char targetLogicalAddress; | |
|
448 | unsigned char protocolIdentifier; | |
|
449 | unsigned char reserved; | |
|
450 | unsigned char userApplication; | |
|
451 | unsigned char packetID[2]; | |
|
452 | unsigned char packetSequenceControl[2]; | |
|
453 | unsigned char packetLength[2]; | |
|
436 | 454 | // DATA FIELD HEADER |
|
437 |
|
|
|
438 |
|
|
|
439 |
|
|
|
440 |
|
|
|
441 |
|
|
|
455 | unsigned char spare1_pusVersion_spare2; | |
|
456 | unsigned char serviceType; | |
|
457 | unsigned char serviceSubType; | |
|
458 | unsigned char destinationID; | |
|
459 | unsigned char time[6]; | |
|
442 | 460 | // AUXILIARY DATA HEADER |
|
443 |
|
|
|
444 |
|
|
|
445 |
|
|
|
446 |
|
|
|
461 | unsigned char sid; | |
|
462 | unsigned char hkBIA; | |
|
463 | unsigned char acquisitionTime[6]; | |
|
464 | unsigned char blkNr[2]; | |
|
447 | 465 | }; |
|
448 | 466 | typedef struct Header_TM_LFR_SCIENCE_CWF_str Header_TM_LFR_SCIENCE_CWF_t; |
|
449 | 467 | |
|
450 | 468 | struct Header_TM_LFR_SCIENCE_ASM_str |
|
451 | 469 | { |
|
452 |
|
|
|
453 |
|
|
|
454 |
|
|
|
455 |
|
|
|
456 |
|
|
|
457 |
|
|
|
458 |
|
|
|
470 | unsigned char targetLogicalAddress; | |
|
471 | unsigned char protocolIdentifier; | |
|
472 | unsigned char reserved; | |
|
473 | unsigned char userApplication; | |
|
474 | unsigned char packetID[2]; | |
|
475 | unsigned char packetSequenceControl[2]; | |
|
476 | unsigned char packetLength[2]; | |
|
459 | 477 | // DATA FIELD HEADER |
|
460 |
|
|
|
461 |
|
|
|
462 |
|
|
|
463 |
|
|
|
464 |
|
|
|
478 | unsigned char spare1_pusVersion_spare2; | |
|
479 | unsigned char serviceType; | |
|
480 | unsigned char serviceSubType; | |
|
481 | unsigned char destinationID; | |
|
482 | unsigned char time[6]; | |
|
465 | 483 | // AUXILIARY HEADER |
|
466 |
|
|
|
467 |
|
|
|
468 |
|
|
|
469 |
|
|
|
470 |
|
|
|
471 |
|
|
|
484 | unsigned char sid; | |
|
485 | unsigned char biaStatusInfo; | |
|
486 | unsigned char cntASM; | |
|
487 | unsigned char nrASM; | |
|
488 | unsigned char acquisitionTime[6]; | |
|
489 | unsigned char blkNr[2]; | |
|
472 | 490 | }; |
|
473 | 491 | typedef struct Header_TM_LFR_SCIENCE_ASM_str Header_TM_LFR_SCIENCE_ASM_t; |
|
474 | 492 | |
|
475 | 493 | struct ccsdsTelecommandPacket_str |
|
476 | 494 | { |
|
477 | 495 | //unsigned char targetLogicalAddress; // removed by the grspw module |
|
478 |
|
|
|
479 |
|
|
|
480 |
|
|
|
481 |
|
|
|
482 |
|
|
|
483 |
|
|
|
496 | unsigned char protocolIdentifier; | |
|
497 | unsigned char reserved; | |
|
498 | unsigned char userApplication; | |
|
499 | unsigned char packetID[2]; | |
|
500 | unsigned char packetSequenceControl[2]; | |
|
501 | unsigned char packetLength[2]; | |
|
484 | 502 | // DATA FIELD HEADER |
|
485 |
|
|
|
486 |
|
|
|
487 |
|
|
|
488 |
|
|
|
489 |
|
|
|
503 | unsigned char headerFlag_pusVersion_Ack; | |
|
504 | unsigned char serviceType; | |
|
505 | unsigned char serviceSubType; | |
|
506 | unsigned char sourceID; | |
|
507 | unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10]; | |
|
490 | 508 | }; |
|
491 | 509 | typedef struct ccsdsTelecommandPacket_str ccsdsTelecommandPacket_t; |
|
492 | 510 | |
|
493 | 511 | struct Packet_TM_LFR_HK_str |
|
494 | 512 | { |
|
495 |
|
|
|
496 |
|
|
|
497 |
|
|
|
498 |
|
|
|
499 |
|
|
|
500 |
|
|
|
501 |
|
|
|
502 |
|
|
|
503 |
|
|
|
504 |
|
|
|
505 |
|
|
|
506 |
|
|
|
507 |
|
|
|
513 | unsigned char targetLogicalAddress; | |
|
514 | unsigned char protocolIdentifier; | |
|
515 | unsigned char reserved; | |
|
516 | unsigned char userApplication; | |
|
517 | unsigned char packetID[2]; | |
|
518 | unsigned char packetSequenceControl[2]; | |
|
519 | unsigned char packetLength[2]; | |
|
520 | unsigned char spare1_pusVersion_spare2; | |
|
521 | unsigned char serviceType; | |
|
522 | unsigned char serviceSubType; | |
|
523 | unsigned char destinationID; | |
|
524 | unsigned char time[6]; | |
|
525 | unsigned char sid; | |
|
508 | 526 | |
|
509 | 527 | //************** |
|
510 | 528 | // HK PARAMETERS |
|
511 | 529 | unsigned char lfr_status_word[2]; |
|
512 | 530 | unsigned char lfr_sw_version[4]; |
|
513 | 531 | // tc statistics |
|
514 | 532 | unsigned char hk_lfr_update_info_tc_cnt[2]; |
|
515 | 533 | unsigned char hk_lfr_update_time_tc_cnt[2]; |
|
516 | 534 | unsigned char hk_dpu_exe_tc_lfr_cnt[2]; |
|
517 | 535 | unsigned char hk_dpu_rej_tc_lfr_cnt[2]; |
|
518 | 536 | unsigned char hk_lfr_last_exe_tc_id[2]; |
|
519 | 537 | unsigned char hk_lfr_last_exe_tc_type[2]; |
|
520 | 538 | unsigned char hk_lfr_last_exe_tc_subtype[2]; |
|
521 | 539 | unsigned char hk_lfr_last_exe_tc_time[6]; |
|
522 | 540 | unsigned char hk_lfr_last_rej_tc_id[2]; |
|
523 | 541 | unsigned char hk_lfr_last_rej_tc_type[2]; |
|
524 | 542 | unsigned char hk_lfr_last_rej_tc_subtype[2]; |
|
525 | 543 | unsigned char hk_lfr_last_rej_tc_time[6]; |
|
526 | 544 | // anomaly statistics |
|
527 | 545 | unsigned char hk_lfr_le_cnt[2]; |
|
528 | 546 | unsigned char hk_lfr_me_cnt[2]; |
|
529 | 547 | unsigned char hk_lfr_he_cnt[2]; |
|
530 | 548 | unsigned char hk_lfr_last_er_rid[2]; |
|
531 | 549 | unsigned char hk_lfr_last_er_code; |
|
532 | 550 | unsigned char hk_lfr_last_er_time[6]; |
|
533 | 551 | // vhdl_blk_status |
|
534 | 552 | unsigned char hk_lfr_vhdl_aa_sm; |
|
535 | 553 | unsigned char hk_lfr_vhdl_fft_sr; |
|
536 | 554 | unsigned char hk_lfr_vhdl_cic_hk; |
|
537 | 555 | unsigned char hk_lfr_vhdl_iir_cal; |
|
538 | 556 | // spacewire_if_statistics |
|
539 | 557 | unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2]; |
|
540 | 558 | unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2]; |
|
541 | 559 | unsigned char hk_lfr_dpu_spw_tick_out_cnt; |
|
542 |
unsigned char hk_lfr_dpu_spw_last_tim |
|
|
560 | unsigned char hk_lfr_dpu_spw_last_time; | |
|
543 | 561 | // ahb error statistics |
|
544 | 562 | unsigned int hk_lfr_last_fail_addr; |
|
545 | 563 | // temperatures |
|
546 | 564 | unsigned char hk_lfr_temp_scm[2]; |
|
547 | 565 | unsigned char hk_lfr_temp_pcb[2]; |
|
548 | 566 | unsigned char hk_lfr_temp_fpga[2]; |
|
549 | 567 | // error counters |
|
550 | 568 | unsigned char hk_lfr_dpu_spw_parity; |
|
551 | 569 | unsigned char hk_lfr_dpu_spw_disconnect; |
|
552 | 570 | unsigned char hk_lfr_dpu_spw_escape; |
|
553 | 571 | unsigned char hk_lfr_dpu_spw_credit; |
|
554 | 572 | unsigned char hk_lfr_dpu_spw_write_sync; |
|
555 | 573 | unsigned char hk_lfr_dpu_spw_rx_ahb; |
|
556 | 574 | unsigned char hk_lfr_dpu_spw_tx_ahb; |
|
557 | 575 | unsigned char hk_lfr_dpu_spw_header_crc; |
|
558 | 576 | unsigned char hk_lfr_dpu_spw_data_crc; |
|
559 | 577 | unsigned char hk_lfr_dpu_spw_early_eop; |
|
560 | 578 | unsigned char hk_lfr_dpu_spw_invalid_addr; |
|
561 | 579 | unsigned char hk_lfr_dpu_spw_eep; |
|
562 | 580 | unsigned char hk_lfr_dpu_spw_rx_too_big; |
|
563 | 581 | // timecode |
|
564 | 582 | unsigned char hk_lfr_timecode_erroneous; |
|
565 | 583 | unsigned char hk_lfr_timecode_missing; |
|
566 | 584 | unsigned char hk_lfr_timecode_invalid; |
|
567 | 585 | // time |
|
568 | 586 | unsigned char hk_lfr_time_timecode_it; |
|
569 | 587 | unsigned char hk_lfr_time_not_synchro; |
|
570 | 588 | unsigned char hk_lfr_time_timecode_ctr; |
|
571 | 589 | // hk_lfr_buffer_dpu_ |
|
572 | 590 | unsigned char hk_lfr_buffer_dpu_tc_fifo; |
|
573 | 591 | unsigned char hk_lfr_buffer_dpu_tm_fifo; |
|
574 | 592 | // hk_lfr_ahb_ |
|
575 | 593 | unsigned char hk_lfr_ahb_correctable; |
|
576 | 594 | unsigned char hk_lfr_ahb_uncorrectable; |
|
577 | 595 | unsigned char hk_lfr_ahb_fails_trans; |
|
578 | 596 | // hk_lfr_adc_ |
|
579 | 597 | unsigned char hk_lfr_adc_failure; |
|
580 | 598 | unsigned char hk_lfr_adc_timeout; |
|
581 | 599 | unsigned char hk_lfr_toomany_err; |
|
582 | 600 | // hk_lfr_cpu_ |
|
583 | 601 | unsigned char hk_lfr_cpu_write_err; |
|
584 | 602 | unsigned char hk_lfr_cpu_ins_access_err; |
|
585 | 603 | unsigned char hk_lfr_cpu_illegal_ins; |
|
586 | 604 | unsigned char hk_lfr_cpu_privilegied_ins; |
|
587 | 605 | unsigned char hk_lfr_cpu_register_hw; |
|
588 | 606 | unsigned char hk_lfr_cpu_not_aligned; |
|
589 | 607 | unsigned char hk_lfr_cpu_data_exception; |
|
590 | 608 | unsigned char hk_lfr_cpu_div_exception; |
|
591 | 609 | unsigned char hk_lfr_cpu_arith_overflow; |
|
592 | 610 | }; |
|
593 | 611 | typedef struct Packet_TM_LFR_HK_str Packet_TM_LFR_HK_t; |
|
594 | 612 | |
|
595 | 613 | struct Packet_TM_LFR_PARAMETER_DUMP_str |
|
596 | 614 | { |
|
597 |
|
|
|
598 |
|
|
|
599 |
|
|
|
600 |
|
|
|
601 |
|
|
|
602 |
|
|
|
603 |
|
|
|
615 | unsigned char targetLogicalAddress; | |
|
616 | unsigned char protocolIdentifier; | |
|
617 | unsigned char reserved; | |
|
618 | unsigned char userApplication; | |
|
619 | unsigned char packetID[2]; | |
|
620 | unsigned char packetSequenceControl[2]; | |
|
621 | unsigned char packetLength[2]; | |
|
604 | 622 | // DATA FIELD HEADER |
|
605 |
|
|
|
606 |
|
|
|
607 |
|
|
|
608 |
|
|
|
609 |
|
|
|
610 |
|
|
|
623 | unsigned char spare1_pusVersion_spare2; | |
|
624 | unsigned char serviceType; | |
|
625 | unsigned char serviceSubType; | |
|
626 | unsigned char destinationID; | |
|
627 | unsigned char time[6]; | |
|
628 | unsigned char sid; | |
|
611 | 629 | |
|
612 | 630 | //****************** |
|
613 | 631 | // COMMON PARAMETERS |
|
614 |
|
|
|
615 |
|
|
|
632 | unsigned char unused0; | |
|
633 | unsigned char bw_sp0_sp1_r0_r1; | |
|
616 | 634 | |
|
617 | 635 | //****************** |
|
618 | 636 | // NORMAL PARAMETERS |
|
619 |
|
|
|
620 |
|
|
|
621 |
|
|
|
622 |
|
|
|
623 |
|
|
|
637 | unsigned char sy_lfr_n_swf_l[2]; | |
|
638 | unsigned char sy_lfr_n_swf_p[2]; | |
|
639 | unsigned char sy_lfr_n_asm_p[2]; | |
|
640 | unsigned char sy_lfr_n_bp_p0; | |
|
641 | unsigned char sy_lfr_n_bp_p1; | |
|
624 | 642 | |
|
625 | 643 | //***************** |
|
626 | 644 | // BURST PARAMETERS |
|
627 |
|
|
|
628 |
|
|
|
645 | unsigned char sy_lfr_b_bp_p0; | |
|
646 | unsigned char sy_lfr_b_bp_p1; | |
|
629 | 647 | |
|
630 | 648 | //**************** |
|
631 | 649 | // SBM1 PARAMETERS |
|
632 |
|
|
|
633 |
|
|
|
650 | unsigned char sy_lfr_s1_bp_p0; | |
|
651 | unsigned char sy_lfr_s1_bp_p1; | |
|
634 | 652 | |
|
635 | 653 | //**************** |
|
636 | 654 | // SBM2 PARAMETERS |
|
637 |
|
|
|
638 |
|
|
|
655 | unsigned char sy_lfr_s2_bp_p0; | |
|
656 | unsigned char sy_lfr_s2_bp_p1; | |
|
639 | 657 | }; |
|
640 | 658 | typedef struct Packet_TM_LFR_PARAMETER_DUMP_str Packet_TM_LFR_PARAMETER_DUMP_t; |
|
641 | 659 | |
|
642 | 660 | |
|
643 | 661 | #endif // CCSDS_TYPES_H_INCLUDED |
@@ -1,48 +1,52 | |||
|
1 | 1 | #ifndef FSW_INIT_H_INCLUDED |
|
2 | 2 | #define FSW_INIT_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include <rtems.h> |
|
5 | 5 | #include <leon.h> |
|
6 | 6 | |
|
7 | 7 | #include "fsw_params.h" |
|
8 | 8 | #include "fsw_misc.h" |
|
9 | 9 | #include "fsw_processing.h" |
|
10 | 10 | #include "tc_handler.h" |
|
11 | 11 | #include "wf_handler.h" |
|
12 | 12 | |
|
13 | 13 | #include "fsw_spacewire.h" |
|
14 | 14 | |
|
15 | 15 | extern rtems_name misc_name[5]; |
|
16 | 16 | extern rtems_id misc_id[5]; |
|
17 | 17 | extern rtems_name Task_name[20]; /* array of task names */ |
|
18 | 18 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
19 | 19 | extern unsigned int maxCount; |
|
20 | 20 | extern int fdSPW; // grspw file descriptor |
|
21 | 21 | extern int fdUART; // uart file descriptor |
|
22 | 22 | extern unsigned char lfrCurrentMode; |
|
23 | 23 | |
|
24 | 24 | // MODE PARAMETERS |
|
25 | 25 | extern struct param_local_str param_local; |
|
26 | 26 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
27 |
extern unsigned short sequenceCounters |
|
|
27 | extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST; | |
|
28 | extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2; | |
|
29 | extern unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID]; | |
|
28 | 30 | |
|
29 | 31 | // RTEMS TASKS |
|
30 | 32 | rtems_task Init( rtems_task_argument argument); |
|
31 | 33 | |
|
32 | 34 | // OTHER functions |
|
33 | 35 | void create_names( void ); |
|
34 | rtems_status_code create_message_queues( void ); | |
|
35 | 36 | int create_all_tasks( void ); |
|
36 | 37 | int start_all_tasks( void ); |
|
38 | // | |
|
39 | rtems_status_code create_message_queues( void ); | |
|
40 | // | |
|
37 | 41 | int start_recv_send_tasks( void ); |
|
38 | 42 | // |
|
39 | 43 | void init_local_mode_parameters( void ); |
|
40 | 44 | |
|
41 | 45 | extern int rtems_cpu_usage_report( void ); |
|
42 | 46 | extern int rtems_cpu_usage_reset( void ); |
|
43 | 47 | extern void rtems_stack_checker_report_usage( void ); |
|
44 | 48 | |
|
45 | 49 | extern int sched_yield( void ); |
|
46 | 50 | extern int errno; |
|
47 | 51 | |
|
48 | 52 | #endif // FSW_INIT_H_INCLUDED |
@@ -1,35 +1,37 | |||
|
1 | 1 | #ifndef FSW_MISC_H_INCLUDED |
|
2 | 2 | #define FSW_MISC_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include <rtems.h> |
|
5 | 5 | #include <stdio.h> |
|
6 | 6 | #include <grspw.h> |
|
7 | 7 | |
|
8 | 8 | #include "fsw_params.h" |
|
9 | 9 | #include "fsw_spacewire.h" |
|
10 | 10 | |
|
11 | 11 | rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic |
|
12 | 12 | rtems_id HK_id; // id of the HK rate monotonic period |
|
13 | 13 | |
|
14 | 14 | extern rtems_name misc_name[5]; |
|
15 | 15 | time_management_regs_t *time_management_regs; |
|
16 | 16 | extern Packet_TM_LFR_HK_t housekeeping_packet; |
|
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 | int timer_start( gptimer_regs_t *gptimer_regs, unsigned char timer ); |
|
21 | 21 | int timer_stop( gptimer_regs_t *gptimer_regs, unsigned char timer ); |
|
22 | 22 | int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider); |
|
23 | 23 | |
|
24 | 24 | // SERIAL LINK |
|
25 | 25 | int send_console_outputs_on_apbuart_port( void ); |
|
26 | 26 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value); |
|
27 | 27 | |
|
28 | 28 | // RTEMS TASKS |
|
29 | 29 | rtems_task stat_task( rtems_task_argument argument ); |
|
30 | 30 | rtems_task hous_task( rtems_task_argument argument ); |
|
31 | 31 | rtems_task dumb_task( rtems_task_argument unused ); |
|
32 | 32 | |
|
33 | 33 | void init_housekeeping_parameters( void ); |
|
34 | 34 | |
|
35 | void increment_seq_counter( unsigned char *packet_sequence_control); | |
|
36 | ||
|
35 | 37 | #endif // FSW_MISC_H_INCLUDED |
@@ -1,235 +1,211 | |||
|
1 | 1 | #ifndef FSW_PARAMS_H_INCLUDED |
|
2 | 2 | #define FSW_PARAMS_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include "grlib_regs.h" |
|
5 | 5 | #include "fsw_params_processing.h" |
|
6 | 6 | #include "tm_byte_positions.h" |
|
7 | 7 | #include "ccsds_types.h" |
|
8 | 8 | |
|
9 | 9 | #define GRSPW_DEVICE_NAME "/dev/grspw0" |
|
10 | 10 | #define UART_DEVICE_NAME "/dev/console" |
|
11 | 11 | |
|
12 | 12 | //************************ |
|
13 | 13 | // flight software version |
|
14 | 14 | // this parameters is handled by the Qt project options |
|
15 | 15 | |
|
16 | 16 | //********** |
|
17 | 17 | // LFR MODES |
|
18 | 18 | #define LFR_MODE_STANDBY 0 |
|
19 | 19 | #define LFR_MODE_NORMAL 1 |
|
20 | 20 | #define LFR_MODE_BURST 2 |
|
21 | 21 | #define LFR_MODE_SBM1 3 |
|
22 | 22 | #define LFR_MODE_SBM2 4 |
|
23 | 23 | #define LFR_MODE_NORMAL_CWF_F3 5 |
|
24 | 24 | |
|
25 | 25 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 |
|
26 | 26 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 |
|
27 | 27 | #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2 |
|
28 | 28 | #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3 |
|
29 | 29 | #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4 |
|
30 | 30 | #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5 |
|
31 | 31 | |
|
32 | 32 | //**************************** |
|
33 | 33 | // LFR DEFAULT MODE PARAMETERS |
|
34 | 34 | // COMMON |
|
35 | 35 | #define DEFAULT_SY_LFR_COMMON0 0x00 |
|
36 | 36 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 |
|
37 | 37 | // NORM |
|
38 | 38 | #define SY_LFR_N_SWF_L 2048 // nb sample |
|
39 | 39 | #define SY_LFR_N_SWF_P 300 // sec |
|
40 | 40 | #define SY_LFR_N_ASM_P 3600 // sec |
|
41 | 41 | #define SY_LFR_N_BP_P0 4 // sec |
|
42 | 42 | #define SY_LFR_N_BP_P1 20 // sec |
|
43 | 43 | #define MIN_DELTA_SNAPSHOT 16 // sec |
|
44 | 44 | // BURST |
|
45 | 45 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec |
|
46 | 46 | #define DEFAULT_SY_LFR_B_BP_P1 5 // sec |
|
47 | 47 | // SBM1 |
|
48 | 48 | #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec |
|
49 | 49 | #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec |
|
50 | 50 | // SBM2 |
|
51 | 51 | #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec |
|
52 | 52 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec |
|
53 | 53 | // ADDITIONAL PARAMETERS |
|
54 | 54 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms |
|
55 | 55 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s |
|
56 | 56 | // STATUS WORD |
|
57 | 57 | #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits |
|
58 | 58 | #define DEFAULT_STATUS_WORD_BYTE1 0x00 |
|
59 | 59 | // |
|
60 | 60 | #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s |
|
61 | 61 | #define SY_LFR_DPU_CONNECT_ATTEMPT 3 |
|
62 | 62 | //**************************** |
|
63 | 63 | |
|
64 | 64 | //***************************** |
|
65 | 65 | // APB REGISTERS BASE ADDRESSES |
|
66 | 66 | #define REGS_ADDR_APBUART 0x80000100 |
|
67 | 67 | #define REGS_ADDR_GPTIMER 0x80000300 |
|
68 | 68 | #define REGS_ADDR_GRSPW 0x80000500 |
|
69 | 69 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 |
|
70 | 70 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 |
|
71 | 71 | |
|
72 | 72 | #ifdef GSA |
|
73 | 73 | #else |
|
74 | 74 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20 |
|
75 | 75 | #endif |
|
76 | 76 | |
|
77 | 77 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
|
78 | 78 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) |
|
79 | 79 | |
|
80 | 80 | //********** |
|
81 | 81 | // IRQ LINES |
|
82 | 82 | #define IRQ_SM 9 |
|
83 | 83 | #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels |
|
84 | 84 | #define IRQ_WF 10 |
|
85 | 85 | #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels |
|
86 | 86 | #define IRQ_TIME1 12 |
|
87 | 87 | #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels |
|
88 | 88 | #define IRQ_TIME2 13 |
|
89 | 89 | #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels |
|
90 | 90 | #define IRQ_WAVEFORM_PICKER 14 |
|
91 | 91 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels |
|
92 | 92 | #define IRQ_SPECTRAL_MATRIX 6 |
|
93 | 93 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels |
|
94 | 94 | |
|
95 | 95 | //***** |
|
96 | 96 | // TIME |
|
97 | 97 | #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms |
|
98 | 98 | #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s |
|
99 | 99 | #define TIMER_SM_SIMULATOR 1 |
|
100 | 100 | #define TIMER_WF_SIMULATOR 2 |
|
101 | 101 | #define HK_PERIOD 100 // 100 * 10ms => 1sec |
|
102 | 102 | |
|
103 | 103 | //********** |
|
104 | 104 | // LPP CODES |
|
105 | 105 | #define LFR_SUCCESSFUL 0 |
|
106 | 106 | #define LFR_DEFAULT 1 |
|
107 | 107 | |
|
108 | 108 | //****** |
|
109 | 109 | // RTEMS |
|
110 | 110 | #define TASKID_RECV 1 |
|
111 | 111 | #define TASKID_ACTN 2 |
|
112 | 112 | #define TASKID_SPIQ 3 |
|
113 | 113 | #define TASKID_SMIQ 4 |
|
114 | 114 | #define TASKID_STAT 5 |
|
115 | 115 | #define TASKID_AVF0 6 |
|
116 | 116 | #define TASKID_BPF0 7 |
|
117 | 117 | #define TASKID_WFRM 8 |
|
118 | 118 | #define TASKID_DUMB 9 |
|
119 | 119 | #define TASKID_HOUS 10 |
|
120 | 120 | #define TASKID_MATR 11 |
|
121 | 121 | #define TASKID_CWF3 12 |
|
122 | 122 | #define TASKID_CWF2 13 |
|
123 | 123 | #define TASKID_CWF1 14 |
|
124 | 124 | #define TASKID_SEND 15 |
|
125 | 125 | #define TASKID_WTDG 16 |
|
126 | 126 | |
|
127 | 127 | #define TASK_PRIORITY_SPIQ 5 |
|
128 | 128 | #define TASK_PRIORITY_SMIQ 10 |
|
129 | 129 | // |
|
130 | 130 | #define TASK_PRIORITY_WTDG 20 |
|
131 | 131 | // |
|
132 | 132 | #define TASK_PRIORITY_HOUS 30 |
|
133 | 133 | // |
|
134 | 134 | #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together |
|
135 | 135 | #define TASK_PRIORITY_CWF2 35 // |
|
136 | 136 | // |
|
137 | 137 | #define TASK_PRIORITY_WFRM 40 |
|
138 | 138 | #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1 |
|
139 | 139 | // |
|
140 | 140 | #define TASK_PRIORITY_SEND 45 |
|
141 | 141 | // |
|
142 | 142 | #define TASK_PRIORITY_RECV 50 |
|
143 | 143 | #define TASK_PRIORITY_ACTN 50 |
|
144 | 144 | // |
|
145 | 145 | #define TASK_PRIORITY_AVF0 60 |
|
146 | 146 | #define TASK_PRIORITY_BPF0 60 |
|
147 | 147 | #define TASK_PRIORITY_MATR 100 |
|
148 | 148 | #define TASK_PRIORITY_STAT 200 |
|
149 | 149 | #define TASK_PRIORITY_DUMB 200 |
|
150 | 150 | |
|
151 | #define SEMQ_PRIORITY_CEILING 30 | |
|
152 | ||
|
151 | 153 | #define ACTION_MSG_QUEUE_COUNT 10 |
|
152 | 154 | #define ACTION_MSG_PKTS_COUNT 50 |
|
153 | 155 | #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES) |
|
154 | 156 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options |
|
155 | 157 | |
|
156 | 158 | #define QUEUE_RECV 0 |
|
157 | 159 | #define QUEUE_SEND 1 |
|
158 | 160 | |
|
159 | 161 | //******* |
|
160 | 162 | // MACROS |
|
161 | 163 | #ifdef PRINT_MESSAGES_ON_CONSOLE |
|
162 | 164 | #define PRINTF(x) printf(x); |
|
163 | 165 | #define PRINTF1(x,y) printf(x,y); |
|
164 | 166 | #define PRINTF2(x,y,z) printf(x,y,z); |
|
165 | 167 | #else |
|
166 | 168 | #define PRINTF(x) ; |
|
167 | 169 | #define PRINTF1(x,y) ; |
|
168 | 170 | #define PRINTF2(x,y,z) ; |
|
169 | 171 | #endif |
|
170 | 172 | |
|
171 | 173 | #ifdef BOOT_MESSAGES |
|
172 | 174 | #define BOOT_PRINTF(x) printf(x); |
|
173 | 175 | #define BOOT_PRINTF1(x,y) printf(x,y); |
|
174 | 176 | #define BOOT_PRINTF2(x,y,z) printf(x,y,z); |
|
175 | 177 | #else |
|
176 | 178 | #define BOOT_PRINTF(x) ; |
|
177 | 179 | #define BOOT_PRINTF1(x,y) ; |
|
178 | 180 | #define BOOT_PRINTF2(x,y,z) ; |
|
179 | 181 | #endif |
|
180 | 182 | |
|
181 | 183 | #ifdef DEBUG_MESSAGES |
|
182 | 184 | #define DEBUG_PRINTF(x) printf(x); |
|
183 | 185 | #define DEBUG_PRINTF1(x,y) printf(x,y); |
|
184 | 186 | #define DEBUG_PRINTF2(x,y,z) printf(x,y,z); |
|
185 | 187 | #else |
|
186 | 188 | #define DEBUG_PRINTF(x) ; |
|
187 | 189 | #define DEBUG_PRINTF1(x,y) ; |
|
188 | 190 | #define DEBUG_PRINTF2(x,y,z) ; |
|
189 | 191 | #endif |
|
190 | 192 | |
|
191 | 193 | #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period |
|
192 | 194 | |
|
193 | 195 | #define NB_SAMPLES_PER_SNAPSHOT 2048 |
|
194 | 196 | #define TIME_OFFSET 2 |
|
195 | 197 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 |
|
196 | 198 | #define NB_BYTES_SWF_BLK (2 * 6) |
|
197 | 199 | #define NB_WORDS_SWF_BLK 3 |
|
198 | 200 | #define NB_BYTES_CWF3_LIGHT_BLK 6 |
|
199 | 201 | #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 |
|
200 | 202 | |
|
201 | //****************** | |
|
202 | // SEQUENCE COUNTERS | |
|
203 | #define SEQ_CNT_NB_PID 2 | |
|
204 | #define SEQ_CNT_NB_CAT 4 | |
|
205 | #define SEQ_CNT_NB_DEST_ID 11 | |
|
206 | // pid | |
|
207 | #define SEQ_CNT_PID_76 0 | |
|
208 | #define SEQ_CNT_PID_79 1 | |
|
209 | //cat | |
|
210 | #define SEQ_CNT_CAT_1 0 | |
|
211 | #define SEQ_CNT_CAT_4 1 | |
|
212 | #define SEQ_CNT_CAT_9 2 | |
|
213 | #define SEQ_CNT_CAT_12 3 | |
|
214 | // destination id | |
|
215 | #define SEQ_CNT_DST_ID_GROUND 0 | |
|
216 | #define SEQ_CNT_DST_ID_MISSION_TIMELINE 1 | |
|
217 | #define SEQ_CNT_DST_ID_TC_SEQUENCES 2 | |
|
218 | #define SEQ_CNT_DST_ID_RECOVERY_ACTION_CMD 3 | |
|
219 | #define SEQ_CNT_DST_ID_BACKUP_MISSION_TIMELINE 4 | |
|
220 | #define SEQ_CNT_DST_ID_DIRECT_CMD 5 | |
|
221 | #define SEQ_CNT_DST_ID_SPARE_GRD_SRC1 6 | |
|
222 | #define SEQ_CNT_DST_ID_SPARE_GRD_SRC2 7 | |
|
223 | #define SEQ_CNT_DST_ID_OBCP 8 | |
|
224 | #define SEQ_CNT_DST_ID_SYSTEM_CONTROL 9 | |
|
225 | #define SEQ_CNT_DST_ID_AOCS 10 | |
|
226 | ||
|
227 | 203 | struct param_local_str{ |
|
228 | 204 | unsigned int local_sbm1_nb_cwf_sent; |
|
229 | 205 | unsigned int local_sbm1_nb_cwf_max; |
|
230 | 206 | unsigned int local_sbm2_nb_cwf_sent; |
|
231 | 207 | unsigned int local_sbm2_nb_cwf_max; |
|
232 | 208 | unsigned int local_nb_interrupt_f0_MAX; |
|
233 | 209 | }; |
|
234 | 210 | |
|
235 | 211 | #endif // FSW_PARAMS_H_INCLUDED |
@@ -1,65 +1,67 | |||
|
1 | 1 | #ifndef FSW_PROCESSING_H_INCLUDED |
|
2 | 2 | #define FSW_PROCESSING_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include <rtems.h> |
|
5 | 5 | #include <grspw.h> |
|
6 | 6 | #include <math.h> |
|
7 | 7 | #include <stdlib.h> // abs() is in the stdlib |
|
8 | 8 | #include <stdio.h> // printf() |
|
9 | #include <math.h> | |
|
9 | 10 | |
|
10 | 11 | #include "fsw_params.h" |
|
12 | #include "fsw_spacewire.h" | |
|
11 | 13 | |
|
12 | 14 | |
|
13 | 15 | extern volatile int spec_mat_f0_0[ ]; |
|
14 | 16 | extern volatile int spec_mat_f0_1[ ]; |
|
15 | 17 | extern volatile int spec_mat_f0_a[ ]; |
|
16 | 18 | extern volatile int spec_mat_f0_b[ ]; |
|
17 | 19 | extern volatile int spec_mat_f0_c[ ]; |
|
18 | 20 | extern volatile int spec_mat_f0_d[ ]; |
|
19 | 21 | extern volatile int spec_mat_f0_e[ ]; |
|
20 | 22 | extern volatile int spec_mat_f0_f[ ]; |
|
21 | 23 | extern volatile int spec_mat_f0_g[ ]; |
|
22 | 24 | extern volatile int spec_mat_f0_h[ ]; |
|
23 | 25 | |
|
24 | 26 | extern volatile int spec_mat_f1[ ]; |
|
25 | 27 | extern volatile int spec_mat_f2[ ]; |
|
26 | 28 | |
|
27 | 29 | extern volatile int spec_mat_f1_bis[ ]; |
|
28 | 30 | extern volatile int spec_mat_f2_bis[ ]; |
|
29 | 31 | extern volatile int spec_mat_f0_0_bis[ ]; |
|
30 | 32 | extern volatile int spec_mat_f0_1_bis[ ]; |
|
31 | 33 | |
|
32 | 34 | // parameters |
|
33 | 35 | extern struct param_local_str param_local; |
|
34 | 36 | |
|
35 | 37 | // registers |
|
36 | 38 | extern time_management_regs_t *time_management_regs; |
|
37 | 39 | extern spectral_matrix_regs_t *spectral_matrix_regs; |
|
38 | 40 | |
|
39 | 41 | extern rtems_name misc_name[5]; |
|
40 | 42 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
41 | 43 | |
|
42 | 44 | // ISR |
|
43 | 45 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ); |
|
44 | 46 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ); |
|
45 | 47 | |
|
46 | 48 | // RTEMS TASKS |
|
47 | 49 | rtems_task spw_bppr_task(rtems_task_argument argument); |
|
48 | 50 | rtems_task avf0_task(rtems_task_argument argument); |
|
49 | 51 | rtems_task bpf0_task(rtems_task_argument argument); |
|
50 | 52 | rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator |
|
51 | 53 | rtems_task matr_task(rtems_task_argument argument); |
|
52 | 54 | |
|
53 | 55 | void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat); |
|
54 | 56 | void matrix_reset(volatile float *averaged_spec_mat); |
|
55 | 57 | void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1); |
|
56 | 58 | void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat); |
|
57 | 59 | // |
|
58 | 60 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header); |
|
59 | 61 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
60 | 62 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id); |
|
61 | 63 | void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix); |
|
62 | 64 | void fill_averaged_spectral_matrix( void ); |
|
63 | 65 | void reset_spectral_matrix_regs(); |
|
64 | 66 | |
|
65 | 67 | #endif // FSW_PROCESSING_H_INCLUDED |
@@ -1,31 +1,32 | |||
|
1 | 1 | #ifndef TC_LOAD_DUMP_PARAMETERS_H |
|
2 | 2 | #define TC_LOAD_DUMP_PARAMETERS_H |
|
3 | 3 | |
|
4 | 4 | #include <rtems.h> |
|
5 | 5 | #include <stdio.h> |
|
6 | 6 | |
|
7 | 7 | #include "fsw_params.h" |
|
8 | 8 | #include "wf_handler.h" |
|
9 | 9 | #include "tm_lfr_tc_exe.h" |
|
10 | #include "fsw_misc.h" | |
|
10 | 11 | |
|
11 | 12 | extern int fdSPW; |
|
12 | 13 | extern unsigned char lfrCurrentMode; |
|
13 | 14 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
14 | 15 | extern Packet_TM_LFR_HK_t housekeeping_packet; |
|
15 | 16 | |
|
16 | 17 | int action_load_common_par( ccsdsTelecommandPacket_t *TC ); |
|
17 | 18 | int action_load_normal_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
18 | 19 | int action_load_burst_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
19 | 20 | int action_load_sbm1_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
20 | 21 | int action_load_sbm2_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
21 | 22 | int action_dump_par(rtems_id queue_id ); |
|
22 | 23 | |
|
23 | 24 | int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
24 | 25 | int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
25 | 26 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
26 | 27 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
27 | 28 | int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
28 | 29 | |
|
29 | 30 | void init_parameter_dump( void ); |
|
30 | 31 | |
|
31 | 32 | #endif // TC_LOAD_DUMP_PARAMETERS_H |
@@ -1,24 +1,28 | |||
|
1 | 1 | #ifndef TM_LFR_TC_EXE_H_INCLUDED |
|
2 | 2 | #define TM_LFR_TC_EXE_H_INCLUDED |
|
3 | 3 | |
|
4 | 4 | #include <rtems.h> |
|
5 | 5 | #include <stdio.h> |
|
6 | 6 | |
|
7 | 7 | #include "fsw_params.h" |
|
8 | #include "fsw_spacewire.h" | |
|
8 | 9 | |
|
9 | 10 | extern time_management_regs_t *time_management_regs; |
|
10 | 11 | extern Packet_TM_LFR_HK_t housekeeping_packet; |
|
12 | extern unsigned short sequenceCounters_TC_EXE[]; | |
|
11 | 13 | |
|
12 | 14 | int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
13 | 15 | int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
14 | 16 | unsigned char byte_position, unsigned char rcv_value); |
|
15 | 17 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
16 | 18 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
17 | 19 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
18 | 20 | int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
19 | 21 | unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV); |
|
20 | 22 | |
|
23 | void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id ); | |
|
24 | ||
|
21 | 25 | #endif // TM_LFR_TC_EXE_H_INCLUDED |
|
22 | 26 | |
|
23 | 27 | |
|
24 | 28 |
@@ -1,81 +1,88 | |||
|
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 | #include "fsw_spacewire.h" | |
|
11 | #include "fsw_misc.h" | |
|
10 | 12 | |
|
11 | 13 | #define pi 3.1415 |
|
12 | 14 | |
|
13 | 15 | extern int fdSPW; |
|
14 | 16 | extern volatile int wf_snap_f0[ ]; |
|
15 | 17 | // |
|
16 | 18 | extern volatile int wf_snap_f1[ ]; |
|
17 | 19 | extern volatile int wf_snap_f1_bis[ ]; |
|
18 | 20 | extern volatile int wf_snap_f1_norm[ ]; |
|
19 | 21 | // |
|
20 | 22 | extern volatile int wf_snap_f2[ ]; |
|
21 | 23 | extern volatile int wf_snap_f2_bis[ ]; |
|
22 | 24 | extern volatile int wf_snap_f2_norm[ ]; |
|
23 | 25 | // |
|
24 | 26 | extern volatile int wf_cont_f3[ ]; |
|
25 | 27 | extern volatile int wf_cont_f3_bis[ ]; |
|
26 | 28 | extern char wf_cont_f3_light[ ]; |
|
27 | 29 | extern waveform_picker_regs_t *waveform_picker_regs; |
|
28 | 30 | extern waveform_picker_regs_t_alt *waveform_picker_regs_alt; |
|
29 | 31 | extern time_management_regs_t *time_management_regs; |
|
30 | 32 | extern Packet_TM_LFR_HK_t housekeeping_packet; |
|
31 | 33 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
32 | 34 | extern struct param_local_str param_local; |
|
33 | 35 | |
|
36 | extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST; | |
|
37 | extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2; | |
|
38 | ||
|
34 | 39 | extern rtems_name misc_name[5]; |
|
35 | 40 | extern rtems_name Task_name[20]; /* array of task ids */ |
|
36 | 41 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
37 | 42 | |
|
38 | 43 | extern unsigned char lfrCurrentMode; |
|
39 | 44 | |
|
40 | 45 | rtems_isr waveforms_isr( rtems_vector_number vector ); |
|
41 | 46 | rtems_isr waveforms_simulator_isr( rtems_vector_number vector ); |
|
42 | 47 | rtems_task wfrm_task( rtems_task_argument argument ); |
|
43 | 48 | rtems_task cwf3_task( rtems_task_argument argument ); |
|
44 | 49 | rtems_task cwf2_task( rtems_task_argument argument ); |
|
45 | 50 | rtems_task cwf1_task( rtems_task_argument argument ); |
|
46 | 51 | |
|
47 | 52 | //****************** |
|
48 | 53 | // general functions |
|
49 | 54 | void init_waveforms( void ); |
|
50 | 55 | // |
|
51 | 56 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF ); |
|
52 | 57 | int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF ); |
|
53 | 58 | int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF ); |
|
54 | 59 | // |
|
55 | 60 | void reset_waveforms( void ); |
|
56 | 61 | // |
|
57 | 62 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id ); |
|
58 | 63 | int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
59 | 64 | int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
60 | 65 | int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id ); |
|
61 | 66 | // |
|
62 | 67 | rtems_id get_pkts_queue_id( void ); |
|
63 | 68 | |
|
64 | 69 | //************** |
|
65 | 70 | // wfp registers |
|
66 | 71 | void set_wfp_data_shaping(); |
|
67 | 72 | char set_wfp_delta_snapshot(); |
|
68 | 73 | void set_wfp_burst_enable_register( unsigned char mode); |
|
69 | 74 | void reset_wfp_burst_enable(); |
|
70 | 75 | void reset_wfp_status(); |
|
71 | 76 | void reset_waveform_picker_regs(); |
|
72 | 77 | |
|
73 | 78 | //***************** |
|
74 | 79 | // local parameters |
|
75 | 80 | void set_local_sbm1_nb_cwf_max(); |
|
76 | 81 | void set_local_sbm2_nb_cwf_max(); |
|
77 | 82 | void set_local_nb_interrupt_f0_MAX(); |
|
78 | 83 | void reset_local_sbm1_nb_cwf_sent(); |
|
79 | 84 | void reset_local_sbm2_nb_cwf_sent(); |
|
80 | 85 | |
|
86 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ); | |
|
87 | ||
|
81 | 88 | #endif // WF_HANDLER_H_INCLUDED |
@@ -1,90 +1,92 | |||
|
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 | 40 | waveform_picker_regs_t_alt *waveform_picker_regs_alt = (waveform_picker_regs_t_alt*) REGS_ADDR_WAVEFORM_PICKER; |
|
41 | 41 | #endif |
|
42 | 42 | spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX; |
|
43 | 43 | |
|
44 | 44 | // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes |
|
45 | 45 | volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
46 | 46 | // |
|
47 | 47 | volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
48 | 48 | volatile int wf_snap_f1_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
49 | 49 | volatile int wf_snap_f1_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
50 | 50 | // |
|
51 | 51 | volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
52 | 52 | volatile int wf_snap_f2_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
53 | 53 | volatile int wf_snap_f2_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
54 | 54 | // |
|
55 | 55 | volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
56 | 56 | volatile int wf_cont_f3_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ]; |
|
57 | 57 | char wf_cont_f3_light[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_CWF3_LIGHT_BLK ]; |
|
58 | 58 | |
|
59 | 59 | // SPECTRAL MATRICES GLOBAL VARIABLES |
|
60 | 60 | volatile int spec_mat_f0_0[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
61 | 61 | volatile int spec_mat_f0_1[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
62 | 62 | volatile int spec_mat_f0_a[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
63 | 63 | volatile int spec_mat_f0_b[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
64 | 64 | volatile int spec_mat_f0_c[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
65 | 65 | volatile int spec_mat_f0_d[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
66 | 66 | volatile int spec_mat_f0_e[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
67 | 67 | volatile int spec_mat_f0_f[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
68 | 68 | volatile int spec_mat_f0_g[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
69 | 69 | volatile int spec_mat_f0_h[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
70 | 70 | volatile int spec_mat_f0_0_bis[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
71 | 71 | volatile int spec_mat_f0_1_bis[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
72 | 72 | // |
|
73 | 73 | volatile int spec_mat_f1[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
74 | 74 | volatile int spec_mat_f1_bis[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
75 | 75 | // |
|
76 | 76 | volatile int spec_mat_f2[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
77 | 77 | volatile int spec_mat_f2_bis[ SM_HEADER + TOTAL_SIZE_SM ]; |
|
78 | 78 | |
|
79 | 79 | // MODE PARAMETERS |
|
80 | 80 | Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
81 | 81 | struct param_local_str param_local; |
|
82 | 82 | |
|
83 | 83 | // HK PACKETS |
|
84 | 84 | Packet_TM_LFR_HK_t housekeeping_packet; |
|
85 | 85 | // sequence counters are incremented by APID (PID + CAT) and destination ID |
|
86 | unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID]; | |
|
86 | unsigned short sequenceCounters_SCIENCE_NORMAL_BURST; | |
|
87 | unsigned short sequenceCounters_SCIENCE_SBM1_SBM2; | |
|
88 | unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID]; | |
|
87 | 89 | spw_stats spacewire_stats; |
|
88 | 90 | spw_stats spacewire_stats_backup; |
|
89 | 91 | |
|
90 | 92 |
@@ -1,592 +1,586 | |||
|
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 | reset_wfp_burst_enable(); // stop the waveform picker if it was running |
|
88 | 88 | |
|
89 | 89 | init_parameter_dump(); |
|
90 | 90 | init_local_mode_parameters(); |
|
91 | 91 | init_housekeeping_parameters(); |
|
92 | 92 | |
|
93 | 93 | updateLFRCurrentMode(); |
|
94 | 94 | |
|
95 | 95 | BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode) |
|
96 | 96 | |
|
97 | 97 | create_names(); // create all names |
|
98 | 98 | |
|
99 | 99 | status = create_message_queues(); // create message queues |
|
100 | 100 | if (status != RTEMS_SUCCESSFUL) |
|
101 | 101 | { |
|
102 | 102 | PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) |
|
103 | 103 | } |
|
104 | 104 | |
|
105 | 105 | status = create_all_tasks(); // create all tasks |
|
106 | 106 | if (status != RTEMS_SUCCESSFUL) |
|
107 | 107 | { |
|
108 | 108 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status) |
|
109 | 109 | } |
|
110 | 110 | |
|
111 | 111 | // ************************** |
|
112 | 112 | // <SPACEWIRE INITIALIZATION> |
|
113 | 113 | grspw_timecode_callback = &timecode_irq_handler; |
|
114 | 114 | |
|
115 | 115 | status_spw = spacewire_open_link(); // (1) open the link |
|
116 | 116 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
117 | 117 | { |
|
118 | 118 | PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) |
|
119 | 119 | } |
|
120 | 120 | |
|
121 | 121 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link |
|
122 | 122 | { |
|
123 | 123 | status_spw = spacewire_configure_link( fdSPW ); |
|
124 | 124 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
125 | 125 | { |
|
126 | 126 | PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) |
|
127 | 127 | } |
|
128 | 128 | } |
|
129 | 129 | |
|
130 | 130 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link |
|
131 | 131 | { |
|
132 | 132 | status_spw = spacewire_start_link( fdSPW ); |
|
133 | 133 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
134 | 134 | { |
|
135 | 135 | PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) |
|
136 | 136 | } |
|
137 | 137 | } |
|
138 | 138 | // </SPACEWIRE INITIALIZATION> |
|
139 | 139 | // *************************** |
|
140 | 140 | |
|
141 | 141 | status = start_all_tasks(); // start all tasks |
|
142 | 142 | if (status != RTEMS_SUCCESSFUL) |
|
143 | 143 | { |
|
144 | 144 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) |
|
145 | 145 | } |
|
146 | 146 | |
|
147 | 147 | // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization |
|
148 | 148 | status = start_recv_send_tasks(); |
|
149 | 149 | if ( status != RTEMS_SUCCESSFUL ) |
|
150 | 150 | { |
|
151 | 151 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) |
|
152 | 152 | } |
|
153 | 153 | |
|
154 | 154 | // suspend science tasks. they will be restarted later depending on the mode |
|
155 | 155 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) |
|
156 | 156 | if (status != RTEMS_SUCCESSFUL) |
|
157 | 157 | { |
|
158 | 158 | PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
159 | 159 | } |
|
160 | 160 | |
|
161 | 161 | #ifdef GSA |
|
162 | 162 | // mask IRQ lines |
|
163 | 163 | LEON_Mask_interrupt( IRQ_SM ); |
|
164 | 164 | LEON_Mask_interrupt( IRQ_WF ); |
|
165 | 165 | // Spectral Matrices simulator |
|
166 | 166 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, |
|
167 | 167 | IRQ_SPARC_SM, spectral_matrices_isr ); |
|
168 | 168 | // WaveForms |
|
169 | 169 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR, |
|
170 | 170 | IRQ_SPARC_WF, waveforms_simulator_isr ); |
|
171 | 171 | #else |
|
172 | 172 | // configure IRQ handling for the waveform picker unit |
|
173 | 173 | status = rtems_interrupt_catch( waveforms_isr, |
|
174 | 174 | IRQ_SPARC_WAVEFORM_PICKER, |
|
175 | 175 | &old_isr_handler) ; |
|
176 | 176 | #endif |
|
177 | 177 | |
|
178 | 178 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery |
|
179 | 179 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
180 | 180 | { |
|
181 | 181 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); |
|
182 | 182 | if ( status != RTEMS_SUCCESSFUL ) { |
|
183 | 183 | PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) |
|
184 | 184 | } |
|
185 | 185 | } |
|
186 | 186 | |
|
187 | 187 | BOOT_PRINTF("delete INIT\n") |
|
188 | 188 | |
|
189 | 189 | status = rtems_task_delete(RTEMS_SELF); |
|
190 | 190 | |
|
191 | 191 | } |
|
192 | 192 | |
|
193 | 193 | void init_local_mode_parameters( void ) |
|
194 | 194 | { |
|
195 | 195 | /** This function initialize the param_local global variable with default values. |
|
196 | 196 | * |
|
197 | 197 | */ |
|
198 | 198 | |
|
199 | 199 | unsigned int i; |
|
200 | unsigned int j; | |
|
201 | unsigned int k; | |
|
202 | 200 | |
|
203 | 201 | // LOCAL PARAMETERS |
|
204 | 202 | set_local_sbm1_nb_cwf_max(); |
|
205 | 203 | set_local_sbm2_nb_cwf_max(); |
|
206 | 204 | set_local_nb_interrupt_f0_MAX(); |
|
207 | 205 | |
|
208 | 206 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
209 | 207 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
210 | 208 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
211 | 209 | |
|
212 | 210 | reset_local_sbm1_nb_cwf_sent(); |
|
213 | 211 | reset_local_sbm2_nb_cwf_sent(); |
|
214 | 212 | |
|
215 | 213 | // init sequence counters |
|
216 | for (i = 0; i<SEQ_CNT_NB_PID; i++) | |
|
214 | ||
|
215 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) | |
|
217 | 216 | { |
|
218 | for(j = 0; j<SEQ_CNT_NB_CAT; j++) | |
|
219 | { | |
|
220 | for(k = 0; k<SEQ_CNT_NB_DEST_ID; k++) | |
|
221 | { | |
|
222 | sequenceCounters[i][j][k] = 0x00; | |
|
223 | } | |
|
224 | } | |
|
217 | sequenceCounters_TC_EXE[i] = 0x00; | |
|
225 | 218 | } |
|
219 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; | |
|
220 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; | |
|
226 | 221 | } |
|
227 | 222 | |
|
228 | 223 | void create_names( void ) // create all names for tasks and queues |
|
229 | 224 | { |
|
230 | 225 | /** This function creates all RTEMS names used in the software for tasks and queues. |
|
231 | 226 | * |
|
232 | 227 | * @return RTEMS directive status codes: |
|
233 | 228 | * - RTEMS_SUCCESSFUL - successful completion |
|
234 | 229 | * |
|
235 | 230 | */ |
|
236 | 231 | |
|
237 | 232 | // task names |
|
238 | 233 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); |
|
239 | 234 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); |
|
240 | 235 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
|
241 | 236 | Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' ); |
|
242 | 237 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); |
|
243 | 238 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); |
|
244 | 239 | Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' ); |
|
245 | 240 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
246 | 241 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); |
|
247 | 242 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
248 | 243 | Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' ); |
|
249 | 244 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); |
|
250 | 245 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); |
|
251 | 246 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); |
|
252 | 247 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); |
|
253 | 248 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); |
|
254 | 249 | |
|
255 | 250 | // rate monotonic period names |
|
256 | 251 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
257 | 252 | |
|
258 | 253 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
259 | 254 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
260 | 255 | } |
|
261 | 256 | |
|
262 | 257 | int create_all_tasks( void ) // create all tasks which run in the software |
|
263 | 258 | { |
|
264 | 259 | /** This function creates all RTEMS tasks used in the software. |
|
265 | 260 | * |
|
266 | 261 | * @return RTEMS directive status codes: |
|
267 | 262 | * - RTEMS_SUCCESSFUL - task created successfully |
|
268 | 263 | * - RTEMS_INVALID_ADDRESS - id is NULL |
|
269 | 264 | * - RTEMS_INVALID_NAME - invalid task name |
|
270 | 265 | * - RTEMS_INVALID_PRIORITY - invalid task priority |
|
271 | 266 | * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured |
|
272 | 267 | * - RTEMS_TOO_MANY - too many tasks created |
|
273 | 268 | * - RTEMS_UNSATISFIED - not enough memory for stack/FP context |
|
274 | 269 | * - RTEMS_TOO_MANY - too many global objects |
|
275 | 270 | * |
|
276 | 271 | */ |
|
277 | 272 | |
|
278 | 273 | rtems_status_code status; |
|
279 | 274 | |
|
280 | 275 | // RECV |
|
281 | 276 | status = rtems_task_create( |
|
282 | 277 | Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE, |
|
283 | 278 | RTEMS_DEFAULT_MODES, |
|
284 | 279 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] |
|
285 | 280 | ); |
|
286 | 281 | |
|
287 | 282 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
288 | 283 | { |
|
289 | 284 | status = rtems_task_create( |
|
290 | 285 | Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, |
|
291 | 286 | RTEMS_DEFAULT_MODES, |
|
292 | 287 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN] |
|
293 | 288 | ); |
|
294 | 289 | } |
|
295 | 290 | if (status == RTEMS_SUCCESSFUL) // SPIQ |
|
296 | 291 | { |
|
297 | 292 | status = rtems_task_create( |
|
298 | 293 | Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
299 | 294 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
300 | 295 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] |
|
301 | 296 | ); |
|
302 | 297 | } |
|
303 | 298 | if (status == RTEMS_SUCCESSFUL) // SMIQ |
|
304 | 299 | { |
|
305 | 300 | status = rtems_task_create( |
|
306 | 301 | Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE, |
|
307 | 302 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
308 | 303 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ] |
|
309 | 304 | ); |
|
310 | 305 | } |
|
311 | 306 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
312 | 307 | { |
|
313 | 308 | status = rtems_task_create( |
|
314 | 309 | Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE, |
|
315 | 310 | RTEMS_DEFAULT_MODES, |
|
316 | 311 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] |
|
317 | 312 | ); |
|
318 | 313 | } |
|
319 | 314 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
320 | 315 | { |
|
321 | 316 | status = rtems_task_create( |
|
322 | 317 | Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE, |
|
323 | 318 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
324 | 319 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] |
|
325 | 320 | ); |
|
326 | 321 | } |
|
327 | 322 | if (status == RTEMS_SUCCESSFUL) // BPF0 |
|
328 | 323 | { |
|
329 | 324 | status = rtems_task_create( |
|
330 | 325 | Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE, |
|
331 | 326 | RTEMS_DEFAULT_MODES, |
|
332 | 327 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0] |
|
333 | 328 | ); |
|
334 | 329 | } |
|
335 | 330 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
336 | 331 | { |
|
337 | 332 | status = rtems_task_create( |
|
338 | 333 | Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE, |
|
339 | 334 | RTEMS_DEFAULT_MODES, |
|
340 | 335 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] |
|
341 | 336 | ); |
|
342 | 337 | } |
|
343 | 338 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
344 | 339 | { |
|
345 | 340 | status = rtems_task_create( |
|
346 | 341 | Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE, |
|
347 | 342 | RTEMS_DEFAULT_MODES, |
|
348 | 343 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] |
|
349 | 344 | ); |
|
350 | 345 | } |
|
351 | 346 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
352 | 347 | { |
|
353 | 348 | status = rtems_task_create( |
|
354 | 349 | Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE, |
|
355 | RTEMS_DEFAULT_MODES, | |
|
350 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
|
356 | 351 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] |
|
357 | 352 | ); |
|
358 | 353 | } |
|
359 | 354 | if (status == RTEMS_SUCCESSFUL) // MATR |
|
360 | 355 | { |
|
361 | 356 | status = rtems_task_create( |
|
362 | 357 | Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE, |
|
363 | 358 | RTEMS_DEFAULT_MODES, |
|
364 | 359 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR] |
|
365 | 360 | ); |
|
366 | 361 | } |
|
367 | 362 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
368 | 363 | { |
|
369 | 364 | status = rtems_task_create( |
|
370 | 365 | Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE, |
|
371 | 366 | RTEMS_DEFAULT_MODES, |
|
372 | 367 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3] |
|
373 | 368 | ); |
|
374 | 369 | } |
|
375 | 370 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
376 | 371 | { |
|
377 | 372 | status = rtems_task_create( |
|
378 | 373 | Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE, |
|
379 | 374 | RTEMS_DEFAULT_MODES, |
|
380 | 375 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2] |
|
381 | 376 | ); |
|
382 | 377 | } |
|
383 | 378 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
384 | 379 | { |
|
385 | 380 | status = rtems_task_create( |
|
386 | 381 | Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE, |
|
387 | 382 | RTEMS_DEFAULT_MODES, |
|
388 | 383 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1] |
|
389 | 384 | ); |
|
390 | 385 | } |
|
391 | 386 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
392 | 387 | { |
|
393 | 388 | status = rtems_task_create( |
|
394 | 389 | Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE, |
|
395 | 390 | RTEMS_DEFAULT_MODES, |
|
396 | 391 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] |
|
397 | 392 | ); |
|
398 | 393 | } |
|
399 | 394 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
400 | 395 | { |
|
401 | 396 | status = rtems_task_create( |
|
402 | 397 | Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE, |
|
403 | 398 | RTEMS_DEFAULT_MODES, |
|
404 | 399 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG] |
|
405 | 400 | ); |
|
406 | 401 | } |
|
407 | 402 | |
|
408 | 403 | return status; |
|
409 | 404 | } |
|
410 | 405 | |
|
411 | 406 | int start_recv_send_tasks( void ) |
|
412 | 407 | { |
|
413 | 408 | rtems_status_code status; |
|
414 | 409 | |
|
415 | 410 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); |
|
416 | 411 | if (status!=RTEMS_SUCCESSFUL) { |
|
417 | 412 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") |
|
418 | 413 | } |
|
419 | 414 | |
|
420 | 415 | if (status == RTEMS_SUCCESSFUL) // SEND |
|
421 | 416 | { |
|
422 | 417 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); |
|
423 | 418 | if (status!=RTEMS_SUCCESSFUL) { |
|
424 | 419 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") |
|
425 | 420 | } |
|
426 | 421 | } |
|
427 | 422 | |
|
428 | 423 | return status; |
|
429 | 424 | } |
|
430 | 425 | |
|
431 | 426 | int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS |
|
432 | 427 | { |
|
433 | 428 | /** This function starts all RTEMS tasks used in the software. |
|
434 | 429 | * |
|
435 | 430 | * @return RTEMS directive status codes: |
|
436 | 431 | * - RTEMS_SUCCESSFUL - ask started successfully |
|
437 | 432 | * - RTEMS_INVALID_ADDRESS - invalid task entry point |
|
438 | 433 | * - RTEMS_INVALID_ID - invalid task id |
|
439 | 434 | * - RTEMS_INCORRECT_STATE - task not in the dormant state |
|
440 | 435 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task |
|
441 | 436 | * |
|
442 | 437 | */ |
|
443 | 438 | // starts all the tasks fot eh flight software |
|
444 | 439 | |
|
445 | 440 | rtems_status_code status; |
|
446 | 441 | |
|
447 | 442 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); |
|
448 | 443 | if (status!=RTEMS_SUCCESSFUL) { |
|
449 | 444 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") |
|
450 | 445 | } |
|
451 | 446 | |
|
452 | 447 | if (status == RTEMS_SUCCESSFUL) // WTDG |
|
453 | 448 | { |
|
454 | 449 | status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 ); |
|
455 | 450 | if (status!=RTEMS_SUCCESSFUL) { |
|
456 | 451 | BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n") |
|
457 | 452 | } |
|
458 | 453 | } |
|
459 | 454 | |
|
460 | 455 | if (status == RTEMS_SUCCESSFUL) // SMIQ |
|
461 | 456 | { |
|
462 | 457 | status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 ); |
|
463 | 458 | if (status!=RTEMS_SUCCESSFUL) { |
|
464 | 459 | BOOT_PRINTF("in INIT *** Error starting TASK_BPPR\n") |
|
465 | 460 | } |
|
466 | 461 | } |
|
467 | 462 | |
|
468 | 463 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
469 | 464 | { |
|
470 | 465 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); |
|
471 | 466 | if (status!=RTEMS_SUCCESSFUL) { |
|
472 | 467 | BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n") |
|
473 | 468 | } |
|
474 | 469 | } |
|
475 | 470 | |
|
476 | 471 | if (status == RTEMS_SUCCESSFUL) // STAT |
|
477 | 472 | { |
|
478 | 473 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); |
|
479 | 474 | if (status!=RTEMS_SUCCESSFUL) { |
|
480 | 475 | BOOT_PRINTF("in INIT *** Error starting TASK_STAT\n") |
|
481 | 476 | } |
|
482 | 477 | } |
|
483 | 478 | |
|
484 | 479 | if (status == RTEMS_SUCCESSFUL) // AVF0 |
|
485 | 480 | { |
|
486 | 481 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 ); |
|
487 | 482 | if (status!=RTEMS_SUCCESSFUL) { |
|
488 | 483 | BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n") |
|
489 | 484 | } |
|
490 | 485 | } |
|
491 | 486 | |
|
492 | 487 | if (status == RTEMS_SUCCESSFUL) // BPF0 |
|
493 | 488 | { |
|
494 | 489 | status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 ); |
|
495 | 490 | if (status!=RTEMS_SUCCESSFUL) { |
|
496 | 491 | BOOT_PRINTF("in INIT *** Error starting TASK_BPF0\n") |
|
497 | 492 | } |
|
498 | 493 | } |
|
499 | 494 | |
|
500 | 495 | if (status == RTEMS_SUCCESSFUL) // WFRM |
|
501 | 496 | { |
|
502 | 497 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); |
|
503 | 498 | if (status!=RTEMS_SUCCESSFUL) { |
|
504 | 499 | BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n") |
|
505 | 500 | } |
|
506 | 501 | } |
|
507 | 502 | |
|
508 | 503 | if (status == RTEMS_SUCCESSFUL) // DUMB |
|
509 | 504 | { |
|
510 | 505 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); |
|
511 | 506 | if (status!=RTEMS_SUCCESSFUL) { |
|
512 | 507 | BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n") |
|
513 | 508 | } |
|
514 | 509 | } |
|
515 | 510 | |
|
516 | 511 | if (status == RTEMS_SUCCESSFUL) // HOUS |
|
517 | 512 | { |
|
518 | 513 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); |
|
519 | 514 | if (status!=RTEMS_SUCCESSFUL) { |
|
520 | 515 | BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n") |
|
521 | 516 | } |
|
522 | 517 | } |
|
523 | 518 | |
|
524 | 519 | if (status == RTEMS_SUCCESSFUL) // MATR |
|
525 | 520 | { |
|
526 | 521 | status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 ); |
|
527 | 522 | if (status!=RTEMS_SUCCESSFUL) { |
|
528 | 523 | BOOT_PRINTF("in INIT *** Error starting TASK_MATR\n") |
|
529 | 524 | } |
|
530 | 525 | } |
|
531 | 526 | |
|
532 | 527 | if (status == RTEMS_SUCCESSFUL) // CWF3 |
|
533 | 528 | { |
|
534 | 529 | status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 ); |
|
535 | 530 | if (status!=RTEMS_SUCCESSFUL) { |
|
536 | 531 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n") |
|
537 | 532 | } |
|
538 | 533 | } |
|
539 | 534 | |
|
540 | 535 | if (status == RTEMS_SUCCESSFUL) // CWF2 |
|
541 | 536 | { |
|
542 | 537 | status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 ); |
|
543 | 538 | if (status!=RTEMS_SUCCESSFUL) { |
|
544 | 539 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n") |
|
545 | 540 | } |
|
546 | 541 | } |
|
547 | 542 | |
|
548 | 543 | if (status == RTEMS_SUCCESSFUL) // CWF1 |
|
549 | 544 | { |
|
550 | 545 | status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 ); |
|
551 | 546 | if (status!=RTEMS_SUCCESSFUL) { |
|
552 | 547 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") |
|
553 | 548 | } |
|
554 | 549 | } |
|
555 | 550 | return status; |
|
556 | 551 | } |
|
557 | 552 | |
|
558 | 553 | rtems_status_code create_message_queues( void ) // create the two message queues used in the software |
|
559 | 554 | { |
|
560 | 555 | rtems_status_code status_recv; |
|
561 | 556 | rtems_status_code status_send; |
|
562 | 557 | rtems_status_code ret; |
|
563 | 558 | rtems_id queue_id; |
|
564 | 559 | |
|
565 | 560 | // create the queue for handling valid TCs |
|
566 | 561 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], |
|
567 | 562 | ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE, |
|
568 | 563 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
569 | 564 | if ( status_recv != RTEMS_SUCCESSFUL ) { |
|
570 | 565 | PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) |
|
571 | 566 | } |
|
572 | 567 | |
|
573 | 568 | // create the queue for handling TM packet sending |
|
574 | 569 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], |
|
575 | 570 | ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE, |
|
576 | 571 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
577 | 572 | if ( status_send != RTEMS_SUCCESSFUL ) { |
|
578 | 573 | PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) |
|
579 | 574 | } |
|
580 | 575 | |
|
581 | 576 | if ( status_recv != RTEMS_SUCCESSFUL ) |
|
582 | 577 | { |
|
583 | 578 | ret = status_recv; |
|
584 | 579 | } |
|
585 | 580 | else |
|
586 | 581 | { |
|
587 | 582 | ret = status_send; |
|
588 | 583 | } |
|
589 | 584 | |
|
590 | 585 | return ret; |
|
591 | 586 | } |
|
592 |
@@ -1,295 +1,325 | |||
|
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[7] = {"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 | "ERR HK" // RTEMS_EVENT_6 |
|
17 | 17 | }; |
|
18 | 18 | |
|
19 | 19 | int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, |
|
20 | 20 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) |
|
21 | 21 | { |
|
22 | 22 | /** This function configures a GPTIMER timer instantiated in the VHDL design. |
|
23 | 23 | * |
|
24 | 24 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
25 | 25 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
26 | 26 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. |
|
27 | 27 | * @param interrupt_level is the interrupt level that the timer drives. |
|
28 | 28 | * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer. |
|
29 | 29 | * |
|
30 | 30 | * @return |
|
31 | 31 | * |
|
32 | 32 | * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76 |
|
33 | 33 | * |
|
34 | 34 | */ |
|
35 | 35 | |
|
36 | 36 | rtems_status_code status; |
|
37 | 37 | rtems_isr_entry old_isr_handler; |
|
38 | 38 | |
|
39 | 39 | status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels |
|
40 | 40 | if (status!=RTEMS_SUCCESSFUL) |
|
41 | 41 | { |
|
42 | 42 | PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n") |
|
43 | 43 | } |
|
44 | 44 | |
|
45 | 45 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); |
|
46 | 46 | |
|
47 | 47 | return 1; |
|
48 | 48 | } |
|
49 | 49 | |
|
50 | 50 | int timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
51 | 51 | { |
|
52 | 52 | /** This function starts a GPTIMER timer. |
|
53 | 53 | * |
|
54 | 54 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
55 | 55 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
56 | 56 | * |
|
57 | 57 | * @return 1 |
|
58 | 58 | * |
|
59 | 59 | */ |
|
60 | 60 | |
|
61 | 61 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
62 | 62 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register |
|
63 | 63 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer |
|
64 | 64 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart |
|
65 | 65 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable |
|
66 | 66 | |
|
67 | 67 | return 1; |
|
68 | 68 | } |
|
69 | 69 | |
|
70 | 70 | int timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer) |
|
71 | 71 | { |
|
72 | 72 | /** This function stops a GPTIMER timer. |
|
73 | 73 | * |
|
74 | 74 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
75 | 75 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
76 | 76 | * |
|
77 | 77 | * @return 1 |
|
78 | 78 | * |
|
79 | 79 | */ |
|
80 | 80 | |
|
81 | 81 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer |
|
82 | 82 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable |
|
83 | 83 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
84 | 84 | |
|
85 | 85 | return 1; |
|
86 | 86 | } |
|
87 | 87 | |
|
88 | 88 | int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider) |
|
89 | 89 | { |
|
90 | 90 | /** This function sets the clock divider of a GPTIMER timer. |
|
91 | 91 | * |
|
92 | 92 | * @param gptimer_regs points to the APB registers of the GPTIMER IP core. |
|
93 | 93 | * @param timer is the number of the timer in the IP core (several timers can be instantiated). |
|
94 | 94 | * @param clock_divider is the divider of the 1 MHz clock that will be configured. |
|
95 | 95 | * |
|
96 | 96 | * @return 1 |
|
97 | 97 | * |
|
98 | 98 | */ |
|
99 | 99 | |
|
100 | 100 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz |
|
101 | 101 | |
|
102 | 102 | return 1; |
|
103 | 103 | } |
|
104 | 104 | |
|
105 | 105 | int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port |
|
106 | 106 | { |
|
107 | 107 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART; |
|
108 | 108 | |
|
109 | 109 | apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB; |
|
110 | 110 | PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n") |
|
111 | 111 | |
|
112 | 112 | return 0; |
|
113 | 113 | } |
|
114 | 114 | |
|
115 | 115 | void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value) |
|
116 | 116 | { |
|
117 | 117 | /** This function sets the scaler reload register of the apbuart module |
|
118 | 118 | * |
|
119 | 119 | * @param regs is the address of the apbuart registers in memory |
|
120 | 120 | * @param value is the value that will be stored in the scaler register |
|
121 | 121 | * |
|
122 | 122 | * The value shall be set by the software to get data on the serial interface. |
|
123 | 123 | * |
|
124 | 124 | */ |
|
125 | 125 | |
|
126 | 126 | struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs; |
|
127 | 127 | |
|
128 | 128 | apbuart_regs->scaler = value; |
|
129 | 129 | BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value) |
|
130 | 130 | } |
|
131 | 131 | |
|
132 | 132 | //************ |
|
133 | 133 | // RTEMS TASKS |
|
134 | 134 | |
|
135 | 135 | rtems_task stat_task(rtems_task_argument argument) |
|
136 | 136 | { |
|
137 | 137 | int i; |
|
138 | 138 | int j; |
|
139 | 139 | i = 0; |
|
140 | 140 | j = 0; |
|
141 | 141 | BOOT_PRINTF("in STAT *** \n") |
|
142 | 142 | while(1){ |
|
143 | 143 | rtems_task_wake_after(1000); |
|
144 | 144 | PRINTF1("%d\n", j) |
|
145 | 145 | if (i == CPU_USAGE_REPORT_PERIOD) { |
|
146 | 146 | // #ifdef PRINT_TASK_STATISTICS |
|
147 | 147 | // rtems_cpu_usage_report(); |
|
148 | 148 | // rtems_cpu_usage_reset(); |
|
149 | 149 | // #endif |
|
150 | 150 | i = 0; |
|
151 | 151 | } |
|
152 | 152 | else i++; |
|
153 | 153 | j++; |
|
154 | 154 | } |
|
155 | 155 | } |
|
156 | 156 | |
|
157 | 157 | rtems_task hous_task(rtems_task_argument argument) |
|
158 | 158 | { |
|
159 | 159 | rtems_status_code status; |
|
160 | 160 | rtems_id queue_id; |
|
161 | 161 | |
|
162 | 162 | status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id ); |
|
163 | 163 | if (status != RTEMS_SUCCESSFUL) |
|
164 | 164 | { |
|
165 | 165 | PRINTF1("in HOUS *** ERR %d\n", status) |
|
166 | 166 | } |
|
167 | 167 | |
|
168 | 168 | BOOT_PRINTF("in HOUS ***\n") |
|
169 | 169 | |
|
170 | 170 | if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) { |
|
171 | 171 | status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id ); |
|
172 | 172 | if( status != RTEMS_SUCCESSFUL ) { |
|
173 | 173 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) |
|
174 | 174 | } |
|
175 | 175 | } |
|
176 | 176 | |
|
177 | 177 | housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
178 | 178 | housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
179 | 179 | housekeeping_packet.reserved = DEFAULT_RESERVED; |
|
180 | 180 | housekeeping_packet.userApplication = CCSDS_USER_APP; |
|
181 | 181 | housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8); |
|
182 | 182 | housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK); |
|
183 | 183 | housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
184 | 184 | housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
185 | 185 | housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8); |
|
186 | 186 | housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK ); |
|
187 | 187 | housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
188 | 188 | housekeeping_packet.serviceType = TM_TYPE_HK; |
|
189 | 189 | housekeeping_packet.serviceSubType = TM_SUBTYPE_HK; |
|
190 | 190 | housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
191 | 191 | |
|
192 | 192 | status = rtems_rate_monotonic_cancel(HK_id); |
|
193 | 193 | if( status != RTEMS_SUCCESSFUL ) { |
|
194 | 194 | PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status ) |
|
195 | 195 | } |
|
196 | 196 | else { |
|
197 | 197 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") |
|
198 | 198 | } |
|
199 | 199 | |
|
200 | 200 | while(1){ // launch the rate monotonic task |
|
201 | 201 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); |
|
202 | 202 | if ( status != RTEMS_SUCCESSFUL ) { |
|
203 | 203 | PRINTF1( "in HOUS *** ERR period: %d\n", status); |
|
204 | 204 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 ); |
|
205 | 205 | } |
|
206 | 206 | else { |
|
207 | increment_seq_counter( housekeeping_packet.packetSequenceControl ); | |
|
207 | 208 | housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
208 | 209 | housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
209 | 210 | housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
210 | 211 | housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
211 | 212 | housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
212 | 213 | housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
213 | 214 | housekeeping_packet.sid = SID_HK; |
|
214 | 215 | |
|
215 | 216 | spacewire_update_statistics(); |
|
216 | 217 | |
|
217 | 218 | // SEND PACKET |
|
218 |
status = rtems_message_queue_ |
|
|
219 | status = rtems_message_queue_send( queue_id, &housekeeping_packet, | |
|
219 | 220 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
220 | 221 | if (status != RTEMS_SUCCESSFUL) { |
|
221 | 222 | PRINTF1("in HOUS *** ERR send: %d\n", status) |
|
222 | 223 | } |
|
223 | 224 | } |
|
224 | 225 | } |
|
225 | 226 | |
|
226 | 227 | PRINTF("in HOUS *** deleting task\n") |
|
227 | 228 | |
|
228 | 229 | status = rtems_task_delete( RTEMS_SELF ); // should not return |
|
229 | 230 | printf( "rtems_task_delete returned with status of %d.\n", status ); |
|
230 | 231 | return; |
|
231 | 232 | } |
|
232 | 233 | |
|
233 | 234 | rtems_task dumb_task( rtems_task_argument unused ) |
|
234 | 235 | { |
|
235 | 236 | /** This RTEMS taks is used to print messages without affecting the general behaviour of the software. |
|
236 | 237 | * |
|
237 | 238 | * @param unused is the starting argument of the RTEMS task |
|
238 | 239 | * |
|
239 | 240 | * The DUMB taks waits for RTEMS events and print messages depending on the incoming events. |
|
240 | 241 | * |
|
241 | 242 | */ |
|
242 | 243 | |
|
243 | 244 | unsigned int i; |
|
244 | 245 | unsigned int intEventOut; |
|
245 | 246 | unsigned int coarse_time = 0; |
|
246 | 247 | unsigned int fine_time = 0; |
|
247 | 248 | rtems_event_set event_out; |
|
248 | 249 | |
|
249 | 250 | BOOT_PRINTF("in DUMB *** \n") |
|
250 | 251 | |
|
251 | 252 | while(1){ |
|
252 | 253 | rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 |
|
253 | 254 | | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6, |
|
254 | 255 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT |
|
255 | 256 | intEventOut = (unsigned int) event_out; |
|
256 | 257 | for ( i=0; i<32; i++) |
|
257 | 258 | { |
|
258 | 259 | if ( ((intEventOut >> i) & 0x0001) != 0) |
|
259 | 260 | { |
|
260 | 261 | coarse_time = time_management_regs->coarse_time; |
|
261 | 262 | fine_time = time_management_regs->fine_time; |
|
262 | 263 | printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]); |
|
263 | 264 | } |
|
264 | 265 | } |
|
265 | 266 | } |
|
266 | 267 | } |
|
267 | 268 | |
|
268 | 269 | //***************************** |
|
269 | 270 | // init housekeeping parameters |
|
270 | 271 | |
|
271 | 272 | void init_housekeeping_parameters( void ) |
|
272 | 273 | { |
|
273 | 274 | /** This function initialize the housekeeping_packet global variable with default values. |
|
274 | 275 | * |
|
275 | 276 | */ |
|
276 | 277 | |
|
277 | 278 | unsigned int i = 0; |
|
278 | 279 | char *parameters; |
|
279 | 280 | |
|
280 | 281 | parameters = (char*) &housekeeping_packet.lfr_status_word; |
|
281 | 282 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) |
|
282 | 283 | { |
|
283 | 284 | parameters[i] = 0x00; |
|
284 | 285 | } |
|
285 | 286 | // init status word |
|
286 | 287 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; |
|
287 | 288 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; |
|
288 | 289 | // init software version |
|
289 | 290 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; |
|
290 | 291 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; |
|
291 | 292 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
292 | 293 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
293 | 294 | |
|
294 | 295 | } |
|
295 | 296 | |
|
297 | void increment_seq_counter( unsigned char *packet_sequence_control) | |
|
298 | { | |
|
299 | unsigned short sequence_cnt; | |
|
300 | unsigned short segmentation_grouping_flag; | |
|
301 | unsigned short new_packet_sequence_control; | |
|
302 | ||
|
303 | segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6 | |
|
304 | sequence_cnt = (unsigned short) ( | |
|
305 | ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0 | |
|
306 | + packet_sequence_control[1] | |
|
307 | ); | |
|
308 | ||
|
309 | if ( sequence_cnt < SEQ_CNT_MAX) | |
|
310 | { | |
|
311 | sequence_cnt = sequence_cnt + 1; | |
|
312 | } | |
|
313 | else | |
|
314 | { | |
|
315 | sequence_cnt = 0; | |
|
316 | } | |
|
317 | ||
|
318 | new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ; | |
|
319 | ||
|
320 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); | |
|
321 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); | |
|
322 | } | |
|
323 | ||
|
324 | ||
|
325 |
@@ -1,678 +1,677 | |||
|
1 | 1 | /** Functions related to data processing. |
|
2 | 2 | * |
|
3 | 3 | * @file |
|
4 | 4 | * @author P. LEROY |
|
5 | 5 | * |
|
6 | 6 | * These function are related to data processing, i.e. spectral matrices averaging and basic parameters computation. |
|
7 | 7 | * |
|
8 | 8 | */ |
|
9 | 9 | |
|
10 | 10 | #include <fsw_processing.h> |
|
11 | #include <math.h> | |
|
12 | 11 | |
|
13 | 12 | #include "fsw_processing_globals.c" |
|
14 | 13 | |
|
15 | 14 | unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_SM_F0 * 9 ]; |
|
16 | 15 | BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ]; |
|
17 | 16 | float averaged_spec_mat_f0[ TOTAL_SIZE_SM ]; |
|
18 | 17 | char averaged_spec_mat_f0_char[ TOTAL_SIZE_SM * 2 ]; |
|
19 | 18 | float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ]; |
|
20 | 19 | |
|
21 | 20 | //*********************************************************** |
|
22 | 21 | // Interrupt Service Routine for spectral matrices processing |
|
23 | 22 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
24 | 23 | { |
|
25 | 24 | unsigned char status; |
|
26 | 25 | unsigned char i; |
|
27 | 26 | |
|
28 | 27 | status = spectral_matrix_regs->status; //[f2 f1 f0_1 f0_0] |
|
29 | 28 | for (i=0; i<4; i++) |
|
30 | 29 | { |
|
31 | 30 | if ( ( (status >> i) & 0x01) == 1) // (1) buffer rotation |
|
32 | 31 | { |
|
33 | 32 | switch(i) |
|
34 | 33 | { |
|
35 | 34 | case 0: |
|
36 | 35 | if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0) |
|
37 | 36 | { |
|
38 | 37 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0_bis; |
|
39 | 38 | } |
|
40 | 39 | else |
|
41 | 40 | { |
|
42 | 41 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0; |
|
43 | 42 | } |
|
44 | 43 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; |
|
45 | 44 | break; |
|
46 | 45 | case 1: |
|
47 | 46 | if (spectral_matrix_regs->matrixFO_Address1 == (int) spec_mat_f0_1) |
|
48 | 47 | { |
|
49 | 48 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1_bis; |
|
50 | 49 | } |
|
51 | 50 | else |
|
52 | 51 | { |
|
53 | 52 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1; |
|
54 | 53 | } |
|
55 | 54 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; |
|
56 | 55 | break; |
|
57 | 56 | case 2: |
|
58 | 57 | if (spectral_matrix_regs->matrixF1_Address == (int) spec_mat_f1) |
|
59 | 58 | { |
|
60 | 59 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1_bis; |
|
61 | 60 | } |
|
62 | 61 | else |
|
63 | 62 | { |
|
64 | 63 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1; |
|
65 | 64 | } |
|
66 | 65 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffb; |
|
67 | 66 | break; |
|
68 | 67 | case 3: |
|
69 | 68 | if (spectral_matrix_regs->matrixF2_Address == (int) spec_mat_f2) |
|
70 | 69 | { |
|
71 | 70 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2_bis; |
|
72 | 71 | } |
|
73 | 72 | else |
|
74 | 73 | { |
|
75 | 74 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2; |
|
76 | 75 | } |
|
77 | 76 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff7; |
|
78 | 77 | break; |
|
79 | 78 | default: |
|
80 | 79 | break; |
|
81 | 80 | } |
|
82 | 81 | } |
|
83 | 82 | } |
|
84 | 83 | |
|
85 | 84 | // reset error codes to 0 |
|
86 | 85 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xffffffcf; // [1100 1111] |
|
87 | 86 | |
|
88 | 87 | if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
89 | 88 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 ); |
|
90 | 89 | } |
|
91 | 90 | } |
|
92 | 91 | |
|
93 | 92 | rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector ) |
|
94 | 93 | { |
|
95 | 94 | if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) { |
|
96 | 95 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 ); |
|
97 | 96 | } |
|
98 | 97 | } |
|
99 | 98 | |
|
100 | 99 | //************ |
|
101 | 100 | // RTEMS TASKS |
|
102 | 101 | |
|
103 | 102 | rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ |
|
104 | 103 | { |
|
105 | 104 | rtems_event_set event_out; |
|
106 | 105 | unsigned int nb_interrupt_f0 = 0; |
|
107 | 106 | |
|
108 | 107 | BOOT_PRINTF("in SMIQ *** \n") |
|
109 | 108 | |
|
110 | 109 | while(1){ |
|
111 | 110 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
112 | 111 | nb_interrupt_f0 = nb_interrupt_f0 + 1; |
|
113 | 112 | if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){ |
|
114 | 113 | if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
115 | 114 | { |
|
116 | 115 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
117 | 116 | } |
|
118 | 117 | nb_interrupt_f0 = 0; |
|
119 | 118 | } |
|
120 | 119 | } |
|
121 | 120 | } |
|
122 | 121 | |
|
123 | 122 | //rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ |
|
124 | 123 | //{ |
|
125 | 124 | // rtems_event_set event_out; |
|
126 | 125 | // unsigned int nb_interrupt_f0 = 0; |
|
127 | 126 | |
|
128 | 127 | // PRINTF("in SMIQ *** \n") |
|
129 | 128 | |
|
130 | 129 | // while(1){ |
|
131 | 130 | // rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
132 | 131 | // nb_interrupt_f0 = nb_interrupt_f0 + 1; |
|
133 | 132 | // if (nb_interrupt_f0 == param_local.local_nb_interrupt_f0_MAX ){ |
|
134 | 133 | // if (rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
135 | 134 | // { |
|
136 | 135 | // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
137 | 136 | // } |
|
138 | 137 | // nb_interrupt_f0 = 0; |
|
139 | 138 | // } |
|
140 | 139 | // } |
|
141 | 140 | //} |
|
142 | 141 | |
|
143 | 142 | rtems_task spw_bppr_task(rtems_task_argument argument) |
|
144 | 143 | { |
|
145 | 144 | rtems_status_code status; |
|
146 | 145 | rtems_event_set event_out; |
|
147 | 146 | |
|
148 | 147 | BOOT_PRINTF("in BPPR ***\n"); |
|
149 | 148 | |
|
150 | 149 | while( true ){ // wait for an event to begin with the processing |
|
151 | 150 | status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); |
|
152 | 151 | } |
|
153 | 152 | } |
|
154 | 153 | |
|
155 | 154 | rtems_task avf0_task(rtems_task_argument argument) |
|
156 | 155 | { |
|
157 | 156 | int i; |
|
158 | 157 | static int nb_average; |
|
159 | 158 | rtems_event_set event_out; |
|
160 | 159 | rtems_status_code status; |
|
161 | 160 | |
|
162 | 161 | nb_average = 0; |
|
163 | 162 | |
|
164 | 163 | BOOT_PRINTF("in AVFO *** \n") |
|
165 | 164 | |
|
166 | 165 | while(1){ |
|
167 | 166 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
168 | 167 | for(i=0; i<TOTAL_SIZE_SM; i++){ |
|
169 | 168 | averaged_spec_mat_f0[i] = averaged_spec_mat_f0[i] + spec_mat_f0_a[i] |
|
170 | 169 | + spec_mat_f0_b[i] |
|
171 | 170 | + spec_mat_f0_c[i] |
|
172 | 171 | + spec_mat_f0_d[i] |
|
173 | 172 | + spec_mat_f0_e[i] |
|
174 | 173 | + spec_mat_f0_f[i] |
|
175 | 174 | + spec_mat_f0_g[i] |
|
176 | 175 | + spec_mat_f0_h[i]; |
|
177 | 176 | } |
|
178 | 177 | nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0; |
|
179 | 178 | if (nb_average == NB_AVERAGE_NORMAL_f0) { |
|
180 | 179 | nb_average = 0; |
|
181 | 180 | status = rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ); // sending an event to the task 7, BPF0 |
|
182 | 181 | if (status != RTEMS_SUCCESSFUL) { |
|
183 | 182 | printf("in AVF0 *** Error sending RTEMS_EVENT_0, code %d\n", status); |
|
184 | 183 | } |
|
185 | 184 | } |
|
186 | 185 | } |
|
187 | 186 | } |
|
188 | 187 | |
|
189 | 188 | rtems_task bpf0_task(rtems_task_argument argument) |
|
190 | 189 | { |
|
191 | 190 | rtems_event_set event_out; |
|
192 | 191 | |
|
193 | 192 | BOOT_PRINTF("in BPFO *** \n") |
|
194 | 193 | |
|
195 | 194 | while(1){ |
|
196 | 195 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
197 | 196 | matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0); |
|
198 | 197 | BP1_set(compressed_spec_mat_f0, NB_BINS_COMPRESSED_SM_F0, LFR_BP1_F0); |
|
199 | 198 | //PRINTF("IN TASK BPF0 *** Matrix compressed, parameters calculated\n") |
|
200 | 199 | } |
|
201 | 200 | } |
|
202 | 201 | |
|
203 | 202 | rtems_task matr_task(rtems_task_argument argument) |
|
204 | 203 | { |
|
205 | 204 | spw_ioctl_pkt_send spw_ioctl_send_ASM; |
|
206 | 205 | rtems_event_set event_out; |
|
207 | 206 | rtems_status_code status; |
|
208 | 207 | rtems_id queue_id; |
|
209 | 208 | Header_TM_LFR_SCIENCE_ASM_t headerASM; |
|
210 | 209 | |
|
211 | 210 | init_header_asm( &headerASM ); |
|
212 | 211 | |
|
213 | 212 | status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id ); |
|
214 | 213 | if (status != RTEMS_SUCCESSFUL) |
|
215 | 214 | { |
|
216 | 215 | PRINTF1("in MATR *** ERR getting queue id, %d\n", status) |
|
217 | 216 | } |
|
218 | 217 | |
|
219 | 218 | BOOT_PRINTF("in MATR *** \n") |
|
220 | 219 | |
|
221 | 220 | fill_averaged_spectral_matrix( ); |
|
222 | 221 | |
|
223 | 222 | while(1){ |
|
224 | 223 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
225 | 224 | |
|
226 | 225 | #ifdef GSA |
|
227 | 226 | #else |
|
228 | 227 | fill_averaged_spectral_matrix( ); |
|
229 | 228 | #endif |
|
230 | 229 | convert_averaged_spectral_matrix( averaged_spec_mat_f0, averaged_spec_mat_f0_char); |
|
231 | 230 | |
|
232 | 231 | send_spectral_matrix( &headerASM, averaged_spec_mat_f0_char, SID_NORM_ASM_F0, &spw_ioctl_send_ASM, queue_id); |
|
233 | 232 | } |
|
234 | 233 | } |
|
235 | 234 | |
|
236 | 235 | //***************************** |
|
237 | 236 | // Spectral matrices processing |
|
238 | 237 | |
|
239 | 238 | void matrix_reset(volatile float *averaged_spec_mat) |
|
240 | 239 | { |
|
241 | 240 | // int i; |
|
242 | 241 | // for(i=0; i<TOTAL_SIZE_SM; i++){ |
|
243 | 242 | // averaged_spec_mat_f0[i] = 0; |
|
244 | 243 | // } |
|
245 | 244 | } |
|
246 | 245 | |
|
247 | 246 | void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat) |
|
248 | 247 | { |
|
249 | 248 | int i; |
|
250 | 249 | int j; |
|
251 | 250 | switch (fChannel){ |
|
252 | 251 | case 0: |
|
253 | 252 | for(i=0;i<NB_BINS_COMPRESSED_SM_F0;i++){ |
|
254 | 253 | j = 17 + (i * 8); |
|
255 | 254 | compressed_spec_mat[i] = (averaged_spec_mat[j] |
|
256 | 255 | + averaged_spec_mat[j+1] |
|
257 | 256 | + averaged_spec_mat[j+2] |
|
258 | 257 | + averaged_spec_mat[j+3] |
|
259 | 258 | + averaged_spec_mat[j+4] |
|
260 | 259 | + averaged_spec_mat[j+5] |
|
261 | 260 | + averaged_spec_mat[j+6] |
|
262 | 261 | + averaged_spec_mat[j+7])/(8*NB_AVERAGE_NORMAL_f0); |
|
263 | 262 | } |
|
264 | 263 | break; |
|
265 | 264 | case 1: |
|
266 | 265 | // case fChannel = f1 to be completed later |
|
267 | 266 | break; |
|
268 | 267 | case 2: |
|
269 | 268 | // case fChannel = f1 to be completed later |
|
270 | 269 | break; |
|
271 | 270 | default: |
|
272 | 271 | break; |
|
273 | 272 | } |
|
274 | 273 | } |
|
275 | 274 | |
|
276 | 275 | void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1){ |
|
277 | 276 | int i; |
|
278 | 277 | int j; |
|
279 | 278 | unsigned char tmp_u_char; |
|
280 | 279 | unsigned char * pt_char = NULL; |
|
281 | 280 | float PSDB, PSDE; |
|
282 | 281 | float NVEC_V0; |
|
283 | 282 | float NVEC_V1; |
|
284 | 283 | float NVEC_V2; |
|
285 | 284 | //float significand; |
|
286 | 285 | //int exponent; |
|
287 | 286 | float aux; |
|
288 | 287 | float tr_SB_SB; |
|
289 | 288 | float tmp; |
|
290 | 289 | float sx_re; |
|
291 | 290 | float sx_im; |
|
292 | 291 | float nebx_re = 0; |
|
293 | 292 | float nebx_im = 0; |
|
294 | 293 | float ny = 0; |
|
295 | 294 | float nz = 0; |
|
296 | 295 | float bx_bx_star = 0; |
|
297 | 296 | for(i=0; i<nb_bins_compressed_spec_mat; i++){ |
|
298 | 297 | //============================================== |
|
299 | 298 | // BP1 PSD == B PAR_LFR_SC_BP1_PE_FL0 == 16 bits |
|
300 | 299 | PSDB = compressed_spec_mat[i*30] // S11 |
|
301 | 300 | + compressed_spec_mat[(i*30) + 10] // S22 |
|
302 | 301 | + compressed_spec_mat[(i*30) + 18]; // S33 |
|
303 | 302 | //significand = frexp(PSDB, &exponent); |
|
304 | 303 | pt_char = (unsigned char*) &PSDB; |
|
305 | 304 | LFR_BP1[(i*9) + 2] = pt_char[0]; // bits 31 downto 24 of the float |
|
306 | 305 | LFR_BP1[(i*9) + 3] = pt_char[1]; // bits 23 downto 16 of the float |
|
307 | 306 | //============================================== |
|
308 | 307 | // BP1 PSD == E PAR_LFR_SC_BP1_PB_FL0 == 16 bits |
|
309 | 308 | PSDE = compressed_spec_mat[(i*30) + 24] * K44_pe // S44 |
|
310 | 309 | + compressed_spec_mat[(i*30) + 28] * K55_pe // S55 |
|
311 | 310 | + compressed_spec_mat[(i*30) + 26] * K45_pe_re // S45 |
|
312 | 311 | - compressed_spec_mat[(i*30) + 27] * K45_pe_im; // S45 |
|
313 | 312 | pt_char = (unsigned char*) &PSDE; |
|
314 | 313 | LFR_BP1[(i*9) + 0] = pt_char[0]; // bits 31 downto 24 of the float |
|
315 | 314 | LFR_BP1[(i*9) + 1] = pt_char[1]; // bits 23 downto 16 of the float |
|
316 | 315 | //============================================================================== |
|
317 | 316 | // BP1 normal wave vector == PAR_LFR_SC_BP1_NVEC_V0_F0 == 8 bits |
|
318 | 317 | // == PAR_LFR_SC_BP1_NVEC_V1_F0 == 8 bits |
|
319 | 318 | // == PAR_LFR_SC_BP1_NVEC_V2_F0 == 1 bits |
|
320 | 319 | tmp = sqrt( |
|
321 | 320 | compressed_spec_mat[(i*30) + 3]*compressed_spec_mat[(i*30) + 3] //Im S12 |
|
322 | 321 | +compressed_spec_mat[(i*30) + 5]*compressed_spec_mat[(i*30) + 5] //Im S13 |
|
323 | 322 | +compressed_spec_mat[(i*30) + 13]*compressed_spec_mat[(i*30) + 13] //Im S23 |
|
324 | 323 | ); |
|
325 | 324 | NVEC_V0 = compressed_spec_mat[(i*30) + 13] / tmp; // Im S23 |
|
326 | 325 | NVEC_V1 = -compressed_spec_mat[(i*30) + 5] / tmp; // Im S13 |
|
327 | 326 | NVEC_V2 = compressed_spec_mat[(i*30) + 3] / tmp; // Im S12 |
|
328 | 327 | LFR_BP1[(i*9) + 4] = (char) (NVEC_V0*127); |
|
329 | 328 | LFR_BP1[(i*9) + 5] = (char) (NVEC_V1*127); |
|
330 | 329 | pt_char = (unsigned char*) &NVEC_V2; |
|
331 | 330 | LFR_BP1[(i*9) + 6] = pt_char[0] & 0x80; // extract the sign of NVEC_V2 |
|
332 | 331 | //======================================================= |
|
333 | 332 | // BP1 ellipticity == PAR_LFR_SC_BP1_ELLIP_F0 == 4 bits |
|
334 | 333 | aux = 2*tmp / PSDB; // compute the ellipticity |
|
335 | 334 | tmp_u_char = (unsigned char) (aux*(16-1)); // convert the ellipticity |
|
336 | 335 | LFR_BP1[i*9+6] = LFR_BP1[i*9+6] | ((tmp_u_char&0x0f)<<3); // keeps 4 bits of the resulting unsigned char |
|
337 | 336 | //============================================================== |
|
338 | 337 | // BP1 degree of polarization == PAR_LFR_SC_BP1_DOP_F0 == 3 bits |
|
339 | 338 | for(j = 0; j<NB_VALUES_PER_SM;j++){ |
|
340 | 339 | tr_SB_SB = compressed_spec_mat[i*30] * compressed_spec_mat[i*30] |
|
341 | 340 | + compressed_spec_mat[(i*30) + 10] * compressed_spec_mat[(i*30) + 10] |
|
342 | 341 | + compressed_spec_mat[(i*30) + 18] * compressed_spec_mat[(i*30) + 18] |
|
343 | 342 | + 2 * compressed_spec_mat[(i*30) + 2] * compressed_spec_mat[(i*30) + 2] |
|
344 | 343 | + 2 * compressed_spec_mat[(i*30) + 3] * compressed_spec_mat[(i*30) + 3] |
|
345 | 344 | + 2 * compressed_spec_mat[(i*30) + 4] * compressed_spec_mat[(i*30) + 4] |
|
346 | 345 | + 2 * compressed_spec_mat[(i*30) + 5] * compressed_spec_mat[(i*30) + 5] |
|
347 | 346 | + 2 * compressed_spec_mat[(i*30) + 12] * compressed_spec_mat[(i*30) + 12] |
|
348 | 347 | + 2 * compressed_spec_mat[(i*30) + 13] * compressed_spec_mat[(i*30) + 13]; |
|
349 | 348 | } |
|
350 | 349 | aux = PSDB*PSDB; |
|
351 | 350 | tmp = sqrt( abs( ( 3*tr_SB_SB - aux ) / ( 2 * aux ) ) ); |
|
352 | 351 | tmp_u_char = (unsigned char) (NVEC_V0*(8-1)); |
|
353 | 352 | LFR_BP1[(i*9) + 6] = LFR_BP1[(i*9) + 6] | (tmp_u_char & 0x07); // keeps 3 bits of the resulting unsigned char |
|
354 | 353 | //======================================================================================= |
|
355 | 354 | // BP1 x-component of the normalized Poynting flux == PAR_LFR_SC_BP1_SZ_F0 == 8 bits (7+1) |
|
356 | 355 | sx_re = compressed_spec_mat[(i*30) + 20] * K34_sx_re |
|
357 | 356 | + compressed_spec_mat[(i*30) + 6] * K14_sx_re |
|
358 | 357 | + compressed_spec_mat[(i*30) + 8] * K15_sx_re |
|
359 | 358 | + compressed_spec_mat[(i*30) + 14] * K24_sx_re |
|
360 | 359 | + compressed_spec_mat[(i*30) + 16] * K25_sx_re |
|
361 | 360 | + compressed_spec_mat[(i*30) + 22] * K35_sx_re; |
|
362 | 361 | sx_im = compressed_spec_mat[(i*30) + 21] * K34_sx_im |
|
363 | 362 | + compressed_spec_mat[(i*30) + 7] * K14_sx_im |
|
364 | 363 | + compressed_spec_mat[(i*30) + 9] * K15_sx_im |
|
365 | 364 | + compressed_spec_mat[(i*30) + 15] * K24_sx_im |
|
366 | 365 | + compressed_spec_mat[(i*30) + 17] * K25_sx_im |
|
367 | 366 | + compressed_spec_mat[(i*30) + 23] * K35_sx_im; |
|
368 | 367 | LFR_BP1[(i*9) + 7] = ((unsigned char) (sx_re * 128)) & 0x7f; // cf DOC for the compression |
|
369 | 368 | if ( abs(sx_re) > abs(sx_im) ) { |
|
370 | 369 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] | (0x80); // extract the sector of sx |
|
371 | 370 | } |
|
372 | 371 | else { |
|
373 | 372 | LFR_BP1[(i*9) + 7] = LFR_BP1[(i*9) + 1] & (0x7f); // extract the sector of sx |
|
374 | 373 | } |
|
375 | 374 | //====================================================================== |
|
376 | 375 | // BP1 phase velocity estimator == PAR_LFR_SC_BP1_VPHI_F0 == 8 bits (7+1) |
|
377 | 376 | ny = sin(Alpha_M)*NVEC_V1 + cos(Alpha_M)*NVEC_V2; |
|
378 | 377 | nz = NVEC_V0; |
|
379 | 378 | bx_bx_star = cos(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+10] // re S22 |
|
380 | 379 | + sin(Alpha_M) * sin(Alpha_M) * compressed_spec_mat[i*30+18] // re S33 |
|
381 | 380 | - 2 * sin(Alpha_M) * cos(Alpha_M) * compressed_spec_mat[i*30+12]; // re S23 |
|
382 | 381 | nebx_re = ny * (compressed_spec_mat[(i*30) + 14] * K24_ny_re |
|
383 | 382 | +compressed_spec_mat[(i*30) + 16] * K25_ny_re |
|
384 | 383 | +compressed_spec_mat[(i*30) + 20] * K34_ny_re |
|
385 | 384 | +compressed_spec_mat[(i*30) + 22] * K35_ny_re) |
|
386 | 385 | + nz * (compressed_spec_mat[(i*30) + 14] * K24_nz_re |
|
387 | 386 | +compressed_spec_mat[(i*30) + 16] * K25_nz_re |
|
388 | 387 | +compressed_spec_mat[(i*30) + 20] * K34_nz_re |
|
389 | 388 | +compressed_spec_mat[(i*30) + 22] * K35_nz_re); |
|
390 | 389 | nebx_im = ny * (compressed_spec_mat[(i*30) + 15]*K24_ny_re |
|
391 | 390 | +compressed_spec_mat[(i*30) + 17] * K25_ny_re |
|
392 | 391 | +compressed_spec_mat[(i*30) + 21] * K34_ny_re |
|
393 | 392 | +compressed_spec_mat[(i*30) + 23] * K35_ny_re) |
|
394 | 393 | + nz * (compressed_spec_mat[(i*30) + 15] * K24_nz_im |
|
395 | 394 | +compressed_spec_mat[(i*30) + 17] * K25_nz_im |
|
396 | 395 | +compressed_spec_mat[(i*30) + 21] * K34_nz_im |
|
397 | 396 | +compressed_spec_mat[(i*30) + 23] * K35_nz_im); |
|
398 | 397 | tmp = nebx_re / bx_bx_star; |
|
399 | 398 | LFR_BP1[(i*9) + 8] = ((unsigned char) (tmp * 128)) & 0x7f; // cf DOC for the compression |
|
400 | 399 | if ( abs(nebx_re) > abs(nebx_im) ) { |
|
401 | 400 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] | (0x80); // extract the sector of nebx |
|
402 | 401 | } |
|
403 | 402 | else { |
|
404 | 403 | LFR_BP1[(i*9) + 8] = LFR_BP1[(i*9) + 8] & (0x7f); // extract the sector of nebx |
|
405 | 404 | } |
|
406 | 405 | } |
|
407 | 406 | |
|
408 | 407 | } |
|
409 | 408 | |
|
410 | 409 | void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat){ |
|
411 | 410 | // BP2 autocorrelation |
|
412 | 411 | int i; |
|
413 | 412 | int aux = 0; |
|
414 | 413 | |
|
415 | 414 | for(i = 0; i<nb_bins_compressed_spec_mat; i++){ |
|
416 | 415 | // S12 |
|
417 | 416 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 10]); |
|
418 | 417 | compressed_spec_mat[(i*30) + 2] = compressed_spec_mat[(i*30) + 2] / aux; |
|
419 | 418 | compressed_spec_mat[(i*30) + 3] = compressed_spec_mat[(i*30) + 3] / aux; |
|
420 | 419 | // S13 |
|
421 | 420 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 18]); |
|
422 | 421 | compressed_spec_mat[(i*30) + 4] = compressed_spec_mat[(i*30) + 4] / aux; |
|
423 | 422 | compressed_spec_mat[(i*30) + 5] = compressed_spec_mat[(i*30) + 5] / aux; |
|
424 | 423 | // S23 |
|
425 | 424 | aux = sqrt(compressed_spec_mat[i*30+12]*compressed_spec_mat[(i*30) + 18]); |
|
426 | 425 | compressed_spec_mat[(i*30) + 12] = compressed_spec_mat[(i*30) + 12] / aux; |
|
427 | 426 | compressed_spec_mat[(i*30) + 13] = compressed_spec_mat[(i*30) + 13] / aux; |
|
428 | 427 | // S45 |
|
429 | 428 | aux = sqrt(compressed_spec_mat[i*30+24]*compressed_spec_mat[(i*30) + 28]); |
|
430 | 429 | compressed_spec_mat[(i*30) + 26] = compressed_spec_mat[(i*30) + 26] / aux; |
|
431 | 430 | compressed_spec_mat[(i*30) + 27] = compressed_spec_mat[(i*30) + 27] / aux; |
|
432 | 431 | // S14 |
|
433 | 432 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) +24]); |
|
434 | 433 | compressed_spec_mat[(i*30) + 6] = compressed_spec_mat[(i*30) + 6] / aux; |
|
435 | 434 | compressed_spec_mat[(i*30) + 7] = compressed_spec_mat[(i*30) + 7] / aux; |
|
436 | 435 | // S15 |
|
437 | 436 | aux = sqrt(compressed_spec_mat[i*30]*compressed_spec_mat[(i*30) + 28]); |
|
438 | 437 | compressed_spec_mat[(i*30) + 8] = compressed_spec_mat[(i*30) + 8] / aux; |
|
439 | 438 | compressed_spec_mat[(i*30) + 9] = compressed_spec_mat[(i*30) + 9] / aux; |
|
440 | 439 | // S24 |
|
441 | 440 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 24]); |
|
442 | 441 | compressed_spec_mat[(i*30) + 14] = compressed_spec_mat[(i*30) + 14] / aux; |
|
443 | 442 | compressed_spec_mat[(i*30) + 15] = compressed_spec_mat[(i*30) + 15] / aux; |
|
444 | 443 | // S25 |
|
445 | 444 | aux = sqrt(compressed_spec_mat[i*10]*compressed_spec_mat[(i*30) + 28]); |
|
446 | 445 | compressed_spec_mat[(i*30) + 16] = compressed_spec_mat[(i*30) + 16] / aux; |
|
447 | 446 | compressed_spec_mat[(i*30) + 17] = compressed_spec_mat[(i*30) + 17] / aux; |
|
448 | 447 | // S34 |
|
449 | 448 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 24]); |
|
450 | 449 | compressed_spec_mat[(i*30) + 20] = compressed_spec_mat[(i*30) + 20] / aux; |
|
451 | 450 | compressed_spec_mat[(i*30) + 21] = compressed_spec_mat[(i*30) + 21] / aux; |
|
452 | 451 | // S35 |
|
453 | 452 | aux = sqrt(compressed_spec_mat[i*18]*compressed_spec_mat[(i*30) + 28]); |
|
454 | 453 | compressed_spec_mat[(i*30) + 22] = compressed_spec_mat[(i*30) + 22] / aux; |
|
455 | 454 | compressed_spec_mat[(i*30) + 23] = compressed_spec_mat[(i*30) + 23] / aux; |
|
456 | 455 | } |
|
457 | 456 | } |
|
458 | 457 | |
|
459 | 458 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header) |
|
460 | 459 | { |
|
461 | 460 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
462 | 461 | header->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
463 | 462 | header->reserved = 0x00; |
|
464 | 463 | header->userApplication = CCSDS_USER_APP; |
|
465 | 464 | header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); |
|
466 | 465 | header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); |
|
467 | 466 | header->packetSequenceControl[0] = 0xc0; |
|
468 | 467 | header->packetSequenceControl[1] = 0x00; |
|
469 | 468 | header->packetLength[0] = 0x00; |
|
470 | 469 | header->packetLength[1] = 0x00; |
|
471 | 470 | // DATA FIELD HEADER |
|
472 | 471 | header->spare1_pusVersion_spare2 = 0x10; |
|
473 | 472 | header->serviceType = TM_TYPE_LFR_SCIENCE; // service type |
|
474 | 473 | header->serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype |
|
475 | 474 | header->destinationID = TM_DESTINATION_ID_GROUND; |
|
476 | 475 | // AUXILIARY DATA HEADER |
|
477 | 476 | header->sid = 0x00; |
|
478 | 477 | header->biaStatusInfo = 0x00; |
|
479 | 478 | header->cntASM = 0x00; |
|
480 | 479 | header->nrASM = 0x00; |
|
481 | 480 | header->time[0] = 0x00; |
|
482 | 481 | header->time[0] = 0x00; |
|
483 | 482 | header->time[0] = 0x00; |
|
484 | 483 | header->time[0] = 0x00; |
|
485 | 484 | header->time[0] = 0x00; |
|
486 | 485 | header->time[0] = 0x00; |
|
487 | 486 | header->blkNr[0] = 0x00; // BLK_NR MSB |
|
488 | 487 | header->blkNr[1] = 0x00; // BLK_NR LSB |
|
489 | 488 | } |
|
490 | 489 | |
|
491 | 490 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, |
|
492 | 491 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send, rtems_id queue_id) |
|
493 | 492 | { |
|
494 | 493 | unsigned int i; |
|
495 | 494 | unsigned int length = 0; |
|
496 | 495 | rtems_status_code status; |
|
497 | 496 | |
|
498 | 497 | header->sid = (unsigned char) sid; |
|
499 | 498 | |
|
500 | 499 | for (i=0; i<2; i++) |
|
501 | 500 | { |
|
502 | 501 | // BUILD THE DATA |
|
503 | 502 | spw_ioctl_send->dlen = TOTAL_SIZE_SM; |
|
504 | 503 | spw_ioctl_send->data = &spectral_matrix[ i * TOTAL_SIZE_SM]; |
|
505 | 504 | spw_ioctl_send->hlen = HEADER_LENGTH_TM_LFR_SCIENCE_ASM + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
506 | 505 | spw_ioctl_send->hdr = (char *) header; |
|
507 | 506 | spw_ioctl_send->options = 0; |
|
508 | 507 | |
|
509 | 508 | // BUILD THE HEADER |
|
510 | 509 | length = PACKET_LENGTH_TM_LFR_SCIENCE_ASM; |
|
511 | 510 | header->packetLength[0] = (unsigned char) (length>>8); |
|
512 | 511 | header->packetLength[1] = (unsigned char) (length); |
|
513 | 512 | header->sid = (unsigned char) sid; // SID |
|
514 | 513 | header->cntASM = 2; |
|
515 | 514 | header->nrASM = (unsigned char) (i+1); |
|
516 | 515 | header->blkNr[0] =(unsigned char) ( (NB_BINS_PER_SM/2) >> 8 ); // BLK_NR MSB |
|
517 | 516 | header->blkNr[1] = (unsigned char) (NB_BINS_PER_SM/2); // BLK_NR LSB |
|
518 | 517 | // SET PACKET TIME |
|
519 | 518 | header->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
520 | 519 | header->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
521 | 520 | header->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
522 | 521 | header->time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
523 | 522 | header->time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
524 | 523 | header->time[5] = (unsigned char) (time_management_regs->fine_time); |
|
525 | 524 | header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
526 | 525 | header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
527 | 526 | header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
528 | 527 | header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); |
|
529 | 528 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
530 | 529 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); |
|
531 | 530 | // SEND PACKET |
|
532 | 531 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
533 | 532 | if (status != RTEMS_SUCCESSFUL) { |
|
534 | 533 | printf("in send_spectral_matrix *** ERR %d\n", (int) status); |
|
535 | 534 | } |
|
536 | 535 | } |
|
537 | 536 | } |
|
538 | 537 | |
|
539 | 538 | void convert_averaged_spectral_matrix( volatile float *input_matrix, char *output_matrix) |
|
540 | 539 | { |
|
541 | 540 | unsigned int i; |
|
542 | 541 | unsigned int j; |
|
543 | 542 | char * pt_char_input; |
|
544 | 543 | char * pt_char_output; |
|
545 | 544 | |
|
546 | 545 | pt_char_input = NULL; |
|
547 | 546 | pt_char_output = NULL; |
|
548 | 547 | |
|
549 | 548 | for( i=0; i<NB_BINS_PER_SM; i++) |
|
550 | 549 | { |
|
551 | 550 | for ( j=0; j<NB_VALUES_PER_SM; j++) |
|
552 | 551 | { |
|
553 | 552 | pt_char_input = (char*) &input_matrix[ (i*NB_VALUES_PER_SM) + j ]; |
|
554 | 553 | pt_char_output = (char*) &output_matrix[ 2 * ( (i*NB_VALUES_PER_SM) + j ) ]; |
|
555 | 554 | pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float |
|
556 | 555 | pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float |
|
557 | 556 | } |
|
558 | 557 | } |
|
559 | 558 | } |
|
560 | 559 | |
|
561 | 560 | void fill_averaged_spectral_matrix(void) |
|
562 | 561 | { |
|
563 | 562 | /** This function fills spectral matrices related buffers with arbitrary data. |
|
564 | 563 | * |
|
565 | 564 | * This function is for testing purpose only. |
|
566 | 565 | * |
|
567 | 566 | */ |
|
568 | 567 | |
|
569 | 568 | #ifdef GSA |
|
570 | 569 | float offset = 10.; |
|
571 | 570 | float coeff = 100000.; |
|
572 | 571 | |
|
573 | 572 | averaged_spec_mat_f0[ 0 + 25 * 0 ] = 0. + offset; |
|
574 | 573 | averaged_spec_mat_f0[ 0 + 25 * 1 ] = 1. + offset; |
|
575 | 574 | averaged_spec_mat_f0[ 0 + 25 * 2 ] = 2. + offset; |
|
576 | 575 | averaged_spec_mat_f0[ 0 + 25 * 3 ] = 3. + offset; |
|
577 | 576 | averaged_spec_mat_f0[ 0 + 25 * 4 ] = 4. + offset; |
|
578 | 577 | averaged_spec_mat_f0[ 0 + 25 * 5 ] = 5. + offset; |
|
579 | 578 | averaged_spec_mat_f0[ 0 + 25 * 6 ] = 6. + offset; |
|
580 | 579 | averaged_spec_mat_f0[ 0 + 25 * 7 ] = 7. + offset; |
|
581 | 580 | averaged_spec_mat_f0[ 0 + 25 * 8 ] = 8. + offset; |
|
582 | 581 | averaged_spec_mat_f0[ 0 + 25 * 9 ] = 9. + offset; |
|
583 | 582 | averaged_spec_mat_f0[ 0 + 25 * 10 ] = 10. + offset; |
|
584 | 583 | averaged_spec_mat_f0[ 0 + 25 * 11 ] = 11. + offset; |
|
585 | 584 | averaged_spec_mat_f0[ 0 + 25 * 12 ] = 12. + offset; |
|
586 | 585 | averaged_spec_mat_f0[ 0 + 25 * 13 ] = 13. + offset; |
|
587 | 586 | averaged_spec_mat_f0[ 0 + 25 * 14 ] = 14. + offset; |
|
588 | 587 | averaged_spec_mat_f0[ 9 + 25 * 0 ] = -(0. + offset)* coeff; |
|
589 | 588 | averaged_spec_mat_f0[ 9 + 25 * 1 ] = -(1. + offset)* coeff; |
|
590 | 589 | averaged_spec_mat_f0[ 9 + 25 * 2 ] = -(2. + offset)* coeff; |
|
591 | 590 | averaged_spec_mat_f0[ 9 + 25 * 3 ] = -(3. + offset)* coeff; |
|
592 | 591 | averaged_spec_mat_f0[ 9 + 25 * 4 ] = -(4. + offset)* coeff; |
|
593 | 592 | averaged_spec_mat_f0[ 9 + 25 * 5 ] = -(5. + offset)* coeff; |
|
594 | 593 | averaged_spec_mat_f0[ 9 + 25 * 6 ] = -(6. + offset)* coeff; |
|
595 | 594 | averaged_spec_mat_f0[ 9 + 25 * 7 ] = -(7. + offset)* coeff; |
|
596 | 595 | averaged_spec_mat_f0[ 9 + 25 * 8 ] = -(8. + offset)* coeff; |
|
597 | 596 | averaged_spec_mat_f0[ 9 + 25 * 9 ] = -(9. + offset)* coeff; |
|
598 | 597 | averaged_spec_mat_f0[ 9 + 25 * 10 ] = -(10. + offset)* coeff; |
|
599 | 598 | averaged_spec_mat_f0[ 9 + 25 * 11 ] = -(11. + offset)* coeff; |
|
600 | 599 | averaged_spec_mat_f0[ 9 + 25 * 12 ] = -(12. + offset)* coeff; |
|
601 | 600 | averaged_spec_mat_f0[ 9 + 25 * 13 ] = -(13. + offset)* coeff; |
|
602 | 601 | averaged_spec_mat_f0[ 9 + 25 * 14 ] = -(14. + offset)* coeff; |
|
603 | 602 | offset = 10000000; |
|
604 | 603 | averaged_spec_mat_f0[ 16 + 25 * 0 ] = (0. + offset)* coeff; |
|
605 | 604 | averaged_spec_mat_f0[ 16 + 25 * 1 ] = (1. + offset)* coeff; |
|
606 | 605 | averaged_spec_mat_f0[ 16 + 25 * 2 ] = (2. + offset)* coeff; |
|
607 | 606 | averaged_spec_mat_f0[ 16 + 25 * 3 ] = (3. + offset)* coeff; |
|
608 | 607 | averaged_spec_mat_f0[ 16 + 25 * 4 ] = (4. + offset)* coeff; |
|
609 | 608 | averaged_spec_mat_f0[ 16 + 25 * 5 ] = (5. + offset)* coeff; |
|
610 | 609 | averaged_spec_mat_f0[ 16 + 25 * 6 ] = (6. + offset)* coeff; |
|
611 | 610 | averaged_spec_mat_f0[ 16 + 25 * 7 ] = (7. + offset)* coeff; |
|
612 | 611 | averaged_spec_mat_f0[ 16 + 25 * 8 ] = (8. + offset)* coeff; |
|
613 | 612 | averaged_spec_mat_f0[ 16 + 25 * 9 ] = (9. + offset)* coeff; |
|
614 | 613 | averaged_spec_mat_f0[ 16 + 25 * 10 ] = (10. + offset)* coeff; |
|
615 | 614 | averaged_spec_mat_f0[ 16 + 25 * 11 ] = (11. + offset)* coeff; |
|
616 | 615 | averaged_spec_mat_f0[ 16 + 25 * 12 ] = (12. + offset)* coeff; |
|
617 | 616 | averaged_spec_mat_f0[ 16 + 25 * 13 ] = (13. + offset)* coeff; |
|
618 | 617 | averaged_spec_mat_f0[ 16 + 25 * 14 ] = (14. + offset)* coeff; |
|
619 | 618 | |
|
620 | 619 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 0 ] = averaged_spec_mat_f0[ 0 ]; |
|
621 | 620 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 1 ] = averaged_spec_mat_f0[ 1 ]; |
|
622 | 621 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 2 ] = averaged_spec_mat_f0[ 2 ]; |
|
623 | 622 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 3 ] = averaged_spec_mat_f0[ 3 ]; |
|
624 | 623 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 4 ] = averaged_spec_mat_f0[ 4 ]; |
|
625 | 624 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 5 ] = averaged_spec_mat_f0[ 5 ]; |
|
626 | 625 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 6 ] = averaged_spec_mat_f0[ 6 ]; |
|
627 | 626 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 7 ] = averaged_spec_mat_f0[ 7 ]; |
|
628 | 627 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 8 ] = averaged_spec_mat_f0[ 8 ]; |
|
629 | 628 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 9 ] = averaged_spec_mat_f0[ 9 ]; |
|
630 | 629 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 10 ] = averaged_spec_mat_f0[ 10 ]; |
|
631 | 630 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 11 ] = averaged_spec_mat_f0[ 11 ]; |
|
632 | 631 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 12 ] = averaged_spec_mat_f0[ 12 ]; |
|
633 | 632 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 13 ] = averaged_spec_mat_f0[ 13 ]; |
|
634 | 633 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 14 ] = averaged_spec_mat_f0[ 14 ]; |
|
635 | 634 | averaged_spec_mat_f0[ (TOTAL_SIZE_SM/2) + 15 ] = averaged_spec_mat_f0[ 15 ]; |
|
636 | 635 | #else |
|
637 | 636 | unsigned int i; |
|
638 | 637 | |
|
639 | 638 | for(i=0; i<TOTAL_SIZE_SM; i++) |
|
640 | 639 | { |
|
641 | 640 | if (spectral_matrix_regs->matrixF0_Address0 == (int) spec_mat_f0_0) |
|
642 | 641 | averaged_spec_mat_f0[i] = (float) spec_mat_f0_0_bis[ SM_HEADER + i ]; |
|
643 | 642 | else |
|
644 | 643 | averaged_spec_mat_f0[i] = (float) spec_mat_f0_0[ SM_HEADER + i ]; |
|
645 | 644 | } |
|
646 | 645 | #endif |
|
647 | 646 | } |
|
648 | 647 | |
|
649 | 648 | void reset_spectral_matrix_regs() |
|
650 | 649 | { |
|
651 | 650 | /** This function resets the spectral matrices module registers. |
|
652 | 651 | * |
|
653 | 652 | * The registers affected by this function are located at the following offset addresses: |
|
654 | 653 | * |
|
655 | 654 | * - 0x00 config |
|
656 | 655 | * - 0x04 status |
|
657 | 656 | * - 0x08 matrixF0_Address0 |
|
658 | 657 | * - 0x10 matrixFO_Address1 |
|
659 | 658 | * - 0x14 matrixF1_Address |
|
660 | 659 | * - 0x18 matrixF2_Address |
|
661 | 660 | * |
|
662 | 661 | */ |
|
663 | 662 | |
|
664 | 663 | #ifdef GSA |
|
665 | 664 | #else |
|
666 | 665 | spectral_matrix_regs->matrixF0_Address0 = (int) spec_mat_f0_0; |
|
667 | 666 | spectral_matrix_regs->matrixFO_Address1 = (int) spec_mat_f0_1; |
|
668 | 667 | spectral_matrix_regs->matrixF1_Address = (int) spec_mat_f1; |
|
669 | 668 | spectral_matrix_regs->matrixF2_Address = (int) spec_mat_f2; |
|
670 | 669 | #endif |
|
671 | 670 | } |
|
672 | 671 | |
|
673 | 672 | //****************** |
|
674 | 673 | // general functions |
|
675 | 674 | |
|
676 | 675 | |
|
677 | 676 | |
|
678 | 677 |
@@ -1,602 +1,623 | |||
|
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 | rtems_name semq_name; | |
|
25 | rtems_id semq_id; | |
|
26 | ||
|
24 | 27 | //*********** |
|
25 | 28 | // RTEMS TASK |
|
26 | 29 | rtems_task spiq_task(rtems_task_argument unused) |
|
27 | 30 | { |
|
28 | 31 | /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver. |
|
29 | 32 | * |
|
30 | 33 | * @param unused is the starting argument of the RTEMS task |
|
31 | 34 | * |
|
32 | 35 | */ |
|
33 | 36 | |
|
34 | 37 | rtems_event_set event_out; |
|
35 | 38 | rtems_status_code status; |
|
36 | 39 | int linkStatus; |
|
37 | 40 | |
|
38 | 41 | BOOT_PRINTF("in SPIQ *** \n") |
|
39 | 42 | |
|
40 | 43 | while(true){ |
|
41 | 44 | rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT |
|
42 | 45 | PRINTF("in SPIQ *** got SPW_LINKERR_EVENT\n") |
|
43 | 46 | |
|
44 | 47 | // [0] SUSPEND RECV AND SEND TASKS |
|
45 | 48 | rtems_task_suspend( Task_id[ TASKID_RECV ] ); |
|
46 | 49 | rtems_task_suspend( Task_id[ TASKID_SEND ] ); |
|
47 | 50 | |
|
48 | 51 | // [1] CHECK THE LINK |
|
49 | 52 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1) |
|
50 | 53 | if ( linkStatus != 5) { |
|
51 | 54 | PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus) |
|
52 | 55 | rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms |
|
53 | 56 | } |
|
54 | 57 | |
|
55 | 58 | // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT |
|
56 | 59 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2) |
|
57 | 60 | if ( linkStatus != 5 ) // [2.a] not in run state, reset the link |
|
58 | 61 | { |
|
59 | 62 | spacewire_compute_stats_offsets(); |
|
60 | 63 | status = spacewire_reset_link( ); |
|
61 | 64 | } |
|
62 | 65 | else // [2.b] in run state, start the link |
|
63 | 66 | { |
|
64 | 67 | status = spacewire_stop_start_link( fdSPW ); // start the link |
|
65 | 68 | if ( status != RTEMS_SUCCESSFUL) |
|
66 | 69 | { |
|
67 | 70 | PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status) |
|
68 | 71 | } |
|
69 | 72 | } |
|
70 | 73 | |
|
71 | 74 | // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS |
|
72 | 75 | if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully |
|
73 | 76 | { |
|
74 | 77 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); |
|
75 | 78 | if ( status != RTEMS_SUCCESSFUL ) { |
|
76 | 79 | PRINTF("in SPIQ *** ERR resuming SEND Task\n") |
|
77 | 80 | } |
|
78 | 81 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); |
|
79 | 82 | if ( status != RTEMS_SUCCESSFUL ) { |
|
80 | 83 | PRINTF("in SPIQ *** ERR resuming RECV Task\n") |
|
81 | 84 | } |
|
82 | 85 | } |
|
83 | 86 | else // [3.b] the link is not in run state, go in STANDBY mode |
|
84 | 87 | { |
|
85 | 88 | status = stop_current_mode(); |
|
86 | 89 | if ( status != RTEMS_SUCCESSFUL ) { |
|
87 | 90 | PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status) |
|
88 | 91 | } |
|
89 | 92 | status = enter_standby_mode(); |
|
90 | 93 | if ( status != RTEMS_SUCCESSFUL ) { |
|
91 | 94 | PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status) |
|
92 | 95 | } |
|
93 | 96 | // wake the WTDG task up to wait for the link recovery |
|
94 | 97 | status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 ); |
|
95 | 98 | rtems_task_suspend( RTEMS_SELF ); |
|
96 | 99 | } |
|
97 | 100 | } |
|
98 | 101 | } |
|
99 | 102 | |
|
100 | 103 | rtems_task recv_task( rtems_task_argument unused ) |
|
101 | 104 | { |
|
102 | 105 | /** This RTEMS task is dedicated to the reception of incoming TeleCommands. |
|
103 | 106 | * |
|
104 | 107 | * @param unused is the starting argument of the RTEMS task |
|
105 | 108 | * |
|
106 | 109 | * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked: |
|
107 | 110 | * 1. It reads the incoming data. |
|
108 | 111 | * 2. Launches the acceptance procedure. |
|
109 | 112 | * 3. If the Telecommand is valid, sends it to a dedicated RTEMS message queue. |
|
110 | 113 | * |
|
111 | 114 | */ |
|
112 | 115 | |
|
113 | 116 | int len; |
|
114 | 117 | ccsdsTelecommandPacket_t currentTC; |
|
115 | 118 | unsigned char computed_CRC[ 2 ]; |
|
116 | 119 | unsigned char currentTC_LEN_RCV[ 2 ]; |
|
117 | 120 | unsigned int currentTC_LEN_RCV_AsUnsignedInt; |
|
118 | 121 | unsigned int parserCode; |
|
119 | 122 | rtems_status_code status; |
|
120 | 123 | rtems_id queue_recv_id; |
|
121 | 124 | rtems_id queue_send_id; |
|
122 | 125 | |
|
123 | 126 | initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes |
|
124 | 127 | |
|
125 | 128 | status = rtems_message_queue_ident( misc_name[QUEUE_RECV], 0, &queue_recv_id ); |
|
126 | 129 | if (status != RTEMS_SUCCESSFUL) |
|
127 | 130 | { |
|
128 | 131 | PRINTF1("in RECV *** ERR getting QUEUE_RECV id, %d\n", status) |
|
129 | 132 | } |
|
130 | 133 | |
|
131 | 134 | status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_send_id ); |
|
132 | 135 | if (status != RTEMS_SUCCESSFUL) |
|
133 | 136 | { |
|
134 | 137 | PRINTF1("in RECV *** ERR getting QUEUE_SEND id, %d\n", status) |
|
135 | 138 | } |
|
136 | 139 | |
|
137 | 140 | BOOT_PRINTF("in RECV *** \n") |
|
138 | 141 | |
|
139 | 142 | while(1) |
|
140 | 143 | { |
|
141 | 144 | len = read( fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking |
|
142 | 145 | if (len == -1){ // error during the read call |
|
143 | 146 | PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno) |
|
144 | 147 | } |
|
145 | 148 | else { |
|
146 | 149 | if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) { |
|
147 | 150 | PRINTF("in RECV *** packet lenght too short\n") |
|
148 | 151 | } |
|
149 | 152 | else { |
|
150 | 153 | currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes |
|
151 | 154 | currentTC_LEN_RCV[ 0 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt >> 8); |
|
152 | 155 | currentTC_LEN_RCV[ 1 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt ); |
|
153 | 156 | // CHECK THE TC |
|
154 | 157 | parserCode = tc_parser( ¤tTC, currentTC_LEN_RCV_AsUnsignedInt, computed_CRC ) ; |
|
155 | 158 | if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT) |
|
156 | 159 | || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE) |
|
157 | 160 | || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA) |
|
158 | 161 | || (parserCode == WRONG_SRC_ID) ) |
|
159 | 162 | { // send TM_LFR_TC_EXE_CORRUPTED |
|
160 | 163 | if ( !( (currentTC.serviceType==TC_TYPE_TIME) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
161 | 164 | && |
|
162 | 165 | !( (currentTC.serviceType==TC_TYPE_GEN) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
163 | 166 | ) |
|
164 | 167 | { |
|
165 | 168 | send_tm_lfr_tc_exe_corrupted( ¤tTC, queue_send_id, computed_CRC, currentTC_LEN_RCV ); |
|
166 | 169 | } |
|
167 | 170 | } |
|
168 | 171 | else |
|
169 | 172 | { // send valid TC to the action launcher |
|
170 | 173 | status = rtems_message_queue_send( queue_recv_id, ¤tTC, |
|
171 | 174 | currentTC_LEN_RCV_AsUnsignedInt + CCSDS_TC_TM_PACKET_OFFSET + 3); |
|
172 | 175 | } |
|
173 | 176 | } |
|
174 | 177 | } |
|
175 | 178 | } |
|
176 | 179 | } |
|
177 | 180 | |
|
178 | 181 | rtems_task send_task( rtems_task_argument argument) |
|
179 | 182 | { |
|
180 | 183 | /** This RTEMS task is dedicated to the transmission of TeleMetry packets. |
|
181 | 184 | * |
|
182 | 185 | * @param unused is the starting argument of the RTEMS task |
|
183 | 186 | * |
|
184 | 187 | * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives: |
|
185 | 188 | * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call. |
|
186 | 189 | * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After |
|
187 | 190 | * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the |
|
188 | 191 | * data it contains. |
|
189 | 192 | * |
|
190 | 193 | */ |
|
191 | 194 | |
|
192 | 195 | rtems_status_code status; // RTEMS status code |
|
193 | 196 | char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer |
|
194 | 197 | spw_ioctl_pkt_send *spw_ioctl_send; |
|
195 | 198 | size_t size; // size of the incoming TC packet |
|
196 | 199 | u_int32_t count; |
|
197 | 200 | rtems_id queue_id; |
|
198 | 201 | |
|
199 | 202 | status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id ); |
|
200 | 203 | if (status != RTEMS_SUCCESSFUL) |
|
201 | 204 | { |
|
202 | 205 | PRINTF1("in SEND *** ERR getting queue id, %d\n", status) |
|
203 | 206 | } |
|
204 | 207 | |
|
205 | 208 | BOOT_PRINTF("in SEND *** \n") |
|
206 | 209 | |
|
207 | 210 | while(1) |
|
208 | 211 | { |
|
209 | 212 | status = rtems_message_queue_receive( queue_id, incomingData, &size, |
|
210 | 213 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); |
|
211 | 214 | |
|
212 | 215 | if (status!=RTEMS_SUCCESSFUL) |
|
213 | 216 | { |
|
214 | 217 | PRINTF1("in SEND *** (1) ERR = %d\n", status) |
|
215 | 218 | } |
|
216 | 219 | else |
|
217 | 220 | { |
|
218 | 221 | if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet |
|
219 | 222 | { |
|
220 | 223 | status = write( fdSPW, incomingData, size ); |
|
221 | 224 | if (status == -1){ |
|
222 | 225 | PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size) |
|
223 | 226 | } |
|
224 | 227 | } |
|
225 | 228 | else // the incoming message is a spw_ioctl_pkt_send structure |
|
226 | 229 | { |
|
227 | 230 | spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData; |
|
228 | 231 | if (spw_ioctl_send->hlen == 0) |
|
229 | 232 | { |
|
230 | 233 | status = write( fdSPW, spw_ioctl_send->data, spw_ioctl_send->dlen ); |
|
231 | 234 | if (status == -1){ |
|
232 | 235 | PRINTF2("in SEND *** (2.b) ERRNO = %d, dlen = %d\n", errno, spw_ioctl_send->dlen) |
|
233 | 236 | } |
|
234 | 237 | } |
|
235 | 238 | else |
|
236 | 239 | { |
|
237 | 240 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send ); |
|
238 | 241 | if (status == -1){ |
|
239 | 242 | PRINTF2("in SEND *** (2.c) ERRNO = %d, dlen = %d\n", errno, spw_ioctl_send->dlen) |
|
240 | 243 | PRINTF1(" hlen = %d\n", spw_ioctl_send->hlen) |
|
241 | 244 | } |
|
242 | 245 | } |
|
243 | 246 | } |
|
244 | 247 | } |
|
245 | 248 | |
|
246 | 249 | status = rtems_message_queue_get_number_pending( queue_id, &count ); |
|
247 | 250 | if (status != RTEMS_SUCCESSFUL) |
|
248 | 251 | { |
|
249 | 252 | PRINTF1("in SEND *** (3) ERR = %d\n", status) |
|
250 | 253 | } |
|
251 | 254 | else |
|
252 | 255 | { |
|
253 | 256 | if (count > maxCount) |
|
254 | 257 | { |
|
255 | 258 | maxCount = count; |
|
256 | 259 | } |
|
257 | 260 | } |
|
258 | 261 | } |
|
259 | 262 | } |
|
260 | 263 | |
|
261 | 264 | rtems_task wtdg_task( rtems_task_argument argument ) |
|
262 | 265 | { |
|
263 | 266 | rtems_event_set event_out; |
|
264 | 267 | rtems_status_code status; |
|
265 | 268 | int linkStatus; |
|
266 | 269 | |
|
267 | 270 | BOOT_PRINTF("in WTDG ***\n") |
|
268 | 271 | |
|
269 | 272 | while(1) |
|
270 | 273 | { |
|
271 | 274 | // wait for an RTEMS_EVENT |
|
272 | 275 | rtems_event_receive( RTEMS_EVENT_0, |
|
273 | 276 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
274 | 277 | PRINTF("in WTDG *** wait for the link\n") |
|
275 | 278 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
276 | 279 | while( linkStatus != 5) // wait for the link |
|
277 | 280 | { |
|
278 | 281 | rtems_task_wake_after( 10 ); |
|
279 | 282 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
280 | 283 | } |
|
281 | 284 | |
|
282 | 285 | status = spacewire_stop_start_link( fdSPW ); |
|
283 | 286 | |
|
284 | 287 | if (status != RTEMS_SUCCESSFUL) |
|
285 | 288 | { |
|
286 | 289 | PRINTF1("in WTDG *** ERR link not started %d\n", status) |
|
287 | 290 | } |
|
288 | 291 | else |
|
289 | 292 | { |
|
290 | 293 | PRINTF("in WTDG *** OK link started\n") |
|
291 | 294 | } |
|
292 | 295 | |
|
293 | 296 | // restart the SPIQ task |
|
294 | 297 | status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 ); |
|
295 | 298 | if ( status != RTEMS_SUCCESSFUL ) { |
|
296 | 299 | PRINTF("in SPIQ *** ERR restarting SPIQ Task\n") |
|
297 | 300 | } |
|
298 | 301 | |
|
299 | 302 | // restart RECV and SEND |
|
300 | 303 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); |
|
301 | 304 | if ( status != RTEMS_SUCCESSFUL ) { |
|
302 | 305 | PRINTF("in SPIQ *** ERR restarting SEND Task\n") |
|
303 | 306 | } |
|
304 | 307 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); |
|
305 | 308 | if ( status != RTEMS_SUCCESSFUL ) { |
|
306 | 309 | PRINTF("in SPIQ *** ERR restarting RECV Task\n") |
|
307 | 310 | } |
|
308 | 311 | } |
|
309 | 312 | } |
|
310 | 313 | |
|
311 | 314 | //**************** |
|
312 | 315 | // OTHER FUNCTIONS |
|
313 | 316 | int spacewire_open_link( void ) |
|
314 | 317 | { |
|
315 | 318 | /** This function opens the SpaceWire link. |
|
316 | 319 | * |
|
317 | 320 | * @return a valid file descriptor in case of success, -1 in case of a failure |
|
318 | 321 | * |
|
319 | 322 | */ |
|
320 | 323 | rtems_status_code status; |
|
321 | 324 | |
|
322 | 325 | fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware |
|
323 | 326 | if ( fdSPW < 0 ) { |
|
324 | 327 | PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno) |
|
325 | 328 | } |
|
326 | 329 | else |
|
327 | 330 | { |
|
328 | 331 | status = RTEMS_SUCCESSFUL; |
|
329 | 332 | } |
|
330 | 333 | |
|
331 | 334 | return status; |
|
332 | 335 | } |
|
333 | 336 | |
|
334 | 337 | int spacewire_start_link( int fd ) |
|
335 | 338 | { |
|
336 | 339 | rtems_status_code status; |
|
337 | 340 | |
|
338 | 341 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started |
|
339 | 342 | // -1 default hardcoded driver timeout |
|
340 | 343 | |
|
341 | 344 | return status; |
|
342 | 345 | } |
|
343 | 346 | |
|
344 | 347 | int spacewire_stop_start_link( int fd ) |
|
345 | 348 | { |
|
346 | 349 | rtems_status_code status; |
|
347 | 350 | |
|
348 | 351 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0 |
|
349 | 352 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started |
|
350 | 353 | // -1 default hardcoded driver timeout |
|
351 | 354 | |
|
352 | 355 | return status; |
|
353 | 356 | } |
|
354 | 357 | |
|
355 | 358 | int spacewire_configure_link( int fd ) |
|
356 | 359 | { |
|
357 | 360 | /** This function configures the SpaceWire link. |
|
358 | 361 | * |
|
359 | 362 | * @return GR-RTEMS-DRIVER directive status codes: |
|
360 | 363 | * - 22 EINVAL - Null pointer or an out of range value was given as the argument. |
|
361 | 364 | * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode. |
|
362 | 365 | * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used. |
|
363 | 366 | * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up. |
|
364 | 367 | * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers. |
|
365 | 368 | * - 5 EIO - Error when writing to grswp hardware registers. |
|
366 | 369 | * - 2 ENOENT - No such file or directory |
|
367 | 370 | */ |
|
368 | 371 | |
|
369 | 372 | rtems_status_code status; |
|
370 | 373 | |
|
371 | 374 | spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force |
|
372 | 375 | spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration |
|
373 | 376 | |
|
374 | 377 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception |
|
375 | 378 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n") |
|
376 | 379 | // |
|
377 | 380 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a |
|
378 | 381 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs |
|
379 | 382 | // |
|
380 | 383 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts |
|
381 | 384 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n") |
|
382 | 385 | // |
|
383 | 386 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit |
|
384 | 387 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n") |
|
385 | 388 | // |
|
386 | 389 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks |
|
387 | 390 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n") |
|
388 | 391 | // |
|
389 | 392 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available |
|
390 | 393 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n") |
|
391 | 394 | // |
|
392 | 395 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ] |
|
393 | 396 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n") |
|
394 | 397 | |
|
395 | 398 | return status; |
|
396 | 399 | } |
|
397 | 400 | |
|
398 | 401 | int spacewire_reset_link( void ) |
|
399 | 402 | { |
|
400 | 403 | /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver. |
|
401 | 404 | * |
|
402 | 405 | * @return RTEMS directive status code: |
|
403 | 406 | * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s. |
|
404 | 407 | * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout. |
|
405 | 408 | * |
|
406 | 409 | */ |
|
407 | 410 | |
|
408 | 411 | rtems_status_code status_spw; |
|
409 | 412 | int i; |
|
410 | 413 | |
|
411 | 414 | for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ ) |
|
412 | 415 | { |
|
413 | 416 | PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i); |
|
414 | 417 | |
|
415 | 418 | // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM |
|
416 | 419 | |
|
417 | 420 | status_spw = spacewire_stop_start_link( fdSPW ); |
|
418 | 421 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
419 | 422 | { |
|
420 | 423 | PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw) |
|
421 | 424 | } |
|
422 | 425 | |
|
423 | 426 | if ( status_spw == RTEMS_SUCCESSFUL) |
|
424 | 427 | { |
|
425 | 428 | break; |
|
426 | 429 | } |
|
427 | 430 | } |
|
428 | 431 | |
|
429 | 432 | return status_spw; |
|
430 | 433 | } |
|
431 | 434 | |
|
432 | 435 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force |
|
433 | 436 | { |
|
434 | 437 | /** This function sets the [N]o [P]ort force bit of the GRSPW control register. |
|
435 | 438 | * |
|
436 | 439 | * @param val is the value, 0 or 1, used to set the value of the NP bit. |
|
437 | 440 | * @param regAddr is the address of the GRSPW control register. |
|
438 | 441 | * |
|
439 | 442 | * NP is the bit 20 of the GRSPW control register. |
|
440 | 443 | * |
|
441 | 444 | */ |
|
442 | 445 | |
|
443 | 446 | unsigned int *spwptr = (unsigned int*) regAddr; |
|
444 | 447 | |
|
445 | 448 | if (val == 1) { |
|
446 | 449 | *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit |
|
447 | 450 | } |
|
448 | 451 | if (val== 0) { |
|
449 | 452 | *spwptr = *spwptr & 0xffdfffff; |
|
450 | 453 | } |
|
451 | 454 | } |
|
452 | 455 | |
|
453 | 456 | void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable |
|
454 | 457 | { |
|
455 | 458 | /** This function sets the [R]MAP [E]nable bit of the GRSPW control register. |
|
456 | 459 | * |
|
457 | 460 | * @param val is the value, 0 or 1, used to set the value of the RE bit. |
|
458 | 461 | * @param regAddr is the address of the GRSPW control register. |
|
459 | 462 | * |
|
460 | 463 | * RE is the bit 16 of the GRSPW control register. |
|
461 | 464 | * |
|
462 | 465 | */ |
|
463 | 466 | |
|
464 | 467 | unsigned int *spwptr = (unsigned int*) regAddr; |
|
465 | 468 | |
|
466 | 469 | if (val == 1) |
|
467 | 470 | { |
|
468 | 471 | *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit |
|
469 | 472 | } |
|
470 | 473 | if (val== 0) |
|
471 | 474 | { |
|
472 | 475 | *spwptr = *spwptr & 0xfffdffff; |
|
473 | 476 | } |
|
474 | 477 | } |
|
475 | 478 | |
|
476 | 479 | void spacewire_compute_stats_offsets( void ) |
|
477 | 480 | { |
|
478 | 481 | /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising. |
|
479 | 482 | * |
|
480 | 483 | * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics |
|
481 | 484 | * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it |
|
482 | 485 | * during the open systel call). |
|
483 | 486 | * |
|
484 | 487 | */ |
|
485 | 488 | |
|
486 | 489 | spw_stats spacewire_stats_grspw; |
|
487 | 490 | rtems_status_code status; |
|
488 | 491 | |
|
489 | 492 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); |
|
490 | 493 | |
|
491 | 494 | spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received |
|
492 | 495 | + spacewire_stats.packets_received; |
|
493 | 496 | spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent |
|
494 | 497 | + spacewire_stats.packets_sent; |
|
495 | 498 | spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err |
|
496 | 499 | + spacewire_stats.parity_err; |
|
497 | 500 | spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err |
|
498 | 501 | + spacewire_stats.disconnect_err; |
|
499 | 502 | spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err |
|
500 | 503 | + spacewire_stats.escape_err; |
|
501 | 504 | spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err |
|
502 | 505 | + spacewire_stats.credit_err; |
|
503 | 506 | spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err |
|
504 | 507 | + spacewire_stats.write_sync_err; |
|
505 | 508 | spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err |
|
506 | 509 | + spacewire_stats.rx_rmap_header_crc_err; |
|
507 | 510 | spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err |
|
508 | 511 | + spacewire_stats.rx_rmap_data_crc_err; |
|
509 | 512 | spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep |
|
510 | 513 | + spacewire_stats.early_ep; |
|
511 | 514 | spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address |
|
512 | 515 | + spacewire_stats.invalid_address; |
|
513 | 516 | spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err |
|
514 | 517 | + spacewire_stats.rx_eep_err; |
|
515 | 518 | spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated |
|
516 | 519 | + spacewire_stats.rx_truncated; |
|
517 | 520 | } |
|
518 | 521 | |
|
519 | 522 | void spacewire_update_statistics( void ) |
|
520 | 523 | { |
|
521 | 524 | rtems_status_code status; |
|
522 | 525 | spw_stats spacewire_stats_grspw; |
|
523 | 526 | |
|
524 | 527 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); |
|
525 | 528 | |
|
526 | 529 | spacewire_stats.packets_received = spacewire_stats_backup.packets_received |
|
527 | 530 | + spacewire_stats_grspw.packets_received; |
|
528 | 531 | spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent |
|
529 | 532 | + spacewire_stats_grspw.packets_sent; |
|
530 | 533 | spacewire_stats.parity_err = spacewire_stats_backup.parity_err |
|
531 | 534 | + spacewire_stats_grspw.parity_err; |
|
532 | 535 | spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err |
|
533 | 536 | + spacewire_stats_grspw.disconnect_err; |
|
534 | 537 | spacewire_stats.escape_err = spacewire_stats_backup.escape_err |
|
535 | 538 | + spacewire_stats_grspw.escape_err; |
|
536 | 539 | spacewire_stats.credit_err = spacewire_stats_backup.credit_err |
|
537 | 540 | + spacewire_stats_grspw.credit_err; |
|
538 | 541 | spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err |
|
539 | 542 | + spacewire_stats_grspw.write_sync_err; |
|
540 | 543 | spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err |
|
541 | 544 | + spacewire_stats_grspw.rx_rmap_header_crc_err; |
|
542 | 545 | spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err |
|
543 | 546 | + spacewire_stats_grspw.rx_rmap_data_crc_err; |
|
544 | 547 | spacewire_stats.early_ep = spacewire_stats_backup.early_ep |
|
545 | 548 | + spacewire_stats_grspw.early_ep; |
|
546 | 549 | spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address |
|
547 | 550 | + spacewire_stats_grspw.invalid_address; |
|
548 | 551 | spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err |
|
549 | 552 | + spacewire_stats_grspw.rx_eep_err; |
|
550 | 553 | spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated |
|
551 | 554 | + spacewire_stats_grspw.rx_truncated; |
|
552 | 555 | //spacewire_stats.tx_link_err; |
|
553 | 556 | |
|
554 | 557 | //**************************** |
|
555 | 558 | // DPU_SPACEWIRE_IF_STATISTICS |
|
556 | 559 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8); |
|
557 | 560 | housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received); |
|
558 | 561 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8); |
|
559 | 562 | housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent); |
|
560 | 563 | //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt; |
|
561 | 564 | //housekeeping_packet.hk_lfr_dpu_spw_last_timc; |
|
562 | 565 | |
|
563 | 566 | //****************************************** |
|
564 | 567 | // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY |
|
565 | 568 | housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err; |
|
566 | 569 | housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err; |
|
567 | 570 | housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err; |
|
568 | 571 | housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err; |
|
569 | 572 | housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err; |
|
570 | 573 | // housekeeping_packet.hk_lfr_dpu_spw_rx_ahb; |
|
571 | 574 | // housekeeping_packet.hk_lfr_dpu_spw_tx_ahb; |
|
572 | 575 | housekeeping_packet.hk_lfr_dpu_spw_header_crc = (unsigned char) spacewire_stats.rx_rmap_header_crc_err; |
|
573 | 576 | housekeeping_packet.hk_lfr_dpu_spw_data_crc = (unsigned char) spacewire_stats.rx_rmap_data_crc_err; |
|
574 | 577 | |
|
575 | 578 | //********************************************* |
|
576 | 579 | // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY |
|
577 | 580 | housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep; |
|
578 | 581 | housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address; |
|
579 | 582 | housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err; |
|
580 | 583 | housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated; |
|
581 | 584 | |
|
582 | 585 | } |
|
583 | 586 | |
|
584 | 587 | void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ) |
|
585 | 588 | { |
|
586 | 589 | //if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) { |
|
587 | 590 | // printf("In timecode_irq_handler *** Error sending event to DUMB\n"); |
|
588 | 591 | //} |
|
589 | 592 | } |
|
590 | 593 | |
|
591 | 594 | rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ) |
|
592 | 595 | { |
|
593 | 596 | int linkStatus; |
|
594 | 597 | rtems_status_code status; |
|
595 | 598 | |
|
596 | 599 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
597 | 600 | |
|
598 | 601 | if ( linkStatus == 5) { |
|
599 | 602 | PRINTF("in spacewire_reset_link *** link is running\n") |
|
600 | 603 | status = RTEMS_SUCCESSFUL; |
|
601 | 604 | } |
|
602 | 605 | } |
|
606 | ||
|
607 | rtems_status_code rtems_message_queue_send_lfr( rtems_id id, const void *buffer, size_t size ) | |
|
608 | { | |
|
609 | rtems_status_code status; | |
|
610 | rtems_mode previous_mode_set; | |
|
611 | ||
|
612 | // set the preemption OFF | |
|
613 | status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &previous_mode_set ); | |
|
614 | ||
|
615 | // use the message queue | |
|
616 | status = rtems_message_queue_send_lfr( id, buffer, size ); | |
|
617 | ||
|
618 | // set the preemption ON | |
|
619 | status = rtems_task_mode( RTEMS_PREEMPT , RTEMS_PREEMPT_MASK, &previous_mode_set ); | |
|
620 | ||
|
621 | return status; | |
|
622 | } | |
|
623 |
@@ -1,448 +1,449 | |||
|
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 | 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 | 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 | increment_seq_counter( parameter_dump_packet.packetSequenceControl ); | |
|
215 | 216 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
216 | 217 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
217 | 218 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
218 | 219 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
219 | 220 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
220 | 221 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
221 | 222 | // SEND DATA |
|
222 | 223 | status = rtems_message_queue_send( queue_id, ¶meter_dump_packet, |
|
223 | 224 | PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
|
224 | 225 | if (status != RTEMS_SUCCESSFUL) { |
|
225 | 226 | PRINTF1("in action_dump *** ERR sending packet, code %d", status) |
|
226 | 227 | } |
|
227 | 228 | |
|
228 | 229 | return status; |
|
229 | 230 | } |
|
230 | 231 | |
|
231 | 232 | //*********************** |
|
232 | 233 | // NORMAL MODE PARAMETERS |
|
233 | 234 | |
|
234 | 235 | int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
235 | 236 | { |
|
236 | 237 | /** This function sets the number of points of a snapshot (sy_lfr_n_swf_l). |
|
237 | 238 | * |
|
238 | 239 | * @param TC points to the TeleCommand packet that is being processed |
|
239 | 240 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
240 | 241 | * |
|
241 | 242 | */ |
|
242 | 243 | |
|
243 | 244 | unsigned int tmp; |
|
244 | 245 | int result; |
|
245 | 246 | unsigned char msb; |
|
246 | 247 | unsigned char lsb; |
|
247 | 248 | |
|
248 | 249 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L ]; |
|
249 | 250 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L+1 ]; |
|
250 | 251 | |
|
251 | 252 | tmp = ( unsigned int ) floor( |
|
252 | 253 | ( ( msb*256 ) + lsb ) / 16 |
|
253 | 254 | ) * 16; |
|
254 | 255 | |
|
255 | 256 | if ( (tmp < 16) || (tmp > 2048) ) // the snapshot period is a multiple of 16 |
|
256 | 257 | { // 2048 is the maximum limit due to the size of the buffers |
|
257 | 258 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_L+10, lsb ); |
|
258 | 259 | result = WRONG_APP_DATA; |
|
259 | 260 | } |
|
260 | 261 | else if (tmp != 2048) |
|
261 | 262 | { |
|
262 | 263 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); |
|
263 | 264 | result = FUNCT_NOT_IMPL; |
|
264 | 265 | } |
|
265 | 266 | else |
|
266 | 267 | { |
|
267 | 268 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (tmp >> 8); |
|
268 | 269 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (tmp ); |
|
269 | 270 | result = LFR_SUCCESSFUL; |
|
270 | 271 | } |
|
271 | 272 | |
|
272 | 273 | return result; |
|
273 | 274 | } |
|
274 | 275 | |
|
275 | 276 | int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
276 | 277 | { |
|
277 | 278 | /** This function sets the time between two snapshots, in s (sy_lfr_n_swf_p). |
|
278 | 279 | * |
|
279 | 280 | * @param TC points to the TeleCommand packet that is being processed |
|
280 | 281 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
281 | 282 | * |
|
282 | 283 | */ |
|
283 | 284 | |
|
284 | 285 | unsigned int tmp; |
|
285 | 286 | int result; |
|
286 | 287 | unsigned char msb; |
|
287 | 288 | unsigned char lsb; |
|
288 | 289 | |
|
289 | 290 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P ]; |
|
290 | 291 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P+1 ]; |
|
291 | 292 | |
|
292 | 293 | tmp = ( unsigned int ) floor( |
|
293 | 294 | ( ( msb*256 ) + lsb ) / 8 |
|
294 | 295 | ) * 8; |
|
295 | 296 | |
|
296 | 297 | if ( (tmp < 16) || (tmp > 65528) ) |
|
297 | 298 | { |
|
298 | 299 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_P+10, lsb ); |
|
299 | 300 | result = WRONG_APP_DATA; |
|
300 | 301 | } |
|
301 | 302 | else |
|
302 | 303 | { |
|
303 | 304 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8); |
|
304 | 305 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp ); |
|
305 | 306 | result = LFR_SUCCESSFUL; |
|
306 | 307 | } |
|
307 | 308 | |
|
308 | 309 | return result; |
|
309 | 310 | } |
|
310 | 311 | |
|
311 | 312 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
312 | 313 | { |
|
313 | 314 | /** This function sets the time between two full spectral matrices transmission, in s (SY_LFR_N_ASM_P). |
|
314 | 315 | * |
|
315 | 316 | * @param TC points to the TeleCommand packet that is being processed |
|
316 | 317 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
317 | 318 | * |
|
318 | 319 | */ |
|
319 | 320 | |
|
320 | 321 | int result; |
|
321 | 322 | unsigned char msb; |
|
322 | 323 | unsigned char lsb; |
|
323 | 324 | |
|
324 | 325 | msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P ]; |
|
325 | 326 | lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P+1 ]; |
|
326 | 327 | |
|
327 | 328 | parameter_dump_packet.sy_lfr_n_asm_p[0] = msb; |
|
328 | 329 | parameter_dump_packet.sy_lfr_n_asm_p[1] = lsb; |
|
329 | 330 | result = LFR_SUCCESSFUL; |
|
330 | 331 | |
|
331 | 332 | return result; |
|
332 | 333 | } |
|
333 | 334 | |
|
334 | 335 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
335 | 336 | { |
|
336 | 337 | /** This function sets the time between two basic parameter sets, in s (SY_LFR_N_BP_P0). |
|
337 | 338 | * |
|
338 | 339 | * @param TC points to the TeleCommand packet that is being processed |
|
339 | 340 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
340 | 341 | * |
|
341 | 342 | */ |
|
342 | 343 | |
|
343 | 344 | int status; |
|
344 | 345 | |
|
345 | 346 | status = LFR_SUCCESSFUL; |
|
346 | 347 | |
|
347 | 348 | parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P0 ]; |
|
348 | 349 | |
|
349 | 350 | return status; |
|
350 | 351 | } |
|
351 | 352 | |
|
352 | 353 | int set_sy_lfr_n_bp_p1(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
353 | 354 | { |
|
354 | 355 | /** This function sets the time between two basic parameter sets (autocorrelation + crosscorrelation), in s (sy_lfr_n_bp_p1). |
|
355 | 356 | * |
|
356 | 357 | * @param TC points to the TeleCommand packet that is being processed |
|
357 | 358 | * @param queue_id is the id of the queue which handles TM related to this execution step |
|
358 | 359 | * |
|
359 | 360 | */ |
|
360 | 361 | |
|
361 | 362 | int status; |
|
362 | 363 | |
|
363 | 364 | status = LFR_SUCCESSFUL; |
|
364 | 365 | |
|
365 | 366 | parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P1 ]; |
|
366 | 367 | |
|
367 | 368 | return status; |
|
368 | 369 | } |
|
369 | 370 | |
|
370 | 371 | //********************** |
|
371 | 372 | // BURST MODE PARAMETERS |
|
372 | 373 | |
|
373 | 374 | //********************* |
|
374 | 375 | // SBM1 MODE PARAMETERS |
|
375 | 376 | |
|
376 | 377 | //********************* |
|
377 | 378 | // SBM2 MODE PARAMETERS |
|
378 | 379 | |
|
379 | 380 | //********** |
|
380 | 381 | // init dump |
|
381 | 382 | |
|
382 | 383 | void init_parameter_dump( void ) |
|
383 | 384 | { |
|
384 | 385 | /** This function initialize the parameter_dump_packet global variable with default values. |
|
385 | 386 | * |
|
386 | 387 | */ |
|
387 | 388 | |
|
388 | 389 | parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
389 | 390 | parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
390 | 391 | parameter_dump_packet.reserved = CCSDS_RESERVED; |
|
391 | 392 | parameter_dump_packet.userApplication = CCSDS_USER_APP; |
|
392 | 393 | parameter_dump_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_PARAMETER_DUMP >> 8); |
|
393 | 394 | parameter_dump_packet.packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP; |
|
394 | 395 | parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; |
|
395 | 396 | parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; |
|
396 | 397 | parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8); |
|
397 | 398 | parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP; |
|
398 | 399 | // DATA FIELD HEADER |
|
399 | 400 | parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2; |
|
400 | 401 | parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP; |
|
401 | 402 | parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP; |
|
402 | 403 | parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND; |
|
403 | 404 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
404 | 405 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
405 | 406 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
406 | 407 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
407 | 408 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
408 | 409 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
409 | 410 | parameter_dump_packet.sid = SID_PARAMETER_DUMP; |
|
410 | 411 | |
|
411 | 412 | //****************** |
|
412 | 413 | // COMMON PARAMETERS |
|
413 | 414 | parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0; |
|
414 | 415 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1; |
|
415 | 416 | |
|
416 | 417 | //****************** |
|
417 | 418 | // NORMAL PARAMETERS |
|
418 | 419 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (SY_LFR_N_SWF_L >> 8); |
|
419 | 420 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (SY_LFR_N_SWF_L ); |
|
420 | 421 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (SY_LFR_N_SWF_P >> 8); |
|
421 | 422 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (SY_LFR_N_SWF_P ); |
|
422 | 423 | parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (SY_LFR_N_ASM_P >> 8); |
|
423 | 424 | parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (SY_LFR_N_ASM_P ); |
|
424 | 425 | parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) SY_LFR_N_BP_P0; |
|
425 | 426 | parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) SY_LFR_N_BP_P1; |
|
426 | 427 | |
|
427 | 428 | //***************** |
|
428 | 429 | // BURST PARAMETERS |
|
429 | 430 | parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0; |
|
430 | 431 | parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1; |
|
431 | 432 | |
|
432 | 433 | //**************** |
|
433 | 434 | // SBM1 PARAMETERS |
|
434 | 435 | 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 | 436 | parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1; |
|
436 | 437 | |
|
437 | 438 | //**************** |
|
438 | 439 | // SBM2 PARAMETERS |
|
439 | 440 | parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0; |
|
440 | 441 | parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1; |
|
441 | 442 | } |
|
442 | 443 | |
|
443 | 444 | |
|
444 | 445 | |
|
445 | 446 | |
|
446 | 447 | |
|
447 | 448 | |
|
448 | 449 |
@@ -1,419 +1,490 | |||
|
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 | TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
|
47 | TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
|
46 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
|
48 | 47 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8); |
|
49 | 48 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS ); |
|
50 | 49 | // DATA FIELD HEADER |
|
51 | 50 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
52 | 51 | TM.serviceType = TM_TYPE_TC_EXE; |
|
53 | 52 | TM.serviceSubType = TM_SUBTYPE_EXE_OK; |
|
54 | 53 | TM.destinationID = TC->sourceID; |
|
55 | 54 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
56 | 55 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
57 | 56 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
58 | 57 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
59 | 58 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
60 | 59 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
61 | 60 | // |
|
62 | 61 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
63 | 62 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
64 | 63 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
65 | 64 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
66 | 65 | |
|
67 | 66 | messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
68 | 67 | |
|
69 | 68 | // SEND DATA |
|
70 |
status = rtems_message_queue_ |
|
|
69 | status = rtems_message_queue_send( queue_id, &TM, messageSize); | |
|
71 | 70 | if (status != RTEMS_SUCCESSFUL) { |
|
72 | 71 | PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n") |
|
73 | 72 | } |
|
74 | 73 | |
|
75 | 74 | return status; |
|
76 | 75 | } |
|
77 | 76 | |
|
78 | 77 | int send_tm_lfr_tc_exe_inconsistent( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
79 | 78 | unsigned char byte_position, unsigned char rcv_value ) |
|
80 | 79 | { |
|
81 | 80 | /** This function sends a TM_LFR_TC_EXE_INCONSISTENT packet in the dedicated RTEMS message queue. |
|
82 | 81 | * |
|
83 | 82 | * @param TC points to the TeleCommand packet that is being processed |
|
84 | 83 | * @param queue_id is the id of the queue which handles TM |
|
85 | 84 | * @param byte_position is the byte position of the MSB of the parameter that has been seen as inconsistent |
|
86 | 85 | * @param rcv_value is the value of the LSB of the parameter that has been deteced as inconsistent |
|
87 | 86 | * |
|
88 | 87 | * @return RTEMS directive status code: |
|
89 | 88 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
90 | 89 | * - RTEMS_INVALID_ID - invalid queue id |
|
91 | 90 | * - RTEMS_INVALID_SIZE - invalid message size |
|
92 | 91 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
93 | 92 | * - RTEMS_UNSATISFIED - out of message buffers |
|
94 | 93 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
95 | 94 | * |
|
96 | 95 | */ |
|
97 | 96 | |
|
98 | 97 | rtems_status_code status; |
|
99 | 98 | Packet_TM_LFR_TC_EXE_INCONSISTENT_t TM; |
|
100 | 99 | unsigned char messageSize; |
|
101 | 100 | |
|
102 | 101 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
103 | 102 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
104 | 103 | TM.reserved = DEFAULT_RESERVED; |
|
105 | 104 | TM.userApplication = CCSDS_USER_APP; |
|
106 | 105 | // PACKET HEADER |
|
107 | 106 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
108 | 107 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
109 | TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
|
110 | TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
|
108 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
|
111 | 109 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8); |
|
112 | 110 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT ); |
|
113 | 111 | // DATA FIELD HEADER |
|
114 | 112 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
115 | 113 | TM.serviceType = TM_TYPE_TC_EXE; |
|
116 | 114 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
117 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id | |
|
115 | TM.destinationID = TC->sourceID; | |
|
118 | 116 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
119 | 117 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
120 | 118 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
121 | 119 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
122 | 120 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
123 | 121 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
124 | 122 | // |
|
125 | 123 | TM.tc_failure_code[0] = (char) (WRONG_APP_DATA >> 8); |
|
126 | 124 | TM.tc_failure_code[1] = (char) (WRONG_APP_DATA ); |
|
127 | 125 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
128 | 126 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
129 | 127 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
130 | 128 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
131 | 129 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
132 | 130 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
133 | 131 | TM.byte_position = byte_position; |
|
134 | 132 | TM.rcv_value = rcv_value; |
|
135 | 133 | |
|
136 | 134 | messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
137 | 135 | |
|
138 | 136 | // SEND DATA |
|
139 |
status = rtems_message_queue_ |
|
|
137 | status = rtems_message_queue_send( queue_id, &TM, messageSize); | |
|
140 | 138 | if (status != RTEMS_SUCCESSFUL) { |
|
141 | 139 | PRINTF("in send_tm_lfr_tc_exe_inconsistent *** ERR\n") |
|
142 | 140 | } |
|
143 | 141 | |
|
144 | 142 | return status; |
|
145 | 143 | } |
|
146 | 144 | |
|
147 | 145 | int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
148 | 146 | { |
|
149 | 147 | /** This function sends a TM_LFR_TC_EXE_NOT_EXECUTABLE packet in the dedicated RTEMS message queue. |
|
150 | 148 | * |
|
151 | 149 | * @param TC points to the TeleCommand packet that is being processed |
|
152 | 150 | * @param queue_id is the id of the queue which handles TM |
|
153 | 151 | * |
|
154 | 152 | * @return RTEMS directive status code: |
|
155 | 153 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
156 | 154 | * - RTEMS_INVALID_ID - invalid queue id |
|
157 | 155 | * - RTEMS_INVALID_SIZE - invalid message size |
|
158 | 156 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
159 | 157 | * - RTEMS_UNSATISFIED - out of message buffers |
|
160 | 158 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
161 | 159 | * |
|
162 | 160 | */ |
|
163 | 161 | |
|
164 | 162 | rtems_status_code status; |
|
165 | 163 | Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t TM; |
|
166 | 164 | unsigned char messageSize; |
|
167 | 165 | |
|
168 | 166 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
169 | 167 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
170 | 168 | TM.reserved = DEFAULT_RESERVED; |
|
171 | 169 | TM.userApplication = CCSDS_USER_APP; |
|
172 | 170 | // PACKET HEADER |
|
173 | 171 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
174 | 172 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
175 | TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
|
176 | TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
|
173 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
|
177 | 174 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8); |
|
178 | 175 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE ); |
|
179 | 176 | // DATA FIELD HEADER |
|
180 | 177 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
181 | 178 | TM.serviceType = TM_TYPE_TC_EXE; |
|
182 | 179 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
183 |
TM.destinationID = T |
|
|
180 | TM.destinationID = TC->sourceID; // default destination id | |
|
184 | 181 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
185 | 182 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
186 | 183 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
187 | 184 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
188 | 185 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
189 | 186 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
190 | 187 | // |
|
191 | 188 | TM.tc_failure_code[0] = (char) (TC_NOT_EXE >> 8); |
|
192 | 189 | TM.tc_failure_code[1] = (char) (TC_NOT_EXE ); |
|
193 | 190 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
194 | 191 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
195 | 192 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
196 | 193 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
197 | 194 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
198 | 195 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
199 | 196 | TM.lfr_status_word[0] = housekeeping_packet.lfr_status_word[0]; |
|
200 | 197 | TM.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1]; |
|
201 | 198 | |
|
202 | 199 | messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
203 | 200 | |
|
204 | 201 | // SEND DATA |
|
205 |
status = rtems_message_queue_ |
|
|
202 | status = rtems_message_queue_send( queue_id, &TM, messageSize); | |
|
206 | 203 | if (status != RTEMS_SUCCESSFUL) { |
|
207 | 204 | PRINTF("in send_tm_lfr_tc_exe_not_executable *** ERR\n") |
|
208 | 205 | } |
|
209 | 206 | |
|
210 | 207 | return status; |
|
211 | 208 | } |
|
212 | 209 | |
|
213 | 210 | int send_tm_lfr_tc_exe_not_implemented( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
214 | 211 | { |
|
215 | 212 | /** This function sends a TM_LFR_TC_EXE_NOT_IMPLEMENTED packet in the dedicated RTEMS message queue. |
|
216 | 213 | * |
|
217 | 214 | * @param TC points to the TeleCommand packet that is being processed |
|
218 | 215 | * @param queue_id is the id of the queue which handles TM |
|
219 | 216 | * |
|
220 | 217 | * @return RTEMS directive status code: |
|
221 | 218 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
222 | 219 | * - RTEMS_INVALID_ID - invalid queue id |
|
223 | 220 | * - RTEMS_INVALID_SIZE - invalid message size |
|
224 | 221 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
225 | 222 | * - RTEMS_UNSATISFIED - out of message buffers |
|
226 | 223 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
227 | 224 | * |
|
228 | 225 | */ |
|
229 | 226 | |
|
230 | 227 | rtems_status_code status; |
|
231 | 228 | Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t TM; |
|
232 | 229 | unsigned char messageSize; |
|
233 | 230 | |
|
234 | 231 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
235 | 232 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
236 | 233 | TM.reserved = DEFAULT_RESERVED; |
|
237 | 234 | TM.userApplication = CCSDS_USER_APP; |
|
238 | 235 | // PACKET HEADER |
|
239 | 236 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
240 | 237 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
241 | TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
|
242 | TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
|
238 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
|
243 | 239 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8); |
|
244 | 240 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED ); |
|
245 | 241 | // DATA FIELD HEADER |
|
246 | 242 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
247 | 243 | TM.serviceType = TM_TYPE_TC_EXE; |
|
248 | 244 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
249 |
TM.destinationID = T |
|
|
245 | TM.destinationID = TC->sourceID; // default destination id | |
|
250 | 246 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
251 | 247 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
252 | 248 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
253 | 249 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
254 | 250 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
255 | 251 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
256 | 252 | // |
|
257 | 253 | TM.tc_failure_code[0] = (char) (FUNCT_NOT_IMPL >> 8); |
|
258 | 254 | TM.tc_failure_code[1] = (char) (FUNCT_NOT_IMPL ); |
|
259 | 255 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
260 | 256 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
261 | 257 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
262 | 258 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
263 | 259 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
264 | 260 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
265 | 261 | |
|
266 | 262 | messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
267 | 263 | |
|
268 | 264 | // SEND DATA |
|
269 |
status = rtems_message_queue_ |
|
|
265 | status = rtems_message_queue_send( queue_id, &TM, messageSize); | |
|
270 | 266 | if (status != RTEMS_SUCCESSFUL) { |
|
271 | 267 | PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n") |
|
272 | 268 | } |
|
273 | 269 | |
|
274 | 270 | return status; |
|
275 | 271 | } |
|
276 | 272 | |
|
277 | 273 | int send_tm_lfr_tc_exe_error( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
278 | 274 | { |
|
279 | 275 | /** This function sends a TM_LFR_TC_EXE_ERROR packet in the dedicated RTEMS message queue. |
|
280 | 276 | * |
|
281 | 277 | * @param TC points to the TeleCommand packet that is being processed |
|
282 | 278 | * @param queue_id is the id of the queue which handles TM |
|
283 | 279 | * |
|
284 | 280 | * @return RTEMS directive status code: |
|
285 | 281 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
286 | 282 | * - RTEMS_INVALID_ID - invalid queue id |
|
287 | 283 | * - RTEMS_INVALID_SIZE - invalid message size |
|
288 | 284 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
289 | 285 | * - RTEMS_UNSATISFIED - out of message buffers |
|
290 | 286 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
291 | 287 | * |
|
292 | 288 | */ |
|
293 | 289 | |
|
294 | 290 | rtems_status_code status; |
|
295 | 291 | Packet_TM_LFR_TC_EXE_ERROR_t TM; |
|
296 | 292 | unsigned char messageSize; |
|
297 | 293 | |
|
298 | 294 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
299 | 295 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
300 | 296 | TM.reserved = DEFAULT_RESERVED; |
|
301 | 297 | TM.userApplication = CCSDS_USER_APP; |
|
302 | 298 | // PACKET HEADER |
|
303 | 299 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
304 | 300 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
305 | TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
|
306 | TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
|
301 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
|
307 | 302 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8); |
|
308 | 303 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR ); |
|
309 | 304 | // DATA FIELD HEADER |
|
310 | 305 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
311 | 306 | TM.serviceType = TM_TYPE_TC_EXE; |
|
312 | 307 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
313 |
TM.destinationID = T |
|
|
308 | TM.destinationID = TC->sourceID; // default destination id | |
|
314 | 309 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
315 | 310 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
316 | 311 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
317 | 312 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
318 | 313 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
319 | 314 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
320 | 315 | // |
|
321 | 316 | TM.tc_failure_code[0] = (char) (FAIL_DETECTED >> 8); |
|
322 | 317 | TM.tc_failure_code[1] = (char) (FAIL_DETECTED ); |
|
323 | 318 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
324 | 319 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
325 | 320 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
326 | 321 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
327 | 322 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
328 | 323 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
329 | 324 | |
|
330 | 325 | messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
331 | 326 | |
|
332 | 327 | // SEND DATA |
|
333 |
status = rtems_message_queue_ |
|
|
328 | status = rtems_message_queue_send( queue_id, &TM, messageSize); | |
|
334 | 329 | if (status != RTEMS_SUCCESSFUL) { |
|
335 | 330 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") |
|
336 | 331 | } |
|
337 | 332 | |
|
338 | 333 | return status; |
|
339 | 334 | } |
|
340 | 335 | |
|
341 | 336 | int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
342 | 337 | unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV ) |
|
343 | 338 | { |
|
344 | 339 | /** This function sends a TM_LFR_TC_EXE_CORRUPTED packet in the dedicated RTEMS message queue. |
|
345 | 340 | * |
|
346 | 341 | * @param TC points to the TeleCommand packet that is being processed |
|
347 | 342 | * @param queue_id is the id of the queue which handles TM |
|
348 | 343 | * @param computed_CRC points to a buffer of two bytes containing the CRC computed during the parsing of the TeleCommand |
|
349 | 344 | * @param currentTC_LEN_RCV points to a buffer of two bytes containing a packet size field computed on the received data |
|
350 | 345 | * |
|
351 | 346 | * @return RTEMS directive status code: |
|
352 | 347 | * - RTEMS_SUCCESSFUL - message sent successfully |
|
353 | 348 | * - RTEMS_INVALID_ID - invalid queue id |
|
354 | 349 | * - RTEMS_INVALID_SIZE - invalid message size |
|
355 | 350 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
356 | 351 | * - RTEMS_UNSATISFIED - out of message buffers |
|
357 | 352 | * - RTEMS_TOO_MANY - queue s limit has been reached |
|
358 | 353 | * |
|
359 | 354 | */ |
|
360 | 355 | |
|
361 | 356 | rtems_status_code status; |
|
362 | 357 | Packet_TM_LFR_TC_EXE_CORRUPTED_t TM; |
|
363 | 358 | unsigned char messageSize; |
|
364 | 359 | unsigned int packetLength; |
|
365 | 360 | unsigned char *packetDataField; |
|
366 | 361 | |
|
367 | 362 | packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1]; // compute the packet length parameter |
|
368 | 363 | packetDataField = (unsigned char *) &TC->headerFlag_pusVersion_Ack; // get the beginning of the data field |
|
369 | 364 | |
|
370 | 365 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
371 | 366 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
372 | 367 | TM.reserved = DEFAULT_RESERVED; |
|
373 | 368 | TM.userApplication = CCSDS_USER_APP; |
|
374 | 369 | // PACKET HEADER |
|
375 | 370 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
376 | 371 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
377 | TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
|
378 | TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
|
372 | increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID ); | |
|
379 | 373 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8); |
|
380 | 374 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED ); |
|
381 | 375 | // DATA FIELD HEADER |
|
382 | 376 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; |
|
383 | 377 | TM.serviceType = TM_TYPE_TC_EXE; |
|
384 | 378 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; |
|
385 |
TM.destinationID = T |
|
|
379 | TM.destinationID = TC->sourceID; // default destination id | |
|
386 | 380 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
387 | 381 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
388 | 382 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
389 | 383 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
390 | 384 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
391 | 385 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); |
|
392 | 386 | // |
|
393 | 387 | TM.tc_failure_code[0] = (unsigned char) (CORRUPTED >> 8); |
|
394 | 388 | TM.tc_failure_code[1] = (unsigned char) (CORRUPTED ); |
|
395 | 389 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
396 | 390 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
397 | 391 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; |
|
398 | 392 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; |
|
399 | 393 | TM.tc_service = TC->serviceType; // type of the rejected TC |
|
400 | 394 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC |
|
401 | 395 | TM.pkt_len_rcv_value[0] = TC->packetLength[0]; |
|
402 | 396 | TM.pkt_len_rcv_value[1] = TC->packetLength[1]; |
|
403 | 397 | TM.pkt_datafieldsize_cnt[0] = currentTC_LEN_RCV[0]; |
|
404 | 398 | TM.pkt_datafieldsize_cnt[1] = currentTC_LEN_RCV[1]; |
|
405 | 399 | TM.rcv_crc[0] = packetDataField[ packetLength - 1 ]; |
|
406 | 400 | TM.rcv_crc[1] = packetDataField[ packetLength ]; |
|
407 | 401 | TM.computed_crc[0] = computed_CRC[0]; |
|
408 | 402 | TM.computed_crc[1] = computed_CRC[1]; |
|
409 | 403 | |
|
410 | 404 | messageSize = PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; |
|
411 | 405 | |
|
412 | 406 | // SEND DATA |
|
413 |
status = rtems_message_queue_ |
|
|
407 | status = rtems_message_queue_send( queue_id, &TM, messageSize); | |
|
414 | 408 | if (status != RTEMS_SUCCESSFUL) { |
|
415 | 409 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") |
|
416 | 410 | } |
|
417 | 411 | |
|
418 | 412 | return status; |
|
419 | 413 | } |
|
414 | ||
|
415 | void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id ) | |
|
416 | { | |
|
417 | unsigned short sequence_cnt; | |
|
418 | unsigned short segmentation_grouping_flag; | |
|
419 | unsigned short new_packet_sequence_control; | |
|
420 | unsigned char i; | |
|
421 | ||
|
422 | switch (destination_id) | |
|
423 | { | |
|
424 | case SID_TC_GROUND: | |
|
425 | i = GROUND; | |
|
426 | break; | |
|
427 | case SID_TC_MISSION_TIMELINE: | |
|
428 | i = MISSION_TIMELINE; | |
|
429 | break; | |
|
430 | case SID_TC_TC_SEQUENCES: | |
|
431 | i = TC_SEQUENCES; | |
|
432 | break; | |
|
433 | case SID_TC_RECOVERY_ACTION_CMD: | |
|
434 | i = RECOVERY_ACTION_CMD; | |
|
435 | break; | |
|
436 | case SID_TC_BACKUP_MISSION_TIMELINE: | |
|
437 | i = BACKUP_MISSION_TIMELINE; | |
|
438 | break; | |
|
439 | case SID_TC_DIRECT_CMD: | |
|
440 | i = DIRECT_CMD; | |
|
441 | break; | |
|
442 | case SID_TC_SPARE_GRD_SRC1: | |
|
443 | i = SPARE_GRD_SRC1; | |
|
444 | break; | |
|
445 | case SID_TC_SPARE_GRD_SRC2: | |
|
446 | i = SPARE_GRD_SRC2; | |
|
447 | break; | |
|
448 | case SID_TC_OBCP: | |
|
449 | i = OBCP; | |
|
450 | break; | |
|
451 | case SID_TC_SYSTEM_CONTROL: | |
|
452 | i = SYSTEM_CONTROL; | |
|
453 | break; | |
|
454 | case SID_TC_AOCS: | |
|
455 | i = AOCS; | |
|
456 | break; | |
|
457 | case SID_TC_RPW_INTERNAL: | |
|
458 | i = RPW_INTERNAL; | |
|
459 | break; | |
|
460 | default: | |
|
461 | i = UNKNOWN; | |
|
462 | break; | |
|
463 | } | |
|
464 | ||
|
465 | if (i != UNKNOWN) | |
|
466 | { | |
|
467 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; | |
|
468 | sequence_cnt = sequenceCounters_TC_EXE[ i ] & 0x3fff; | |
|
469 | ||
|
470 | new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ; | |
|
471 | ||
|
472 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); | |
|
473 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); | |
|
474 | ||
|
475 | // increment the seuqence counter for the next packet | |
|
476 | if ( sequenceCounters_TC_EXE[ i ] < SEQ_CNT_MAX) | |
|
477 | { | |
|
478 | sequenceCounters_TC_EXE[ i ] = sequenceCounters_TC_EXE[ i ] + 1; | |
|
479 | } | |
|
480 | else | |
|
481 | { | |
|
482 | sequenceCounters_TC_EXE[ i ] = 0; | |
|
483 | } | |
|
484 | } | |
|
485 | else | |
|
486 | { | |
|
487 | PRINTF1("in increment_seq_counter_destination_id *** ERR destination ID %d not known\n", destination_id) | |
|
488 | } | |
|
489 | ||
|
490 | } |
@@ -1,1172 +1,1219 | |||
|
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 | headerSWF[ i ].sid = sid; | |
|
537 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; | |
|
538 | 536 | headerSWF[ i ].time[0] = 0x00; |
|
539 | 537 | headerSWF[ i ].time[0] = 0x00; |
|
540 | 538 | headerSWF[ i ].time[0] = 0x00; |
|
541 | 539 | headerSWF[ i ].time[0] = 0x00; |
|
542 | 540 | headerSWF[ i ].time[0] = 0x00; |
|
543 | 541 | headerSWF[ i ].time[0] = 0x00; |
|
542 | headerSWF[ i ].sid = sid; | |
|
543 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; | |
|
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 | // SET PACKET SEQUENCE COUNTER | |
|
736 | increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid ); | |
|
735 | 737 | // SET PACKET TIME |
|
736 | 738 | headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
737 | 739 | headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
738 | 740 | headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
739 | 741 | headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); |
|
740 | 742 | headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
741 | 743 | headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); |
|
742 | 744 | headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
743 | 745 | headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
744 | 746 | headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
745 | 747 | headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
746 | 748 | headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
747 | 749 | headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); |
|
748 | 750 | // SEND PACKET |
|
749 | 751 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
750 | 752 | if (status != RTEMS_SUCCESSFUL) { |
|
751 | 753 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
752 | 754 | ret = LFR_DEFAULT; |
|
753 | 755 | } |
|
754 | 756 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds |
|
755 | 757 | } |
|
756 | 758 | |
|
757 | 759 | return ret; |
|
758 | 760 | } |
|
759 | 761 | |
|
760 | 762 | int send_waveform_CWF(volatile int *waveform, unsigned int sid, |
|
761 | 763 | Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
762 | 764 | { |
|
763 | 765 | /** This function sends CWF CCSDS packets (F2, F1 or F0). |
|
764 | 766 | * |
|
765 | 767 | * @param waveform points to the buffer containing the data that will be send. |
|
766 | 768 | * @param sid is the source identifier of the data that will be sent. |
|
767 | 769 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
768 | 770 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
769 | 771 | * contain information to setup the transmission of the data packets. |
|
770 | 772 | * |
|
771 | 773 | * One group of 2048 samples is sent as 7 consecutive packets, 6 packets containing 340 blocks and 8 packets containing 8 blocks. |
|
772 | 774 | * |
|
773 | 775 | */ |
|
774 | 776 | |
|
775 | 777 | unsigned int i; |
|
776 | 778 | int ret; |
|
777 | 779 | rtems_status_code status; |
|
778 | 780 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
779 | 781 | |
|
780 | 782 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
781 | 783 | spw_ioctl_send_CWF.options = 0; |
|
782 | 784 | |
|
783 | 785 | ret = LFR_DEFAULT; |
|
784 | 786 | |
|
785 | 787 | for (i=0; i<7; i++) // send waveform |
|
786 | 788 | { |
|
787 | 789 | int coarseTime = 0x00; |
|
788 | 790 | int fineTime = 0x00; |
|
789 | 791 | spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; |
|
790 | 792 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
791 | 793 | // BUILD THE DATA |
|
792 | 794 | if (i==6) { |
|
793 | 795 | spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK; |
|
794 | 796 | } |
|
795 | 797 | else { |
|
796 | 798 | spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK; |
|
797 | 799 | } |
|
800 | // SET PACKET SEQUENCE COUNTER | |
|
801 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid ); | |
|
798 | 802 | // SET PACKET TIME |
|
799 | 803 | coarseTime = time_management_regs->coarse_time; |
|
800 | 804 | fineTime = time_management_regs->fine_time; |
|
801 | 805 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); |
|
802 | 806 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); |
|
803 | 807 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); |
|
804 | 808 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); |
|
805 | 809 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); |
|
806 | 810 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); |
|
807 | 811 | headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24); |
|
808 | 812 | headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16); |
|
809 | 813 | headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8); |
|
810 | 814 | headerCWF[ i ].time[3] = (unsigned char) (coarseTime); |
|
811 | 815 | headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8); |
|
812 | 816 | headerCWF[ i ].time[5] = (unsigned char) (fineTime); |
|
813 | 817 | // SEND PACKET |
|
814 | 818 | if (sid == SID_NORM_CWF_F3) |
|
815 | 819 | { |
|
816 | 820 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
817 | 821 | if (status != RTEMS_SUCCESSFUL) { |
|
818 | 822 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
819 | 823 | ret = LFR_DEFAULT; |
|
820 | 824 | } |
|
821 | 825 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
822 | 826 | } |
|
823 | 827 | else |
|
824 | 828 | { |
|
825 | 829 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
826 | 830 | if (status != RTEMS_SUCCESSFUL) { |
|
827 | 831 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
828 | 832 | ret = LFR_DEFAULT; |
|
829 | 833 | } |
|
830 | 834 | } |
|
831 | 835 | } |
|
832 | 836 | |
|
833 | 837 | return ret; |
|
834 | 838 | } |
|
835 | 839 | |
|
836 | 840 | int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id) |
|
837 | 841 | { |
|
838 | 842 | /** This function sends CWF_F3 CCSDS packets without the b1, b2 and b3 data. |
|
839 | 843 | * |
|
840 | 844 | * @param waveform points to the buffer containing the data that will be send. |
|
841 | 845 | * @param headerCWF points to a table of headers that have been prepared for the data transmission. |
|
842 | 846 | * @param queue_id is the id of the rtems queue to which spw_ioctl_pkt_send structures will be send. The structures |
|
843 | 847 | * contain information to setup the transmission of the data packets. |
|
844 | 848 | * |
|
845 | 849 | * By default, CWF_F3 packet are send without the b1, b2 and b3 data. This function rebuilds a data buffer |
|
846 | 850 | * from the incoming data and sends it in 7 packets, 6 containing 340 blocks and 1 one containing 8 blocks. |
|
847 | 851 | * |
|
848 | 852 | */ |
|
849 | 853 | |
|
850 | 854 | unsigned int i; |
|
851 | 855 | int ret; |
|
852 | 856 | rtems_status_code status; |
|
853 | 857 | spw_ioctl_pkt_send spw_ioctl_send_CWF; |
|
854 | 858 | char *sample; |
|
855 | 859 | |
|
856 | 860 | spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header |
|
857 | 861 | spw_ioctl_send_CWF.options = 0; |
|
858 | 862 | |
|
859 | 863 | ret = LFR_DEFAULT; |
|
860 | 864 | |
|
861 | 865 | //********************** |
|
862 | 866 | // BUILD CWF3_light DATA |
|
863 | 867 | for ( i=0; i< 2048; i++) |
|
864 | 868 | { |
|
865 | 869 | sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ]; |
|
866 | 870 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ]; |
|
867 | 871 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ]; |
|
868 | 872 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ]; |
|
869 | 873 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ]; |
|
870 | 874 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ]; |
|
871 | 875 | wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ]; |
|
872 | 876 | } |
|
873 | 877 | |
|
874 | 878 | //********************* |
|
875 | 879 | // SEND CWF3_light DATA |
|
876 | 880 | |
|
877 | 881 | for (i=0; i<7; i++) // send waveform |
|
878 | 882 | { |
|
879 | 883 | int coarseTime = 0x00; |
|
880 | 884 | int fineTime = 0x00; |
|
881 | 885 | spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * 340 * NB_BYTES_CWF3_LIGHT_BLK) ]; |
|
882 | 886 | spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ]; |
|
883 | 887 | // BUILD THE DATA |
|
884 | 888 | if ( i == WFRM_INDEX_OF_LAST_PACKET ) { |
|
885 | 889 | spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_CWF3_LIGHT_BLK; |
|
886 | 890 | } |
|
887 | 891 | else { |
|
888 | 892 | spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK; |
|
889 | 893 | } |
|
894 | // SET PACKET SEQUENCE COUNTER | |
|
895 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 ); | |
|
890 | 896 | // SET PACKET TIME |
|
891 | 897 | coarseTime = time_management_regs->coarse_time; |
|
892 | 898 | fineTime = time_management_regs->fine_time; |
|
893 | 899 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); |
|
894 | 900 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); |
|
895 | 901 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); |
|
896 | 902 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); |
|
897 | 903 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); |
|
898 | 904 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); |
|
899 | 905 | headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24); |
|
900 | 906 | headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16); |
|
901 | 907 | headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8); |
|
902 | 908 | headerCWF[ i ].time[3] = (unsigned char) (coarseTime); |
|
903 | 909 | headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8); |
|
904 | 910 | headerCWF[ i ].time[5] = (unsigned char) (fineTime); |
|
905 | 911 | // SEND PACKET |
|
906 | 912 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
907 | 913 | if (status != RTEMS_SUCCESSFUL) { |
|
908 | 914 | printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status); |
|
909 | 915 | ret = LFR_DEFAULT; |
|
910 | 916 | } |
|
911 | 917 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
912 | 918 | } |
|
913 | 919 | |
|
914 | 920 | return ret; |
|
915 | 921 | } |
|
916 | 922 | |
|
917 | 923 | |
|
918 | 924 | //************** |
|
919 | 925 | // wfp registers |
|
920 | 926 | void set_wfp_data_shaping() |
|
921 | 927 | { |
|
922 | 928 | /** This function sets the data_shaping register of the waveform picker module. |
|
923 | 929 | * |
|
924 | 930 | * The value is read from one field of the parameter_dump_packet structure:\n |
|
925 | 931 | * bw_sp0_sp1_r0_r1 |
|
926 | 932 | * |
|
927 | 933 | */ |
|
928 | 934 | |
|
929 | 935 | unsigned char data_shaping; |
|
930 | 936 | |
|
931 | 937 | // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register |
|
932 | 938 | // waveform picker : [R1 R0 SP1 SP0 BW] |
|
933 | 939 | |
|
934 | 940 | data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1; |
|
935 | 941 | |
|
936 | 942 | #ifdef GSA |
|
937 | 943 | #else |
|
938 | 944 | waveform_picker_regs->data_shaping = |
|
939 | 945 | ( (data_shaping & 0x10) >> 4 ) // BW |
|
940 | 946 | + ( (data_shaping & 0x08) >> 2 ) // SP0 |
|
941 | 947 | + ( (data_shaping & 0x04) ) // SP1 |
|
942 | 948 | + ( (data_shaping & 0x02) << 2 ) // R0 |
|
943 | 949 | + ( (data_shaping & 0x01) << 4 ); // R1 |
|
944 | 950 | #endif |
|
945 | 951 | } |
|
946 | 952 | |
|
947 | 953 | char set_wfp_delta_snapshot() |
|
948 | 954 | { |
|
949 | 955 | /** This function sets the delta_snapshot register of the waveform picker module. |
|
950 | 956 | * |
|
951 | 957 | * The value is read from two (unsigned char) of the parameter_dump_packet structure: |
|
952 | 958 | * - sy_lfr_n_swf_p[0] |
|
953 | 959 | * - sy_lfr_n_swf_p[1] |
|
954 | 960 | * |
|
955 | 961 | */ |
|
956 | 962 | |
|
957 | 963 | char ret; |
|
958 | 964 | unsigned int delta_snapshot; |
|
959 | 965 | unsigned int aux; |
|
960 | 966 | |
|
961 | 967 | aux = 0; |
|
962 | 968 | ret = LFR_DEFAULT; |
|
963 | 969 | |
|
964 | 970 | delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256 |
|
965 | 971 | + parameter_dump_packet.sy_lfr_n_swf_p[1]; |
|
966 | 972 | |
|
967 | 973 | #ifdef GSA |
|
968 | 974 | #else |
|
969 | 975 | if ( delta_snapshot < MIN_DELTA_SNAPSHOT ) |
|
970 | 976 | { |
|
971 | 977 | aux = MIN_DELTA_SNAPSHOT; |
|
972 | 978 | ret = LFR_DEFAULT; |
|
973 | 979 | } |
|
974 | 980 | else |
|
975 | 981 | { |
|
976 | 982 | aux = delta_snapshot ; |
|
977 | 983 | ret = LFR_SUCCESSFUL; |
|
978 | 984 | } |
|
979 | 985 | waveform_picker_regs->delta_snapshot = aux - 1; // max 2 bytes |
|
980 | 986 | #endif |
|
981 | 987 | |
|
982 | 988 | return ret; |
|
983 | 989 | } |
|
984 | 990 | |
|
985 | 991 | void set_wfp_burst_enable_register( unsigned char mode) |
|
986 | 992 | { |
|
987 | 993 | /** This function sets the waveform picker burst_enable register depending on the mode. |
|
988 | 994 | * |
|
989 | 995 | * @param mode is the LFR mode to launch. |
|
990 | 996 | * |
|
991 | 997 | * The burst bits shall be before the enable bits. |
|
992 | 998 | * |
|
993 | 999 | */ |
|
994 | 1000 | |
|
995 | 1001 | #ifdef GSA |
|
996 | 1002 | #else |
|
997 | 1003 | // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0 |
|
998 | 1004 | // the burst bits shall be set first, before the enable bits |
|
999 | 1005 | switch(mode) { |
|
1000 | 1006 | case(LFR_MODE_NORMAL): |
|
1001 | 1007 | waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enable |
|
1002 | 1008 | waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0 |
|
1003 | 1009 | break; |
|
1004 | 1010 | case(LFR_MODE_BURST): |
|
1005 | 1011 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1006 | 1012 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2 |
|
1007 | 1013 | break; |
|
1008 | 1014 | case(LFR_MODE_SBM1): |
|
1009 | 1015 | waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled |
|
1010 | 1016 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1011 | 1017 | break; |
|
1012 | 1018 | case(LFR_MODE_SBM2): |
|
1013 | 1019 | waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled |
|
1014 | 1020 | waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0 |
|
1015 | 1021 | break; |
|
1016 | 1022 | default: |
|
1017 | 1023 | waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled |
|
1018 | 1024 | break; |
|
1019 | 1025 | } |
|
1020 | 1026 | #endif |
|
1021 | 1027 | } |
|
1022 | 1028 | |
|
1023 | 1029 | void reset_wfp_burst_enable() |
|
1024 | 1030 | { |
|
1025 | 1031 | /** This function resets the waveform picker burst_enable register. |
|
1026 | 1032 | * |
|
1027 | 1033 | * The burst bits [f2 f1 f0] and the enable bits [f3 f2 f1 f0] are set to 0. |
|
1028 | 1034 | * |
|
1029 | 1035 | */ |
|
1030 | 1036 | |
|
1031 | 1037 | #ifdef GSA |
|
1032 | 1038 | #else |
|
1033 | 1039 | waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1034 | 1040 | #endif |
|
1035 | 1041 | } |
|
1036 | 1042 | |
|
1037 | 1043 | void reset_wfp_status() |
|
1038 | 1044 | { |
|
1039 | 1045 | /** This function resets the waveform picker status register. |
|
1040 | 1046 | * |
|
1041 | 1047 | * All status bits are set to 0 [new_err full_err full]. |
|
1042 | 1048 | * |
|
1043 | 1049 | */ |
|
1044 | 1050 | |
|
1045 | 1051 | #ifdef GSA |
|
1046 | 1052 | #else |
|
1047 | 1053 | waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0 |
|
1048 | 1054 | #endif |
|
1049 | 1055 | } |
|
1050 | 1056 | |
|
1051 | 1057 | void reset_waveform_picker_regs() |
|
1052 | 1058 | { |
|
1053 | 1059 | /** This function resets the waveform picker module registers. |
|
1054 | 1060 | * |
|
1055 | 1061 | * The registers affected by this function are located at the following offset addresses: |
|
1056 | 1062 | * - 0x00 data_shaping |
|
1057 | 1063 | * - 0x04 burst_enable |
|
1058 | 1064 | * - 0x08 addr_data_f0 |
|
1059 | 1065 | * - 0x0C addr_data_f1 |
|
1060 | 1066 | * - 0x10 addr_data_f2 |
|
1061 | 1067 | * - 0x14 addr_data_f3 |
|
1062 | 1068 | * - 0x18 status |
|
1063 | 1069 | * - 0x1C delta_snapshot |
|
1064 | 1070 | * - 0x20 delta_f2_f1 |
|
1065 | 1071 | * - 0x24 delta_f2_f0 |
|
1066 | 1072 | * - 0x28 nb_burst |
|
1067 | 1073 | * - 0x2C nb_snapshot |
|
1068 | 1074 | * |
|
1069 | 1075 | */ |
|
1070 | 1076 | |
|
1071 | 1077 | #ifdef GSA |
|
1072 | 1078 | #else |
|
1073 | 1079 | reset_wfp_burst_enable(); |
|
1074 | 1080 | reset_wfp_status(); |
|
1075 | 1081 | // set buffer addresses |
|
1076 | 1082 | waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // |
|
1077 | 1083 | waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); // |
|
1078 | 1084 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); // |
|
1079 | 1085 | waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); // |
|
1080 | 1086 | // set other parameters |
|
1081 | 1087 | set_wfp_data_shaping(); |
|
1082 | 1088 | set_wfp_delta_snapshot(); // time in seconds between two snapshots |
|
1083 | 1089 | waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes) |
|
1084 | 1090 | waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes) |
|
1085 | 1091 | waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets) |
|
1086 | 1092 | waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1 |
|
1087 | 1093 | #endif |
|
1088 | 1094 | } |
|
1089 | 1095 | |
|
1090 | 1096 | //***************** |
|
1091 | 1097 | // local parameters |
|
1092 | 1098 | void set_local_sbm1_nb_cwf_max() |
|
1093 | 1099 | { |
|
1094 | 1100 | /** This function sets the value of the sbm1_nb_cwf_max local parameter. |
|
1095 | 1101 | * |
|
1096 | 1102 | * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n |
|
1097 | 1103 | * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active.\n\n |
|
1098 | 1104 | * (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot) |
|
1099 | 1105 | * |
|
1100 | 1106 | */ |
|
1101 | 1107 | param_local.local_sbm1_nb_cwf_max = 2 * |
|
1102 | 1108 | (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256 |
|
1103 | 1109 | + parameter_dump_packet.sy_lfr_n_swf_p[1]) - 8; // 16 CWF1 parts during 1 SWF2 |
|
1104 | 1110 | } |
|
1105 | 1111 | |
|
1106 | 1112 | void set_local_sbm2_nb_cwf_max() |
|
1107 | 1113 | { |
|
1108 | 1114 | /** This function sets the value of the sbm1_nb_cwf_max local parameter. |
|
1109 | 1115 | * |
|
1110 | 1116 | * The sbm1_nb_cwf_max parameter counts the number of CWF_F1 records that have been sent.\n |
|
1111 | 1117 | * This parameter is used to send CWF_F2 data as normal data when the SBM2 is active.\n\n |
|
1112 | 1118 | * (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz) |
|
1113 | 1119 | * |
|
1114 | 1120 | */ |
|
1115 | 1121 | |
|
1116 | 1122 | param_local.local_sbm2_nb_cwf_max = (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256 |
|
1117 | 1123 | + parameter_dump_packet.sy_lfr_n_swf_p[1]) / 8; |
|
1118 | 1124 | } |
|
1119 | 1125 | |
|
1120 | 1126 | void set_local_nb_interrupt_f0_MAX() |
|
1121 | 1127 | { |
|
1122 | 1128 | /** This function sets the value of the nb_interrupt_f0_MAX local parameter. |
|
1123 | 1129 | * |
|
1124 | 1130 | * This parameter is used for the SM validation only.\n |
|
1125 | 1131 | * The software waits param_local.local_nb_interrupt_f0_MAX interruptions from the spectral matrices |
|
1126 | 1132 | * module before launching a basic processing. |
|
1127 | 1133 | * |
|
1128 | 1134 | */ |
|
1129 | 1135 | |
|
1130 | 1136 | param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256 |
|
1131 | 1137 | + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100; |
|
1132 | 1138 | } |
|
1133 | 1139 | |
|
1134 | 1140 | void reset_local_sbm1_nb_cwf_sent() |
|
1135 | 1141 | { |
|
1136 | 1142 | /** This function resets the value of the sbm1_nb_cwf_sent local parameter. |
|
1137 | 1143 | * |
|
1138 | 1144 | * The sbm1_nb_cwf_sent parameter counts the number of CWF_F1 records that have been sent.\n |
|
1139 | 1145 | * This parameter is used to send CWF_F1 data as normal data when the SBM1 is active. |
|
1140 | 1146 | * |
|
1141 | 1147 | */ |
|
1142 | 1148 | |
|
1143 | 1149 | param_local.local_sbm1_nb_cwf_sent = 0; |
|
1144 | 1150 | } |
|
1145 | 1151 | |
|
1146 | 1152 | void reset_local_sbm2_nb_cwf_sent() |
|
1147 | 1153 | { |
|
1148 | 1154 | /** This function resets the value of the sbm2_nb_cwf_sent local parameter. |
|
1149 | 1155 | * |
|
1150 | 1156 | * The sbm2_nb_cwf_sent parameter counts the number of CWF_F2 records that have been sent.\n |
|
1151 | 1157 | * This parameter is used to send CWF_F2 data as normal data when the SBM2 mode is active. |
|
1152 | 1158 | * |
|
1153 | 1159 | */ |
|
1154 | 1160 | |
|
1155 | 1161 | param_local.local_sbm2_nb_cwf_sent = 0; |
|
1156 | 1162 | } |
|
1157 | 1163 | |
|
1158 | 1164 | rtems_id get_pkts_queue_id( void ) |
|
1159 | 1165 | { |
|
1160 | 1166 | rtems_id queue_id; |
|
1161 | 1167 | rtems_status_code status; |
|
1162 | 1168 | rtems_name queue_send_name; |
|
1163 | 1169 | |
|
1164 | 1170 | queue_send_name = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
1165 | 1171 | |
|
1166 | 1172 | status = rtems_message_queue_ident( queue_send_name, 0, &queue_id ); |
|
1167 | 1173 | if (status != RTEMS_SUCCESSFUL) |
|
1168 | 1174 | { |
|
1169 | 1175 | PRINTF1("in get_pkts_queue_id *** ERR %d\n", status) |
|
1170 | 1176 | } |
|
1171 | 1177 | return queue_id; |
|
1172 | 1178 | } |
|
1179 | ||
|
1180 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ) | |
|
1181 | { | |
|
1182 | unsigned short *sequence_cnt; | |
|
1183 | unsigned short segmentation_grouping_flag; | |
|
1184 | unsigned short new_packet_sequence_control; | |
|
1185 | ||
|
1186 | if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2) | |
|
1187 | || (sid ==SID_BURST_CWF_F2) ) | |
|
1188 | { | |
|
1189 | sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST; | |
|
1190 | } | |
|
1191 | else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) ) | |
|
1192 | { | |
|
1193 | sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2; | |
|
1194 | } | |
|
1195 | else | |
|
1196 | { | |
|
1197 | sequence_cnt = &sequenceCounters_TC_EXE[ UNKNOWN ]; | |
|
1198 | PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid) | |
|
1199 | } | |
|
1200 | ||
|
1201 | segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8; | |
|
1202 | *sequence_cnt = (*sequence_cnt) & 0x3fff; | |
|
1203 | ||
|
1204 | new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ; | |
|
1205 | ||
|
1206 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); | |
|
1207 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); | |
|
1208 | ||
|
1209 | // increment the seuqence counter for the next packet | |
|
1210 | if ( *sequence_cnt < SEQ_CNT_MAX) | |
|
1211 | { | |
|
1212 | *sequence_cnt = *sequence_cnt + 1; | |
|
1213 | } | |
|
1214 | else | |
|
1215 | { | |
|
1216 | *sequence_cnt = 0; | |
|
1217 | } | |
|
1218 | ||
|
1219 | } |
General Comments 0
You need to be logged in to leave comments.
Login now