##// END OF EJS Templates
Bug 596...
paul -
r68:8128a81f2c21 VHDLib206
parent child
Show More
@@ -1,7 +1,9
1 1 syntax: glob
2 2 *.pdf
3 3 *~
4 4 *.o
5 5 tests/*.err
6 6 doc
7 *.srec
8 FSW-qt/bin/fsw
7 9
@@ -1,248 +1,248
1 1 #############################################################################
2 2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Nov 12 13:28:25 2013
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Wed Nov 13 08:18:19 2013
4 4 # Project: fsw-qt.pro
5 5 # Template: app
6 6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
7 7 #############################################################################
8 8
9 9 ####### Compiler, tools and options
10 10
11 11 CC = sparc-rtems-gcc
12 12 CXX = sparc-rtems-g++
13 DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=21 -DPRINT_MESSAGES_ON_CONSOLE
13 DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=22 -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,78 +1,78
1 1 TEMPLATE = app
2 2 # CONFIG += console v8 sim
3 3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** gsa
4 4 CONFIG += console verbose
5 5 CONFIG -= qt
6 6
7 7 include(./sparc.pri)
8 8
9 9 # flight software version
10 SWVERSION=-0-21
10 SWVERSION=-0-22
11 11 DEFINES += SW_VERSION_N1=0
12 12 DEFINES += SW_VERSION_N2=0
13 13 DEFINES += SW_VERSION_N3=0
14 DEFINES += SW_VERSION_N4=21
14 DEFINES += SW_VERSION_N4=22
15 15
16 16 contains( CONFIG, verbose ) {
17 17 DEFINES += PRINT_MESSAGES_ON_CONSOLE
18 18 }
19 19
20 20 contains( CONFIG, debug_messages ) {
21 21 DEFINES += DEBUG_MESSAGES
22 22 }
23 23
24 24 contains( CONFIG, cpu_usage_report ) {
25 25 DEFINES += PRINT_TASK_STATISTICS
26 26 }
27 27
28 28 contains( CONFIG, stack_report ) {
29 29 DEFINES += PRINT_STACK_REPORT
30 30 }
31 31
32 32 contains( CONFIG, boot_messages ) {
33 33 DEFINES += BOOT_MESSAGES
34 34 }
35 35
36 36 #doxygen.target = doxygen
37 37 #doxygen.commands = doxygen ../doc/Doxyfile
38 38 #QMAKE_EXTRA_TARGETS += doxygen
39 39
40 40 TARGET = fsw
41 41 contains( CONFIG, gsa ) {
42 42 DEFINES += GSA
43 43 TARGET = fsw-gsa
44 44 }
45 45
46 46 INCLUDEPATH += \
47 47 ../src \
48 48 ../header
49 49
50 50 SOURCES += \
51 51 ../src/wf_handler.c \
52 52 ../src/tc_handler.c \
53 53 ../src/fsw_processing.c \
54 54 ../src/fsw_misc.c \
55 55 ../src/fsw_init.c \
56 56 ../src/fsw_globals.c \
57 57 ../src/fsw_spacewire.c \
58 58 ../src/tc_load_dump_parameters.c \
59 59 ../src/tm_lfr_tc_exe.c \
60 60 ../src/tc_acceptance.c
61 61
62 62
63 63 HEADERS += \
64 64 ../header/wf_handler.h \
65 65 ../header/tc_handler.h \
66 66 ../header/grlib_regs.h \
67 67 ../header/fsw_processing.h \
68 68 ../header/fsw_params.h \
69 69 ../header/fsw_misc.h \
70 70 ../header/fsw_init.h \
71 71 ../header/ccsds_types.h \
72 72 ../header/fsw_params_processing.h \
73 73 ../header/fsw_spacewire.h \
74 74 ../header/tm_byte_positions.h \
75 75 ../header/tc_load_dump_parameters.h \
76 76 ../header/tm_lfr_tc_exe.h \
77 77 ../header/tc_acceptance.h
78 78
@@ -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-12T14:12:08. -->
3 <!-- Written by QtCreator 2.8.1, 2013-11-13T08:16:16. -->
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,28 +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 8 #include "fsw_spacewire.h"
9 9
10 10 extern time_management_regs_t *time_management_regs;
11 11 extern Packet_TM_LFR_HK_t housekeeping_packet;
12 12 extern unsigned short sequenceCounters_TC_EXE[];
13 13
14 14 int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
15 15 int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
16 16 unsigned char byte_position, unsigned char rcv_value);
17 17 int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
18 18 int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
19 19 int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
20 20 int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
21 unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV);
21 unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV, unsigned char destinationID);
22 22
23 23 void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id );
24 24
25 25 #endif // TM_LFR_TC_EXE_H_INCLUDED
26 26
27 27
28 28
@@ -1,612 +1,621
1 1 /** Functions related to the SpaceWire interface.
2 2 *
3 3 * @file
4 4 * @author P. LEROY
5 5 *
6 6 * A group of functions to handle SpaceWire transmissions:
7 7 * - configuration of the SpaceWire link
8 8 * - SpaceWire related interruption requests processing
9 9 * - transmission of TeleMetry packets by a dedicated RTEMS task
10 10 * - reception of TeleCommands by a dedicated RTEMS task
11 11 *
12 12 */
13 13
14 14 #include "fsw_spacewire.h"
15 15
16 16 char *lstates[6] = {"Error-reset",
17 17 "Error-wait",
18 18 "Ready",
19 19 "Started",
20 20 "Connecting",
21 21 "Run"
22 22 };
23 23
24 24 rtems_name semq_name;
25 25 rtems_id semq_id;
26 26
27 27 //***********
28 28 // RTEMS TASK
29 29 rtems_task spiq_task(rtems_task_argument unused)
30 30 {
31 31 /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver.
32 32 *
33 33 * @param unused is the starting argument of the RTEMS task
34 34 *
35 35 */
36 36
37 37 rtems_event_set event_out;
38 38 rtems_status_code status;
39 39 int linkStatus;
40 40
41 41 BOOT_PRINTF("in SPIQ *** \n")
42 42
43 43 while(true){
44 44 rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT
45 45 PRINTF("in SPIQ *** got SPW_LINKERR_EVENT\n")
46 46
47 47 // [0] SUSPEND RECV AND SEND TASKS
48 48 rtems_task_suspend( Task_id[ TASKID_RECV ] );
49 49 rtems_task_suspend( Task_id[ TASKID_SEND ] );
50 50
51 51 // [1] CHECK THE LINK
52 52 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1)
53 53 if ( linkStatus != 5) {
54 54 PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus)
55 55 rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms
56 56 }
57 57
58 58 // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT
59 59 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2)
60 60 if ( linkStatus != 5 ) // [2.a] not in run state, reset the link
61 61 {
62 62 spacewire_compute_stats_offsets();
63 63 status = spacewire_reset_link( );
64 64 }
65 65 else // [2.b] in run state, start the link
66 66 {
67 67 status = spacewire_stop_start_link( fdSPW ); // start the link
68 68 if ( status != RTEMS_SUCCESSFUL)
69 69 {
70 70 PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status)
71 71 }
72 72 }
73 73
74 74 // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS
75 75 if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully
76 76 {
77 77 status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 );
78 78 if ( status != RTEMS_SUCCESSFUL ) {
79 79 PRINTF("in SPIQ *** ERR resuming SEND Task\n")
80 80 }
81 81 status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 );
82 82 if ( status != RTEMS_SUCCESSFUL ) {
83 83 PRINTF("in SPIQ *** ERR resuming RECV Task\n")
84 84 }
85 85 }
86 86 else // [3.b] the link is not in run state, go in STANDBY mode
87 87 {
88 88 status = stop_current_mode();
89 89 if ( status != RTEMS_SUCCESSFUL ) {
90 90 PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status)
91 91 }
92 92 status = enter_standby_mode();
93 93 if ( status != RTEMS_SUCCESSFUL ) {
94 94 PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status)
95 95 }
96 96 // wake the WTDG task up to wait for the link recovery
97 97 status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 );
98 98 rtems_task_suspend( RTEMS_SELF );
99 99 }
100 100 }
101 101 }
102 102
103 103 rtems_task recv_task( rtems_task_argument unused )
104 104 {
105 105 /** This RTEMS task is dedicated to the reception of incoming TeleCommands.
106 106 *
107 107 * @param unused is the starting argument of the RTEMS task
108 108 *
109 109 * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked:
110 110 * 1. It reads the incoming data.
111 111 * 2. Launches the acceptance procedure.
112 112 * 3. If the Telecommand is valid, sends it to a dedicated RTEMS message queue.
113 113 *
114 114 */
115 115
116 116 int len;
117 117 ccsdsTelecommandPacket_t currentTC;
118 118 unsigned char computed_CRC[ 2 ];
119 119 unsigned char currentTC_LEN_RCV[ 2 ];
120 unsigned char destinationID;
120 121 unsigned int currentTC_LEN_RCV_AsUnsignedInt;
121 122 unsigned int parserCode;
122 123 rtems_status_code status;
123 124 rtems_id queue_recv_id;
124 125 rtems_id queue_send_id;
125 126
126 127 initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes
127 128
128 129 status = rtems_message_queue_ident( misc_name[QUEUE_RECV], 0, &queue_recv_id );
129 130 if (status != RTEMS_SUCCESSFUL)
130 131 {
131 132 PRINTF1("in RECV *** ERR getting QUEUE_RECV id, %d\n", status)
132 133 }
133 134
134 135 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_send_id );
135 136 if (status != RTEMS_SUCCESSFUL)
136 137 {
137 138 PRINTF1("in RECV *** ERR getting QUEUE_SEND id, %d\n", status)
138 139 }
139 140
140 141 BOOT_PRINTF("in RECV *** \n")
141 142
142 143 while(1)
143 144 {
144 145 len = read( fdSPW, (char*) &currentTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking
145 146 if (len == -1){ // error during the read call
146 147 PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno)
147 148 }
148 149 else {
149 150 if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) {
150 151 PRINTF("in RECV *** packet lenght too short\n")
151 152 }
152 153 else {
153 154 currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes
154 155 currentTC_LEN_RCV[ 0 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt >> 8);
155 156 currentTC_LEN_RCV[ 1 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt );
156 157 // CHECK THE TC
157 158 parserCode = tc_parser( &currentTC, currentTC_LEN_RCV_AsUnsignedInt, computed_CRC ) ;
158 159 if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT)
159 160 || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE)
160 161 || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA)
161 162 || (parserCode == WRONG_SRC_ID) )
162 163 { // send TM_LFR_TC_EXE_CORRUPTED
163 164 if ( !( (currentTC.serviceType==TC_TYPE_TIME) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_TIME) )
164 165 &&
165 166 !( (currentTC.serviceType==TC_TYPE_GEN) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_INFO))
166 167 )
167 168 {
168 send_tm_lfr_tc_exe_corrupted( &currentTC, queue_send_id, computed_CRC, currentTC_LEN_RCV );
169 if ( parserCode == WRONG_SRC_ID )
170 {
171 destinationID = SID_TC_GROUND;
172 }
173 else
174 {
175 destinationID = currentTC.sourceID;
176 }
177 send_tm_lfr_tc_exe_corrupted( &currentTC, queue_send_id, computed_CRC, currentTC_LEN_RCV, destinationID );
169 178 }
170 179 }
171 180 else
172 181 { // send valid TC to the action launcher
173 182 status = rtems_message_queue_send( queue_recv_id, &currentTC,
174 183 currentTC_LEN_RCV_AsUnsignedInt + CCSDS_TC_TM_PACKET_OFFSET + 3);
175 184 }
176 185 }
177 186 }
178 187 }
179 188 }
180 189
181 190 rtems_task send_task( rtems_task_argument argument)
182 191 {
183 192 /** This RTEMS task is dedicated to the transmission of TeleMetry packets.
184 193 *
185 194 * @param unused is the starting argument of the RTEMS task
186 195 *
187 196 * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives:
188 197 * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call.
189 198 * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After
190 199 * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the
191 200 * data it contains.
192 201 *
193 202 */
194 203
195 204 rtems_status_code status; // RTEMS status code
196 205 char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer
197 206 spw_ioctl_pkt_send *spw_ioctl_send;
198 207 size_t size; // size of the incoming TC packet
199 208 u_int32_t count;
200 209 rtems_id queue_id;
201 210
202 211 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id );
203 212 if (status != RTEMS_SUCCESSFUL)
204 213 {
205 214 PRINTF1("in SEND *** ERR getting queue id, %d\n", status)
206 215 }
207 216
208 217 BOOT_PRINTF("in SEND *** \n")
209 218
210 219 while(1)
211 220 {
212 221 status = rtems_message_queue_receive( queue_id, incomingData, &size,
213 222 RTEMS_WAIT, RTEMS_NO_TIMEOUT );
214 223
215 224 if (status!=RTEMS_SUCCESSFUL)
216 225 {
217 226 PRINTF1("in SEND *** (1) ERR = %d\n", status)
218 227 }
219 228 else
220 229 {
221 230 if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet
222 231 {
223 232 status = write( fdSPW, incomingData, size );
224 233 if (status == -1){
225 234 PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size)
226 235 }
227 236 }
228 237 else // the incoming message is a spw_ioctl_pkt_send structure
229 238 {
230 239 spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData;
231 240 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send );
232 241 if (status == -1){
233 242 PRINTF2("in SEND *** (2.b) ERRNO = %d, RTEMS = %d\n", errno, status)
234 243 }
235 244 }
236 245 }
237 246
238 247 status = rtems_message_queue_get_number_pending( queue_id, &count );
239 248 if (status != RTEMS_SUCCESSFUL)
240 249 {
241 250 PRINTF1("in SEND *** (3) ERR = %d\n", status)
242 251 }
243 252 else
244 253 {
245 254 if (count > maxCount)
246 255 {
247 256 maxCount = count;
248 257 }
249 258 }
250 259 }
251 260 }
252 261
253 262 rtems_task wtdg_task( rtems_task_argument argument )
254 263 {
255 264 rtems_event_set event_out;
256 265 rtems_status_code status;
257 266 int linkStatus;
258 267
259 268 BOOT_PRINTF("in WTDG ***\n")
260 269
261 270 while(1)
262 271 {
263 272 // wait for an RTEMS_EVENT
264 273 rtems_event_receive( RTEMS_EVENT_0,
265 274 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
266 275 PRINTF("in WTDG *** wait for the link\n")
267 276 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
268 277 while( linkStatus != 5) // wait for the link
269 278 {
270 279 rtems_task_wake_after( 10 );
271 280 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
272 281 }
273 282
274 283 status = spacewire_stop_start_link( fdSPW );
275 284
276 285 if (status != RTEMS_SUCCESSFUL)
277 286 {
278 287 PRINTF1("in WTDG *** ERR link not started %d\n", status)
279 288 }
280 289 else
281 290 {
282 291 PRINTF("in WTDG *** OK link started\n")
283 292 }
284 293
285 294 // restart the SPIQ task
286 295 status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 );
287 296 if ( status != RTEMS_SUCCESSFUL ) {
288 297 PRINTF("in SPIQ *** ERR restarting SPIQ Task\n")
289 298 }
290 299
291 300 // restart RECV and SEND
292 301 status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 );
293 302 if ( status != RTEMS_SUCCESSFUL ) {
294 303 PRINTF("in SPIQ *** ERR restarting SEND Task\n")
295 304 }
296 305 status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 );
297 306 if ( status != RTEMS_SUCCESSFUL ) {
298 307 PRINTF("in SPIQ *** ERR restarting RECV Task\n")
299 308 }
300 309 }
301 310 }
302 311
303 312 //****************
304 313 // OTHER FUNCTIONS
305 314 int spacewire_open_link( void )
306 315 {
307 316 /** This function opens the SpaceWire link.
308 317 *
309 318 * @return a valid file descriptor in case of success, -1 in case of a failure
310 319 *
311 320 */
312 321 rtems_status_code status;
313 322
314 323 fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware
315 324 if ( fdSPW < 0 ) {
316 325 PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno)
317 326 }
318 327 else
319 328 {
320 329 status = RTEMS_SUCCESSFUL;
321 330 }
322 331
323 332 return status;
324 333 }
325 334
326 335 int spacewire_start_link( int fd )
327 336 {
328 337 rtems_status_code status;
329 338
330 339 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
331 340 // -1 default hardcoded driver timeout
332 341
333 342 return status;
334 343 }
335 344
336 345 int spacewire_stop_start_link( int fd )
337 346 {
338 347 rtems_status_code status;
339 348
340 349 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0
341 350 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
342 351 // -1 default hardcoded driver timeout
343 352
344 353 return status;
345 354 }
346 355
347 356 int spacewire_configure_link( int fd )
348 357 {
349 358 /** This function configures the SpaceWire link.
350 359 *
351 360 * @return GR-RTEMS-DRIVER directive status codes:
352 361 * - 22 EINVAL - Null pointer or an out of range value was given as the argument.
353 362 * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode.
354 363 * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used.
355 364 * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up.
356 365 * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers.
357 366 * - 5 EIO - Error when writing to grswp hardware registers.
358 367 * - 2 ENOENT - No such file or directory
359 368 */
360 369
361 370 rtems_status_code status;
362 371
363 372 spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force
364 373 spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration
365 374
366 375 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception
367 376 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n")
368 377 //
369 378 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a
370 379 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs
371 380 //
372 381 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts
373 382 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n")
374 383 //
375 384 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit
376 385 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
377 386 //
378 387 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks
379 388 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n")
380 389 //
381 390 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available
382 391 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n")
383 392 //
384 393 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ]
385 394 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n")
386 395
387 396 return status;
388 397 }
389 398
390 399 int spacewire_reset_link( void )
391 400 {
392 401 /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver.
393 402 *
394 403 * @return RTEMS directive status code:
395 404 * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s.
396 405 * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout.
397 406 *
398 407 */
399 408
400 409 rtems_status_code status_spw;
401 410 int i;
402 411
403 412 for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ )
404 413 {
405 414 PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i);
406 415
407 416 // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM
408 417
409 418 status_spw = spacewire_stop_start_link( fdSPW );
410 419 if ( status_spw != RTEMS_SUCCESSFUL )
411 420 {
412 421 PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw)
413 422 }
414 423
415 424 if ( status_spw == RTEMS_SUCCESSFUL)
416 425 {
417 426 break;
418 427 }
419 428 }
420 429
421 430 return status_spw;
422 431 }
423 432
424 433 void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force
425 434 {
426 435 /** This function sets the [N]o [P]ort force bit of the GRSPW control register.
427 436 *
428 437 * @param val is the value, 0 or 1, used to set the value of the NP bit.
429 438 * @param regAddr is the address of the GRSPW control register.
430 439 *
431 440 * NP is the bit 20 of the GRSPW control register.
432 441 *
433 442 */
434 443
435 444 unsigned int *spwptr = (unsigned int*) regAddr;
436 445
437 446 if (val == 1) {
438 447 *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit
439 448 }
440 449 if (val== 0) {
441 450 *spwptr = *spwptr & 0xffdfffff;
442 451 }
443 452 }
444 453
445 454 void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable
446 455 {
447 456 /** This function sets the [R]MAP [E]nable bit of the GRSPW control register.
448 457 *
449 458 * @param val is the value, 0 or 1, used to set the value of the RE bit.
450 459 * @param regAddr is the address of the GRSPW control register.
451 460 *
452 461 * RE is the bit 16 of the GRSPW control register.
453 462 *
454 463 */
455 464
456 465 unsigned int *spwptr = (unsigned int*) regAddr;
457 466
458 467 if (val == 1)
459 468 {
460 469 *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit
461 470 }
462 471 if (val== 0)
463 472 {
464 473 *spwptr = *spwptr & 0xfffdffff;
465 474 }
466 475 }
467 476
468 477 void spacewire_compute_stats_offsets( void )
469 478 {
470 479 /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising.
471 480 *
472 481 * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics
473 482 * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it
474 483 * during the open systel call).
475 484 *
476 485 */
477 486
478 487 spw_stats spacewire_stats_grspw;
479 488 rtems_status_code status;
480 489
481 490 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
482 491
483 492 spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received
484 493 + spacewire_stats.packets_received;
485 494 spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent
486 495 + spacewire_stats.packets_sent;
487 496 spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err
488 497 + spacewire_stats.parity_err;
489 498 spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err
490 499 + spacewire_stats.disconnect_err;
491 500 spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err
492 501 + spacewire_stats.escape_err;
493 502 spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err
494 503 + spacewire_stats.credit_err;
495 504 spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err
496 505 + spacewire_stats.write_sync_err;
497 506 spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err
498 507 + spacewire_stats.rx_rmap_header_crc_err;
499 508 spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err
500 509 + spacewire_stats.rx_rmap_data_crc_err;
501 510 spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep
502 511 + spacewire_stats.early_ep;
503 512 spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address
504 513 + spacewire_stats.invalid_address;
505 514 spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err
506 515 + spacewire_stats.rx_eep_err;
507 516 spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated
508 517 + spacewire_stats.rx_truncated;
509 518 }
510 519
511 520 void spacewire_update_statistics( void )
512 521 {
513 522 rtems_status_code status;
514 523 spw_stats spacewire_stats_grspw;
515 524
516 525 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
517 526
518 527 spacewire_stats.packets_received = spacewire_stats_backup.packets_received
519 528 + spacewire_stats_grspw.packets_received;
520 529 spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent
521 530 + spacewire_stats_grspw.packets_sent;
522 531 spacewire_stats.parity_err = spacewire_stats_backup.parity_err
523 532 + spacewire_stats_grspw.parity_err;
524 533 spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err
525 534 + spacewire_stats_grspw.disconnect_err;
526 535 spacewire_stats.escape_err = spacewire_stats_backup.escape_err
527 536 + spacewire_stats_grspw.escape_err;
528 537 spacewire_stats.credit_err = spacewire_stats_backup.credit_err
529 538 + spacewire_stats_grspw.credit_err;
530 539 spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err
531 540 + spacewire_stats_grspw.write_sync_err;
532 541 spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err
533 542 + spacewire_stats_grspw.rx_rmap_header_crc_err;
534 543 spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err
535 544 + spacewire_stats_grspw.rx_rmap_data_crc_err;
536 545 spacewire_stats.early_ep = spacewire_stats_backup.early_ep
537 546 + spacewire_stats_grspw.early_ep;
538 547 spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address
539 548 + spacewire_stats_grspw.invalid_address;
540 549 spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err
541 550 + spacewire_stats_grspw.rx_eep_err;
542 551 spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated
543 552 + spacewire_stats_grspw.rx_truncated;
544 553 //spacewire_stats.tx_link_err;
545 554
546 555 //****************************
547 556 // DPU_SPACEWIRE_IF_STATISTICS
548 557 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8);
549 558 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received);
550 559 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8);
551 560 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent);
552 561 //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt;
553 562 //housekeeping_packet.hk_lfr_dpu_spw_last_timc;
554 563
555 564 //******************************************
556 565 // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY
557 566 housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err;
558 567 housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err;
559 568 housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err;
560 569 housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err;
561 570 housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err;
562 571 // housekeeping_packet.hk_lfr_dpu_spw_rx_ahb;
563 572 // housekeeping_packet.hk_lfr_dpu_spw_tx_ahb;
564 573 housekeeping_packet.hk_lfr_dpu_spw_header_crc = (unsigned char) spacewire_stats.rx_rmap_header_crc_err;
565 574 housekeeping_packet.hk_lfr_dpu_spw_data_crc = (unsigned char) spacewire_stats.rx_rmap_data_crc_err;
566 575
567 576 //*********************************************
568 577 // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY
569 578 housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep;
570 579 housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address;
571 580 housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err;
572 581 housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated;
573 582
574 583 }
575 584
576 585 void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc )
577 586 {
578 587 //if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) {
579 588 // printf("In timecode_irq_handler *** Error sending event to DUMB\n");
580 589 //}
581 590 }
582 591
583 592 rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data )
584 593 {
585 594 int linkStatus;
586 595 rtems_status_code status;
587 596
588 597 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
589 598
590 599 if ( linkStatus == 5) {
591 600 PRINTF("in spacewire_reset_link *** link is running\n")
592 601 status = RTEMS_SUCCESSFUL;
593 602 }
594 603 }
595 604
596 605 rtems_status_code rtems_message_queue_send_lfr( rtems_id id, const void *buffer, size_t size )
597 606 {
598 607 rtems_status_code status;
599 608 rtems_mode previous_mode_set;
600 609
601 610 // set the preemption OFF
602 611 status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &previous_mode_set );
603 612
604 613 // use the message queue
605 614 status = rtems_message_queue_send_lfr( id, buffer, size );
606 615
607 616 // set the preemption ON
608 617 status = rtems_task_mode( RTEMS_PREEMPT , RTEMS_PREEMPT_MASK, &previous_mode_set );
609 618
610 619 return status;
611 620 }
612 621
@@ -1,415 +1,417
1 1 /** Functions related to TeleCommand acceptance.
2 2 *
3 3 * @file
4 4 * @author P. LEROY
5 5 *
6 6 * A group of functions to handle TeleCommands parsing.\n
7 7 *
8 8 */
9 9
10 10 #include "tc_acceptance.h"
11 11
12 12 unsigned int lookUpTableForCRC[256];
13 13
14 14 //**********************
15 15 // GENERAL USE FUNCTIONS
16 16 unsigned int Crc_opt( unsigned char D, unsigned int Chk)
17 17 {
18 18 /** This function generate the CRC for one byte and returns the value of the new syndrome.
19 19 *
20 20 * @param D is the current byte of data.
21 21 * @param Chk is the current syndrom value.
22 22 *
23 23 * @return the value of the new syndrome on two bytes.
24 24 *
25 25 */
26 26
27 27 return(((Chk << 8) & 0xff00)^lookUpTableForCRC [(((Chk >> 8)^D) & 0x00ff)]);
28 28 }
29 29
30 30 void initLookUpTableForCRC( void )
31 31 {
32 32 /** This function is used to initiates the look-up table for fast CRC computation.
33 33 *
34 34 * The global table lookUpTableForCRC[256] is initiated.
35 35 *
36 36 */
37 37
38 38 unsigned int i;
39 39 unsigned int tmp;
40 40
41 41 for (i=0; i<256; i++)
42 42 {
43 43 tmp = 0;
44 44 if((i & 1) != 0) {
45 45 tmp = tmp ^ 0x1021;
46 46 }
47 47 if((i & 2) != 0) {
48 48 tmp = tmp ^ 0x2042;
49 49 }
50 50 if((i & 4) != 0) {
51 51 tmp = tmp ^ 0x4084;
52 52 }
53 53 if((i & 8) != 0) {
54 54 tmp = tmp ^ 0x8108;
55 55 }
56 56 if((i & 16) != 0) {
57 57 tmp = tmp ^ 0x1231;
58 58 }
59 59 if((i & 32) != 0) {
60 60 tmp = tmp ^ 0x2462;
61 61 }
62 62 if((i & 64) != 0) {
63 63 tmp = tmp ^ 0x48c4;
64 64 }
65 65 if((i & 128) != 0) {
66 66 tmp = tmp ^ 0x9188;
67 67 }
68 68 lookUpTableForCRC[i] = tmp;
69 69 }
70 70 }
71 71
72 72 void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData)
73 73 {
74 74 /** This function calculates a two bytes Cyclic Redundancy Code.
75 75 *
76 76 * @param data points to a buffer containing the data on which to compute the CRC.
77 77 * @param crcAsTwoBytes points points to a two bytes buffer in which the CRC is stored.
78 78 * @param sizeOfData is the number of bytes of *data* used to compute the CRC.
79 79 *
80 80 * The specification of the Cyclic Redundancy Code is described in the following document: ECSS-E-70-41-A.
81 81 *
82 82 */
83 83
84 84 unsigned int Chk;
85 85 int j;
86 86 Chk = 0xffff; // reset the syndrom to all ones
87 87 for (j=0; j<sizeOfData; j++) {
88 88 Chk = Crc_opt(data[j], Chk);
89 89 }
90 90 crcAsTwoBytes[0] = (unsigned char) (Chk >> 8);
91 91 crcAsTwoBytes[1] = (unsigned char) (Chk & 0x00ff);
92 92 }
93 93
94 94 //*********************
95 95 // ACCEPTANCE FUNCTIONS
96 96 int tc_parser(ccsdsTelecommandPacket_t * TCPacket, unsigned int TC_LEN_RCV, unsigned char *computed_CRC)
97 97 {
98 98 /** This function parses TeleCommands.
99 99 *
100 100 * @param TC points to the TeleCommand that will be parsed.
101 101 * @param TC_LEN_RCV is the received packet length.
102 102 *
103 103 * @return Status code of the parsing.
104 104 *
105 105 * The parsing checks:
106 106 * - process id
107 107 * - category
108 108 * - length: a global check is performed and a per subtype check also
109 109 * - type
110 110 * - subtype
111 111 * - crc
112 112 *
113 113 */
114 114
115 115 int status;
116 int status_crc;
116 117 unsigned char pid;
117 118 unsigned char category;
118 119 unsigned int length;
119 120 unsigned char packetType;
120 121 unsigned char packetSubtype;
121 122 unsigned char sid;
122 123
123 124 status = CCSDS_TM_VALID;
124 125
125 126 // APID check *** APID on 2 bytes
126 127 pid = ((TCPacket->packetID[0] & 0x07)<<4) + ( (TCPacket->packetID[1]>>4) & 0x0f ); // PID = 11 *** 7 bits xxxxx210 7654xxxx
127 128 category = (TCPacket->packetID[1] & 0x0f); // PACKET_CATEGORY = 12 *** 4 bits xxxxxxxx xxxx3210
128 129 length = (TCPacket->packetLength[0] * 256) + TCPacket->packetLength[1];
129 130 packetType = TCPacket->serviceType;
130 131 packetSubtype = TCPacket->serviceSubType;
131 132 sid = TCPacket->sourceID;
132 133
133 134 if ( pid != CCSDS_PROCESS_ID ) // CHECK THE PROCESS ID
134 135 {
135 136 status = ILLEGAL_APID;
136 137 }
137 138 if (status == CCSDS_TM_VALID) // CHECK THE CATEGORY
138 139 {
139 140 if ( category != CCSDS_PACKET_CATEGORY )
140 141 {
141 142 status = ILLEGAL_APID;
142 143 }
143 144 }
144 145 if (status == CCSDS_TM_VALID) // CHECK THE PACKET LENGTH FIELD AND THE ACTUAL LENGTH COMPLIANCE
145 146 {
146 147 if (length != TC_LEN_RCV ) {
147 148 status = WRONG_LEN_PKT;
148 149 }
149 150 }
150 151 if (status == CCSDS_TM_VALID) // CHECK THAT THE PACKET DOES NOT EXCEED THE MAX SIZE
151 152 {
152 153 if ( length >= CCSDS_TC_PKT_MAX_SIZE ) {
153 154 status = WRONG_LEN_PKT;
154 155 }
155 156 }
156 157 if (status == CCSDS_TM_VALID) // CHECK THE TYPE
157 158 {
158 159 status = tc_check_type( packetType );
159 160 }
160 161 if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE
161 162 {
162 163 status = tc_check_subtype( packetSubtype );
163 164 }
164 165 if (status == CCSDS_TM_VALID) // CHECK THE SID
165 166 {
166 167 status = tc_check_sid( sid );
167 168 }
168 169 if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE AND LENGTH COMPLIANCE
169 170 {
170 171 status = tc_check_length( packetSubtype, length );
171 172 }
173 status_crc = tc_check_crc( TCPacket, length, computed_CRC );
172 174 if (status == CCSDS_TM_VALID ) // CHECK CRC
173 175 {
174 status = tc_check_crc( TCPacket, length, computed_CRC );
176 status = status_crc;
175 177 }
176 178
177 179 return status;
178 180 }
179 181
180 182 int tc_check_type( unsigned char packetType )
181 183 {
182 184 /** This function checks that the type of a TeleCommand is valid.
183 185 *
184 186 * @param packetType is the type to check.
185 187 *
186 188 * @return Status code CCSDS_TM_VALID or ILL_TYPE.
187 189 *
188 190 */
189 191
190 192 int status;
191 193
192 194 if ( (packetType == TC_TYPE_GEN) || (packetType == TC_TYPE_TIME))
193 195 {
194 196 status = CCSDS_TM_VALID;
195 197 }
196 198 else
197 199 {
198 200 status = ILL_TYPE;
199 201 }
200 202
201 203 return status;
202 204 }
203 205
204 206 int tc_check_subtype( unsigned char packetSubType )
205 207 {
206 208 /** This function checks that the subtype of a TeleCommand is valid.
207 209 *
208 210 * @param packetSubType is the subtype to check.
209 211 *
210 212 * @return Status code CCSDS_TM_VALID or ILL_SUBTYPE.
211 213 *
212 214 */
213 215
214 216 int status;
215 217
216 218 if ( (packetSubType == TC_SUBTYPE_RESET)
217 219 || (packetSubType == TC_SUBTYPE_LOAD_COMM)
218 220 || (packetSubType == TC_SUBTYPE_LOAD_NORM) || (packetSubType == TC_SUBTYPE_LOAD_BURST)
219 221 || (packetSubType == TC_SUBTYPE_LOAD_SBM1) || (packetSubType == TC_SUBTYPE_LOAD_SBM2)
220 222 || (packetSubType == TC_SUBTYPE_DUMP)
221 223 || (packetSubType == TC_SUBTYPE_ENTER)
222 224 || (packetSubType == TC_SUBTYPE_UPDT_INFO) || (packetSubType == TC_SUBTYPE_UPDT_TIME)
223 225 || (packetSubType == TC_SUBTYPE_EN_CAL) || (packetSubType == TC_SUBTYPE_DIS_CAL) )
224 226 {
225 227 status = CCSDS_TM_VALID;
226 228 }
227 229 else
228 230 {
229 231 status = ILL_SUBTYPE;
230 232 }
231 233
232 234 return status;
233 235 }
234 236
235 237 int tc_check_sid( unsigned char sid )
236 238 {
237 239 /** This function checks that the sid of a TeleCommand is valid.
238 240 *
239 241 * @param sid is the sid to check.
240 242 *
241 243 * @return Status code CCSDS_TM_VALID or CORRUPTED.
242 244 *
243 245 */
244 246
245 247 int status;
246 248
247 249 if ( (sid == SID_TC_GROUND)
248 250 || (sid == SID_TC_MISSION_TIMELINE) || (sid == SID_TC_TC_SEQUENCES) || (sid == SID_TC_RECOVERY_ACTION_CMD)
249 251 || (sid == SID_TC_BACKUP_MISSION_TIMELINE)
250 252 || (sid == SID_TC_DIRECT_CMD) || (sid == SID_TC_SPARE_GRD_SRC1) || (sid == SID_TC_SPARE_GRD_SRC2)
251 253 || (sid == SID_TC_OBCP) || (sid == SID_TC_SYSTEM_CONTROL) || (sid == SID_TC_AOCS)
252 254 || (sid == SID_TC_RPW_INTERNAL))
253 255 {
254 256 status = CCSDS_TM_VALID;
255 257 }
256 258 else
257 259 {
258 260 status = WRONG_SRC_ID;
259 261 }
260 262
261 263 return status;
262 264 }
263 265
264 266 int tc_check_length( unsigned char packetSubType, unsigned int length )
265 267 {
266 268 /** This function checks that the subtype and the length are compliant.
267 269 *
268 270 * @param packetSubType is the subtype to check.
269 271 * @param length is the length to check.
270 272 *
271 273 * @return Status code CCSDS_TM_VALID or ILL_TYPE.
272 274 *
273 275 */
274 276
275 277 int status;
276 278
277 279 status = LFR_SUCCESSFUL;
278 280
279 281 switch(packetSubType)
280 282 {
281 283 case TC_SUBTYPE_RESET:
282 284 if (length!=(TC_LEN_RESET-CCSDS_TC_TM_PACKET_OFFSET)) {
283 285 status = WRONG_LEN_PKT;
284 286 }
285 287 else {
286 288 status = CCSDS_TM_VALID;
287 289 }
288 290 break;
289 291 case TC_SUBTYPE_LOAD_COMM:
290 292 if (length!=(TC_LEN_LOAD_COMM-CCSDS_TC_TM_PACKET_OFFSET)) {
291 293 status = WRONG_LEN_PKT;
292 294 }
293 295 else {
294 296 status = CCSDS_TM_VALID;
295 297 }
296 298 break;
297 299 case TC_SUBTYPE_LOAD_NORM:
298 300 if (length!=(TC_LEN_LOAD_NORM-CCSDS_TC_TM_PACKET_OFFSET)) {
299 301 status = WRONG_LEN_PKT;
300 302 }
301 303 else {
302 304 status = CCSDS_TM_VALID;
303 305 }
304 306 break;
305 307 case TC_SUBTYPE_LOAD_BURST:
306 308 if (length!=(TC_LEN_LOAD_BURST-CCSDS_TC_TM_PACKET_OFFSET)) {
307 309 status = WRONG_LEN_PKT;
308 310 }
309 311 else {
310 312 status = CCSDS_TM_VALID;
311 313 }
312 314 break;
313 315 case TC_SUBTYPE_LOAD_SBM1:
314 316 if (length!=(TC_LEN_LOAD_SBM1-CCSDS_TC_TM_PACKET_OFFSET)) {
315 317 status = WRONG_LEN_PKT;
316 318 }
317 319 else {
318 320 status = CCSDS_TM_VALID;
319 321 }
320 322 break;
321 323 case TC_SUBTYPE_LOAD_SBM2:
322 324 if (length!=(TC_LEN_LOAD_SBM2-CCSDS_TC_TM_PACKET_OFFSET)) {
323 325 status = WRONG_LEN_PKT;
324 326 }
325 327 else {
326 328 status = CCSDS_TM_VALID;
327 329 }
328 330 break;
329 331 case TC_SUBTYPE_DUMP:
330 332 if (length!=(TC_LEN_DUMP-CCSDS_TC_TM_PACKET_OFFSET)) {
331 333 status = WRONG_LEN_PKT;
332 334 }
333 335 else {
334 336 status = CCSDS_TM_VALID;
335 337 }
336 338 break;
337 339 case TC_SUBTYPE_ENTER:
338 340 if (length!=(TC_LEN_ENTER-CCSDS_TC_TM_PACKET_OFFSET)) {
339 341 status = WRONG_LEN_PKT;
340 342 }
341 343 else {
342 344 status = CCSDS_TM_VALID;
343 345 }
344 346 break;
345 347 case TC_SUBTYPE_UPDT_INFO:
346 348 if (length!=(TC_LEN_UPDT_INFO-CCSDS_TC_TM_PACKET_OFFSET)) {
347 349 status = WRONG_LEN_PKT;
348 350 }
349 351 else {
350 352 status = CCSDS_TM_VALID;
351 353 }
352 354 break;
353 355 case TC_SUBTYPE_EN_CAL:
354 356 if (length!=(TC_LEN_EN_CAL-CCSDS_TC_TM_PACKET_OFFSET)) {
355 357 status = WRONG_LEN_PKT;
356 358 }
357 359 else {
358 360 status = CCSDS_TM_VALID;
359 361 }
360 362 break;
361 363 case TC_SUBTYPE_DIS_CAL:
362 364 if (length!=(TC_LEN_DIS_CAL-CCSDS_TC_TM_PACKET_OFFSET)) {
363 365 status = WRONG_LEN_PKT;
364 366 }
365 367 else {
366 368 status = CCSDS_TM_VALID;
367 369 }
368 370 break;
369 371 case TC_SUBTYPE_UPDT_TIME:
370 372 if (length!=(TC_LEN_UPDT_TIME-CCSDS_TC_TM_PACKET_OFFSET)) {
371 373 status = WRONG_LEN_PKT;
372 374 }
373 375 else {
374 376 status = CCSDS_TM_VALID;
375 377 }
376 378 break;
377 379 default: // if the subtype is not a legal value, return ILL_SUBTYPE
378 380 status = ILL_SUBTYPE;
379 381 break ;
380 382 }
381 383
382 384 return status;
383 385 }
384 386
385 387 int tc_check_crc( ccsdsTelecommandPacket_t * TCPacket, unsigned int length, unsigned char *computed_CRC )
386 388 {
387 389 /** This function checks the CRC validity of the corresponding TeleCommand packet.
388 390 *
389 391 * @param TCPacket points to the TeleCommand packet to check.
390 392 * @param length is the length of the TC packet.
391 393 *
392 394 * @return Status code CCSDS_TM_VALID or INCOR_CHECKSUM.
393 395 *
394 396 */
395 397
396 398 int status;
397 399 unsigned char * CCSDSContent;
398 400
399 401 CCSDSContent = (unsigned char*) TCPacket->packetID;
400 402 GetCRCAsTwoBytes(CCSDSContent, computed_CRC, length + CCSDS_TC_TM_PACKET_OFFSET - 2); // 2 CRC bytes removed from the calculation of the CRC
401 403 if (computed_CRC[0] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -2]) {
402 404 status = INCOR_CHECKSUM;
403 405 }
404 406 else if (computed_CRC[1] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -1]) {
405 407 status = INCOR_CHECKSUM;
406 408 }
407 409 else {
408 410 status = CCSDS_TM_VALID;
409 411 }
410 412
411 413 return status;
412 414 }
413 415
414 416
415 417
@@ -1,490 +1,491
1 1 /** Functions to send TM packets related to TC parsing and execution.
2 2 *
3 3 * @file
4 4 * @author P. LEROY
5 5 *
6 6 * A group of functions to send appropriate TM packets after parsing and execution:
7 7 * - TM_LFR_TC_EXE_SUCCESS
8 8 * - TM_LFR_TC_EXE_INCONSISTENT
9 9 * - TM_LFR_TC_EXE_NOT_EXECUTABLE
10 10 * - TM_LFR_TC_EXE_NOT_IMPLEMENTED
11 11 * - TM_LFR_TC_EXE_ERROR
12 12 * - TM_LFR_TC_EXE_CORRUPTED
13 13 *
14 14 */
15 15
16 16 #include "tm_lfr_tc_exe.h"
17 17
18 18 int send_tm_lfr_tc_exe_success( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
19 19 {
20 20 /** This function sends a TM_LFR_TC_EXE_SUCCESS packet in the dedicated RTEMS message queue.
21 21 *
22 22 * @param TC points to the TeleCommand packet that is being processed
23 23 * @param queue_id is the id of the queue which handles TM
24 24 *
25 25 * @return RTEMS directive status code:
26 26 * - RTEMS_SUCCESSFUL - message sent successfully
27 27 * - RTEMS_INVALID_ID - invalid queue id
28 28 * - RTEMS_INVALID_SIZE - invalid message size
29 29 * - RTEMS_INVALID_ADDRESS - buffer is NULL
30 30 * - RTEMS_UNSATISFIED - out of message buffers
31 31 * - RTEMS_TOO_MANY - queue s limit has been reached
32 32 *
33 33 */
34 34
35 35 rtems_status_code status;
36 36 Packet_TM_LFR_TC_EXE_SUCCESS_t TM;
37 37 unsigned char messageSize;
38 38
39 39 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
40 40 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
41 41 TM.reserved = DEFAULT_RESERVED;
42 42 TM.userApplication = CCSDS_USER_APP;
43 43 // PACKET HEADER
44 44 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
45 45 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
46 46 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
47 47 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8);
48 48 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS );
49 49 // DATA FIELD HEADER
50 50 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
51 51 TM.serviceType = TM_TYPE_TC_EXE;
52 52 TM.serviceSubType = TM_SUBTYPE_EXE_OK;
53 53 TM.destinationID = TC->sourceID;
54 54 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
55 55 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
56 56 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
57 57 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
58 58 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
59 59 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
60 60 //
61 61 TM.telecommand_pkt_id[0] = TC->packetID[0];
62 62 TM.telecommand_pkt_id[1] = TC->packetID[1];
63 63 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
64 64 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
65 65
66 66 messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
67 67
68 68 // SEND DATA
69 69 status = rtems_message_queue_send( queue_id, &TM, messageSize);
70 70 if (status != RTEMS_SUCCESSFUL) {
71 71 PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n")
72 72 }
73 73
74 74 return status;
75 75 }
76 76
77 77 int send_tm_lfr_tc_exe_inconsistent( ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
78 78 unsigned char byte_position, unsigned char rcv_value )
79 79 {
80 80 /** This function sends a TM_LFR_TC_EXE_INCONSISTENT packet in the dedicated RTEMS message queue.
81 81 *
82 82 * @param TC points to the TeleCommand packet that is being processed
83 83 * @param queue_id is the id of the queue which handles TM
84 84 * @param byte_position is the byte position of the MSB of the parameter that has been seen as inconsistent
85 85 * @param rcv_value is the value of the LSB of the parameter that has been deteced as inconsistent
86 86 *
87 87 * @return RTEMS directive status code:
88 88 * - RTEMS_SUCCESSFUL - message sent successfully
89 89 * - RTEMS_INVALID_ID - invalid queue id
90 90 * - RTEMS_INVALID_SIZE - invalid message size
91 91 * - RTEMS_INVALID_ADDRESS - buffer is NULL
92 92 * - RTEMS_UNSATISFIED - out of message buffers
93 93 * - RTEMS_TOO_MANY - queue s limit has been reached
94 94 *
95 95 */
96 96
97 97 rtems_status_code status;
98 98 Packet_TM_LFR_TC_EXE_INCONSISTENT_t TM;
99 99 unsigned char messageSize;
100 100
101 101 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
102 102 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
103 103 TM.reserved = DEFAULT_RESERVED;
104 104 TM.userApplication = CCSDS_USER_APP;
105 105 // PACKET HEADER
106 106 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
107 107 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
108 108 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
109 109 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8);
110 110 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT );
111 111 // DATA FIELD HEADER
112 112 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
113 113 TM.serviceType = TM_TYPE_TC_EXE;
114 114 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
115 115 TM.destinationID = TC->sourceID;
116 116 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
117 117 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
118 118 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
119 119 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
120 120 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
121 121 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
122 122 //
123 123 TM.tc_failure_code[0] = (char) (WRONG_APP_DATA >> 8);
124 124 TM.tc_failure_code[1] = (char) (WRONG_APP_DATA );
125 125 TM.telecommand_pkt_id[0] = TC->packetID[0];
126 126 TM.telecommand_pkt_id[1] = TC->packetID[1];
127 127 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
128 128 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
129 129 TM.tc_service = TC->serviceType; // type of the rejected TC
130 130 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
131 131 TM.byte_position = byte_position;
132 132 TM.rcv_value = rcv_value;
133 133
134 134 messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
135 135
136 136 // SEND DATA
137 137 status = rtems_message_queue_send( queue_id, &TM, messageSize);
138 138 if (status != RTEMS_SUCCESSFUL) {
139 139 PRINTF("in send_tm_lfr_tc_exe_inconsistent *** ERR\n")
140 140 }
141 141
142 142 return status;
143 143 }
144 144
145 145 int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
146 146 {
147 147 /** This function sends a TM_LFR_TC_EXE_NOT_EXECUTABLE packet in the dedicated RTEMS message queue.
148 148 *
149 149 * @param TC points to the TeleCommand packet that is being processed
150 150 * @param queue_id is the id of the queue which handles TM
151 151 *
152 152 * @return RTEMS directive status code:
153 153 * - RTEMS_SUCCESSFUL - message sent successfully
154 154 * - RTEMS_INVALID_ID - invalid queue id
155 155 * - RTEMS_INVALID_SIZE - invalid message size
156 156 * - RTEMS_INVALID_ADDRESS - buffer is NULL
157 157 * - RTEMS_UNSATISFIED - out of message buffers
158 158 * - RTEMS_TOO_MANY - queue s limit has been reached
159 159 *
160 160 */
161 161
162 162 rtems_status_code status;
163 163 Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t TM;
164 164 unsigned char messageSize;
165 165
166 166 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
167 167 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
168 168 TM.reserved = DEFAULT_RESERVED;
169 169 TM.userApplication = CCSDS_USER_APP;
170 170 // PACKET HEADER
171 171 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
172 172 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
173 173 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
174 174 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8);
175 175 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE );
176 176 // DATA FIELD HEADER
177 177 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
178 178 TM.serviceType = TM_TYPE_TC_EXE;
179 179 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
180 180 TM.destinationID = TC->sourceID; // default destination id
181 181 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
182 182 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
183 183 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
184 184 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
185 185 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
186 186 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
187 187 //
188 188 TM.tc_failure_code[0] = (char) (TC_NOT_EXE >> 8);
189 189 TM.tc_failure_code[1] = (char) (TC_NOT_EXE );
190 190 TM.telecommand_pkt_id[0] = TC->packetID[0];
191 191 TM.telecommand_pkt_id[1] = TC->packetID[1];
192 192 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
193 193 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
194 194 TM.tc_service = TC->serviceType; // type of the rejected TC
195 195 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
196 196 TM.lfr_status_word[0] = housekeeping_packet.lfr_status_word[0];
197 197 TM.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1];
198 198
199 199 messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
200 200
201 201 // SEND DATA
202 202 status = rtems_message_queue_send( queue_id, &TM, messageSize);
203 203 if (status != RTEMS_SUCCESSFUL) {
204 204 PRINTF("in send_tm_lfr_tc_exe_not_executable *** ERR\n")
205 205 }
206 206
207 207 return status;
208 208 }
209 209
210 210 int send_tm_lfr_tc_exe_not_implemented( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
211 211 {
212 212 /** This function sends a TM_LFR_TC_EXE_NOT_IMPLEMENTED packet in the dedicated RTEMS message queue.
213 213 *
214 214 * @param TC points to the TeleCommand packet that is being processed
215 215 * @param queue_id is the id of the queue which handles TM
216 216 *
217 217 * @return RTEMS directive status code:
218 218 * - RTEMS_SUCCESSFUL - message sent successfully
219 219 * - RTEMS_INVALID_ID - invalid queue id
220 220 * - RTEMS_INVALID_SIZE - invalid message size
221 221 * - RTEMS_INVALID_ADDRESS - buffer is NULL
222 222 * - RTEMS_UNSATISFIED - out of message buffers
223 223 * - RTEMS_TOO_MANY - queue s limit has been reached
224 224 *
225 225 */
226 226
227 227 rtems_status_code status;
228 228 Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t TM;
229 229 unsigned char messageSize;
230 230
231 231 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
232 232 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
233 233 TM.reserved = DEFAULT_RESERVED;
234 234 TM.userApplication = CCSDS_USER_APP;
235 235 // PACKET HEADER
236 236 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
237 237 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
238 238 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
239 239 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8);
240 240 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED );
241 241 // DATA FIELD HEADER
242 242 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
243 243 TM.serviceType = TM_TYPE_TC_EXE;
244 244 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
245 245 TM.destinationID = TC->sourceID; // default destination id
246 246 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
247 247 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
248 248 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
249 249 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
250 250 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
251 251 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
252 252 //
253 253 TM.tc_failure_code[0] = (char) (FUNCT_NOT_IMPL >> 8);
254 254 TM.tc_failure_code[1] = (char) (FUNCT_NOT_IMPL );
255 255 TM.telecommand_pkt_id[0] = TC->packetID[0];
256 256 TM.telecommand_pkt_id[1] = TC->packetID[1];
257 257 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
258 258 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
259 259 TM.tc_service = TC->serviceType; // type of the rejected TC
260 260 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
261 261
262 262 messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
263 263
264 264 // SEND DATA
265 265 status = rtems_message_queue_send( queue_id, &TM, messageSize);
266 266 if (status != RTEMS_SUCCESSFUL) {
267 267 PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n")
268 268 }
269 269
270 270 return status;
271 271 }
272 272
273 273 int send_tm_lfr_tc_exe_error( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
274 274 {
275 275 /** This function sends a TM_LFR_TC_EXE_ERROR packet in the dedicated RTEMS message queue.
276 276 *
277 277 * @param TC points to the TeleCommand packet that is being processed
278 278 * @param queue_id is the id of the queue which handles TM
279 279 *
280 280 * @return RTEMS directive status code:
281 281 * - RTEMS_SUCCESSFUL - message sent successfully
282 282 * - RTEMS_INVALID_ID - invalid queue id
283 283 * - RTEMS_INVALID_SIZE - invalid message size
284 284 * - RTEMS_INVALID_ADDRESS - buffer is NULL
285 285 * - RTEMS_UNSATISFIED - out of message buffers
286 286 * - RTEMS_TOO_MANY - queue s limit has been reached
287 287 *
288 288 */
289 289
290 290 rtems_status_code status;
291 291 Packet_TM_LFR_TC_EXE_ERROR_t TM;
292 292 unsigned char messageSize;
293 293
294 294 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
295 295 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
296 296 TM.reserved = DEFAULT_RESERVED;
297 297 TM.userApplication = CCSDS_USER_APP;
298 298 // PACKET HEADER
299 299 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
300 300 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
301 301 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
302 302 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8);
303 303 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR );
304 304 // DATA FIELD HEADER
305 305 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
306 306 TM.serviceType = TM_TYPE_TC_EXE;
307 307 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
308 308 TM.destinationID = TC->sourceID; // default destination id
309 309 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
310 310 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
311 311 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
312 312 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
313 313 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
314 314 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
315 315 //
316 316 TM.tc_failure_code[0] = (char) (FAIL_DETECTED >> 8);
317 317 TM.tc_failure_code[1] = (char) (FAIL_DETECTED );
318 318 TM.telecommand_pkt_id[0] = TC->packetID[0];
319 319 TM.telecommand_pkt_id[1] = TC->packetID[1];
320 320 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
321 321 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
322 322 TM.tc_service = TC->serviceType; // type of the rejected TC
323 323 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
324 324
325 325 messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
326 326
327 327 // SEND DATA
328 328 status = rtems_message_queue_send( queue_id, &TM, messageSize);
329 329 if (status != RTEMS_SUCCESSFUL) {
330 330 PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n")
331 331 }
332 332
333 333 return status;
334 334 }
335 335
336 336 int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
337 unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV )
337 unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV,
338 unsigned char destinationID)
338 339 {
339 340 /** This function sends a TM_LFR_TC_EXE_CORRUPTED packet in the dedicated RTEMS message queue.
340 341 *
341 342 * @param TC points to the TeleCommand packet that is being processed
342 343 * @param queue_id is the id of the queue which handles TM
343 344 * @param computed_CRC points to a buffer of two bytes containing the CRC computed during the parsing of the TeleCommand
344 345 * @param currentTC_LEN_RCV points to a buffer of two bytes containing a packet size field computed on the received data
345 346 *
346 347 * @return RTEMS directive status code:
347 348 * - RTEMS_SUCCESSFUL - message sent successfully
348 349 * - RTEMS_INVALID_ID - invalid queue id
349 350 * - RTEMS_INVALID_SIZE - invalid message size
350 351 * - RTEMS_INVALID_ADDRESS - buffer is NULL
351 352 * - RTEMS_UNSATISFIED - out of message buffers
352 353 * - RTEMS_TOO_MANY - queue s limit has been reached
353 354 *
354 355 */
355 356
356 357 rtems_status_code status;
357 358 Packet_TM_LFR_TC_EXE_CORRUPTED_t TM;
358 359 unsigned char messageSize;
359 360 unsigned int packetLength;
360 361 unsigned char *packetDataField;
361 362
362 363 packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1]; // compute the packet length parameter
363 364 packetDataField = (unsigned char *) &TC->headerFlag_pusVersion_Ack; // get the beginning of the data field
364 365
365 366 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
366 367 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
367 368 TM.reserved = DEFAULT_RESERVED;
368 369 TM.userApplication = CCSDS_USER_APP;
369 370 // PACKET HEADER
370 371 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
371 372 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
372 373 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
373 374 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8);
374 375 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED );
375 376 // DATA FIELD HEADER
376 377 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
377 378 TM.serviceType = TM_TYPE_TC_EXE;
378 379 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
379 TM.destinationID = TC->sourceID; // default destination id
380 TM.destinationID = destinationID;
380 381 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
381 382 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
382 383 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
383 384 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
384 385 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
385 386 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
386 387 //
387 388 TM.tc_failure_code[0] = (unsigned char) (CORRUPTED >> 8);
388 389 TM.tc_failure_code[1] = (unsigned char) (CORRUPTED );
389 390 TM.telecommand_pkt_id[0] = TC->packetID[0];
390 391 TM.telecommand_pkt_id[1] = TC->packetID[1];
391 392 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
392 393 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
393 394 TM.tc_service = TC->serviceType; // type of the rejected TC
394 395 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
395 396 TM.pkt_len_rcv_value[0] = TC->packetLength[0];
396 397 TM.pkt_len_rcv_value[1] = TC->packetLength[1];
397 398 TM.pkt_datafieldsize_cnt[0] = currentTC_LEN_RCV[0];
398 399 TM.pkt_datafieldsize_cnt[1] = currentTC_LEN_RCV[1];
399 400 TM.rcv_crc[0] = packetDataField[ packetLength - 1 ];
400 401 TM.rcv_crc[1] = packetDataField[ packetLength ];
401 402 TM.computed_crc[0] = computed_CRC[0];
402 403 TM.computed_crc[1] = computed_CRC[1];
403 404
404 405 messageSize = PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
405 406
406 407 // SEND DATA
407 408 status = rtems_message_queue_send( queue_id, &TM, messageSize);
408 409 if (status != RTEMS_SUCCESSFUL) {
409 410 PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n")
410 411 }
411 412
412 413 return status;
413 414 }
414 415
415 416 void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id )
416 417 {
417 418 unsigned short sequence_cnt;
418 419 unsigned short segmentation_grouping_flag;
419 420 unsigned short new_packet_sequence_control;
420 421 unsigned char i;
421 422
422 423 switch (destination_id)
423 424 {
424 425 case SID_TC_GROUND:
425 426 i = GROUND;
426 427 break;
427 428 case SID_TC_MISSION_TIMELINE:
428 429 i = MISSION_TIMELINE;
429 430 break;
430 431 case SID_TC_TC_SEQUENCES:
431 432 i = TC_SEQUENCES;
432 433 break;
433 434 case SID_TC_RECOVERY_ACTION_CMD:
434 435 i = RECOVERY_ACTION_CMD;
435 436 break;
436 437 case SID_TC_BACKUP_MISSION_TIMELINE:
437 438 i = BACKUP_MISSION_TIMELINE;
438 439 break;
439 440 case SID_TC_DIRECT_CMD:
440 441 i = DIRECT_CMD;
441 442 break;
442 443 case SID_TC_SPARE_GRD_SRC1:
443 444 i = SPARE_GRD_SRC1;
444 445 break;
445 446 case SID_TC_SPARE_GRD_SRC2:
446 447 i = SPARE_GRD_SRC2;
447 448 break;
448 449 case SID_TC_OBCP:
449 450 i = OBCP;
450 451 break;
451 452 case SID_TC_SYSTEM_CONTROL:
452 453 i = SYSTEM_CONTROL;
453 454 break;
454 455 case SID_TC_AOCS:
455 456 i = AOCS;
456 457 break;
457 458 case SID_TC_RPW_INTERNAL:
458 459 i = RPW_INTERNAL;
459 460 break;
460 461 default:
461 462 i = UNKNOWN;
462 463 break;
463 464 }
464 465
465 466 if (i != UNKNOWN)
466 467 {
467 468 segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
468 469 sequence_cnt = sequenceCounters_TC_EXE[ i ] & 0x3fff;
469 470
470 471 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
471 472
472 473 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
473 474 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
474 475
475 476 // increment the sequence counter for the next packet
476 477 if ( sequenceCounters_TC_EXE[ i ] < SEQ_CNT_MAX)
477 478 {
478 479 sequenceCounters_TC_EXE[ i ] = sequenceCounters_TC_EXE[ i ] + 1;
479 480 }
480 481 else
481 482 {
482 483 sequenceCounters_TC_EXE[ i ] = 0;
483 484 }
484 485 }
485 486 else
486 487 {
487 488 DEBUG_PRINTF1("in increment_seq_counter_destination_id *** ERR destination ID %d not known\n", destination_id)
488 489 }
489 490
490 491 }
General Comments 0
You need to be logged in to leave comments. Login now