##// END OF EJS Templates
fsw-0-23...
paul -
r75:1aca4e63f8e6 VHDLib206
parent child
Show More
@@ -1,248 +1,248
1 #############################################################################
1 #############################################################################
2 # Makefile for building: bin/fsw
2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Nov 14 08:56:42 2013
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Nov 14 12:02:16 2013
4 # Project: fsw-qt.pro
4 # Project: fsw-qt.pro
5 # Template: app
5 # Template: app
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
7 #############################################################################
7 #############################################################################
8
8
9 ####### Compiler, tools and options
9 ####### Compiler, tools and options
10
10
11 CC = sparc-rtems-gcc
11 CC = sparc-rtems-gcc
12 CXX = sparc-rtems-g++
12 CXX = sparc-rtems-g++
13 DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=23 -DPRINT_MESSAGES_ON_CONSOLE
13 DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=23 -DPRINT_MESSAGES_ON_CONSOLE
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header
17 LINK = sparc-rtems-g++
17 LINK = sparc-rtems-g++
18 LFLAGS =
18 LFLAGS =
19 LIBS = $(SUBLIBS)
19 LIBS = $(SUBLIBS)
20 AR = sparc-rtems-ar rcs
20 AR = sparc-rtems-ar rcs
21 RANLIB =
21 RANLIB =
22 QMAKE = /usr/bin/qmake-qt4
22 QMAKE = /usr/bin/qmake-qt4
23 TAR = tar -cf
23 TAR = tar -cf
24 COMPRESS = gzip -9f
24 COMPRESS = gzip -9f
25 COPY = cp -f
25 COPY = cp -f
26 SED = sed
26 SED = sed
27 COPY_FILE = $(COPY)
27 COPY_FILE = $(COPY)
28 COPY_DIR = $(COPY) -r
28 COPY_DIR = $(COPY) -r
29 STRIP = sparc-rtems-strip
29 STRIP = sparc-rtems-strip
30 INSTALL_FILE = install -m 644 -p
30 INSTALL_FILE = install -m 644 -p
31 INSTALL_DIR = $(COPY_DIR)
31 INSTALL_DIR = $(COPY_DIR)
32 INSTALL_PROGRAM = install -m 755 -p
32 INSTALL_PROGRAM = install -m 755 -p
33 DEL_FILE = rm -f
33 DEL_FILE = rm -f
34 SYMLINK = ln -f -s
34 SYMLINK = ln -f -s
35 DEL_DIR = rmdir
35 DEL_DIR = rmdir
36 MOVE = mv -f
36 MOVE = mv -f
37 CHK_DIR_EXISTS= test -d
37 CHK_DIR_EXISTS= test -d
38 MKDIR = mkdir -p
38 MKDIR = mkdir -p
39
39
40 ####### Output directory
40 ####### Output directory
41
41
42 OBJECTS_DIR = obj/
42 OBJECTS_DIR = obj/
43
43
44 ####### Files
44 ####### Files
45
45
46 SOURCES = ../src/wf_handler.c \
46 SOURCES = ../src/wf_handler.c \
47 ../src/tc_handler.c \
47 ../src/tc_handler.c \
48 ../src/fsw_processing.c \
48 ../src/fsw_processing.c \
49 ../src/fsw_misc.c \
49 ../src/fsw_misc.c \
50 ../src/fsw_init.c \
50 ../src/fsw_init.c \
51 ../src/fsw_globals.c \
51 ../src/fsw_globals.c \
52 ../src/fsw_spacewire.c \
52 ../src/fsw_spacewire.c \
53 ../src/tc_load_dump_parameters.c \
53 ../src/tc_load_dump_parameters.c \
54 ../src/tm_lfr_tc_exe.c \
54 ../src/tm_lfr_tc_exe.c \
55 ../src/tc_acceptance.c
55 ../src/tc_acceptance.c
56 OBJECTS = obj/wf_handler.o \
56 OBJECTS = obj/wf_handler.o \
57 obj/tc_handler.o \
57 obj/tc_handler.o \
58 obj/fsw_processing.o \
58 obj/fsw_processing.o \
59 obj/fsw_misc.o \
59 obj/fsw_misc.o \
60 obj/fsw_init.o \
60 obj/fsw_init.o \
61 obj/fsw_globals.o \
61 obj/fsw_globals.o \
62 obj/fsw_spacewire.o \
62 obj/fsw_spacewire.o \
63 obj/tc_load_dump_parameters.o \
63 obj/tc_load_dump_parameters.o \
64 obj/tm_lfr_tc_exe.o \
64 obj/tm_lfr_tc_exe.o \
65 obj/tc_acceptance.o
65 obj/tc_acceptance.o
66 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
66 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
67 /usr/lib64/qt4/mkspecs/common/linux.conf \
67 /usr/lib64/qt4/mkspecs/common/linux.conf \
68 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
68 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
69 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
69 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
70 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
70 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
71 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
71 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
72 /usr/lib64/qt4/mkspecs/qconfig.pri \
72 /usr/lib64/qt4/mkspecs/qconfig.pri \
73 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
73 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
74 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
74 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
75 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
75 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
76 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
76 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
77 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
77 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
78 sparc.pri \
78 sparc.pri \
79 /usr/lib64/qt4/mkspecs/features/release.prf \
79 /usr/lib64/qt4/mkspecs/features/release.prf \
80 /usr/lib64/qt4/mkspecs/features/default_post.prf \
80 /usr/lib64/qt4/mkspecs/features/default_post.prf \
81 /usr/lib64/qt4/mkspecs/features/shared.prf \
81 /usr/lib64/qt4/mkspecs/features/shared.prf \
82 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
82 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
83 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
83 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
84 /usr/lib64/qt4/mkspecs/features/resources.prf \
84 /usr/lib64/qt4/mkspecs/features/resources.prf \
85 /usr/lib64/qt4/mkspecs/features/uic.prf \
85 /usr/lib64/qt4/mkspecs/features/uic.prf \
86 /usr/lib64/qt4/mkspecs/features/yacc.prf \
86 /usr/lib64/qt4/mkspecs/features/yacc.prf \
87 /usr/lib64/qt4/mkspecs/features/lex.prf \
87 /usr/lib64/qt4/mkspecs/features/lex.prf \
88 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
88 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
89 fsw-qt.pro
89 fsw-qt.pro
90 QMAKE_TARGET = fsw
90 QMAKE_TARGET = fsw
91 DESTDIR = bin/
91 DESTDIR = bin/
92 TARGET = bin/fsw
92 TARGET = bin/fsw
93
93
94 first: all
94 first: all
95 ####### Implicit rules
95 ####### Implicit rules
96
96
97 .SUFFIXES: .o .c .cpp .cc .cxx .C
97 .SUFFIXES: .o .c .cpp .cc .cxx .C
98
98
99 .cpp.o:
99 .cpp.o:
100 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
100 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
101
101
102 .cc.o:
102 .cc.o:
103 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
103 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
104
104
105 .cxx.o:
105 .cxx.o:
106 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
106 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
107
107
108 .C.o:
108 .C.o:
109 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
109 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
110
110
111 .c.o:
111 .c.o:
112 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
112 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
113
113
114 ####### Build rules
114 ####### Build rules
115
115
116 all: Makefile $(TARGET)
116 all: Makefile $(TARGET)
117
117
118 $(TARGET): $(OBJECTS)
118 $(TARGET): $(OBJECTS)
119 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
119 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
120 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
120 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
121
121
122 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
122 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
123 /usr/lib64/qt4/mkspecs/common/linux.conf \
123 /usr/lib64/qt4/mkspecs/common/linux.conf \
124 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
124 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
125 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
125 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
126 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
126 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
127 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
127 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
128 /usr/lib64/qt4/mkspecs/qconfig.pri \
128 /usr/lib64/qt4/mkspecs/qconfig.pri \
129 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
129 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
130 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
130 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
131 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
131 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
132 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
132 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
133 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
133 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
134 sparc.pri \
134 sparc.pri \
135 /usr/lib64/qt4/mkspecs/features/release.prf \
135 /usr/lib64/qt4/mkspecs/features/release.prf \
136 /usr/lib64/qt4/mkspecs/features/default_post.prf \
136 /usr/lib64/qt4/mkspecs/features/default_post.prf \
137 /usr/lib64/qt4/mkspecs/features/shared.prf \
137 /usr/lib64/qt4/mkspecs/features/shared.prf \
138 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
138 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
139 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
139 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
140 /usr/lib64/qt4/mkspecs/features/resources.prf \
140 /usr/lib64/qt4/mkspecs/features/resources.prf \
141 /usr/lib64/qt4/mkspecs/features/uic.prf \
141 /usr/lib64/qt4/mkspecs/features/uic.prf \
142 /usr/lib64/qt4/mkspecs/features/yacc.prf \
142 /usr/lib64/qt4/mkspecs/features/yacc.prf \
143 /usr/lib64/qt4/mkspecs/features/lex.prf \
143 /usr/lib64/qt4/mkspecs/features/lex.prf \
144 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
144 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
145 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
145 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
146 /usr/lib64/qt4/mkspecs/common/unix.conf:
146 /usr/lib64/qt4/mkspecs/common/unix.conf:
147 /usr/lib64/qt4/mkspecs/common/linux.conf:
147 /usr/lib64/qt4/mkspecs/common/linux.conf:
148 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
148 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
149 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
149 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
150 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
150 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
151 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
151 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
152 /usr/lib64/qt4/mkspecs/qconfig.pri:
152 /usr/lib64/qt4/mkspecs/qconfig.pri:
153 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
153 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
154 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
154 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
155 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
155 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
156 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
156 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
157 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
157 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
158 sparc.pri:
158 sparc.pri:
159 /usr/lib64/qt4/mkspecs/features/release.prf:
159 /usr/lib64/qt4/mkspecs/features/release.prf:
160 /usr/lib64/qt4/mkspecs/features/default_post.prf:
160 /usr/lib64/qt4/mkspecs/features/default_post.prf:
161 /usr/lib64/qt4/mkspecs/features/shared.prf:
161 /usr/lib64/qt4/mkspecs/features/shared.prf:
162 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
162 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
163 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
163 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
164 /usr/lib64/qt4/mkspecs/features/resources.prf:
164 /usr/lib64/qt4/mkspecs/features/resources.prf:
165 /usr/lib64/qt4/mkspecs/features/uic.prf:
165 /usr/lib64/qt4/mkspecs/features/uic.prf:
166 /usr/lib64/qt4/mkspecs/features/yacc.prf:
166 /usr/lib64/qt4/mkspecs/features/yacc.prf:
167 /usr/lib64/qt4/mkspecs/features/lex.prf:
167 /usr/lib64/qt4/mkspecs/features/lex.prf:
168 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
168 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
169 qmake: FORCE
169 qmake: FORCE
170 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
170 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
171
171
172 dist:
172 dist:
173 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
173 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
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
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 clean:compiler_clean
177 clean:compiler_clean
178 -$(DEL_FILE) $(OBJECTS)
178 -$(DEL_FILE) $(OBJECTS)
179 -$(DEL_FILE) *~ core *.core
179 -$(DEL_FILE) *~ core *.core
180
180
181
181
182 ####### Sub-libraries
182 ####### Sub-libraries
183
183
184 distclean: clean
184 distclean: clean
185 -$(DEL_FILE) $(TARGET)
185 -$(DEL_FILE) $(TARGET)
186 -$(DEL_FILE) Makefile
186 -$(DEL_FILE) Makefile
187
187
188
188
189 grmon:
189 grmon:
190 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
190 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
191
191
192 check: first
192 check: first
193
193
194 compiler_rcc_make_all:
194 compiler_rcc_make_all:
195 compiler_rcc_clean:
195 compiler_rcc_clean:
196 compiler_uic_make_all:
196 compiler_uic_make_all:
197 compiler_uic_clean:
197 compiler_uic_clean:
198 compiler_image_collection_make_all: qmake_image_collection.cpp
198 compiler_image_collection_make_all: qmake_image_collection.cpp
199 compiler_image_collection_clean:
199 compiler_image_collection_clean:
200 -$(DEL_FILE) qmake_image_collection.cpp
200 -$(DEL_FILE) qmake_image_collection.cpp
201 compiler_yacc_decl_make_all:
201 compiler_yacc_decl_make_all:
202 compiler_yacc_decl_clean:
202 compiler_yacc_decl_clean:
203 compiler_yacc_impl_make_all:
203 compiler_yacc_impl_make_all:
204 compiler_yacc_impl_clean:
204 compiler_yacc_impl_clean:
205 compiler_lex_make_all:
205 compiler_lex_make_all:
206 compiler_lex_clean:
206 compiler_lex_clean:
207 compiler_clean:
207 compiler_clean:
208
208
209 ####### Compile
209 ####### Compile
210
210
211 obj/wf_handler.o: ../src/wf_handler.c
211 obj/wf_handler.o: ../src/wf_handler.c
212 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
212 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
213
213
214 obj/tc_handler.o: ../src/tc_handler.c
214 obj/tc_handler.o: ../src/tc_handler.c
215 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
215 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
216
216
217 obj/fsw_processing.o: ../src/fsw_processing.c ../src/fsw_processing_globals.c
217 obj/fsw_processing.o: ../src/fsw_processing.c ../src/fsw_processing_globals.c
218 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c
218 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c
219
219
220 obj/fsw_misc.o: ../src/fsw_misc.c
220 obj/fsw_misc.o: ../src/fsw_misc.c
221 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
221 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
222
222
223 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
223 obj/fsw_init.o: ../src/fsw_init.c ../src/fsw_config.c
224 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
224 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
225
225
226 obj/fsw_globals.o: ../src/fsw_globals.c
226 obj/fsw_globals.o: ../src/fsw_globals.c
227 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
227 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
228
228
229 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
229 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
230 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
230 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
231
231
232 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
232 obj/tc_load_dump_parameters.o: ../src/tc_load_dump_parameters.c
233 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
233 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_load_dump_parameters.o ../src/tc_load_dump_parameters.c
234
234
235 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
235 obj/tm_lfr_tc_exe.o: ../src/tm_lfr_tc_exe.c
236 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
236 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tm_lfr_tc_exe.o ../src/tm_lfr_tc_exe.c
237
237
238 obj/tc_acceptance.o: ../src/tc_acceptance.c
238 obj/tc_acceptance.o: ../src/tc_acceptance.c
239 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
239 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_acceptance.o ../src/tc_acceptance.c
240
240
241 ####### Install
241 ####### Install
242
242
243 install: FORCE
243 install: FORCE
244
244
245 uninstall: FORCE
245 uninstall: FORCE
246
246
247 FORCE:
247 FORCE:
248
248
@@ -1,305 +1,305
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 2.8.1, 2013-11-14T09:19:44. -->
3 <!-- Written by QtCreator 2.8.1, 2013-11-14T11:59:15. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
7 <value type="int">0</value>
7 <value type="int">0</value>
8 </data>
8 </data>
9 <data>
9 <data>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
10 <variable>ProjectExplorer.Project.EditorSettings</variable>
11 <valuemap type="QVariantMap">
11 <valuemap type="QVariantMap">
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
12 <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
13 <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
14 <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
15 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
16 <value type="QString" key="language">Cpp</value>
16 <value type="QString" key="language">Cpp</value>
17 <valuemap type="QVariantMap" key="value">
17 <valuemap type="QVariantMap" key="value">
18 <value type="QString" key="CurrentPreferences">CppGlobal</value>
18 <value type="QString" key="CurrentPreferences">CppGlobal</value>
19 </valuemap>
19 </valuemap>
20 </valuemap>
20 </valuemap>
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
21 <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
22 <value type="QString" key="language">QmlJS</value>
22 <value type="QString" key="language">QmlJS</value>
23 <valuemap type="QVariantMap" key="value">
23 <valuemap type="QVariantMap" key="value">
24 <value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
24 <value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
25 </valuemap>
25 </valuemap>
26 </valuemap>
26 </valuemap>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
27 <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
28 <value type="QByteArray" key="EditorConfiguration.Codec">System</value>
28 <value type="QByteArray" key="EditorConfiguration.Codec">System</value>
29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
29 <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
30 <value type="int" key="EditorConfiguration.IndentSize">4</value>
31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
31 <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
32 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
32 <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
33 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
33 <value type="int" key="EditorConfiguration.PaddingMode">1</value>
34 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
34 <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
35 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
35 <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
36 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
36 <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
37 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
37 <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
38 <value type="int" key="EditorConfiguration.TabSize">8</value>
38 <value type="int" key="EditorConfiguration.TabSize">8</value>
39 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
39 <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
40 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
40 <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
41 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
41 <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
42 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
42 <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
43 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
43 <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
44 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
44 <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
45 </valuemap>
45 </valuemap>
46 </data>
46 </data>
47 <data>
47 <data>
48 <variable>ProjectExplorer.Project.PluginSettings</variable>
48 <variable>ProjectExplorer.Project.PluginSettings</variable>
49 <valuemap type="QVariantMap"/>
49 <valuemap type="QVariantMap"/>
50 </data>
50 </data>
51 <data>
51 <data>
52 <variable>ProjectExplorer.Project.Target.0</variable>
52 <variable>ProjectExplorer.Project.Target.0</variable>
53 <valuemap type="QVariantMap">
53 <valuemap type="QVariantMap">
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
54 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
55 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop-Qt 4.8.2 in PATH (System)</value>
56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
56 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{5289e843-9ef2-45ce-88c6-ad27d8e08def}</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
57 <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
58 <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">1</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">1</value>
60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
60 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
61 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
61 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
62 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
63 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
63 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
64 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
64 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
65 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
66 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
67 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
67 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
68 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
69 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
69 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
70 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
70 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
71 </valuemap>
71 </valuemap>
72 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
72 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
73 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
73 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
74 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
74 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
75 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
76 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
77 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
77 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
78 <value type="QString">-w</value>
78 <value type="QString">-w</value>
79 <value type="QString">-r</value>
79 <value type="QString">-r</value>
80 </valuelist>
80 </valuelist>
81 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
81 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
82 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w -j 4</value>
82 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w -j 4</value>
83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
83 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
84 </valuemap>
84 </valuemap>
85 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
85 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
86 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
86 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
87 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
88 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
89 </valuemap>
89 </valuemap>
90 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
90 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
91 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
92 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
92 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
93 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
93 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
94 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
95 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
96 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
96 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
97 <value type="QString">-w</value>
97 <value type="QString">-w</value>
98 <value type="QString">-r</value>
98 <value type="QString">-r</value>
99 </valuelist>
99 </valuelist>
100 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
100 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
101 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value>
101 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value>
102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
102 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
103 </valuemap>
103 </valuemap>
104 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
104 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
105 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
105 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
106 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
107 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
108 </valuemap>
108 </valuemap>
109 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
109 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
110 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
110 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
111 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
111 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
112 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value>
112 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Release</value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
113 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
114 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
115 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
115 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
116 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
116 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
117 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
118 </valuemap>
118 </valuemap>
119 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
119 <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
120 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
120 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
121 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
122 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
122 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
123 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
124 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
125 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
126 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
126 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
127 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
127 <value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
128 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
128 <value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
129 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
129 <value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
130 </valuemap>
130 </valuemap>
131 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
131 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
132 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
132 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
133 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
133 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
134 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
134 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
135 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
136 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
136 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
137 <value type="QString">-w</value>
137 <value type="QString">-w</value>
138 <value type="QString">-r</value>
138 <value type="QString">-r</value>
139 </valuelist>
139 </valuelist>
140 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
140 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
141 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w </value>
141 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w </value>
142 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
142 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
143 </valuemap>
143 </valuemap>
144 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
144 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
145 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
145 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
146 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
146 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
147 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
147 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
148 </valuemap>
148 </valuemap>
149 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
149 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
150 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
150 <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
151 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
151 <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
152 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
152 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
153 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
153 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
154 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
154 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
155 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
155 <valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments">
156 <value type="QString">-w</value>
156 <value type="QString">-w</value>
157 <value type="QString">-r</value>
157 <value type="QString">-r</value>
158 </valuelist>
158 </valuelist>
159 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
159 <value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
160 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value>
160 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w clean</value>
161 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
161 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
162 </valuemap>
162 </valuemap>
163 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
163 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
164 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
164 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
165 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
165 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
166 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
166 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
167 </valuemap>
167 </valuemap>
168 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
168 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
169 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
169 <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
170 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
170 <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
171 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value>
171 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.2 in PATH (System) Debug</value>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
172 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
173 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
174 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
174 <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
175 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
175 <value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">/opt/DEV_PLE/FSW-qt</value>
176 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
176 <value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
177 </valuemap>
177 </valuemap>
178 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
178 <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
179 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
179 <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
180 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
180 <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
181 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
181 <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
182 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
182 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
183 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
183 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
184 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
184 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
185 </valuemap>
185 </valuemap>
186 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
186 <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
187 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value>
187 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">No deployment</value>
188 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
188 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
189 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
189 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
190 </valuemap>
190 </valuemap>
191 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
191 <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
192 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
192 <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
193 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
193 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
194 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
194 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
195 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
195 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
196 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
196 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
197 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
197 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
198 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
198 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
199 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
199 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
200 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
200 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
201 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
201 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
202 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
202 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
203 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
203 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
204 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
204 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
205 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
205 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
206 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
206 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
207 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
207 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
208 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
208 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
209 <value type="int">0</value>
209 <value type="int">0</value>
210 <value type="int">1</value>
210 <value type="int">1</value>
211 <value type="int">2</value>
211 <value type="int">2</value>
212 <value type="int">3</value>
212 <value type="int">3</value>
213 <value type="int">4</value>
213 <value type="int">4</value>
214 <value type="int">5</value>
214 <value type="int">5</value>
215 <value type="int">6</value>
215 <value type="int">6</value>
216 <value type="int">7</value>
216 <value type="int">7</value>
217 <value type="int">8</value>
217 <value type="int">8</value>
218 <value type="int">9</value>
218 <value type="int">9</value>
219 <value type="int">10</value>
219 <value type="int">10</value>
220 <value type="int">11</value>
220 <value type="int">11</value>
221 <value type="int">12</value>
221 <value type="int">12</value>
222 <value type="int">13</value>
222 <value type="int">13</value>
223 <value type="int">14</value>
223 <value type="int">14</value>
224 </valuelist>
224 </valuelist>
225 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
225 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
226 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
226 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
227 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
227 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">fsw-qt</value>
228 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
228 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
229 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
229 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/opt/DEV_PLE/FSW-qt/fsw-qt.pro</value>
230 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
230 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
231 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
231 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">fsw-qt.pro</value>
232 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
232 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
233 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
233 <value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">true</value>
234 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
234 <value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
235 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
235 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
236 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
236 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
237 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
237 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
238 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
238 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
239 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
239 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
240 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
240 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
241 </valuemap>
241 </valuemap>
242 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
242 <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
243 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
243 <value type="bool" key="Analyzer.Project.UseGlobal">true</value>
244 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
244 <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
245 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
245 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
246 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
246 <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
247 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
247 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
248 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
248 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
249 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
249 <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
250 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
250 <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
251 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
251 <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
252 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
252 <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
253 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
253 <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
254 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
254 <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
255 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
255 <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
256 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
256 <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
257 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
257 <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
258 <value type="int">0</value>
258 <value type="int">0</value>
259 <value type="int">1</value>
259 <value type="int">1</value>
260 <value type="int">2</value>
260 <value type="int">2</value>
261 <value type="int">3</value>
261 <value type="int">3</value>
262 <value type="int">4</value>
262 <value type="int">4</value>
263 <value type="int">5</value>
263 <value type="int">5</value>
264 <value type="int">6</value>
264 <value type="int">6</value>
265 <value type="int">7</value>
265 <value type="int">7</value>
266 <value type="int">8</value>
266 <value type="int">8</value>
267 <value type="int">9</value>
267 <value type="int">9</value>
268 <value type="int">10</value>
268 <value type="int">10</value>
269 <value type="int">11</value>
269 <value type="int">11</value>
270 <value type="int">12</value>
270 <value type="int">12</value>
271 <value type="int">13</value>
271 <value type="int">13</value>
272 <value type="int">14</value>
272 <value type="int">14</value>
273 </valuelist>
273 </valuelist>
274 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
274 <value type="int" key="PE.EnvironmentAspect.Base">2</value>
275 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
275 <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
276 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
276 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
277 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">doxygen</value>
277 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable">doxygen</value>
278 <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">true</value>
278 <value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">true</value>
279 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">/opt/DEV_PLE/doc</value>
279 <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">/opt/DEV_PLE/doc</value>
280 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run doxygen</value>
280 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Run doxygen</value>
281 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
281 <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
282 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
282 <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
283 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
283 <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
284 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
284 <value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
285 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
285 <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
286 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
286 <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
287 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
287 <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
288 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
288 <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
289 </valuemap>
289 </valuemap>
290 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">2</value>
290 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">2</value>
291 </valuemap>
291 </valuemap>
292 </data>
292 </data>
293 <data>
293 <data>
294 <variable>ProjectExplorer.Project.TargetCount</variable>
294 <variable>ProjectExplorer.Project.TargetCount</variable>
295 <value type="int">1</value>
295 <value type="int">1</value>
296 </data>
296 </data>
297 <data>
297 <data>
298 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
298 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
299 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
299 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
300 </data>
300 </data>
301 <data>
301 <data>
302 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
302 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
303 <value type="int">14</value>
303 <value type="int">14</value>
304 </data>
304 </data>
305 </qtcreator>
305 </qtcreator>
@@ -1,37 +1,39
1 #ifndef FSW_MISC_H_INCLUDED
1 #ifndef FSW_MISC_H_INCLUDED
2 #define FSW_MISC_H_INCLUDED
2 #define FSW_MISC_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <stdio.h>
5 #include <stdio.h>
6 #include <grspw.h>
6 #include <grspw.h>
7
7
8 #include "fsw_params.h"
8 #include "fsw_params.h"
9 #include "fsw_spacewire.h"
9 #include "fsw_spacewire.h"
10
10
11 rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic
11 rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic
12 rtems_id HK_id; // id of the HK rate monotonic period
12 rtems_id HK_id; // id of the HK rate monotonic period
13
13
14 extern rtems_name misc_name[5];
14 extern rtems_name misc_name[5];
15 time_management_regs_t *time_management_regs;
15 time_management_regs_t *time_management_regs;
16 extern Packet_TM_LFR_HK_t housekeeping_packet;
16 extern Packet_TM_LFR_HK_t housekeeping_packet;
17
17
18 int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
18 int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
19 unsigned char interrupt_level, rtems_isr (*timer_isr)() );
19 unsigned char interrupt_level, rtems_isr (*timer_isr)() );
20 int timer_start( gptimer_regs_t *gptimer_regs, unsigned char timer );
20 int timer_start( gptimer_regs_t *gptimer_regs, unsigned char timer );
21 int timer_stop( gptimer_regs_t *gptimer_regs, unsigned char timer );
21 int timer_stop( gptimer_regs_t *gptimer_regs, unsigned char timer );
22 int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider);
22 int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider);
23
23
24 // SERIAL LINK
24 // SERIAL LINK
25 int send_console_outputs_on_apbuart_port( void );
25 int send_console_outputs_on_apbuart_port( void );
26 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value);
26 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value);
27
27
28 // RTEMS TASKS
28 // RTEMS TASKS
29 rtems_task stat_task( rtems_task_argument argument );
29 rtems_task stat_task( rtems_task_argument argument );
30 rtems_task hous_task( rtems_task_argument argument );
30 rtems_task hous_task( rtems_task_argument argument );
31 rtems_task dumb_task( rtems_task_argument unused );
31 rtems_task dumb_task( rtems_task_argument unused );
32
32
33 void init_housekeeping_parameters( void );
33 void init_housekeeping_parameters( void );
34
34
35 void increment_seq_counter( unsigned char *packet_sequence_control);
35 void increment_seq_counter( unsigned char *packet_sequence_control);
36
36
37 void getTime( unsigned char *time);
38
37 #endif // FSW_MISC_H_INCLUDED
39 #endif // FSW_MISC_H_INCLUDED
@@ -1,63 +1,63
1 #ifndef TC_HANDLER_H_INCLUDED
1 #ifndef TC_HANDLER_H_INCLUDED
2 #define TC_HANDLER_H_INCLUDED
2 #define TC_HANDLER_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <leon.h>
5 #include <leon.h>
6
6
7 #include "tc_load_dump_parameters.h"
7 #include "tc_load_dump_parameters.h"
8 #include "tc_acceptance.h"
8 #include "tc_acceptance.h"
9 #include "tm_lfr_tc_exe.h"
9 #include "tm_lfr_tc_exe.h"
10 #include "wf_handler.h"
10 #include "wf_handler.h"
11
11
12 // MODE PARAMETERS
12 // MODE PARAMETERS
13 extern struct param_sbm1_str param_sbm1;
13 extern struct param_sbm1_str param_sbm1;
14 extern struct param_sbm2_str param_sbm2;
14 extern struct param_sbm2_str param_sbm2;
15 extern time_management_regs_t *time_management_regs;
15 extern time_management_regs_t *time_management_regs;
16 extern waveform_picker_regs_t *waveform_picker_regs;
16 extern waveform_picker_regs_t *waveform_picker_regs;
17 extern gptimer_regs_t *gptimer_regs;
17 extern gptimer_regs_t *gptimer_regs;
18 extern rtems_name misc_name[5];
18 extern rtems_name misc_name[5];
19 extern rtems_id Task_id[20]; /* array of task ids */
19 extern rtems_id Task_id[20]; /* array of task ids */
20 extern unsigned char lfrCurrentMode;
20 extern unsigned char lfrCurrentMode;
21 extern unsigned int maxCount;
21 extern unsigned int maxCount;
22
22
23
23
24 //****
24 //****
25 // ISR
25 // ISR
26 rtems_isr commutation_isr1( rtems_vector_number vector );
26 rtems_isr commutation_isr1( rtems_vector_number vector );
27 rtems_isr commutation_isr2( rtems_vector_number vector );
27 rtems_isr commutation_isr2( rtems_vector_number vector );
28
28
29 //***********
29 //***********
30 // RTEMS TASK
30 // RTEMS TASK
31 rtems_task actn_task( rtems_task_argument unused );
31 rtems_task actn_task( rtems_task_argument unused );
32
32
33 //***********
33 //***********
34 // TC ACTIONS
34 // TC ACTIONS
35 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
35 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
36 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
36 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
37 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
37 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
38 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
38 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
39 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
39 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
40 int action_update_time(ccsdsTelecommandPacket_t *TC);
40 int action_update_time(ccsdsTelecommandPacket_t *TC);
41
41
42 // mode transition
42 // mode transition
43 int transition_validation(unsigned char requestedMode);
43 int transition_validation(unsigned char requestedMode);
44 int stop_current_mode();
44 int stop_current_mode();
45 int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC);
45 int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC);
46 int enter_standby_mode();
46 int enter_standby_mode();
47 int enter_normal_mode();
47 int enter_normal_mode();
48 int enter_burst_mode();
48 int enter_burst_mode();
49 int enter_sbm1_mode();
49 int enter_sbm1_mode();
50 int enter_sbm2_mode();
50 int enter_sbm2_mode();
51 int restart_science_tasks();
51 int restart_science_tasks();
52 int suspend_science_tasks();
52 int suspend_science_tasks();
53
53
54 // other functions
54 // other functions
55 void updateLFRCurrentMode();
55 void updateLFRCurrentMode();
56 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time);
56 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time);
57 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time);
57 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time);
58 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id);
58 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time);
59
59
60 #endif // TC_HANDLER_H_INCLUDED
60 #endif // TC_HANDLER_H_INCLUDED
61
61
62
62
63
63
@@ -1,32 +1,32
1 #ifndef TC_LOAD_DUMP_PARAMETERS_H
1 #ifndef TC_LOAD_DUMP_PARAMETERS_H
2 #define TC_LOAD_DUMP_PARAMETERS_H
2 #define TC_LOAD_DUMP_PARAMETERS_H
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <stdio.h>
5 #include <stdio.h>
6
6
7 #include "fsw_params.h"
7 #include "fsw_params.h"
8 #include "wf_handler.h"
8 #include "wf_handler.h"
9 #include "tm_lfr_tc_exe.h"
9 #include "tm_lfr_tc_exe.h"
10 #include "fsw_misc.h"
10 #include "fsw_misc.h"
11
11
12 extern int fdSPW;
12 extern int fdSPW;
13 extern unsigned char lfrCurrentMode;
13 extern unsigned char lfrCurrentMode;
14 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
14 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
15 extern Packet_TM_LFR_HK_t housekeeping_packet;
15 extern Packet_TM_LFR_HK_t housekeeping_packet;
16
16
17 int action_load_common_par( ccsdsTelecommandPacket_t *TC );
17 int action_load_common_par( ccsdsTelecommandPacket_t *TC );
18 int action_load_normal_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
18 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
19 int action_load_burst_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
19 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
20 int action_load_sbm1_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
20 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
21 int action_load_sbm2_par( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
21 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
22 int action_dump_par(rtems_id queue_id );
22 int action_dump_par(rtems_id queue_id );
23
23
24 int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
24 int set_sy_lfr_n_swf_l(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
25 int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
25 int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
26 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
26 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
27 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
27 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
28 int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
28 int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
29
29
30 void init_parameter_dump( void );
30 void init_parameter_dump( void );
31
31
32 #endif // TC_LOAD_DUMP_PARAMETERS_H
32 #endif // TC_LOAD_DUMP_PARAMETERS_H
@@ -1,28 +1,28
1 #ifndef TM_LFR_TC_EXE_H_INCLUDED
1 #ifndef TM_LFR_TC_EXE_H_INCLUDED
2 #define TM_LFR_TC_EXE_H_INCLUDED
2 #define TM_LFR_TC_EXE_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <stdio.h>
5 #include <stdio.h>
6
6
7 #include "fsw_params.h"
7 #include "fsw_params.h"
8 #include "fsw_spacewire.h"
8 #include "fsw_spacewire.h"
9
9
10 extern time_management_regs_t *time_management_regs;
10 extern time_management_regs_t *time_management_regs;
11 extern Packet_TM_LFR_HK_t housekeeping_packet;
11 extern Packet_TM_LFR_HK_t housekeeping_packet;
12 extern unsigned short sequenceCounters_TC_EXE[];
12 extern unsigned short sequenceCounters_TC_EXE[];
13
13
14 int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
14 int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
15 int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
15 int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
16 unsigned char byte_position, unsigned char rcv_value);
16 unsigned char byte_position, unsigned char rcv_value, unsigned char *time);
17 int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
17 int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
18 int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
18 int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
19 int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id);
19 int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
20 int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
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, unsigned char destinationID);
21 unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV, unsigned char destinationID, unsigned char *time);
22
22
23 void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id );
23 void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id );
24
24
25 #endif // TM_LFR_TC_EXE_H_INCLUDED
25 #endif // TM_LFR_TC_EXE_H_INCLUDED
26
26
27
27
28
28
@@ -1,325 +1,333
1 /** General usage functions and RTEMS tasks.
1 /** General usage functions and RTEMS tasks.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 */
6 */
7
7
8 #include "fsw_misc.h"
8 #include "fsw_misc.h"
9
9
10 char *DumbMessages[7] = {"in DUMB *** default", // RTEMS_EVENT_0
10 char *DumbMessages[7] = {"in DUMB *** default", // RTEMS_EVENT_0
11 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
11 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
12 "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
12 "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
13 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
13 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
14 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
14 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
15 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
15 "in DUMB *** waveforms_simulator_isr", // RTEMS_EVENT_5
16 "ERR HK" // RTEMS_EVENT_6
16 "ERR HK" // RTEMS_EVENT_6
17 };
17 };
18
18
19 int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
19 int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
20 unsigned char interrupt_level, rtems_isr (*timer_isr)() )
20 unsigned char interrupt_level, rtems_isr (*timer_isr)() )
21 {
21 {
22 /** This function configures a GPTIMER timer instantiated in the VHDL design.
22 /** This function configures a GPTIMER timer instantiated in the VHDL design.
23 *
23 *
24 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
24 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
25 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
25 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
26 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
26 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
27 * @param interrupt_level is the interrupt level that the timer drives.
27 * @param interrupt_level is the interrupt level that the timer drives.
28 * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer.
28 * @param timer_isr is the interrupt subroutine that will be attached to the IRQ driven by the timer.
29 *
29 *
30 * @return
30 * @return
31 *
31 *
32 * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76
32 * Interrupt levels are described in the SPARC documentation sparcv8.pdf p.76
33 *
33 *
34 */
34 */
35
35
36 rtems_status_code status;
36 rtems_status_code status;
37 rtems_isr_entry old_isr_handler;
37 rtems_isr_entry old_isr_handler;
38
38
39 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
39 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
40 if (status!=RTEMS_SUCCESSFUL)
40 if (status!=RTEMS_SUCCESSFUL)
41 {
41 {
42 PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n")
42 PRINTF("in configure_timer *** ERR rtems_interrupt_catch\n")
43 }
43 }
44
44
45 timer_set_clock_divider( gptimer_regs, timer, clock_divider);
45 timer_set_clock_divider( gptimer_regs, timer, clock_divider);
46
46
47 return 1;
47 return 1;
48 }
48 }
49
49
50 int timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer)
50 int timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer)
51 {
51 {
52 /** This function starts a GPTIMER timer.
52 /** This function starts a GPTIMER timer.
53 *
53 *
54 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
54 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
55 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
55 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
56 *
56 *
57 * @return 1
57 * @return 1
58 *
58 *
59 */
59 */
60
60
61 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
61 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
62 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register
62 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register
63 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer
63 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer
64 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart
64 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000002; // RS restart
65 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable
65 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000008; // IE interrupt enable
66
66
67 return 1;
67 return 1;
68 }
68 }
69
69
70 int timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer)
70 int timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer)
71 {
71 {
72 /** This function stops a GPTIMER timer.
72 /** This function stops a GPTIMER timer.
73 *
73 *
74 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
74 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
75 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
75 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
76 *
76 *
77 * @return 1
77 * @return 1
78 *
78 *
79 */
79 */
80
80
81 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer
81 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer
82 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable
82 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable
83 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
83 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any
84
84
85 return 1;
85 return 1;
86 }
86 }
87
87
88 int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider)
88 int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider)
89 {
89 {
90 /** This function sets the clock divider of a GPTIMER timer.
90 /** This function sets the clock divider of a GPTIMER timer.
91 *
91 *
92 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
92 * @param gptimer_regs points to the APB registers of the GPTIMER IP core.
93 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
93 * @param timer is the number of the timer in the IP core (several timers can be instantiated).
94 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
94 * @param clock_divider is the divider of the 1 MHz clock that will be configured.
95 *
95 *
96 * @return 1
96 * @return 1
97 *
97 *
98 */
98 */
99
99
100 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
100 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
101
101
102 return 1;
102 return 1;
103 }
103 }
104
104
105 int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port
105 int send_console_outputs_on_apbuart_port( void ) // Send the console outputs on the apbuart port
106 {
106 {
107 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
107 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
108
108
109 apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB;
109 apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB;
110 PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
110 PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
111
111
112 return 0;
112 return 0;
113 }
113 }
114
114
115 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
115 void set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
116 {
116 {
117 /** This function sets the scaler reload register of the apbuart module
117 /** This function sets the scaler reload register of the apbuart module
118 *
118 *
119 * @param regs is the address of the apbuart registers in memory
119 * @param regs is the address of the apbuart registers in memory
120 * @param value is the value that will be stored in the scaler register
120 * @param value is the value that will be stored in the scaler register
121 *
121 *
122 * The value shall be set by the software to get data on the serial interface.
122 * The value shall be set by the software to get data on the serial interface.
123 *
123 *
124 */
124 */
125
125
126 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
126 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
127
127
128 apbuart_regs->scaler = value;
128 apbuart_regs->scaler = value;
129 BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value)
129 BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value)
130 }
130 }
131
131
132 //************
132 //************
133 // RTEMS TASKS
133 // RTEMS TASKS
134
134
135 rtems_task stat_task(rtems_task_argument argument)
135 rtems_task stat_task(rtems_task_argument argument)
136 {
136 {
137 int i;
137 int i;
138 int j;
138 int j;
139 i = 0;
139 i = 0;
140 j = 0;
140 j = 0;
141 BOOT_PRINTF("in STAT *** \n")
141 BOOT_PRINTF("in STAT *** \n")
142 while(1){
142 while(1){
143 rtems_task_wake_after(1000);
143 rtems_task_wake_after(1000);
144 PRINTF1("%d\n", j)
144 PRINTF1("%d\n", j)
145 if (i == CPU_USAGE_REPORT_PERIOD) {
145 if (i == CPU_USAGE_REPORT_PERIOD) {
146 // #ifdef PRINT_TASK_STATISTICS
146 // #ifdef PRINT_TASK_STATISTICS
147 // rtems_cpu_usage_report();
147 // rtems_cpu_usage_report();
148 // rtems_cpu_usage_reset();
148 // rtems_cpu_usage_reset();
149 // #endif
149 // #endif
150 i = 0;
150 i = 0;
151 }
151 }
152 else i++;
152 else i++;
153 j++;
153 j++;
154 }
154 }
155 }
155 }
156
156
157 rtems_task hous_task(rtems_task_argument argument)
157 rtems_task hous_task(rtems_task_argument argument)
158 {
158 {
159 rtems_status_code status;
159 rtems_status_code status;
160 rtems_id queue_id;
160 rtems_id queue_id;
161
161
162 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id );
162 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id );
163 if (status != RTEMS_SUCCESSFUL)
163 if (status != RTEMS_SUCCESSFUL)
164 {
164 {
165 PRINTF1("in HOUS *** ERR %d\n", status)
165 PRINTF1("in HOUS *** ERR %d\n", status)
166 }
166 }
167
167
168 BOOT_PRINTF("in HOUS ***\n")
168 BOOT_PRINTF("in HOUS ***\n")
169
169
170 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
170 if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) {
171 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
171 status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id );
172 if( status != RTEMS_SUCCESSFUL ) {
172 if( status != RTEMS_SUCCESSFUL ) {
173 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
173 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
174 }
174 }
175 }
175 }
176
176
177 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
177 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
178 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
178 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
179 housekeeping_packet.reserved = DEFAULT_RESERVED;
179 housekeeping_packet.reserved = DEFAULT_RESERVED;
180 housekeeping_packet.userApplication = CCSDS_USER_APP;
180 housekeeping_packet.userApplication = CCSDS_USER_APP;
181 housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8);
181 housekeeping_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8);
182 housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK);
182 housekeeping_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK);
183 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
183 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
184 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
184 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
185 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
185 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
186 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
186 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
187 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
187 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
188 housekeeping_packet.serviceType = TM_TYPE_HK;
188 housekeeping_packet.serviceType = TM_TYPE_HK;
189 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
189 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
190 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
190 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
191
191
192 status = rtems_rate_monotonic_cancel(HK_id);
192 status = rtems_rate_monotonic_cancel(HK_id);
193 if( status != RTEMS_SUCCESSFUL ) {
193 if( status != RTEMS_SUCCESSFUL ) {
194 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
194 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
195 }
195 }
196 else {
196 else {
197 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
197 DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
198 }
198 }
199
199
200 while(1){ // launch the rate monotonic task
200 while(1){ // launch the rate monotonic task
201 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
201 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
202 if ( status != RTEMS_SUCCESSFUL ) {
202 if ( status != RTEMS_SUCCESSFUL ) {
203 PRINTF1( "in HOUS *** ERR period: %d\n", status);
203 PRINTF1( "in HOUS *** ERR period: %d\n", status);
204 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
204 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_6 );
205 }
205 }
206 else {
206 else {
207 increment_seq_counter( housekeeping_packet.packetSequenceControl );
207 increment_seq_counter( housekeeping_packet.packetSequenceControl );
208 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
208 housekeeping_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
209 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
209 housekeeping_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
210 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
210 housekeeping_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
211 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
211 housekeeping_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
212 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
212 housekeeping_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
213 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
213 housekeeping_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
214 housekeeping_packet.sid = SID_HK;
214 housekeeping_packet.sid = SID_HK;
215
215
216 spacewire_update_statistics();
216 spacewire_update_statistics();
217
217
218 // SEND PACKET
218 // SEND PACKET
219 status = rtems_message_queue_send( queue_id, &housekeeping_packet,
219 status = rtems_message_queue_send( queue_id, &housekeeping_packet,
220 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
220 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
221 if (status != RTEMS_SUCCESSFUL) {
221 if (status != RTEMS_SUCCESSFUL) {
222 PRINTF1("in HOUS *** ERR send: %d\n", status)
222 PRINTF1("in HOUS *** ERR send: %d\n", status)
223 }
223 }
224 }
224 }
225 }
225 }
226
226
227 PRINTF("in HOUS *** deleting task\n")
227 PRINTF("in HOUS *** deleting task\n")
228
228
229 status = rtems_task_delete( RTEMS_SELF ); // should not return
229 status = rtems_task_delete( RTEMS_SELF ); // should not return
230 printf( "rtems_task_delete returned with status of %d.\n", status );
230 printf( "rtems_task_delete returned with status of %d.\n", status );
231 return;
231 return;
232 }
232 }
233
233
234 rtems_task dumb_task( rtems_task_argument unused )
234 rtems_task dumb_task( rtems_task_argument unused )
235 {
235 {
236 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
236 /** This RTEMS taks is used to print messages without affecting the general behaviour of the software.
237 *
237 *
238 * @param unused is the starting argument of the RTEMS task
238 * @param unused is the starting argument of the RTEMS task
239 *
239 *
240 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
240 * The DUMB taks waits for RTEMS events and print messages depending on the incoming events.
241 *
241 *
242 */
242 */
243
243
244 unsigned int i;
244 unsigned int i;
245 unsigned int intEventOut;
245 unsigned int intEventOut;
246 unsigned int coarse_time = 0;
246 unsigned int coarse_time = 0;
247 unsigned int fine_time = 0;
247 unsigned int fine_time = 0;
248 rtems_event_set event_out;
248 rtems_event_set event_out;
249
249
250 BOOT_PRINTF("in DUMB *** \n")
250 BOOT_PRINTF("in DUMB *** \n")
251
251
252 while(1){
252 while(1){
253 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
253 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3
254 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6,
254 | RTEMS_EVENT_4 | RTEMS_EVENT_5 | RTEMS_EVENT_6,
255 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
255 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
256 intEventOut = (unsigned int) event_out;
256 intEventOut = (unsigned int) event_out;
257 for ( i=0; i<32; i++)
257 for ( i=0; i<32; i++)
258 {
258 {
259 if ( ((intEventOut >> i) & 0x0001) != 0)
259 if ( ((intEventOut >> i) & 0x0001) != 0)
260 {
260 {
261 coarse_time = time_management_regs->coarse_time;
261 coarse_time = time_management_regs->coarse_time;
262 fine_time = time_management_regs->fine_time;
262 fine_time = time_management_regs->fine_time;
263 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
263 printf("in DUMB *** coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
264 }
264 }
265 }
265 }
266 }
266 }
267 }
267 }
268
268
269 //*****************************
269 //*****************************
270 // init housekeeping parameters
270 // init housekeeping parameters
271
271
272 void init_housekeeping_parameters( void )
272 void init_housekeeping_parameters( void )
273 {
273 {
274 /** This function initialize the housekeeping_packet global variable with default values.
274 /** This function initialize the housekeeping_packet global variable with default values.
275 *
275 *
276 */
276 */
277
277
278 unsigned int i = 0;
278 unsigned int i = 0;
279 char *parameters;
279 char *parameters;
280
280
281 parameters = (char*) &housekeeping_packet.lfr_status_word;
281 parameters = (char*) &housekeeping_packet.lfr_status_word;
282 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
282 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
283 {
283 {
284 parameters[i] = 0x00;
284 parameters[i] = 0x00;
285 }
285 }
286 // init status word
286 // init status word
287 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
287 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
288 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
288 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
289 // init software version
289 // init software version
290 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
290 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
291 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
291 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
292 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
292 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
293 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
293 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
294
294
295 }
295 }
296
296
297 void increment_seq_counter( unsigned char *packet_sequence_control)
297 void increment_seq_counter( unsigned char *packet_sequence_control)
298 {
298 {
299 unsigned short sequence_cnt;
299 unsigned short sequence_cnt;
300 unsigned short segmentation_grouping_flag;
300 unsigned short segmentation_grouping_flag;
301 unsigned short new_packet_sequence_control;
301 unsigned short new_packet_sequence_control;
302
302
303 segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6
303 segmentation_grouping_flag = (unsigned short) ( (packet_sequence_control[0] & 0xc0) << 8 ); // keep bits 7 downto 6
304 sequence_cnt = (unsigned short) (
304 sequence_cnt = (unsigned short) (
305 ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0
305 ( (packet_sequence_control[0] & 0x3f) << 8 ) // keep bits 5 downto 0
306 + packet_sequence_control[1]
306 + packet_sequence_control[1]
307 );
307 );
308
308
309 if ( sequence_cnt < SEQ_CNT_MAX)
309 if ( sequence_cnt < SEQ_CNT_MAX)
310 {
310 {
311 sequence_cnt = sequence_cnt + 1;
311 sequence_cnt = sequence_cnt + 1;
312 }
312 }
313 else
313 else
314 {
314 {
315 sequence_cnt = 0;
315 sequence_cnt = 0;
316 }
316 }
317
317
318 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
318 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
319
319
320 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
320 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
321 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
321 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
322 }
322 }
323
323
324 void getTime( unsigned char *time)
325 {
326 time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
327 time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
328 time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
329 time[3] = (unsigned char) (time_management_regs->coarse_time);
330 time[4] = (unsigned char) (time_management_regs->fine_time>>8);
331 time[5] = (unsigned char) (time_management_regs->fine_time);
332 }
324
333
325
@@ -1,621 +1,626
1 /** Functions related to the SpaceWire interface.
1 /** Functions related to the SpaceWire interface.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to handle SpaceWire transmissions:
6 * A group of functions to handle SpaceWire transmissions:
7 * - configuration of the SpaceWire link
7 * - configuration of the SpaceWire link
8 * - SpaceWire related interruption requests processing
8 * - SpaceWire related interruption requests processing
9 * - transmission of TeleMetry packets by a dedicated RTEMS task
9 * - transmission of TeleMetry packets by a dedicated RTEMS task
10 * - reception of TeleCommands by a dedicated RTEMS task
10 * - reception of TeleCommands by a dedicated RTEMS task
11 *
11 *
12 */
12 */
13
13
14 #include "fsw_spacewire.h"
14 #include "fsw_spacewire.h"
15
15
16 char *lstates[6] = {"Error-reset",
16 char *lstates[6] = {"Error-reset",
17 "Error-wait",
17 "Error-wait",
18 "Ready",
18 "Ready",
19 "Started",
19 "Started",
20 "Connecting",
20 "Connecting",
21 "Run"
21 "Run"
22 };
22 };
23
23
24 rtems_name semq_name;
24 rtems_name semq_name;
25 rtems_id semq_id;
25 rtems_id semq_id;
26
26
27 //***********
27 //***********
28 // RTEMS TASK
28 // RTEMS TASK
29 rtems_task spiq_task(rtems_task_argument unused)
29 rtems_task spiq_task(rtems_task_argument unused)
30 {
30 {
31 /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver.
31 /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver.
32 *
32 *
33 * @param unused is the starting argument of the RTEMS task
33 * @param unused is the starting argument of the RTEMS task
34 *
34 *
35 */
35 */
36
36
37 rtems_event_set event_out;
37 rtems_event_set event_out;
38 rtems_status_code status;
38 rtems_status_code status;
39 int linkStatus;
39 int linkStatus;
40
40
41 BOOT_PRINTF("in SPIQ *** \n")
41 BOOT_PRINTF("in SPIQ *** \n")
42
42
43 while(true){
43 while(true){
44 rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT
44 rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT
45 PRINTF("in SPIQ *** got SPW_LINKERR_EVENT\n")
45 PRINTF("in SPIQ *** got SPW_LINKERR_EVENT\n")
46
46
47 // [0] SUSPEND RECV AND SEND TASKS
47 // [0] SUSPEND RECV AND SEND TASKS
48 rtems_task_suspend( Task_id[ TASKID_RECV ] );
48 rtems_task_suspend( Task_id[ TASKID_RECV ] );
49 rtems_task_suspend( Task_id[ TASKID_SEND ] );
49 rtems_task_suspend( Task_id[ TASKID_SEND ] );
50
50
51 // [1] CHECK THE LINK
51 // [1] CHECK THE LINK
52 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1)
52 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1)
53 if ( linkStatus != 5) {
53 if ( linkStatus != 5) {
54 PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus)
54 PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus)
55 rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms
55 rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms
56 }
56 }
57
57
58 // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT
58 // [2] RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT
59 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2)
59 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2)
60 if ( linkStatus != 5 ) // [2.a] not in run state, reset the link
60 if ( linkStatus != 5 ) // [2.a] not in run state, reset the link
61 {
61 {
62 spacewire_compute_stats_offsets();
62 spacewire_compute_stats_offsets();
63 status = spacewire_reset_link( );
63 status = spacewire_reset_link( );
64 }
64 }
65 else // [2.b] in run state, start the link
65 else // [2.b] in run state, start the link
66 {
66 {
67 status = spacewire_stop_start_link( fdSPW ); // start the link
67 status = spacewire_stop_start_link( fdSPW ); // start the link
68 if ( status != RTEMS_SUCCESSFUL)
68 if ( status != RTEMS_SUCCESSFUL)
69 {
69 {
70 PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status)
70 PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status)
71 }
71 }
72 }
72 }
73
73
74 // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS
74 // [3] COMPLETE RECOVERY ACTION AFTER SY_LFR_DPU_CONNECT_ATTEMPTS
75 if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully
75 if ( status == RTEMS_SUCCESSFUL ) // [3.a] the link is in run state and has been started successfully
76 {
76 {
77 status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 );
77 status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 );
78 if ( status != RTEMS_SUCCESSFUL ) {
78 if ( status != RTEMS_SUCCESSFUL ) {
79 PRINTF("in SPIQ *** ERR resuming SEND Task\n")
79 PRINTF("in SPIQ *** ERR resuming SEND Task\n")
80 }
80 }
81 status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 );
81 status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 );
82 if ( status != RTEMS_SUCCESSFUL ) {
82 if ( status != RTEMS_SUCCESSFUL ) {
83 PRINTF("in SPIQ *** ERR resuming RECV Task\n")
83 PRINTF("in SPIQ *** ERR resuming RECV Task\n")
84 }
84 }
85 }
85 }
86 else // [3.b] the link is not in run state, go in STANDBY mode
86 else // [3.b] the link is not in run state, go in STANDBY mode
87 {
87 {
88 status = stop_current_mode();
88 status = stop_current_mode();
89 if ( status != RTEMS_SUCCESSFUL ) {
89 if ( status != RTEMS_SUCCESSFUL ) {
90 PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status)
90 PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status)
91 }
91 }
92 status = enter_standby_mode();
92 status = enter_standby_mode();
93 if ( status != RTEMS_SUCCESSFUL ) {
93 if ( status != RTEMS_SUCCESSFUL ) {
94 PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status)
94 PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status)
95 }
95 }
96 // wake the WTDG task up to wait for the link recovery
96 // wake the WTDG task up to wait for the link recovery
97 status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 );
97 status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 );
98 rtems_task_suspend( RTEMS_SELF );
98 rtems_task_suspend( RTEMS_SELF );
99 }
99 }
100 }
100 }
101 }
101 }
102
102
103 rtems_task recv_task( rtems_task_argument unused )
103 rtems_task recv_task( rtems_task_argument unused )
104 {
104 {
105 /** This RTEMS task is dedicated to the reception of incoming TeleCommands.
105 /** This RTEMS task is dedicated to the reception of incoming TeleCommands.
106 *
106 *
107 * @param unused is the starting argument of the RTEMS task
107 * @param unused is the starting argument of the RTEMS task
108 *
108 *
109 * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked:
109 * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked:
110 * 1. It reads the incoming data.
110 * 1. It reads the incoming data.
111 * 2. Launches the acceptance procedure.
111 * 2. Launches the acceptance procedure.
112 * 3. If the Telecommand is valid, sends it to a dedicated RTEMS message queue.
112 * 3. If the Telecommand is valid, sends it to a dedicated RTEMS message queue.
113 *
113 *
114 */
114 */
115
115
116 int len;
116 int len;
117 ccsdsTelecommandPacket_t currentTC;
117 ccsdsTelecommandPacket_t currentTC;
118 unsigned char computed_CRC[ 2 ];
118 unsigned char computed_CRC[ 2 ];
119 unsigned char currentTC_LEN_RCV[ 2 ];
119 unsigned char currentTC_LEN_RCV[ 2 ];
120 unsigned char destinationID;
120 unsigned char destinationID;
121 unsigned int currentTC_LEN_RCV_AsUnsignedInt;
121 unsigned int currentTC_LEN_RCV_AsUnsignedInt;
122 unsigned int parserCode;
122 unsigned int parserCode;
123 unsigned char time[6];
123 rtems_status_code status;
124 rtems_status_code status;
124 rtems_id queue_recv_id;
125 rtems_id queue_recv_id;
125 rtems_id queue_send_id;
126 rtems_id queue_send_id;
126
127
127 initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes
128 initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes
128
129
129 status = rtems_message_queue_ident( misc_name[QUEUE_RECV], 0, &queue_recv_id );
130 status = rtems_message_queue_ident( misc_name[QUEUE_RECV], 0, &queue_recv_id );
130 if (status != RTEMS_SUCCESSFUL)
131 if (status != RTEMS_SUCCESSFUL)
131 {
132 {
132 PRINTF1("in RECV *** ERR getting QUEUE_RECV id, %d\n", status)
133 PRINTF1("in RECV *** ERR getting QUEUE_RECV id, %d\n", status)
133 }
134 }
134
135
135 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_send_id );
136 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_send_id );
136 if (status != RTEMS_SUCCESSFUL)
137 if (status != RTEMS_SUCCESSFUL)
137 {
138 {
138 PRINTF1("in RECV *** ERR getting QUEUE_SEND id, %d\n", status)
139 PRINTF1("in RECV *** ERR getting QUEUE_SEND id, %d\n", status)
139 }
140 }
140
141
141 BOOT_PRINTF("in RECV *** \n")
142 BOOT_PRINTF("in RECV *** \n")
142
143
143 while(1)
144 while(1)
144 {
145 {
145 len = read( fdSPW, (char*) &currentTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking
146 len = read( fdSPW, (char*) &currentTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking
146 if (len == -1){ // error during the read call
147 if (len == -1){ // error during the read call
147 PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno)
148 PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno)
148 }
149 }
149 else {
150 else {
150 if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) {
151 if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) {
151 PRINTF("in RECV *** packet lenght too short\n")
152 PRINTF("in RECV *** packet lenght too short\n")
152 }
153 }
153 else {
154 else {
154 currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes
155 currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes
155 currentTC_LEN_RCV[ 0 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt >> 8);
156 currentTC_LEN_RCV[ 0 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt >> 8);
156 currentTC_LEN_RCV[ 1 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt );
157 currentTC_LEN_RCV[ 1 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt );
157 // CHECK THE TC
158 // CHECK THE TC
158 parserCode = tc_parser( &currentTC, currentTC_LEN_RCV_AsUnsignedInt, computed_CRC ) ;
159 parserCode = tc_parser( &currentTC, currentTC_LEN_RCV_AsUnsignedInt, computed_CRC ) ;
159 if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT)
160 if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT)
160 || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE)
161 || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE)
161 || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA)
162 || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA)
162 || (parserCode == WRONG_SRC_ID) )
163 || (parserCode == WRONG_SRC_ID) )
163 { // send TM_LFR_TC_EXE_CORRUPTED
164 { // send TM_LFR_TC_EXE_CORRUPTED
164 if ( !( (currentTC.serviceType==TC_TYPE_TIME) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_TIME) )
165 if ( !( (currentTC.serviceType==TC_TYPE_TIME) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_TIME) )
165 &&
166 &&
166 !( (currentTC.serviceType==TC_TYPE_GEN) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_INFO))
167 !( (currentTC.serviceType==TC_TYPE_GEN) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_INFO))
167 )
168 )
168 {
169 {
169 if ( parserCode == WRONG_SRC_ID )
170 if ( parserCode == WRONG_SRC_ID )
170 {
171 {
171 destinationID = SID_TC_GROUND;
172 destinationID = SID_TC_GROUND;
172 }
173 }
173 else
174 else
174 {
175 {
175 destinationID = currentTC.sourceID;
176 destinationID = currentTC.sourceID;
176 }
177 }
177 send_tm_lfr_tc_exe_corrupted( &currentTC, queue_send_id, computed_CRC, currentTC_LEN_RCV, destinationID );
178 getTime( time );
179 close_action( &currentTC, LFR_DEFAULT, queue_send_id, time);
180 send_tm_lfr_tc_exe_corrupted( &currentTC, queue_send_id,
181 computed_CRC, currentTC_LEN_RCV,
182 destinationID, time );
178 }
183 }
179 }
184 }
180 else
185 else
181 { // send valid TC to the action launcher
186 { // send valid TC to the action launcher
182 status = rtems_message_queue_send( queue_recv_id, &currentTC,
187 status = rtems_message_queue_send( queue_recv_id, &currentTC,
183 currentTC_LEN_RCV_AsUnsignedInt + CCSDS_TC_TM_PACKET_OFFSET + 3);
188 currentTC_LEN_RCV_AsUnsignedInt + CCSDS_TC_TM_PACKET_OFFSET + 3);
184 }
189 }
185 }
190 }
186 }
191 }
187 }
192 }
188 }
193 }
189
194
190 rtems_task send_task( rtems_task_argument argument)
195 rtems_task send_task( rtems_task_argument argument)
191 {
196 {
192 /** This RTEMS task is dedicated to the transmission of TeleMetry packets.
197 /** This RTEMS task is dedicated to the transmission of TeleMetry packets.
193 *
198 *
194 * @param unused is the starting argument of the RTEMS task
199 * @param unused is the starting argument of the RTEMS task
195 *
200 *
196 * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives:
201 * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives:
197 * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call.
202 * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call.
198 * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After
203 * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After
199 * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the
204 * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the
200 * data it contains.
205 * data it contains.
201 *
206 *
202 */
207 */
203
208
204 rtems_status_code status; // RTEMS status code
209 rtems_status_code status; // RTEMS status code
205 char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer
210 char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer
206 spw_ioctl_pkt_send *spw_ioctl_send;
211 spw_ioctl_pkt_send *spw_ioctl_send;
207 size_t size; // size of the incoming TC packet
212 size_t size; // size of the incoming TC packet
208 u_int32_t count;
213 u_int32_t count;
209 rtems_id queue_id;
214 rtems_id queue_id;
210
215
211 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id );
216 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id );
212 if (status != RTEMS_SUCCESSFUL)
217 if (status != RTEMS_SUCCESSFUL)
213 {
218 {
214 PRINTF1("in SEND *** ERR getting queue id, %d\n", status)
219 PRINTF1("in SEND *** ERR getting queue id, %d\n", status)
215 }
220 }
216
221
217 BOOT_PRINTF("in SEND *** \n")
222 BOOT_PRINTF("in SEND *** \n")
218
223
219 while(1)
224 while(1)
220 {
225 {
221 status = rtems_message_queue_receive( queue_id, incomingData, &size,
226 status = rtems_message_queue_receive( queue_id, incomingData, &size,
222 RTEMS_WAIT, RTEMS_NO_TIMEOUT );
227 RTEMS_WAIT, RTEMS_NO_TIMEOUT );
223
228
224 if (status!=RTEMS_SUCCESSFUL)
229 if (status!=RTEMS_SUCCESSFUL)
225 {
230 {
226 PRINTF1("in SEND *** (1) ERR = %d\n", status)
231 PRINTF1("in SEND *** (1) ERR = %d\n", status)
227 }
232 }
228 else
233 else
229 {
234 {
230 if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet
235 if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet
231 {
236 {
232 status = write( fdSPW, incomingData, size );
237 status = write( fdSPW, incomingData, size );
233 if (status == -1){
238 if (status == -1){
234 PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size)
239 PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size)
235 }
240 }
236 }
241 }
237 else // the incoming message is a spw_ioctl_pkt_send structure
242 else // the incoming message is a spw_ioctl_pkt_send structure
238 {
243 {
239 spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData;
244 spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData;
240 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send );
245 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send );
241 if (status == -1){
246 if (status == -1){
242 PRINTF2("in SEND *** (2.b) ERRNO = %d, RTEMS = %d\n", errno, status)
247 PRINTF2("in SEND *** (2.b) ERRNO = %d, RTEMS = %d\n", errno, status)
243 }
248 }
244 }
249 }
245 }
250 }
246
251
247 status = rtems_message_queue_get_number_pending( queue_id, &count );
252 status = rtems_message_queue_get_number_pending( queue_id, &count );
248 if (status != RTEMS_SUCCESSFUL)
253 if (status != RTEMS_SUCCESSFUL)
249 {
254 {
250 PRINTF1("in SEND *** (3) ERR = %d\n", status)
255 PRINTF1("in SEND *** (3) ERR = %d\n", status)
251 }
256 }
252 else
257 else
253 {
258 {
254 if (count > maxCount)
259 if (count > maxCount)
255 {
260 {
256 maxCount = count;
261 maxCount = count;
257 }
262 }
258 }
263 }
259 }
264 }
260 }
265 }
261
266
262 rtems_task wtdg_task( rtems_task_argument argument )
267 rtems_task wtdg_task( rtems_task_argument argument )
263 {
268 {
264 rtems_event_set event_out;
269 rtems_event_set event_out;
265 rtems_status_code status;
270 rtems_status_code status;
266 int linkStatus;
271 int linkStatus;
267
272
268 BOOT_PRINTF("in WTDG ***\n")
273 BOOT_PRINTF("in WTDG ***\n")
269
274
270 while(1)
275 while(1)
271 {
276 {
272 // wait for an RTEMS_EVENT
277 // wait for an RTEMS_EVENT
273 rtems_event_receive( RTEMS_EVENT_0,
278 rtems_event_receive( RTEMS_EVENT_0,
274 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
279 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
275 PRINTF("in WTDG *** wait for the link\n")
280 PRINTF("in WTDG *** wait for the link\n")
276 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
281 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
277 while( linkStatus != 5) // wait for the link
282 while( linkStatus != 5) // wait for the link
278 {
283 {
279 rtems_task_wake_after( 10 );
284 rtems_task_wake_after( 10 );
280 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
285 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
281 }
286 }
282
287
283 status = spacewire_stop_start_link( fdSPW );
288 status = spacewire_stop_start_link( fdSPW );
284
289
285 if (status != RTEMS_SUCCESSFUL)
290 if (status != RTEMS_SUCCESSFUL)
286 {
291 {
287 PRINTF1("in WTDG *** ERR link not started %d\n", status)
292 PRINTF1("in WTDG *** ERR link not started %d\n", status)
288 }
293 }
289 else
294 else
290 {
295 {
291 PRINTF("in WTDG *** OK link started\n")
296 PRINTF("in WTDG *** OK link started\n")
292 }
297 }
293
298
294 // restart the SPIQ task
299 // restart the SPIQ task
295 status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 );
300 status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 );
296 if ( status != RTEMS_SUCCESSFUL ) {
301 if ( status != RTEMS_SUCCESSFUL ) {
297 PRINTF("in SPIQ *** ERR restarting SPIQ Task\n")
302 PRINTF("in SPIQ *** ERR restarting SPIQ Task\n")
298 }
303 }
299
304
300 // restart RECV and SEND
305 // restart RECV and SEND
301 status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 );
306 status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 );
302 if ( status != RTEMS_SUCCESSFUL ) {
307 if ( status != RTEMS_SUCCESSFUL ) {
303 PRINTF("in SPIQ *** ERR restarting SEND Task\n")
308 PRINTF("in SPIQ *** ERR restarting SEND Task\n")
304 }
309 }
305 status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 );
310 status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 );
306 if ( status != RTEMS_SUCCESSFUL ) {
311 if ( status != RTEMS_SUCCESSFUL ) {
307 PRINTF("in SPIQ *** ERR restarting RECV Task\n")
312 PRINTF("in SPIQ *** ERR restarting RECV Task\n")
308 }
313 }
309 }
314 }
310 }
315 }
311
316
312 //****************
317 //****************
313 // OTHER FUNCTIONS
318 // OTHER FUNCTIONS
314 int spacewire_open_link( void )
319 int spacewire_open_link( void )
315 {
320 {
316 /** This function opens the SpaceWire link.
321 /** This function opens the SpaceWire link.
317 *
322 *
318 * @return a valid file descriptor in case of success, -1 in case of a failure
323 * @return a valid file descriptor in case of success, -1 in case of a failure
319 *
324 *
320 */
325 */
321 rtems_status_code status;
326 rtems_status_code status;
322
327
323 fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware
328 fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware
324 if ( fdSPW < 0 ) {
329 if ( fdSPW < 0 ) {
325 PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno)
330 PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno)
326 }
331 }
327 else
332 else
328 {
333 {
329 status = RTEMS_SUCCESSFUL;
334 status = RTEMS_SUCCESSFUL;
330 }
335 }
331
336
332 return status;
337 return status;
333 }
338 }
334
339
335 int spacewire_start_link( int fd )
340 int spacewire_start_link( int fd )
336 {
341 {
337 rtems_status_code status;
342 rtems_status_code status;
338
343
339 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
344 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
340 // -1 default hardcoded driver timeout
345 // -1 default hardcoded driver timeout
341
346
342 return status;
347 return status;
343 }
348 }
344
349
345 int spacewire_stop_start_link( int fd )
350 int spacewire_stop_start_link( int fd )
346 {
351 {
347 rtems_status_code status;
352 rtems_status_code status;
348
353
349 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0
354 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0
350 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
355 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started
351 // -1 default hardcoded driver timeout
356 // -1 default hardcoded driver timeout
352
357
353 return status;
358 return status;
354 }
359 }
355
360
356 int spacewire_configure_link( int fd )
361 int spacewire_configure_link( int fd )
357 {
362 {
358 /** This function configures the SpaceWire link.
363 /** This function configures the SpaceWire link.
359 *
364 *
360 * @return GR-RTEMS-DRIVER directive status codes:
365 * @return GR-RTEMS-DRIVER directive status codes:
361 * - 22 EINVAL - Null pointer or an out of range value was given as the argument.
366 * - 22 EINVAL - Null pointer or an out of range value was given as the argument.
362 * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode.
367 * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode.
363 * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used.
368 * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used.
364 * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up.
369 * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up.
365 * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers.
370 * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers.
366 * - 5 EIO - Error when writing to grswp hardware registers.
371 * - 5 EIO - Error when writing to grswp hardware registers.
367 * - 2 ENOENT - No such file or directory
372 * - 2 ENOENT - No such file or directory
368 */
373 */
369
374
370 rtems_status_code status;
375 rtems_status_code status;
371
376
372 spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force
377 spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force
373 spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration
378 spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration
374
379
375 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception
380 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception
376 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n")
381 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n")
377 //
382 //
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
383 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a
379 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs
384 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs
380 //
385 //
381 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts
386 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts
382 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n")
387 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n")
383 //
388 //
384 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit
389 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit
385 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
390 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
386 //
391 //
387 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks
392 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks
388 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n")
393 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n")
389 //
394 //
390 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available
395 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available
391 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n")
396 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n")
392 //
397 //
393 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ]
398 status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ]
394 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n")
399 if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n")
395
400
396 return status;
401 return status;
397 }
402 }
398
403
399 int spacewire_reset_link( void )
404 int spacewire_reset_link( void )
400 {
405 {
401 /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver.
406 /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver.
402 *
407 *
403 * @return RTEMS directive status code:
408 * @return RTEMS directive status code:
404 * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s.
409 * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s.
405 * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout.
410 * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout.
406 *
411 *
407 */
412 */
408
413
409 rtems_status_code status_spw;
414 rtems_status_code status_spw;
410 int i;
415 int i;
411
416
412 for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ )
417 for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ )
413 {
418 {
414 PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i);
419 PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i);
415
420
416 // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM
421 // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM
417
422
418 status_spw = spacewire_stop_start_link( fdSPW );
423 status_spw = spacewire_stop_start_link( fdSPW );
419 if ( status_spw != RTEMS_SUCCESSFUL )
424 if ( status_spw != RTEMS_SUCCESSFUL )
420 {
425 {
421 PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw)
426 PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw)
422 }
427 }
423
428
424 if ( status_spw == RTEMS_SUCCESSFUL)
429 if ( status_spw == RTEMS_SUCCESSFUL)
425 {
430 {
426 break;
431 break;
427 }
432 }
428 }
433 }
429
434
430 return status_spw;
435 return status_spw;
431 }
436 }
432
437
433 void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force
438 void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force
434 {
439 {
435 /** This function sets the [N]o [P]ort force bit of the GRSPW control register.
440 /** This function sets the [N]o [P]ort force bit of the GRSPW control register.
436 *
441 *
437 * @param val is the value, 0 or 1, used to set the value of the NP bit.
442 * @param val is the value, 0 or 1, used to set the value of the NP bit.
438 * @param regAddr is the address of the GRSPW control register.
443 * @param regAddr is the address of the GRSPW control register.
439 *
444 *
440 * NP is the bit 20 of the GRSPW control register.
445 * NP is the bit 20 of the GRSPW control register.
441 *
446 *
442 */
447 */
443
448
444 unsigned int *spwptr = (unsigned int*) regAddr;
449 unsigned int *spwptr = (unsigned int*) regAddr;
445
450
446 if (val == 1) {
451 if (val == 1) {
447 *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit
452 *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit
448 }
453 }
449 if (val== 0) {
454 if (val== 0) {
450 *spwptr = *spwptr & 0xffdfffff;
455 *spwptr = *spwptr & 0xffdfffff;
451 }
456 }
452 }
457 }
453
458
454 void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable
459 void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable
455 {
460 {
456 /** This function sets the [R]MAP [E]nable bit of the GRSPW control register.
461 /** This function sets the [R]MAP [E]nable bit of the GRSPW control register.
457 *
462 *
458 * @param val is the value, 0 or 1, used to set the value of the RE bit.
463 * @param val is the value, 0 or 1, used to set the value of the RE bit.
459 * @param regAddr is the address of the GRSPW control register.
464 * @param regAddr is the address of the GRSPW control register.
460 *
465 *
461 * RE is the bit 16 of the GRSPW control register.
466 * RE is the bit 16 of the GRSPW control register.
462 *
467 *
463 */
468 */
464
469
465 unsigned int *spwptr = (unsigned int*) regAddr;
470 unsigned int *spwptr = (unsigned int*) regAddr;
466
471
467 if (val == 1)
472 if (val == 1)
468 {
473 {
469 *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit
474 *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit
470 }
475 }
471 if (val== 0)
476 if (val== 0)
472 {
477 {
473 *spwptr = *spwptr & 0xfffdffff;
478 *spwptr = *spwptr & 0xfffdffff;
474 }
479 }
475 }
480 }
476
481
477 void spacewire_compute_stats_offsets( void )
482 void spacewire_compute_stats_offsets( void )
478 {
483 {
479 /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising.
484 /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising.
480 *
485 *
481 * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics
486 * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics
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
487 * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it
483 * during the open systel call).
488 * during the open systel call).
484 *
489 *
485 */
490 */
486
491
487 spw_stats spacewire_stats_grspw;
492 spw_stats spacewire_stats_grspw;
488 rtems_status_code status;
493 rtems_status_code status;
489
494
490 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
495 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
491
496
492 spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received
497 spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received
493 + spacewire_stats.packets_received;
498 + spacewire_stats.packets_received;
494 spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent
499 spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent
495 + spacewire_stats.packets_sent;
500 + spacewire_stats.packets_sent;
496 spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err
501 spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err
497 + spacewire_stats.parity_err;
502 + spacewire_stats.parity_err;
498 spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err
503 spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err
499 + spacewire_stats.disconnect_err;
504 + spacewire_stats.disconnect_err;
500 spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err
505 spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err
501 + spacewire_stats.escape_err;
506 + spacewire_stats.escape_err;
502 spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err
507 spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err
503 + spacewire_stats.credit_err;
508 + spacewire_stats.credit_err;
504 spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err
509 spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err
505 + spacewire_stats.write_sync_err;
510 + spacewire_stats.write_sync_err;
506 spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err
511 spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err
507 + spacewire_stats.rx_rmap_header_crc_err;
512 + spacewire_stats.rx_rmap_header_crc_err;
508 spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err
513 spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err
509 + spacewire_stats.rx_rmap_data_crc_err;
514 + spacewire_stats.rx_rmap_data_crc_err;
510 spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep
515 spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep
511 + spacewire_stats.early_ep;
516 + spacewire_stats.early_ep;
512 spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address
517 spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address
513 + spacewire_stats.invalid_address;
518 + spacewire_stats.invalid_address;
514 spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err
519 spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err
515 + spacewire_stats.rx_eep_err;
520 + spacewire_stats.rx_eep_err;
516 spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated
521 spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated
517 + spacewire_stats.rx_truncated;
522 + spacewire_stats.rx_truncated;
518 }
523 }
519
524
520 void spacewire_update_statistics( void )
525 void spacewire_update_statistics( void )
521 {
526 {
522 rtems_status_code status;
527 rtems_status_code status;
523 spw_stats spacewire_stats_grspw;
528 spw_stats spacewire_stats_grspw;
524
529
525 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
530 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw );
526
531
527 spacewire_stats.packets_received = spacewire_stats_backup.packets_received
532 spacewire_stats.packets_received = spacewire_stats_backup.packets_received
528 + spacewire_stats_grspw.packets_received;
533 + spacewire_stats_grspw.packets_received;
529 spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent
534 spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent
530 + spacewire_stats_grspw.packets_sent;
535 + spacewire_stats_grspw.packets_sent;
531 spacewire_stats.parity_err = spacewire_stats_backup.parity_err
536 spacewire_stats.parity_err = spacewire_stats_backup.parity_err
532 + spacewire_stats_grspw.parity_err;
537 + spacewire_stats_grspw.parity_err;
533 spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err
538 spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err
534 + spacewire_stats_grspw.disconnect_err;
539 + spacewire_stats_grspw.disconnect_err;
535 spacewire_stats.escape_err = spacewire_stats_backup.escape_err
540 spacewire_stats.escape_err = spacewire_stats_backup.escape_err
536 + spacewire_stats_grspw.escape_err;
541 + spacewire_stats_grspw.escape_err;
537 spacewire_stats.credit_err = spacewire_stats_backup.credit_err
542 spacewire_stats.credit_err = spacewire_stats_backup.credit_err
538 + spacewire_stats_grspw.credit_err;
543 + spacewire_stats_grspw.credit_err;
539 spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err
544 spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err
540 + spacewire_stats_grspw.write_sync_err;
545 + spacewire_stats_grspw.write_sync_err;
541 spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err
546 spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err
542 + spacewire_stats_grspw.rx_rmap_header_crc_err;
547 + spacewire_stats_grspw.rx_rmap_header_crc_err;
543 spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err
548 spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err
544 + spacewire_stats_grspw.rx_rmap_data_crc_err;
549 + spacewire_stats_grspw.rx_rmap_data_crc_err;
545 spacewire_stats.early_ep = spacewire_stats_backup.early_ep
550 spacewire_stats.early_ep = spacewire_stats_backup.early_ep
546 + spacewire_stats_grspw.early_ep;
551 + spacewire_stats_grspw.early_ep;
547 spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address
552 spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address
548 + spacewire_stats_grspw.invalid_address;
553 + spacewire_stats_grspw.invalid_address;
549 spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err
554 spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err
550 + spacewire_stats_grspw.rx_eep_err;
555 + spacewire_stats_grspw.rx_eep_err;
551 spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated
556 spacewire_stats.rx_truncated = spacewire_stats_backup.rx_truncated
552 + spacewire_stats_grspw.rx_truncated;
557 + spacewire_stats_grspw.rx_truncated;
553 //spacewire_stats.tx_link_err;
558 //spacewire_stats.tx_link_err;
554
559
555 //****************************
560 //****************************
556 // DPU_SPACEWIRE_IF_STATISTICS
561 // DPU_SPACEWIRE_IF_STATISTICS
557 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8);
562 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[0] = (unsigned char) (spacewire_stats.packets_received >> 8);
558 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received);
563 housekeeping_packet.hk_lfr_dpu_spw_pkt_rcv_cnt[1] = (unsigned char) (spacewire_stats.packets_received);
559 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8);
564 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[0] = (unsigned char) (spacewire_stats.packets_sent >> 8);
560 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent);
565 housekeeping_packet.hk_lfr_dpu_spw_pkt_sent_cnt[1] = (unsigned char) (spacewire_stats.packets_sent);
561 //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt;
566 //housekeeping_packet.hk_lfr_dpu_spw_tick_out_cnt;
562 //housekeeping_packet.hk_lfr_dpu_spw_last_timc;
567 //housekeeping_packet.hk_lfr_dpu_spw_last_timc;
563
568
564 //******************************************
569 //******************************************
565 // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY
570 // ERROR COUNTERS / SPACEWIRE / LOW SEVERITY
566 housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err;
571 housekeeping_packet.hk_lfr_dpu_spw_parity = (unsigned char) spacewire_stats.parity_err;
567 housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err;
572 housekeeping_packet.hk_lfr_dpu_spw_disconnect = (unsigned char) spacewire_stats.disconnect_err;
568 housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err;
573 housekeeping_packet.hk_lfr_dpu_spw_escape = (unsigned char) spacewire_stats.escape_err;
569 housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err;
574 housekeeping_packet.hk_lfr_dpu_spw_credit = (unsigned char) spacewire_stats.credit_err;
570 housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err;
575 housekeeping_packet.hk_lfr_dpu_spw_write_sync = (unsigned char) spacewire_stats.write_sync_err;
571 // housekeeping_packet.hk_lfr_dpu_spw_rx_ahb;
576 // housekeeping_packet.hk_lfr_dpu_spw_rx_ahb;
572 // housekeeping_packet.hk_lfr_dpu_spw_tx_ahb;
577 // housekeeping_packet.hk_lfr_dpu_spw_tx_ahb;
573 housekeeping_packet.hk_lfr_dpu_spw_header_crc = (unsigned char) spacewire_stats.rx_rmap_header_crc_err;
578 housekeeping_packet.hk_lfr_dpu_spw_header_crc = (unsigned char) spacewire_stats.rx_rmap_header_crc_err;
574 housekeeping_packet.hk_lfr_dpu_spw_data_crc = (unsigned char) spacewire_stats.rx_rmap_data_crc_err;
579 housekeeping_packet.hk_lfr_dpu_spw_data_crc = (unsigned char) spacewire_stats.rx_rmap_data_crc_err;
575
580
576 //*********************************************
581 //*********************************************
577 // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY
582 // ERROR COUNTERS / SPACEWIRE / MEDIUM SEVERITY
578 housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep;
583 housekeeping_packet.hk_lfr_dpu_spw_early_eop = (unsigned char) spacewire_stats.early_ep;
579 housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address;
584 housekeeping_packet.hk_lfr_dpu_spw_invalid_addr = (unsigned char) spacewire_stats.invalid_address;
580 housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err;
585 housekeeping_packet.hk_lfr_dpu_spw_eep = (unsigned char) spacewire_stats.rx_eep_err;
581 housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated;
586 housekeeping_packet.hk_lfr_dpu_spw_rx_too_big = (unsigned char) spacewire_stats.rx_truncated;
582
587
583 }
588 }
584
589
585 void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc )
590 void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc )
586 {
591 {
587 //if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) {
592 //if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_1 ) != RTEMS_SUCCESSFUL) {
588 // printf("In timecode_irq_handler *** Error sending event to DUMB\n");
593 // printf("In timecode_irq_handler *** Error sending event to DUMB\n");
589 //}
594 //}
590 }
595 }
591
596
592 rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data )
597 rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data )
593 {
598 {
594 int linkStatus;
599 int linkStatus;
595 rtems_status_code status;
600 rtems_status_code status;
596
601
597 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
602 ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status
598
603
599 if ( linkStatus == 5) {
604 if ( linkStatus == 5) {
600 PRINTF("in spacewire_reset_link *** link is running\n")
605 PRINTF("in spacewire_reset_link *** link is running\n")
601 status = RTEMS_SUCCESSFUL;
606 status = RTEMS_SUCCESSFUL;
602 }
607 }
603 }
608 }
604
609
605 rtems_status_code rtems_message_queue_send_lfr( rtems_id id, const void *buffer, size_t size )
610 rtems_status_code rtems_message_queue_send_lfr( rtems_id id, const void *buffer, size_t size )
606 {
611 {
607 rtems_status_code status;
612 rtems_status_code status;
608 rtems_mode previous_mode_set;
613 rtems_mode previous_mode_set;
609
614
610 // set the preemption OFF
615 // set the preemption OFF
611 status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &previous_mode_set );
616 status = rtems_task_mode( RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &previous_mode_set );
612
617
613 // use the message queue
618 // use the message queue
614 status = rtems_message_queue_send_lfr( id, buffer, size );
619 status = rtems_message_queue_send_lfr( id, buffer, size );
615
620
616 // set the preemption ON
621 // set the preemption ON
617 status = rtems_task_mode( RTEMS_PREEMPT , RTEMS_PREEMPT_MASK, &previous_mode_set );
622 status = rtems_task_mode( RTEMS_PREEMPT , RTEMS_PREEMPT_MASK, &previous_mode_set );
618
623
619 return status;
624 return status;
620 }
625 }
621
626
@@ -1,777 +1,771
1 /** Functions and tasks related to TeleCommand handling.
1 /** Functions and tasks related to TeleCommand handling.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to handle TeleCommands:\n
6 * A group of functions to handle TeleCommands:\n
7 * action launching\n
7 * action launching\n
8 * TC parsing\n
8 * TC parsing\n
9 * ...
9 * ...
10 *
10 *
11 */
11 */
12
12
13 #include "tc_handler.h"
13 #include "tc_handler.h"
14
14
15 //***********
15 //***********
16 // RTEMS TASK
16 // RTEMS TASK
17
17
18 rtems_task actn_task( rtems_task_argument unused )
18 rtems_task actn_task( rtems_task_argument unused )
19 {
19 {
20 /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands.
20 /** This RTEMS task is responsible for launching actions upton the reception of valid TeleCommands.
21 *
21 *
22 * @param unused is the starting argument of the RTEMS task
22 * @param unused is the starting argument of the RTEMS task
23 *
23 *
24 * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending
24 * The ACTN task waits for data coming from an RTEMS msesage queue. When data arrives, it launches specific actions depending
25 * on the incoming TeleCommand.
25 * on the incoming TeleCommand.
26 *
26 *
27 */
27 */
28
28
29 int result;
29 int result;
30 rtems_status_code status; // RTEMS status code
30 rtems_status_code status; // RTEMS status code
31 ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task
31 ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task
32 size_t size; // size of the incoming TC packet
32 size_t size; // size of the incoming TC packet
33 unsigned char subtype; // subtype of the current TC packet
33 unsigned char subtype; // subtype of the current TC packet
34 unsigned char time[6];
34 rtems_id queue_rcv_id;
35 rtems_id queue_rcv_id;
35 rtems_id queue_snd_id;
36 rtems_id queue_snd_id;
36
37
37 status = rtems_message_queue_ident( misc_name[QUEUE_RECV], 0, &queue_rcv_id );
38 status = rtems_message_queue_ident( misc_name[QUEUE_RECV], 0, &queue_rcv_id );
38 if (status != RTEMS_SUCCESSFUL)
39 if (status != RTEMS_SUCCESSFUL)
39 {
40 {
40 PRINTF1("in ACTN *** ERR getting queue_rcv_id %d\n", status)
41 PRINTF1("in ACTN *** ERR getting queue_rcv_id %d\n", status)
41 }
42 }
42
43
43 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_snd_id );
44 status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_snd_id );
44 if (status != RTEMS_SUCCESSFUL)
45 if (status != RTEMS_SUCCESSFUL)
45 {
46 {
46 PRINTF1("in ACTN *** ERR getting queue_snd_id %d\n", status)
47 PRINTF1("in ACTN *** ERR getting queue_snd_id %d\n", status)
47 }
48 }
48
49
49 result = LFR_SUCCESSFUL;
50 result = LFR_SUCCESSFUL;
50 subtype = 0; // subtype of the current TC packet
51 subtype = 0; // subtype of the current TC packet
51
52
52 BOOT_PRINTF("in ACTN *** \n")
53 BOOT_PRINTF("in ACTN *** \n")
53
54
54 while(1)
55 while(1)
55 {
56 {
56 status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
57 status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
57 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
58 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
59 getTime( time ); // set time to the current time
58 if (status!=RTEMS_SUCCESSFUL) PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
60 if (status!=RTEMS_SUCCESSFUL) PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
59 else
61 else
60 {
62 {
61 subtype = TC.serviceSubType;
63 subtype = TC.serviceSubType;
62 switch(subtype)
64 switch(subtype)
63 {
65 {
64 case TC_SUBTYPE_RESET:
66 case TC_SUBTYPE_RESET:
65 result = action_reset( &TC, queue_snd_id );
67 result = action_reset( &TC, queue_snd_id, time );
66 close_action( &TC, result, queue_snd_id );
68 close_action( &TC, result, queue_snd_id, time );
67 break;
69 break;
68 //
70 //
69 case TC_SUBTYPE_LOAD_COMM:
71 case TC_SUBTYPE_LOAD_COMM:
70 result = action_load_common_par( &TC );
72 result = action_load_common_par( &TC );
71 close_action( &TC, result, queue_snd_id );
73 close_action( &TC, result, queue_snd_id, time );
72 break;
74 break;
73 //
75 //
74 case TC_SUBTYPE_LOAD_NORM:
76 case TC_SUBTYPE_LOAD_NORM:
75 result = action_load_normal_par( &TC, queue_snd_id );
77 result = action_load_normal_par( &TC, queue_snd_id, time );
76 close_action( &TC, result, queue_snd_id );
78 close_action( &TC, result, queue_snd_id, time );
77 break;
79 break;
78 //
80 //
79 case TC_SUBTYPE_LOAD_BURST:
81 case TC_SUBTYPE_LOAD_BURST:
80 result = action_load_burst_par( &TC, queue_snd_id );
82 result = action_load_burst_par( &TC, queue_snd_id, time );
81 close_action( &TC, result, queue_snd_id );
83 close_action( &TC, result, queue_snd_id, time );
82 break;
84 break;
83 //
85 //
84 case TC_SUBTYPE_LOAD_SBM1:
86 case TC_SUBTYPE_LOAD_SBM1:
85 result = action_load_sbm1_par( &TC, queue_snd_id );
87 result = action_load_sbm1_par( &TC, queue_snd_id, time );
86 close_action( &TC, result, queue_snd_id );
88 close_action( &TC, result, queue_snd_id, time );
87 break;
89 break;
88 //
90 //
89 case TC_SUBTYPE_LOAD_SBM2:
91 case TC_SUBTYPE_LOAD_SBM2:
90 result = action_load_sbm2_par( &TC, queue_snd_id );
92 result = action_load_sbm2_par( &TC, queue_snd_id, time );
91 close_action( &TC, result, queue_snd_id );
93 close_action( &TC, result, queue_snd_id, time );
92 break;
94 break;
93 //
95 //
94 case TC_SUBTYPE_DUMP:
96 case TC_SUBTYPE_DUMP:
95 result = action_dump_par( queue_snd_id );
97 result = action_dump_par( queue_snd_id );
96 close_action( &TC, result, queue_snd_id );
98 close_action( &TC, result, queue_snd_id, time );
97 break;
99 break;
98 //
100 //
99 case TC_SUBTYPE_ENTER:
101 case TC_SUBTYPE_ENTER:
100 result = action_enter_mode( &TC, queue_snd_id );
102 result = action_enter_mode( &TC, queue_snd_id, time );
101 close_action( &TC, result, queue_snd_id );
103 close_action( &TC, result, queue_snd_id, time );
102 break;
104 break;
103 //
105 //
104 case TC_SUBTYPE_UPDT_INFO:
106 case TC_SUBTYPE_UPDT_INFO:
105 result = action_update_info( &TC, queue_snd_id );
107 result = action_update_info( &TC, queue_snd_id );
106 close_action( &TC, result, queue_snd_id );
108 close_action( &TC, result, queue_snd_id, time );
107 break;
109 break;
108 //
110 //
109 case TC_SUBTYPE_EN_CAL:
111 case TC_SUBTYPE_EN_CAL:
110 result = action_enable_calibration( &TC, queue_snd_id );
112 result = action_enable_calibration( &TC, queue_snd_id, time );
111 close_action( &TC, result, queue_snd_id );
113 close_action( &TC, result, queue_snd_id, time );
112 break;
114 break;
113 //
115 //
114 case TC_SUBTYPE_DIS_CAL:
116 case TC_SUBTYPE_DIS_CAL:
115 result = action_disable_calibration( &TC, queue_snd_id );
117 result = action_disable_calibration( &TC, queue_snd_id, time );
116 close_action( &TC, result, queue_snd_id );
118 close_action( &TC, result, queue_snd_id, time );
117 break;
119 break;
118 //
120 //
119 case TC_SUBTYPE_UPDT_TIME:
121 case TC_SUBTYPE_UPDT_TIME:
120 result = action_update_time( &TC );
122 result = action_update_time( &TC );
121 close_action( &TC, result, queue_snd_id );
123 close_action( &TC, result, queue_snd_id, time );
122 break;
124 break;
123 //
125 //
124 default:
126 default:
125 break;
127 break;
126 }
128 }
127 }
129 }
128 }
130 }
129 }
131 }
130
132
131 //***********
133 //***********
132 // TC ACTIONS
134 // TC ACTIONS
133
135
134 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
136 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
135 {
137 {
136 /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
138 /** This function executes specific actions when a TC_LFR_RESET TeleCommand has been received.
137 *
139 *
138 * @param TC points to the TeleCommand packet that is being processed
140 * @param TC points to the TeleCommand packet that is being processed
139 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
141 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
140 *
142 *
141 */
143 */
142
144
143 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
145 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
144 return LFR_DEFAULT;
146 return LFR_DEFAULT;
145 }
147 }
146
148
147 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
149 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
148 {
150 {
149 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
151 /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received.
150 *
152 *
151 * @param TC points to the TeleCommand packet that is being processed
153 * @param TC points to the TeleCommand packet that is being processed
152 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
154 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
153 *
155 *
154 */
156 */
155
157
156 rtems_status_code status;
158 rtems_status_code status;
157 unsigned char requestedMode;
159 unsigned char requestedMode;
158
160
159 requestedMode = TC->dataAndCRC[1];
161 requestedMode = TC->dataAndCRC[1];
160
162
161 if ( (requestedMode != LFR_MODE_STANDBY)
163 if ( (requestedMode != LFR_MODE_STANDBY)
162 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
164 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
163 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
165 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
164 {
166 {
165 status = RTEMS_UNSATISFIED;
167 status = RTEMS_UNSATISFIED;
166 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode );
168 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode, time );
167 }
169 }
168 else
170 else
169 {
171 {
170 printf("try to enter mode %d\n", requestedMode);
172 printf("try to enter mode %d\n", requestedMode);
171
173
172 #ifdef PRINT_TASK_STATISTICS
174 #ifdef PRINT_TASK_STATISTICS
173 if (requestedMode != LFR_MODE_STANDBY)
175 if (requestedMode != LFR_MODE_STANDBY)
174 {
176 {
175 rtems_cpu_usage_reset();
177 rtems_cpu_usage_reset();
176 maxCount = 0;
178 maxCount = 0;
177 }
179 }
178 #endif
180 #endif
179
181
180 status = transition_validation(requestedMode);
182 status = transition_validation(requestedMode);
181
183
182 if ( status == LFR_SUCCESSFUL ) {
184 if ( status == LFR_SUCCESSFUL ) {
183 if ( lfrCurrentMode != LFR_MODE_STANDBY)
185 if ( lfrCurrentMode != LFR_MODE_STANDBY)
184 {
186 {
185 status = stop_current_mode();
187 status = stop_current_mode();
186 }
188 }
187 if (status != RTEMS_SUCCESSFUL)
189 if (status != RTEMS_SUCCESSFUL)
188 {
190 {
189 PRINTF("ERR *** in action_enter *** stop_current_mode\n")
191 PRINTF("ERR *** in action_enter *** stop_current_mode\n")
190 }
192 }
191 status = enter_mode(requestedMode, TC);
193 status = enter_mode(requestedMode, TC);
192 }
194 }
193 else
195 else
194 {
196 {
195 PRINTF("ERR *** in action_enter *** transition rejected\n")
197 PRINTF("ERR *** in action_enter *** transition rejected\n")
196 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
198 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
197 }
199 }
198 }
200 }
199
201
200 return status;
202 return status;
201 }
203 }
202
204
203 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
205 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
204 {
206 {
205 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
207 /** This function executes specific actions when a TC_LFR_UPDATE_INFO TeleCommand has been received.
206 *
208 *
207 * @param TC points to the TeleCommand packet that is being processed
209 * @param TC points to the TeleCommand packet that is being processed
208 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
210 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
209 *
211 *
210 * @return LFR directive status code:
212 * @return LFR directive status code:
211 * - LFR_DEFAULT
213 * - LFR_DEFAULT
212 * - LFR_SUCCESSFUL
214 * - LFR_SUCCESSFUL
213 *
215 *
214 */
216 */
215
217
216 unsigned int val;
218 unsigned int val;
217 int result;
219 int result;
218
220
219 result = LFR_DEFAULT;
221 result = LFR_DEFAULT;
220
222
221 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
223 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
222 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
224 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
223 val++;
225 val++;
224 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
226 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
225 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
227 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
226
228
227 return result;
229 return result;
228 }
230 }
229
231
230 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
232 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
231 {
233 {
232 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
234 /** This function executes specific actions when a TC_LFR_ENABLE_CALIBRATION TeleCommand has been received.
233 *
235 *
234 * @param TC points to the TeleCommand packet that is being processed
236 * @param TC points to the TeleCommand packet that is being processed
235 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
237 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
236 *
238 *
237 */
239 */
238
240
239 int result;
241 int result;
240 unsigned char lfrMode;
242 unsigned char lfrMode;
241
243
242 result = LFR_DEFAULT;
244 result = LFR_DEFAULT;
243 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
245 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
244
246
245 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
247 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
246 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
248 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
247 result = LFR_DEFAULT;
249 result = LFR_DEFAULT;
248 }
250 }
249 else {
251 else {
250 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
252 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
251 result = LFR_DEFAULT;
253 result = LFR_DEFAULT;
252 }
254 }
253 return result;
255 return result;
254 }
256 }
255
257
256 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
258 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
257 {
259 {
258 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
260 /** This function executes specific actions when a TC_LFR_DISABLE_CALIBRATION TeleCommand has been received.
259 *
261 *
260 * @param TC points to the TeleCommand packet that is being processed
262 * @param TC points to the TeleCommand packet that is being processed
261 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
263 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
262 *
264 *
263 */
265 */
264
266
265 int result;
267 int result;
266 unsigned char lfrMode;
268 unsigned char lfrMode;
267
269
268 result = LFR_DEFAULT;
270 result = LFR_DEFAULT;
269 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
271 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
270
272
271 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
273 if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) {
272 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
274 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
273 result = LFR_DEFAULT;
275 result = LFR_DEFAULT;
274 }
276 }
275 else {
277 else {
276 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
278 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
277 result = LFR_DEFAULT;
279 result = LFR_DEFAULT;
278 }
280 }
279 return result;
281 return result;
280 }
282 }
281
283
282 int action_update_time(ccsdsTelecommandPacket_t *TC)
284 int action_update_time(ccsdsTelecommandPacket_t *TC)
283 {
285 {
284 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
286 /** This function executes specific actions when a TC_LFR_UPDATE_TIME TeleCommand has been received.
285 *
287 *
286 * @param TC points to the TeleCommand packet that is being processed
288 * @param TC points to the TeleCommand packet that is being processed
287 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
289 * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver
288 *
290 *
289 * @return LFR_SUCCESSFUL
291 * @return LFR_SUCCESSFUL
290 *
292 *
291 */
293 */
292
294
293 unsigned int val;
295 unsigned int val;
294
296
295 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
297 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
296 + (TC->dataAndCRC[1] << 16)
298 + (TC->dataAndCRC[1] << 16)
297 + (TC->dataAndCRC[2] << 8)
299 + (TC->dataAndCRC[2] << 8)
298 + TC->dataAndCRC[3];
300 + TC->dataAndCRC[3];
299 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
301 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
300 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
302 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
301 val++;
303 val++;
302 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
304 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
303 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
305 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
304 time_management_regs->ctrl = time_management_regs->ctrl | 1;
306 time_management_regs->ctrl = time_management_regs->ctrl | 1;
305
307
306 return LFR_SUCCESSFUL;
308 return LFR_SUCCESSFUL;
307 }
309 }
308
310
309 //*******************
311 //*******************
310 // ENTERING THE MODES
312 // ENTERING THE MODES
311
313
312 int transition_validation(unsigned char requestedMode)
314 int transition_validation(unsigned char requestedMode)
313 {
315 {
314 int status;
316 int status;
315
317
316 switch (requestedMode)
318 switch (requestedMode)
317 {
319 {
318 case LFR_MODE_STANDBY:
320 case LFR_MODE_STANDBY:
319 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
321 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
320 status = LFR_DEFAULT;
322 status = LFR_DEFAULT;
321 }
323 }
322 else
324 else
323 {
325 {
324 status = LFR_SUCCESSFUL;
326 status = LFR_SUCCESSFUL;
325 }
327 }
326 break;
328 break;
327 case LFR_MODE_NORMAL:
329 case LFR_MODE_NORMAL:
328 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
330 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
329 status = LFR_DEFAULT;
331 status = LFR_DEFAULT;
330 }
332 }
331 else {
333 else {
332 status = LFR_SUCCESSFUL;
334 status = LFR_SUCCESSFUL;
333 }
335 }
334 break;
336 break;
335 case LFR_MODE_BURST:
337 case LFR_MODE_BURST:
336 if ( lfrCurrentMode == LFR_MODE_BURST ) {
338 if ( lfrCurrentMode == LFR_MODE_BURST ) {
337 status = LFR_DEFAULT;
339 status = LFR_DEFAULT;
338 }
340 }
339 else {
341 else {
340 status = LFR_SUCCESSFUL;
342 status = LFR_SUCCESSFUL;
341 }
343 }
342 break;
344 break;
343 case LFR_MODE_SBM1:
345 case LFR_MODE_SBM1:
344 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
346 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
345 status = LFR_DEFAULT;
347 status = LFR_DEFAULT;
346 }
348 }
347 else {
349 else {
348 status = LFR_SUCCESSFUL;
350 status = LFR_SUCCESSFUL;
349 }
351 }
350 break;
352 break;
351 case LFR_MODE_SBM2:
353 case LFR_MODE_SBM2:
352 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
354 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
353 status = LFR_DEFAULT;
355 status = LFR_DEFAULT;
354 }
356 }
355 else {
357 else {
356 status = LFR_SUCCESSFUL;
358 status = LFR_SUCCESSFUL;
357 }
359 }
358 break;
360 break;
359 default:
361 default:
360 status = LFR_DEFAULT;
362 status = LFR_DEFAULT;
361 break;
363 break;
362 }
364 }
363
365
364 return status;
366 return status;
365 }
367 }
366
368
367 int stop_current_mode()
369 int stop_current_mode()
368 {
370 {
369 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
371 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
370 *
372 *
371 * @return RTEMS directive status codes:
373 * @return RTEMS directive status codes:
372 * - RTEMS_SUCCESSFUL - task restarted successfully
374 * - RTEMS_SUCCESSFUL - task restarted successfully
373 * - RTEMS_INVALID_ID - task id invalid
375 * - RTEMS_INVALID_ID - task id invalid
374 * - RTEMS_ALREADY_SUSPENDED - task already suspended
376 * - RTEMS_ALREADY_SUSPENDED - task already suspended
375 *
377 *
376 */
378 */
377
379
378 rtems_status_code status;
380 rtems_status_code status;
379
381
380 status = RTEMS_SUCCESSFUL;
382 status = RTEMS_SUCCESSFUL;
381
383
382 #ifdef GSA
384 #ifdef GSA
383 LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP)
385 LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP)
384 LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP)
386 LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP)
385 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR );
387 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR );
386 #else
388 #else
387 // mask interruptions
389 // mask interruptions
388 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
390 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
389 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt
391 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt
390 // reset registers
392 // reset registers
391 reset_wfp_burst_enable(); // reset burst and enable bits
393 reset_wfp_burst_enable(); // reset burst and enable bits
392 reset_wfp_status(); // reset all the status bits
394 reset_wfp_status(); // reset all the status bits
393 // creal interruptions
395 // creal interruptions
394 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
396 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
395 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectarl matrix interrupt
397 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectarl matrix interrupt
396 #endif
398 #endif
397 //**********************
399 //**********************
398 // suspend several tasks
400 // suspend several tasks
399 if (lfrCurrentMode != LFR_MODE_STANDBY) {
401 if (lfrCurrentMode != LFR_MODE_STANDBY) {
400 status = suspend_science_tasks();
402 status = suspend_science_tasks();
401 }
403 }
402
404
403 if (status != RTEMS_SUCCESSFUL)
405 if (status != RTEMS_SUCCESSFUL)
404 {
406 {
405 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
407 PRINTF1("in stop_current_mode *** in suspend_science_tasks *** ERR code: %d\n", status)
406 }
408 }
407
409
408 return status;
410 return status;
409 }
411 }
410
412
411 int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC )
413 int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC )
412 {
414 {
413 rtems_status_code status;
415 rtems_status_code status;
414
416
415 status = RTEMS_UNSATISFIED;
417 status = RTEMS_UNSATISFIED;
416
418
417 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d);
419 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d);
418 updateLFRCurrentMode();
420 updateLFRCurrentMode();
419
421
420 switch(mode){
422 switch(mode){
421 case LFR_MODE_STANDBY:
423 case LFR_MODE_STANDBY:
422 status = enter_standby_mode( );
424 status = enter_standby_mode( );
423 break;
425 break;
424 case LFR_MODE_NORMAL:
426 case LFR_MODE_NORMAL:
425 status = enter_normal_mode( );
427 status = enter_normal_mode( );
426 break;
428 break;
427 case LFR_MODE_BURST:
429 case LFR_MODE_BURST:
428 status = enter_burst_mode( );
430 status = enter_burst_mode( );
429 break;
431 break;
430 case LFR_MODE_SBM1:
432 case LFR_MODE_SBM1:
431 status = enter_sbm1_mode( );
433 status = enter_sbm1_mode( );
432 break;
434 break;
433 case LFR_MODE_SBM2:
435 case LFR_MODE_SBM2:
434 status = enter_sbm2_mode( );
436 status = enter_sbm2_mode( );
435 break;
437 break;
436 default:
438 default:
437 status = RTEMS_UNSATISFIED;
439 status = RTEMS_UNSATISFIED;
438 }
440 }
439
441
440 if (status != RTEMS_SUCCESSFUL)
442 if (status != RTEMS_SUCCESSFUL)
441 {
443 {
442 PRINTF("in enter_mode *** ERR\n")
444 PRINTF("in enter_mode *** ERR\n")
443 status = RTEMS_UNSATISFIED;
445 status = RTEMS_UNSATISFIED;
444 }
446 }
445
447
446 return status;
448 return status;
447 }
449 }
448
450
449 int enter_standby_mode()
451 int enter_standby_mode()
450 {
452 {
451 PRINTF1("maxCount = %d\n", maxCount)
453 PRINTF1("maxCount = %d\n", maxCount)
452
454
453 #ifdef PRINT_TASK_STATISTICS
455 #ifdef PRINT_TASK_STATISTICS
454 rtems_cpu_usage_report();
456 rtems_cpu_usage_report();
455 #endif
457 #endif
456
458
457 #ifdef PRINT_STACK_REPORT
459 #ifdef PRINT_STACK_REPORT
458 rtems_stack_checker_report_usage();
460 rtems_stack_checker_report_usage();
459 #endif
461 #endif
460
462
461 return LFR_SUCCESSFUL;
463 return LFR_SUCCESSFUL;
462 }
464 }
463
465
464 int enter_normal_mode()
466 int enter_normal_mode()
465 {
467 {
466 rtems_status_code status;
468 rtems_status_code status;
467
469
468 status = restart_science_tasks();
470 status = restart_science_tasks();
469
471
470 #ifdef GSA
472 #ifdef GSA
471 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR );
473 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR );
472 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
474 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
473 LEON_Clear_interrupt( IRQ_WF );
475 LEON_Clear_interrupt( IRQ_WF );
474 LEON_Unmask_interrupt( IRQ_WF );
476 LEON_Unmask_interrupt( IRQ_WF );
475 //
477 //
476 set_local_nb_interrupt_f0_MAX();
478 set_local_nb_interrupt_f0_MAX();
477 LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board
479 LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board
478 LEON_Unmask_interrupt( IRQ_SM );
480 LEON_Unmask_interrupt( IRQ_SM );
479 #else
481 #else
480 //****************
482 //****************
481 // waveform picker
483 // waveform picker
482 reset_waveform_picker_regs();
484 reset_waveform_picker_regs();
483 set_wfp_burst_enable_register(LFR_MODE_NORMAL);
485 set_wfp_burst_enable_register(LFR_MODE_NORMAL);
484 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
486 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
485 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
487 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
486 //****************
488 //****************
487 // spectral matrix
489 // spectral matrix
488 #endif
490 #endif
489
491
490 return status;
492 return status;
491 }
493 }
492
494
493 int enter_burst_mode()
495 int enter_burst_mode()
494 {
496 {
495 rtems_status_code status;
497 rtems_status_code status;
496
498
497 status = restart_science_tasks();
499 status = restart_science_tasks();
498
500
499 #ifdef GSA
501 #ifdef GSA
500 LEON_Unmask_interrupt( IRQ_SM );
502 LEON_Unmask_interrupt( IRQ_SM );
501 #else
503 #else
502 reset_waveform_picker_regs();
504 reset_waveform_picker_regs();
503 set_wfp_burst_enable_register(LFR_MODE_BURST);
505 set_wfp_burst_enable_register(LFR_MODE_BURST);
504 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
506 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
505 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
507 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
506 #endif
508 #endif
507
509
508 return status;
510 return status;
509 }
511 }
510
512
511 int enter_sbm1_mode()
513 int enter_sbm1_mode()
512 {
514 {
513 rtems_status_code status;
515 rtems_status_code status;
514
516
515 status = restart_science_tasks();
517 status = restart_science_tasks();
516
518
517 set_local_sbm1_nb_cwf_max();
519 set_local_sbm1_nb_cwf_max();
518
520
519 reset_local_sbm1_nb_cwf_sent();
521 reset_local_sbm1_nb_cwf_sent();
520
522
521 #ifdef GSA
523 #ifdef GSA
522 LEON_Unmask_interrupt( IRQ_SM );
524 LEON_Unmask_interrupt( IRQ_SM );
523 #else
525 #else
524 reset_waveform_picker_regs();
526 reset_waveform_picker_regs();
525 set_wfp_burst_enable_register(LFR_MODE_SBM1);
527 set_wfp_burst_enable_register(LFR_MODE_SBM1);
526 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
528 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
527 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
529 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
528 // SM simulation
530 // SM simulation
529 // timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
531 // timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
530 // LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board
532 // LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board
531 // LEON_Unmask_interrupt( IRQ_SM );
533 // LEON_Unmask_interrupt( IRQ_SM );
532 #endif
534 #endif
533
535
534 return status;
536 return status;
535 }
537 }
536
538
537 int enter_sbm2_mode()
539 int enter_sbm2_mode()
538 {
540 {
539 rtems_status_code status;
541 rtems_status_code status;
540
542
541 status = restart_science_tasks();
543 status = restart_science_tasks();
542
544
543 set_local_sbm2_nb_cwf_max();
545 set_local_sbm2_nb_cwf_max();
544
546
545 reset_local_sbm2_nb_cwf_sent();
547 reset_local_sbm2_nb_cwf_sent();
546
548
547 #ifdef GSA
549 #ifdef GSA
548 LEON_Unmask_interrupt( IRQ_SM );
550 LEON_Unmask_interrupt( IRQ_SM );
549 #else
551 #else
550 reset_waveform_picker_regs();
552 reset_waveform_picker_regs();
551 set_wfp_burst_enable_register(LFR_MODE_SBM2);
553 set_wfp_burst_enable_register(LFR_MODE_SBM2);
552 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
554 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
553 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
555 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
554 #endif
556 #endif
555
557
556 return status;
558 return status;
557 }
559 }
558
560
559 int restart_science_tasks()
561 int restart_science_tasks()
560 {
562 {
561 rtems_status_code status[6];
563 rtems_status_code status[6];
562 rtems_status_code ret;
564 rtems_status_code ret;
563
565
564 ret = RTEMS_SUCCESSFUL;
566 ret = RTEMS_SUCCESSFUL;
565
567
566 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 );
568 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 );
567 if (status[0] != RTEMS_SUCCESSFUL)
569 if (status[0] != RTEMS_SUCCESSFUL)
568 {
570 {
569 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
571 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
570 }
572 }
571
573
572 status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 );
574 status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 );
573 if (status[1] != RTEMS_SUCCESSFUL)
575 if (status[1] != RTEMS_SUCCESSFUL)
574 {
576 {
575 PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1])
577 PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1])
576 }
578 }
577
579
578 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
580 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
579 if (status[2] != RTEMS_SUCCESSFUL)
581 if (status[2] != RTEMS_SUCCESSFUL)
580 {
582 {
581 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
583 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
582 }
584 }
583
585
584 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
586 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
585 if (status[3] != RTEMS_SUCCESSFUL)
587 if (status[3] != RTEMS_SUCCESSFUL)
586 {
588 {
587 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
589 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
588 }
590 }
589
591
590 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
592 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
591 if (status[4] != RTEMS_SUCCESSFUL)
593 if (status[4] != RTEMS_SUCCESSFUL)
592 {
594 {
593 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
595 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
594 }
596 }
595
597
596 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
598 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
597 if (status[5] != RTEMS_SUCCESSFUL)
599 if (status[5] != RTEMS_SUCCESSFUL)
598 {
600 {
599 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
601 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
600 }
602 }
601
603
602 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
604 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
603 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
605 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
604 {
606 {
605 ret = RTEMS_UNSATISFIED;
607 ret = RTEMS_UNSATISFIED;
606 }
608 }
607
609
608 return ret;
610 return ret;
609 }
611 }
610
612
611 int suspend_science_tasks()
613 int suspend_science_tasks()
612 {
614 {
613 /** This function suspends the science tasks.
615 /** This function suspends the science tasks.
614 *
616 *
615 * @return RTEMS directive status codes:
617 * @return RTEMS directive status codes:
616 * - RTEMS_SUCCESSFUL - task restarted successfully
618 * - RTEMS_SUCCESSFUL - task restarted successfully
617 * - RTEMS_INVALID_ID - task id invalid
619 * - RTEMS_INVALID_ID - task id invalid
618 * - RTEMS_ALREADY_SUSPENDED - task already suspended
620 * - RTEMS_ALREADY_SUSPENDED - task already suspended
619 *
621 *
620 */
622 */
621
623
622 rtems_status_code status;
624 rtems_status_code status;
623
625
624 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
626 status = rtems_task_suspend( Task_id[TASKID_AVF0] );
625 if (status != RTEMS_SUCCESSFUL)
627 if (status != RTEMS_SUCCESSFUL)
626 {
628 {
627 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
629 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
628 }
630 }
629
631
630 if (status == RTEMS_SUCCESSFUL) // suspend BPF0
632 if (status == RTEMS_SUCCESSFUL) // suspend BPF0
631 {
633 {
632 status = rtems_task_suspend( Task_id[TASKID_BPF0] );
634 status = rtems_task_suspend( Task_id[TASKID_BPF0] );
633 if (status != RTEMS_SUCCESSFUL)
635 if (status != RTEMS_SUCCESSFUL)
634 {
636 {
635 PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status)
637 PRINTF1("in suspend_science_task *** BPF0 ERR %d\n", status)
636 }
638 }
637 }
639 }
638
640
639 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
641 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
640 {
642 {
641 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
643 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
642 if (status != RTEMS_SUCCESSFUL)
644 if (status != RTEMS_SUCCESSFUL)
643 {
645 {
644 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
646 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
645 }
647 }
646 }
648 }
647
649
648 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
650 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
649 {
651 {
650 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
652 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
651 if (status != RTEMS_SUCCESSFUL)
653 if (status != RTEMS_SUCCESSFUL)
652 {
654 {
653 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
655 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
654 }
656 }
655 }
657 }
656
658
657 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
659 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
658 {
660 {
659 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
661 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
660 if (status != RTEMS_SUCCESSFUL)
662 if (status != RTEMS_SUCCESSFUL)
661 {
663 {
662 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
664 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
663 }
665 }
664 }
666 }
665
667
666 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
668 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
667 {
669 {
668 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
670 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
669 if (status != RTEMS_SUCCESSFUL)
671 if (status != RTEMS_SUCCESSFUL)
670 {
672 {
671 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
673 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
672 }
674 }
673 }
675 }
674
676
675 return status;
677 return status;
676 }
678 }
677
679
678 //****************
680 //****************
679 // CLOSING ACTIONS
681 // CLOSING ACTIONS
680 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time)
682 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time)
681 {
683 {
682 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
684 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
683 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
685 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
684 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
686 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
685 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
687 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
686 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
688 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
687 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
689 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
688 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
690 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
689 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
691 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
690 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
692 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
691 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
693 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
692 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
694 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
693 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
695 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
694 }
696 }
695
697
696 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time)
698 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time)
697 {
699 {
698 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
700 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
699 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
701 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
700 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
702 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
701 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
703 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
702 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
704 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
703 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
705 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
704 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
706 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
705 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
707 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
706 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
708 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
707 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
709 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
708 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
710 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
709 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
711 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
710 }
712 }
711
713
712 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id)
714 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time)
713 {
715 {
714 unsigned int val = 0;
716 unsigned int val = 0;
715 unsigned char time[6];
716
717 time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
718 time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
719 time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
720 time[3] = (unsigned char) (time_management_regs->coarse_time);
721 time[4] = (unsigned char) (time_management_regs->fine_time>>8);
722 time[5] = (unsigned char) (time_management_regs->fine_time);
723
717
724 if (result == LFR_SUCCESSFUL)
718 if (result == LFR_SUCCESSFUL)
725 {
719 {
726 if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
720 if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) )
727 &&
721 &&
728 !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
722 !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO))
729 )
723 )
730 {
724 {
731 send_tm_lfr_tc_exe_success( TC, queue_id, time );
725 send_tm_lfr_tc_exe_success( TC, queue_id, time );
732 }
726 }
733 update_last_TC_exe( TC, time );
727 update_last_TC_exe( TC, time );
734 val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1];
728 val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1];
735 val++;
729 val++;
736 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
730 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
737 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val);
731 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val);
738 }
732 }
739 else
733 else
740 {
734 {
741 update_last_TC_rej( TC, time );
735 update_last_TC_rej( TC, time );
742 val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1];
736 val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1];
743 val++;
737 val++;
744 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
738 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
745 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val);
739 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val);
746 }
740 }
747 }
741 }
748
742
749 //***************************
743 //***************************
750 // Interrupt Service Routines
744 // Interrupt Service Routines
751 rtems_isr commutation_isr1( rtems_vector_number vector )
745 rtems_isr commutation_isr1( rtems_vector_number vector )
752 {
746 {
753 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
747 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
754 printf("In commutation_isr1 *** Error sending event to DUMB\n");
748 printf("In commutation_isr1 *** Error sending event to DUMB\n");
755 }
749 }
756 }
750 }
757
751
758 rtems_isr commutation_isr2( rtems_vector_number vector )
752 rtems_isr commutation_isr2( rtems_vector_number vector )
759 {
753 {
760 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
754 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
761 printf("In commutation_isr2 *** Error sending event to DUMB\n");
755 printf("In commutation_isr2 *** Error sending event to DUMB\n");
762 }
756 }
763 }
757 }
764
758
765 //****************
759 //****************
766 // OTHER FUNCTIONS
760 // OTHER FUNCTIONS
767 void updateLFRCurrentMode()
761 void updateLFRCurrentMode()
768 {
762 {
769 /** This function updates the value of the global variable lfrCurrentMode.
763 /** This function updates the value of the global variable lfrCurrentMode.
770 *
764 *
771 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
765 * lfrCurrentMode is a parameter used by several functions to know in which mode LFR is running.
772 *
766 *
773 */
767 */
774 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
768 // update the local value of lfrCurrentMode with the value contained in the housekeeping_packet structure
775 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
769 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
776 }
770 }
777
771
@@ -1,449 +1,449
1 /** Functions to load and dump parameters in the LFR registers.
1 /** Functions to load and dump parameters in the LFR registers.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to handle TC related to parameter loading and dumping.\n
6 * A group of functions to handle TC related to parameter loading and dumping.\n
7 * TC_LFR_LOAD_COMMON_PAR\n
7 * TC_LFR_LOAD_COMMON_PAR\n
8 * TC_LFR_LOAD_NORMAL_PAR\n
8 * TC_LFR_LOAD_NORMAL_PAR\n
9 * TC_LFR_LOAD_BURST_PAR\n
9 * TC_LFR_LOAD_BURST_PAR\n
10 * TC_LFR_LOAD_SBM1_PAR\n
10 * TC_LFR_LOAD_SBM1_PAR\n
11 * TC_LFR_LOAD_SBM2_PAR\n
11 * TC_LFR_LOAD_SBM2_PAR\n
12 *
12 *
13 */
13 */
14
14
15 #include "tc_load_dump_parameters.h"
15 #include "tc_load_dump_parameters.h"
16
16
17 int action_load_common_par(ccsdsTelecommandPacket_t *TC)
17 int action_load_common_par(ccsdsTelecommandPacket_t *TC)
18 {
18 {
19 /** This function updates the LFR registers with the incoming common parameters.
19 /** This function updates the LFR registers with the incoming common parameters.
20 *
20 *
21 * @param TC points to the TeleCommand packet that is being processed
21 * @param TC points to the TeleCommand packet that is being processed
22 *
22 *
23 *
23 *
24 */
24 */
25
25
26 parameter_dump_packet.unused0 = TC->dataAndCRC[0];
26 parameter_dump_packet.unused0 = TC->dataAndCRC[0];
27 parameter_dump_packet.bw_sp0_sp1_r0_r1 = TC->dataAndCRC[1];
27 parameter_dump_packet.bw_sp0_sp1_r0_r1 = TC->dataAndCRC[1];
28 set_wfp_data_shaping(parameter_dump_packet.bw_sp0_sp1_r0_r1);
28 set_wfp_data_shaping(parameter_dump_packet.bw_sp0_sp1_r0_r1);
29 return LFR_SUCCESSFUL;
29 return LFR_SUCCESSFUL;
30 }
30 }
31
31
32 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
32 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
33 {
33 {
34 /** This function updates the LFR registers with the incoming normal parameters.
34 /** This function updates the LFR registers with the incoming normal parameters.
35 *
35 *
36 * @param TC points to the TeleCommand packet that is being processed
36 * @param TC points to the TeleCommand packet that is being processed
37 * @param queue_id is the id of the queue which handles TM related to this execution step
37 * @param queue_id is the id of the queue which handles TM related to this execution step
38 *
38 *
39 */
39 */
40
40
41 int result;
41 int result;
42 int flag;
42 int flag;
43
43
44 flag = LFR_SUCCESSFUL;
44 flag = LFR_SUCCESSFUL;
45
45
46 if ( (lfrCurrentMode == LFR_MODE_NORMAL) ||
46 if ( (lfrCurrentMode == LFR_MODE_NORMAL) ||
47 (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) {
47 (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) {
48 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
48 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
49 flag = LFR_DEFAULT;
49 flag = LFR_DEFAULT;
50 }
50 }
51
51
52 //***************
52 //***************
53 // sy_lfr_n_swf_l
53 // sy_lfr_n_swf_l
54 if (flag == LFR_SUCCESSFUL)
54 if (flag == LFR_SUCCESSFUL)
55 {
55 {
56 result = set_sy_lfr_n_swf_l( TC, queue_id );
56 result = set_sy_lfr_n_swf_l( TC, queue_id, time );
57 if (result != LFR_SUCCESSFUL)
57 if (result != LFR_SUCCESSFUL)
58 {
58 {
59 flag = LFR_DEFAULT;
59 flag = LFR_DEFAULT;
60 }
60 }
61 }
61 }
62
62
63 //***************
63 //***************
64 // sy_lfr_n_swf_p
64 // sy_lfr_n_swf_p
65 if (flag == LFR_SUCCESSFUL)
65 if (flag == LFR_SUCCESSFUL)
66 {
66 {
67 result = set_sy_lfr_n_swf_p( TC, queue_id );
67 result = set_sy_lfr_n_swf_p( TC, queue_id, time );
68 if (result != LFR_SUCCESSFUL)
68 if (result != LFR_SUCCESSFUL)
69 {
69 {
70 flag = LFR_DEFAULT;
70 flag = LFR_DEFAULT;
71 }
71 }
72 }
72 }
73
73
74 //***************
74 //***************
75 // SY_LFR_N_ASM_P
75 // SY_LFR_N_ASM_P
76 if (flag == LFR_SUCCESSFUL)
76 if (flag == LFR_SUCCESSFUL)
77 {
77 {
78 result = set_sy_lfr_n_asm_p( TC, queue_id );
78 result = set_sy_lfr_n_asm_p( TC, queue_id );
79 if (result != LFR_SUCCESSFUL)
79 if (result != LFR_SUCCESSFUL)
80 {
80 {
81 flag = LFR_DEFAULT;
81 flag = LFR_DEFAULT;
82 }
82 }
83 }
83 }
84
84
85 //***************
85 //***************
86 // SY_LFR_N_BP_P0
86 // SY_LFR_N_BP_P0
87 if (flag == LFR_SUCCESSFUL)
87 if (flag == LFR_SUCCESSFUL)
88 {
88 {
89 result = set_sy_lfr_n_bp_p0( TC, queue_id );
89 result = set_sy_lfr_n_bp_p0( TC, queue_id );
90 if (result != LFR_SUCCESSFUL)
90 if (result != LFR_SUCCESSFUL)
91 {
91 {
92 flag = LFR_DEFAULT;
92 flag = LFR_DEFAULT;
93 }
93 }
94 }
94 }
95
95
96 //***************
96 //***************
97 // sy_lfr_n_bp_p1
97 // sy_lfr_n_bp_p1
98 if (flag == LFR_SUCCESSFUL)
98 if (flag == LFR_SUCCESSFUL)
99 {
99 {
100 result = set_sy_lfr_n_bp_p1( TC, queue_id );
100 result = set_sy_lfr_n_bp_p1( TC, queue_id );
101 if (result != LFR_SUCCESSFUL)
101 if (result != LFR_SUCCESSFUL)
102 {
102 {
103 flag = LFR_DEFAULT;
103 flag = LFR_DEFAULT;
104 }
104 }
105 }
105 }
106
106
107 return flag;
107 return flag;
108 }
108 }
109
109
110 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
110 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
111 {
111 {
112 /** This function updates the LFR registers with the incoming burst parameters.
112 /** This function updates the LFR registers with the incoming burst parameters.
113 *
113 *
114 * @param TC points to the TeleCommand packet that is being processed
114 * @param TC points to the TeleCommand packet that is being processed
115 * @param queue_id is the id of the queue which handles TM related to this execution step
115 * @param queue_id is the id of the queue which handles TM related to this execution step
116 *
116 *
117 */
117 */
118
118
119 int result;
119 int result;
120 unsigned char lfrMode;
120 unsigned char lfrMode;
121
121
122 result = LFR_DEFAULT;
122 result = LFR_DEFAULT;
123 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
123 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
124
124
125 if ( lfrMode == LFR_MODE_BURST ) {
125 if ( lfrMode == LFR_MODE_BURST ) {
126 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
126 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
127 result = LFR_DEFAULT;
127 result = LFR_DEFAULT;
128 }
128 }
129 else {
129 else {
130 parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[0];
130 parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[0];
131 parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[1];
131 parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[1];
132
132
133 result = LFR_SUCCESSFUL;
133 result = LFR_SUCCESSFUL;
134 }
134 }
135
135
136 return result;
136 return result;
137 }
137 }
138
138
139 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
139 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
140 {
140 {
141 /** This function updates the LFR registers with the incoming sbm1 parameters.
141 /** This function updates the LFR registers with the incoming sbm1 parameters.
142 *
142 *
143 * @param TC points to the TeleCommand packet that is being processed
143 * @param TC points to the TeleCommand packet that is being processed
144 * @param queue_id is the id of the queue which handles TM related to this execution step
144 * @param queue_id is the id of the queue which handles TM related to this execution step
145 *
145 *
146 */
146 */
147 int result;
147 int result;
148 unsigned char lfrMode;
148 unsigned char lfrMode;
149
149
150 result = LFR_DEFAULT;
150 result = LFR_DEFAULT;
151 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
151 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
152
152
153 if ( (lfrMode == LFR_MODE_SBM1) || (lfrMode == LFR_MODE_SBM2) ) {
153 if ( (lfrMode == LFR_MODE_SBM1) || (lfrMode == LFR_MODE_SBM2) ) {
154 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
154 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
155 result = LFR_DEFAULT;
155 result = LFR_DEFAULT;
156 }
156 }
157 else {
157 else {
158 parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[0];
158 parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[0];
159 parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[1];
159 parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[1];
160
160
161 result = LFR_SUCCESSFUL;
161 result = LFR_SUCCESSFUL;
162 }
162 }
163
163
164 return result;
164 return result;
165 }
165 }
166
166
167 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
167 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time)
168 {
168 {
169 /** This function updates the LFR registers with the incoming sbm2 parameters.
169 /** This function updates the LFR registers with the incoming sbm2 parameters.
170 *
170 *
171 * @param TC points to the TeleCommand packet that is being processed
171 * @param TC points to the TeleCommand packet that is being processed
172 * @param queue_id is the id of the queue which handles TM related to this execution step
172 * @param queue_id is the id of the queue which handles TM related to this execution step
173 *
173 *
174 */
174 */
175
175
176 int result;
176 int result;
177 unsigned char lfrMode;
177 unsigned char lfrMode;
178
178
179 result = LFR_DEFAULT;
179 result = LFR_DEFAULT;
180 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
180 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
181
181
182 if ( (lfrMode == LFR_MODE_SBM2) || (lfrMode == LFR_MODE_SBM2) ) {
182 if ( (lfrMode == LFR_MODE_SBM2) || (lfrMode == LFR_MODE_SBM2) ) {
183 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
183 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
184 result = LFR_DEFAULT;
184 result = LFR_DEFAULT;
185 }
185 }
186 else {
186 else {
187 parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[0];
187 parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[0];
188 parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[1];
188 parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[1];
189
189
190 result = LFR_SUCCESSFUL;
190 result = LFR_SUCCESSFUL;
191 }
191 }
192
192
193 return result;
193 return result;
194 }
194 }
195
195
196 int action_dump_par( rtems_id queue_id )
196 int action_dump_par( rtems_id queue_id )
197 {
197 {
198 /** This function dumps the LFR parameters by sending the appropriate TM packet to the dedicated RTEMS message queue.
198 /** This function dumps the LFR parameters by sending the appropriate TM packet to the dedicated RTEMS message queue.
199 *
199 *
200 * @param queue_id is the id of the queue which handles TM related to this execution step.
200 * @param queue_id is the id of the queue which handles TM related to this execution step.
201 *
201 *
202 * @return RTEMS directive status codes:
202 * @return RTEMS directive status codes:
203 * - RTEMS_SUCCESSFUL - message sent successfully
203 * - RTEMS_SUCCESSFUL - message sent successfully
204 * - RTEMS_INVALID_ID - invalid queue id
204 * - RTEMS_INVALID_ID - invalid queue id
205 * - RTEMS_INVALID_SIZE - invalid message size
205 * - RTEMS_INVALID_SIZE - invalid message size
206 * - RTEMS_INVALID_ADDRESS - buffer is NULL
206 * - RTEMS_INVALID_ADDRESS - buffer is NULL
207 * - RTEMS_UNSATISFIED - out of message buffers
207 * - RTEMS_UNSATISFIED - out of message buffers
208 * - RTEMS_TOO_MANY - queue s limit has been reached
208 * - RTEMS_TOO_MANY - queue s limit has been reached
209 *
209 *
210 */
210 */
211
211
212 int status;
212 int status;
213
213
214 // UPDATE TIME
214 // UPDATE TIME
215 increment_seq_counter( parameter_dump_packet.packetSequenceControl );
215 increment_seq_counter( parameter_dump_packet.packetSequenceControl );
216 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
216 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
217 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
217 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
218 parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
218 parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
219 parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
219 parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
220 parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
220 parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
221 parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
221 parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
222 // SEND DATA
222 // SEND DATA
223 status = rtems_message_queue_send( queue_id, &parameter_dump_packet,
223 status = rtems_message_queue_send( queue_id, &parameter_dump_packet,
224 PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
224 PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
225 if (status != RTEMS_SUCCESSFUL) {
225 if (status != RTEMS_SUCCESSFUL) {
226 PRINTF1("in action_dump *** ERR sending packet, code %d", status)
226 PRINTF1("in action_dump *** ERR sending packet, code %d", status)
227 }
227 }
228
228
229 return status;
229 return status;
230 }
230 }
231
231
232 //***********************
232 //***********************
233 // NORMAL MODE PARAMETERS
233 // NORMAL MODE PARAMETERS
234
234
235 int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
235 int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time )
236 {
236 {
237 /** This function sets the number of points of a snapshot (sy_lfr_n_swf_l).
237 /** This function sets the number of points of a snapshot (sy_lfr_n_swf_l).
238 *
238 *
239 * @param TC points to the TeleCommand packet that is being processed
239 * @param TC points to the TeleCommand packet that is being processed
240 * @param queue_id is the id of the queue which handles TM related to this execution step
240 * @param queue_id is the id of the queue which handles TM related to this execution step
241 *
241 *
242 */
242 */
243
243
244 unsigned int tmp;
244 unsigned int tmp;
245 int result;
245 int result;
246 unsigned char msb;
246 unsigned char msb;
247 unsigned char lsb;
247 unsigned char lsb;
248
248
249 msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L ];
249 msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L ];
250 lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L+1 ];
250 lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_L+1 ];
251
251
252 tmp = ( unsigned int ) floor(
252 tmp = ( unsigned int ) floor(
253 ( ( msb*256 ) + lsb ) / 16
253 ( ( msb*256 ) + lsb ) / 16
254 ) * 16;
254 ) * 16;
255
255
256 if ( (tmp < 16) || (tmp > 2048) ) // the snapshot period is a multiple of 16
256 if ( (tmp < 16) || (tmp > 2048) ) // the snapshot period is a multiple of 16
257 { // 2048 is the maximum limit due to the size of the buffers
257 { // 2048 is the maximum limit due to the size of the buffers
258 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_L+10, lsb );
258 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_L+10, lsb, time );
259 result = WRONG_APP_DATA;
259 result = WRONG_APP_DATA;
260 }
260 }
261 else if (tmp != 2048)
261 else if (tmp != 2048)
262 {
262 {
263 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
263 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
264 result = FUNCT_NOT_IMPL;
264 result = FUNCT_NOT_IMPL;
265 }
265 }
266 else
266 else
267 {
267 {
268 parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (tmp >> 8);
268 parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (tmp >> 8);
269 parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (tmp );
269 parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (tmp );
270 result = LFR_SUCCESSFUL;
270 result = LFR_SUCCESSFUL;
271 }
271 }
272
272
273 return result;
273 return result;
274 }
274 }
275
275
276 int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
276 int set_sy_lfr_n_swf_p(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time)
277 {
277 {
278 /** This function sets the time between two snapshots, in s (sy_lfr_n_swf_p).
278 /** This function sets the time between two snapshots, in s (sy_lfr_n_swf_p).
279 *
279 *
280 * @param TC points to the TeleCommand packet that is being processed
280 * @param TC points to the TeleCommand packet that is being processed
281 * @param queue_id is the id of the queue which handles TM related to this execution step
281 * @param queue_id is the id of the queue which handles TM related to this execution step
282 *
282 *
283 */
283 */
284
284
285 unsigned int tmp;
285 unsigned int tmp;
286 int result;
286 int result;
287 unsigned char msb;
287 unsigned char msb;
288 unsigned char lsb;
288 unsigned char lsb;
289
289
290 msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P ];
290 msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P ];
291 lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P+1 ];
291 lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_SWF_P+1 ];
292
292
293 tmp = ( unsigned int ) floor(
293 tmp = ( unsigned int ) floor(
294 ( ( msb*256 ) + lsb ) / 8
294 ( ( msb*256 ) + lsb ) / 8
295 ) * 8;
295 ) * 8;
296
296
297 if ( (tmp < 16) || (tmp > 65528) )
297 if ( (tmp < 16) || (tmp > 65528) )
298 {
298 {
299 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_P+10, lsb );
299 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_P+10, lsb, time );
300 result = WRONG_APP_DATA;
300 result = WRONG_APP_DATA;
301 }
301 }
302 else
302 else
303 {
303 {
304 parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8);
304 parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8);
305 parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp );
305 parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp );
306 result = LFR_SUCCESSFUL;
306 result = LFR_SUCCESSFUL;
307 }
307 }
308
308
309 return result;
309 return result;
310 }
310 }
311
311
312 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
312 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
313 {
313 {
314 /** This function sets the time between two full spectral matrices transmission, in s (SY_LFR_N_ASM_P).
314 /** This function sets the time between two full spectral matrices transmission, in s (SY_LFR_N_ASM_P).
315 *
315 *
316 * @param TC points to the TeleCommand packet that is being processed
316 * @param TC points to the TeleCommand packet that is being processed
317 * @param queue_id is the id of the queue which handles TM related to this execution step
317 * @param queue_id is the id of the queue which handles TM related to this execution step
318 *
318 *
319 */
319 */
320
320
321 int result;
321 int result;
322 unsigned char msb;
322 unsigned char msb;
323 unsigned char lsb;
323 unsigned char lsb;
324
324
325 msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P ];
325 msb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P ];
326 lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P+1 ];
326 lsb = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_ASM_P+1 ];
327
327
328 parameter_dump_packet.sy_lfr_n_asm_p[0] = msb;
328 parameter_dump_packet.sy_lfr_n_asm_p[0] = msb;
329 parameter_dump_packet.sy_lfr_n_asm_p[1] = lsb;
329 parameter_dump_packet.sy_lfr_n_asm_p[1] = lsb;
330 result = LFR_SUCCESSFUL;
330 result = LFR_SUCCESSFUL;
331
331
332 return result;
332 return result;
333 }
333 }
334
334
335 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
335 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
336 {
336 {
337 /** This function sets the time between two basic parameter sets, in s (SY_LFR_N_BP_P0).
337 /** This function sets the time between two basic parameter sets, in s (SY_LFR_N_BP_P0).
338 *
338 *
339 * @param TC points to the TeleCommand packet that is being processed
339 * @param TC points to the TeleCommand packet that is being processed
340 * @param queue_id is the id of the queue which handles TM related to this execution step
340 * @param queue_id is the id of the queue which handles TM related to this execution step
341 *
341 *
342 */
342 */
343
343
344 int status;
344 int status;
345
345
346 status = LFR_SUCCESSFUL;
346 status = LFR_SUCCESSFUL;
347
347
348 parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P0 ];
348 parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P0 ];
349
349
350 return status;
350 return status;
351 }
351 }
352
352
353 int set_sy_lfr_n_bp_p1(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
353 int set_sy_lfr_n_bp_p1(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
354 {
354 {
355 /** This function sets the time between two basic parameter sets (autocorrelation + crosscorrelation), in s (sy_lfr_n_bp_p1).
355 /** This function sets the time between two basic parameter sets (autocorrelation + crosscorrelation), in s (sy_lfr_n_bp_p1).
356 *
356 *
357 * @param TC points to the TeleCommand packet that is being processed
357 * @param TC points to the TeleCommand packet that is being processed
358 * @param queue_id is the id of the queue which handles TM related to this execution step
358 * @param queue_id is the id of the queue which handles TM related to this execution step
359 *
359 *
360 */
360 */
361
361
362 int status;
362 int status;
363
363
364 status = LFR_SUCCESSFUL;
364 status = LFR_SUCCESSFUL;
365
365
366 parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P1 ];
366 parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[ BYTE_POS_SY_LFR_N_BP_P1 ];
367
367
368 return status;
368 return status;
369 }
369 }
370
370
371 //**********************
371 //**********************
372 // BURST MODE PARAMETERS
372 // BURST MODE PARAMETERS
373
373
374 //*********************
374 //*********************
375 // SBM1 MODE PARAMETERS
375 // SBM1 MODE PARAMETERS
376
376
377 //*********************
377 //*********************
378 // SBM2 MODE PARAMETERS
378 // SBM2 MODE PARAMETERS
379
379
380 //**********
380 //**********
381 // init dump
381 // init dump
382
382
383 void init_parameter_dump( void )
383 void init_parameter_dump( void )
384 {
384 {
385 /** This function initialize the parameter_dump_packet global variable with default values.
385 /** This function initialize the parameter_dump_packet global variable with default values.
386 *
386 *
387 */
387 */
388
388
389 parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
389 parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
390 parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
390 parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
391 parameter_dump_packet.reserved = CCSDS_RESERVED;
391 parameter_dump_packet.reserved = CCSDS_RESERVED;
392 parameter_dump_packet.userApplication = CCSDS_USER_APP;
392 parameter_dump_packet.userApplication = CCSDS_USER_APP;
393 parameter_dump_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_PARAMETER_DUMP >> 8);
393 parameter_dump_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_PARAMETER_DUMP >> 8);
394 parameter_dump_packet.packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP;
394 parameter_dump_packet.packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP;
395 parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
395 parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
396 parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
396 parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
397 parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8);
397 parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8);
398 parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP;
398 parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP;
399 // DATA FIELD HEADER
399 // DATA FIELD HEADER
400 parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2;
400 parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2;
401 parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP;
401 parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP;
402 parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP;
402 parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP;
403 parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND;
403 parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND;
404 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
404 parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
405 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
405 parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
406 parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
406 parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
407 parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
407 parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time);
408 parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
408 parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
409 parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
409 parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time);
410 parameter_dump_packet.sid = SID_PARAMETER_DUMP;
410 parameter_dump_packet.sid = SID_PARAMETER_DUMP;
411
411
412 //******************
412 //******************
413 // COMMON PARAMETERS
413 // COMMON PARAMETERS
414 parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0;
414 parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0;
415 parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1;
415 parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1;
416
416
417 //******************
417 //******************
418 // NORMAL PARAMETERS
418 // NORMAL PARAMETERS
419 parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (SY_LFR_N_SWF_L >> 8);
419 parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (SY_LFR_N_SWF_L >> 8);
420 parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (SY_LFR_N_SWF_L );
420 parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (SY_LFR_N_SWF_L );
421 parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (SY_LFR_N_SWF_P >> 8);
421 parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (SY_LFR_N_SWF_P >> 8);
422 parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (SY_LFR_N_SWF_P );
422 parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (SY_LFR_N_SWF_P );
423 parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (SY_LFR_N_ASM_P >> 8);
423 parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (SY_LFR_N_ASM_P >> 8);
424 parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (SY_LFR_N_ASM_P );
424 parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (SY_LFR_N_ASM_P );
425 parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) SY_LFR_N_BP_P0;
425 parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) SY_LFR_N_BP_P0;
426 parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) SY_LFR_N_BP_P1;
426 parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) SY_LFR_N_BP_P1;
427
427
428 //*****************
428 //*****************
429 // BURST PARAMETERS
429 // BURST PARAMETERS
430 parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0;
430 parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0;
431 parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1;
431 parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1;
432
432
433 //****************
433 //****************
434 // SBM1 PARAMETERS
434 // SBM1 PARAMETERS
435 parameter_dump_packet.sy_lfr_s1_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P0; // min value is 0.25 s for the period
435 parameter_dump_packet.sy_lfr_s1_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P0; // min value is 0.25 s for the period
436 parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1;
436 parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1;
437
437
438 //****************
438 //****************
439 // SBM2 PARAMETERS
439 // SBM2 PARAMETERS
440 parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0;
440 parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0;
441 parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1;
441 parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1;
442 }
442 }
443
443
444
444
445
445
446
446
447
447
448
448
449
449
@@ -1,491 +1,492
1 /** Functions to send TM packets related to TC parsing and execution.
1 /** Functions to send TM packets related to TC parsing and execution.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * A group of functions to send appropriate TM packets after parsing and execution:
6 * A group of functions to send appropriate TM packets after parsing and execution:
7 * - TM_LFR_TC_EXE_SUCCESS
7 * - TM_LFR_TC_EXE_SUCCESS
8 * - TM_LFR_TC_EXE_INCONSISTENT
8 * - TM_LFR_TC_EXE_INCONSISTENT
9 * - TM_LFR_TC_EXE_NOT_EXECUTABLE
9 * - TM_LFR_TC_EXE_NOT_EXECUTABLE
10 * - TM_LFR_TC_EXE_NOT_IMPLEMENTED
10 * - TM_LFR_TC_EXE_NOT_IMPLEMENTED
11 * - TM_LFR_TC_EXE_ERROR
11 * - TM_LFR_TC_EXE_ERROR
12 * - TM_LFR_TC_EXE_CORRUPTED
12 * - TM_LFR_TC_EXE_CORRUPTED
13 *
13 *
14 */
14 */
15
15
16 #include "tm_lfr_tc_exe.h"
16 #include "tm_lfr_tc_exe.h"
17
17
18 int send_tm_lfr_tc_exe_success( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time )
18 int send_tm_lfr_tc_exe_success( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time )
19 {
19 {
20 /** This function sends a TM_LFR_TC_EXE_SUCCESS packet in the dedicated RTEMS message queue.
20 /** This function sends a TM_LFR_TC_EXE_SUCCESS packet in the dedicated RTEMS message queue.
21 *
21 *
22 * @param TC points to the TeleCommand packet that is being processed
22 * @param TC points to the TeleCommand packet that is being processed
23 * @param queue_id is the id of the queue which handles TM
23 * @param queue_id is the id of the queue which handles TM
24 *
24 *
25 * @return RTEMS directive status code:
25 * @return RTEMS directive status code:
26 * - RTEMS_SUCCESSFUL - message sent successfully
26 * - RTEMS_SUCCESSFUL - message sent successfully
27 * - RTEMS_INVALID_ID - invalid queue id
27 * - RTEMS_INVALID_ID - invalid queue id
28 * - RTEMS_INVALID_SIZE - invalid message size
28 * - RTEMS_INVALID_SIZE - invalid message size
29 * - RTEMS_INVALID_ADDRESS - buffer is NULL
29 * - RTEMS_INVALID_ADDRESS - buffer is NULL
30 * - RTEMS_UNSATISFIED - out of message buffers
30 * - RTEMS_UNSATISFIED - out of message buffers
31 * - RTEMS_TOO_MANY - queue s limit has been reached
31 * - RTEMS_TOO_MANY - queue s limit has been reached
32 *
32 *
33 */
33 */
34
34
35 rtems_status_code status;
35 rtems_status_code status;
36 Packet_TM_LFR_TC_EXE_SUCCESS_t TM;
36 Packet_TM_LFR_TC_EXE_SUCCESS_t TM;
37 unsigned char messageSize;
37 unsigned char messageSize;
38
38
39 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
39 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
40 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
40 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
41 TM.reserved = DEFAULT_RESERVED;
41 TM.reserved = DEFAULT_RESERVED;
42 TM.userApplication = CCSDS_USER_APP;
42 TM.userApplication = CCSDS_USER_APP;
43 // PACKET HEADER
43 // PACKET HEADER
44 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
44 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
45 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
45 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
46 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
46 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
47 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8);
47 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8);
48 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS );
48 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS );
49 // DATA FIELD HEADER
49 // DATA FIELD HEADER
50 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
50 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
51 TM.serviceType = TM_TYPE_TC_EXE;
51 TM.serviceType = TM_TYPE_TC_EXE;
52 TM.serviceSubType = TM_SUBTYPE_EXE_OK;
52 TM.serviceSubType = TM_SUBTYPE_EXE_OK;
53 TM.destinationID = TC->sourceID;
53 TM.destinationID = TC->sourceID;
54 TM.time[0] = time[0];
54 TM.time[0] = time[0];
55 TM.time[1] = time[1];
55 TM.time[1] = time[1];
56 TM.time[2] = time[2];
56 TM.time[2] = time[2];
57 TM.time[3] = time[3];
57 TM.time[3] = time[3];
58 TM.time[4] = time[4];
58 TM.time[4] = time[4];
59 TM.time[5] = time[5];
59 TM.time[5] = time[5];
60 //
60 //
61 TM.telecommand_pkt_id[0] = TC->packetID[0];
61 TM.telecommand_pkt_id[0] = TC->packetID[0];
62 TM.telecommand_pkt_id[1] = TC->packetID[1];
62 TM.telecommand_pkt_id[1] = TC->packetID[1];
63 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
63 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
64 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
64 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
65
65
66 messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
66 messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
67
67
68 // SEND DATA
68 // SEND DATA
69 status = rtems_message_queue_send( queue_id, &TM, messageSize);
69 status = rtems_message_queue_send( queue_id, &TM, messageSize);
70 if (status != RTEMS_SUCCESSFUL) {
70 if (status != RTEMS_SUCCESSFUL) {
71 PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n")
71 PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n")
72 }
72 }
73
73
74 return status;
74 return status;
75 }
75 }
76
76
77 int send_tm_lfr_tc_exe_inconsistent( ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
77 int send_tm_lfr_tc_exe_inconsistent( ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
78 unsigned char byte_position, unsigned char rcv_value )
78 unsigned char byte_position, unsigned char rcv_value,
79 unsigned char *time)
79 {
80 {
80 /** This function sends a TM_LFR_TC_EXE_INCONSISTENT packet in the dedicated RTEMS message queue.
81 /** This function sends a TM_LFR_TC_EXE_INCONSISTENT packet in the dedicated RTEMS message queue.
81 *
82 *
82 * @param TC points to the TeleCommand packet that is being processed
83 * @param TC points to the TeleCommand packet that is being processed
83 * @param queue_id is the id of the queue which handles TM
84 * @param queue_id is the id of the queue which handles TM
84 * @param byte_position is the byte position of the MSB of the parameter that has been seen as inconsistent
85 * @param byte_position is the byte position of the MSB of the parameter that has been seen as inconsistent
85 * @param rcv_value is the value of the LSB of the parameter that has been deteced as inconsistent
86 * @param rcv_value is the value of the LSB of the parameter that has been deteced as inconsistent
86 *
87 *
87 * @return RTEMS directive status code:
88 * @return RTEMS directive status code:
88 * - RTEMS_SUCCESSFUL - message sent successfully
89 * - RTEMS_SUCCESSFUL - message sent successfully
89 * - RTEMS_INVALID_ID - invalid queue id
90 * - RTEMS_INVALID_ID - invalid queue id
90 * - RTEMS_INVALID_SIZE - invalid message size
91 * - RTEMS_INVALID_SIZE - invalid message size
91 * - RTEMS_INVALID_ADDRESS - buffer is NULL
92 * - RTEMS_INVALID_ADDRESS - buffer is NULL
92 * - RTEMS_UNSATISFIED - out of message buffers
93 * - RTEMS_UNSATISFIED - out of message buffers
93 * - RTEMS_TOO_MANY - queue s limit has been reached
94 * - RTEMS_TOO_MANY - queue s limit has been reached
94 *
95 *
95 */
96 */
96
97
97 rtems_status_code status;
98 rtems_status_code status;
98 Packet_TM_LFR_TC_EXE_INCONSISTENT_t TM;
99 Packet_TM_LFR_TC_EXE_INCONSISTENT_t TM;
99 unsigned char messageSize;
100 unsigned char messageSize;
100
101
101 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
102 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
102 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
103 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
103 TM.reserved = DEFAULT_RESERVED;
104 TM.reserved = DEFAULT_RESERVED;
104 TM.userApplication = CCSDS_USER_APP;
105 TM.userApplication = CCSDS_USER_APP;
105 // PACKET HEADER
106 // PACKET HEADER
106 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
107 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
107 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
108 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
108 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
109 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
109 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8);
110 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8);
110 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT );
111 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT );
111 // DATA FIELD HEADER
112 // DATA FIELD HEADER
112 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
113 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
113 TM.serviceType = TM_TYPE_TC_EXE;
114 TM.serviceType = TM_TYPE_TC_EXE;
114 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
115 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
115 TM.destinationID = TC->sourceID;
116 TM.destinationID = TC->sourceID;
116 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
117 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
117 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
118 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
118 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
119 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
119 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
120 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
120 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
121 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
121 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
122 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
122 //
123 //
123 TM.tc_failure_code[0] = (char) (WRONG_APP_DATA >> 8);
124 TM.tc_failure_code[0] = (char) (WRONG_APP_DATA >> 8);
124 TM.tc_failure_code[1] = (char) (WRONG_APP_DATA );
125 TM.tc_failure_code[1] = (char) (WRONG_APP_DATA );
125 TM.telecommand_pkt_id[0] = TC->packetID[0];
126 TM.telecommand_pkt_id[0] = TC->packetID[0];
126 TM.telecommand_pkt_id[1] = TC->packetID[1];
127 TM.telecommand_pkt_id[1] = TC->packetID[1];
127 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
128 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
128 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
129 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
129 TM.tc_service = TC->serviceType; // type of the rejected TC
130 TM.tc_service = TC->serviceType; // type of the rejected TC
130 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
131 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
131 TM.byte_position = byte_position;
132 TM.byte_position = byte_position;
132 TM.rcv_value = rcv_value;
133 TM.rcv_value = rcv_value;
133
134
134 messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
135 messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
135
136
136 // SEND DATA
137 // SEND DATA
137 status = rtems_message_queue_send( queue_id, &TM, messageSize);
138 status = rtems_message_queue_send( queue_id, &TM, messageSize);
138 if (status != RTEMS_SUCCESSFUL) {
139 if (status != RTEMS_SUCCESSFUL) {
139 PRINTF("in send_tm_lfr_tc_exe_inconsistent *** ERR\n")
140 PRINTF("in send_tm_lfr_tc_exe_inconsistent *** ERR\n")
140 }
141 }
141
142
142 return status;
143 return status;
143 }
144 }
144
145
145 int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
146 int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time )
146 {
147 {
147 /** This function sends a TM_LFR_TC_EXE_NOT_EXECUTABLE packet in the dedicated RTEMS message queue.
148 /** This function sends a TM_LFR_TC_EXE_NOT_EXECUTABLE packet in the dedicated RTEMS message queue.
148 *
149 *
149 * @param TC points to the TeleCommand packet that is being processed
150 * @param TC points to the TeleCommand packet that is being processed
150 * @param queue_id is the id of the queue which handles TM
151 * @param queue_id is the id of the queue which handles TM
151 *
152 *
152 * @return RTEMS directive status code:
153 * @return RTEMS directive status code:
153 * - RTEMS_SUCCESSFUL - message sent successfully
154 * - RTEMS_SUCCESSFUL - message sent successfully
154 * - RTEMS_INVALID_ID - invalid queue id
155 * - RTEMS_INVALID_ID - invalid queue id
155 * - RTEMS_INVALID_SIZE - invalid message size
156 * - RTEMS_INVALID_SIZE - invalid message size
156 * - RTEMS_INVALID_ADDRESS - buffer is NULL
157 * - RTEMS_INVALID_ADDRESS - buffer is NULL
157 * - RTEMS_UNSATISFIED - out of message buffers
158 * - RTEMS_UNSATISFIED - out of message buffers
158 * - RTEMS_TOO_MANY - queue s limit has been reached
159 * - RTEMS_TOO_MANY - queue s limit has been reached
159 *
160 *
160 */
161 */
161
162
162 rtems_status_code status;
163 rtems_status_code status;
163 Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t TM;
164 Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t TM;
164 unsigned char messageSize;
165 unsigned char messageSize;
165
166
166 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
167 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
167 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
168 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
168 TM.reserved = DEFAULT_RESERVED;
169 TM.reserved = DEFAULT_RESERVED;
169 TM.userApplication = CCSDS_USER_APP;
170 TM.userApplication = CCSDS_USER_APP;
170 // PACKET HEADER
171 // PACKET HEADER
171 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
172 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
172 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
173 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
173 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
174 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
174 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8);
175 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8);
175 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE );
176 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE );
176 // DATA FIELD HEADER
177 // DATA FIELD HEADER
177 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
178 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
178 TM.serviceType = TM_TYPE_TC_EXE;
179 TM.serviceType = TM_TYPE_TC_EXE;
179 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
180 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
180 TM.destinationID = TC->sourceID; // default destination id
181 TM.destinationID = TC->sourceID; // default destination id
181 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
182 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
182 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
183 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
183 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
184 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
184 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
185 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
185 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
186 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
186 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
187 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
187 //
188 //
188 TM.tc_failure_code[0] = (char) (TC_NOT_EXE >> 8);
189 TM.tc_failure_code[0] = (char) (TC_NOT_EXE >> 8);
189 TM.tc_failure_code[1] = (char) (TC_NOT_EXE );
190 TM.tc_failure_code[1] = (char) (TC_NOT_EXE );
190 TM.telecommand_pkt_id[0] = TC->packetID[0];
191 TM.telecommand_pkt_id[0] = TC->packetID[0];
191 TM.telecommand_pkt_id[1] = TC->packetID[1];
192 TM.telecommand_pkt_id[1] = TC->packetID[1];
192 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
193 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
193 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
194 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
194 TM.tc_service = TC->serviceType; // type of the rejected TC
195 TM.tc_service = TC->serviceType; // type of the rejected TC
195 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
196 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
196 TM.lfr_status_word[0] = housekeeping_packet.lfr_status_word[0];
197 TM.lfr_status_word[0] = housekeeping_packet.lfr_status_word[0];
197 TM.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1];
198 TM.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1];
198
199
199 messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
200 messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
200
201
201 // SEND DATA
202 // SEND DATA
202 status = rtems_message_queue_send( queue_id, &TM, messageSize);
203 status = rtems_message_queue_send( queue_id, &TM, messageSize);
203 if (status != RTEMS_SUCCESSFUL) {
204 if (status != RTEMS_SUCCESSFUL) {
204 PRINTF("in send_tm_lfr_tc_exe_not_executable *** ERR\n")
205 PRINTF("in send_tm_lfr_tc_exe_not_executable *** ERR\n")
205 }
206 }
206
207
207 return status;
208 return status;
208 }
209 }
209
210
210 int send_tm_lfr_tc_exe_not_implemented( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
211 int send_tm_lfr_tc_exe_not_implemented( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time )
211 {
212 {
212 /** This function sends a TM_LFR_TC_EXE_NOT_IMPLEMENTED packet in the dedicated RTEMS message queue.
213 /** This function sends a TM_LFR_TC_EXE_NOT_IMPLEMENTED packet in the dedicated RTEMS message queue.
213 *
214 *
214 * @param TC points to the TeleCommand packet that is being processed
215 * @param TC points to the TeleCommand packet that is being processed
215 * @param queue_id is the id of the queue which handles TM
216 * @param queue_id is the id of the queue which handles TM
216 *
217 *
217 * @return RTEMS directive status code:
218 * @return RTEMS directive status code:
218 * - RTEMS_SUCCESSFUL - message sent successfully
219 * - RTEMS_SUCCESSFUL - message sent successfully
219 * - RTEMS_INVALID_ID - invalid queue id
220 * - RTEMS_INVALID_ID - invalid queue id
220 * - RTEMS_INVALID_SIZE - invalid message size
221 * - RTEMS_INVALID_SIZE - invalid message size
221 * - RTEMS_INVALID_ADDRESS - buffer is NULL
222 * - RTEMS_INVALID_ADDRESS - buffer is NULL
222 * - RTEMS_UNSATISFIED - out of message buffers
223 * - RTEMS_UNSATISFIED - out of message buffers
223 * - RTEMS_TOO_MANY - queue s limit has been reached
224 * - RTEMS_TOO_MANY - queue s limit has been reached
224 *
225 *
225 */
226 */
226
227
227 rtems_status_code status;
228 rtems_status_code status;
228 Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t TM;
229 Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t TM;
229 unsigned char messageSize;
230 unsigned char messageSize;
230
231
231 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
232 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
232 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
233 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
233 TM.reserved = DEFAULT_RESERVED;
234 TM.reserved = DEFAULT_RESERVED;
234 TM.userApplication = CCSDS_USER_APP;
235 TM.userApplication = CCSDS_USER_APP;
235 // PACKET HEADER
236 // PACKET HEADER
236 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
237 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
237 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
238 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
238 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
239 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
239 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8);
240 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8);
240 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED );
241 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED );
241 // DATA FIELD HEADER
242 // DATA FIELD HEADER
242 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
243 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
243 TM.serviceType = TM_TYPE_TC_EXE;
244 TM.serviceType = TM_TYPE_TC_EXE;
244 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
245 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
245 TM.destinationID = TC->sourceID; // default destination id
246 TM.destinationID = TC->sourceID; // default destination id
246 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
247 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
247 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
248 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
248 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
249 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
249 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
250 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
250 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
251 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
251 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
252 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
252 //
253 //
253 TM.tc_failure_code[0] = (char) (FUNCT_NOT_IMPL >> 8);
254 TM.tc_failure_code[0] = (char) (FUNCT_NOT_IMPL >> 8);
254 TM.tc_failure_code[1] = (char) (FUNCT_NOT_IMPL );
255 TM.tc_failure_code[1] = (char) (FUNCT_NOT_IMPL );
255 TM.telecommand_pkt_id[0] = TC->packetID[0];
256 TM.telecommand_pkt_id[0] = TC->packetID[0];
256 TM.telecommand_pkt_id[1] = TC->packetID[1];
257 TM.telecommand_pkt_id[1] = TC->packetID[1];
257 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
258 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
258 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
259 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
259 TM.tc_service = TC->serviceType; // type of the rejected TC
260 TM.tc_service = TC->serviceType; // type of the rejected TC
260 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
261 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
261
262
262 messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
263 messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
263
264
264 // SEND DATA
265 // SEND DATA
265 status = rtems_message_queue_send( queue_id, &TM, messageSize);
266 status = rtems_message_queue_send( queue_id, &TM, messageSize);
266 if (status != RTEMS_SUCCESSFUL) {
267 if (status != RTEMS_SUCCESSFUL) {
267 PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n")
268 PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n")
268 }
269 }
269
270
270 return status;
271 return status;
271 }
272 }
272
273
273 int send_tm_lfr_tc_exe_error( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
274 int send_tm_lfr_tc_exe_error( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time )
274 {
275 {
275 /** This function sends a TM_LFR_TC_EXE_ERROR packet in the dedicated RTEMS message queue.
276 /** This function sends a TM_LFR_TC_EXE_ERROR packet in the dedicated RTEMS message queue.
276 *
277 *
277 * @param TC points to the TeleCommand packet that is being processed
278 * @param TC points to the TeleCommand packet that is being processed
278 * @param queue_id is the id of the queue which handles TM
279 * @param queue_id is the id of the queue which handles TM
279 *
280 *
280 * @return RTEMS directive status code:
281 * @return RTEMS directive status code:
281 * - RTEMS_SUCCESSFUL - message sent successfully
282 * - RTEMS_SUCCESSFUL - message sent successfully
282 * - RTEMS_INVALID_ID - invalid queue id
283 * - RTEMS_INVALID_ID - invalid queue id
283 * - RTEMS_INVALID_SIZE - invalid message size
284 * - RTEMS_INVALID_SIZE - invalid message size
284 * - RTEMS_INVALID_ADDRESS - buffer is NULL
285 * - RTEMS_INVALID_ADDRESS - buffer is NULL
285 * - RTEMS_UNSATISFIED - out of message buffers
286 * - RTEMS_UNSATISFIED - out of message buffers
286 * - RTEMS_TOO_MANY - queue s limit has been reached
287 * - RTEMS_TOO_MANY - queue s limit has been reached
287 *
288 *
288 */
289 */
289
290
290 rtems_status_code status;
291 rtems_status_code status;
291 Packet_TM_LFR_TC_EXE_ERROR_t TM;
292 Packet_TM_LFR_TC_EXE_ERROR_t TM;
292 unsigned char messageSize;
293 unsigned char messageSize;
293
294
294 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
295 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
295 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
296 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
296 TM.reserved = DEFAULT_RESERVED;
297 TM.reserved = DEFAULT_RESERVED;
297 TM.userApplication = CCSDS_USER_APP;
298 TM.userApplication = CCSDS_USER_APP;
298 // PACKET HEADER
299 // PACKET HEADER
299 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
300 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
300 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
301 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
301 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
302 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
302 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8);
303 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8);
303 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR );
304 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR );
304 // DATA FIELD HEADER
305 // DATA FIELD HEADER
305 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
306 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
306 TM.serviceType = TM_TYPE_TC_EXE;
307 TM.serviceType = TM_TYPE_TC_EXE;
307 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
308 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
308 TM.destinationID = TC->sourceID; // default destination id
309 TM.destinationID = TC->sourceID; // default destination id
309 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
310 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
310 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
311 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
311 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
312 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
312 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
313 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
313 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
314 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
314 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
315 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
315 //
316 //
316 TM.tc_failure_code[0] = (char) (FAIL_DETECTED >> 8);
317 TM.tc_failure_code[0] = (char) (FAIL_DETECTED >> 8);
317 TM.tc_failure_code[1] = (char) (FAIL_DETECTED );
318 TM.tc_failure_code[1] = (char) (FAIL_DETECTED );
318 TM.telecommand_pkt_id[0] = TC->packetID[0];
319 TM.telecommand_pkt_id[0] = TC->packetID[0];
319 TM.telecommand_pkt_id[1] = TC->packetID[1];
320 TM.telecommand_pkt_id[1] = TC->packetID[1];
320 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
321 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
321 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
322 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
322 TM.tc_service = TC->serviceType; // type of the rejected TC
323 TM.tc_service = TC->serviceType; // type of the rejected TC
323 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
324 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
324
325
325 messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
326 messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
326
327
327 // SEND DATA
328 // SEND DATA
328 status = rtems_message_queue_send( queue_id, &TM, messageSize);
329 status = rtems_message_queue_send( queue_id, &TM, messageSize);
329 if (status != RTEMS_SUCCESSFUL) {
330 if (status != RTEMS_SUCCESSFUL) {
330 PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n")
331 PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n")
331 }
332 }
332
333
333 return status;
334 return status;
334 }
335 }
335
336
336 int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
337 int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
337 unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV,
338 unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV,
338 unsigned char destinationID)
339 unsigned char destinationID, unsigned char *time)
339 {
340 {
340 /** This function sends a TM_LFR_TC_EXE_CORRUPTED packet in the dedicated RTEMS message queue.
341 /** This function sends a TM_LFR_TC_EXE_CORRUPTED packet in the dedicated RTEMS message queue.
341 *
342 *
342 * @param TC points to the TeleCommand packet that is being processed
343 * @param TC points to the TeleCommand packet that is being processed
343 * @param queue_id is the id of the queue which handles TM
344 * @param queue_id is the id of the queue which handles TM
344 * @param computed_CRC points to a buffer of two bytes containing the CRC computed during the parsing of the TeleCommand
345 * @param computed_CRC points to a buffer of two bytes containing the CRC computed during the parsing of the TeleCommand
345 * @param currentTC_LEN_RCV points to a buffer of two bytes containing a packet size field computed on the received data
346 * @param currentTC_LEN_RCV points to a buffer of two bytes containing a packet size field computed on the received data
346 *
347 *
347 * @return RTEMS directive status code:
348 * @return RTEMS directive status code:
348 * - RTEMS_SUCCESSFUL - message sent successfully
349 * - RTEMS_SUCCESSFUL - message sent successfully
349 * - RTEMS_INVALID_ID - invalid queue id
350 * - RTEMS_INVALID_ID - invalid queue id
350 * - RTEMS_INVALID_SIZE - invalid message size
351 * - RTEMS_INVALID_SIZE - invalid message size
351 * - RTEMS_INVALID_ADDRESS - buffer is NULL
352 * - RTEMS_INVALID_ADDRESS - buffer is NULL
352 * - RTEMS_UNSATISFIED - out of message buffers
353 * - RTEMS_UNSATISFIED - out of message buffers
353 * - RTEMS_TOO_MANY - queue s limit has been reached
354 * - RTEMS_TOO_MANY - queue s limit has been reached
354 *
355 *
355 */
356 */
356
357
357 rtems_status_code status;
358 rtems_status_code status;
358 Packet_TM_LFR_TC_EXE_CORRUPTED_t TM;
359 Packet_TM_LFR_TC_EXE_CORRUPTED_t TM;
359 unsigned char messageSize;
360 unsigned char messageSize;
360 unsigned int packetLength;
361 unsigned int packetLength;
361 unsigned char *packetDataField;
362 unsigned char *packetDataField;
362
363
363 packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1]; // compute the packet length parameter
364 packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1]; // compute the packet length parameter
364 packetDataField = (unsigned char *) &TC->headerFlag_pusVersion_Ack; // get the beginning of the data field
365 packetDataField = (unsigned char *) &TC->headerFlag_pusVersion_Ack; // get the beginning of the data field
365
366
366 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
367 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
367 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
368 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
368 TM.reserved = DEFAULT_RESERVED;
369 TM.reserved = DEFAULT_RESERVED;
369 TM.userApplication = CCSDS_USER_APP;
370 TM.userApplication = CCSDS_USER_APP;
370 // PACKET HEADER
371 // PACKET HEADER
371 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
372 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
372 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
373 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
373 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
374 increment_seq_counter_destination_id( TM.packetSequenceControl, TC->sourceID );
374 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8);
375 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8);
375 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED );
376 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED );
376 // DATA FIELD HEADER
377 // DATA FIELD HEADER
377 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
378 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
378 TM.serviceType = TM_TYPE_TC_EXE;
379 TM.serviceType = TM_TYPE_TC_EXE;
379 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
380 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
380 TM.destinationID = destinationID;
381 TM.destinationID = destinationID;
381 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
382 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
382 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
383 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
383 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
384 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
384 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
385 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
385 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
386 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
386 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
387 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
387 //
388 //
388 TM.tc_failure_code[0] = (unsigned char) (CORRUPTED >> 8);
389 TM.tc_failure_code[0] = (unsigned char) (CORRUPTED >> 8);
389 TM.tc_failure_code[1] = (unsigned char) (CORRUPTED );
390 TM.tc_failure_code[1] = (unsigned char) (CORRUPTED );
390 TM.telecommand_pkt_id[0] = TC->packetID[0];
391 TM.telecommand_pkt_id[0] = TC->packetID[0];
391 TM.telecommand_pkt_id[1] = TC->packetID[1];
392 TM.telecommand_pkt_id[1] = TC->packetID[1];
392 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
393 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
393 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
394 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
394 TM.tc_service = TC->serviceType; // type of the rejected TC
395 TM.tc_service = TC->serviceType; // type of the rejected TC
395 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
396 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
396 TM.pkt_len_rcv_value[0] = TC->packetLength[0];
397 TM.pkt_len_rcv_value[0] = TC->packetLength[0];
397 TM.pkt_len_rcv_value[1] = TC->packetLength[1];
398 TM.pkt_len_rcv_value[1] = TC->packetLength[1];
398 TM.pkt_datafieldsize_cnt[0] = currentTC_LEN_RCV[0];
399 TM.pkt_datafieldsize_cnt[0] = currentTC_LEN_RCV[0];
399 TM.pkt_datafieldsize_cnt[1] = currentTC_LEN_RCV[1];
400 TM.pkt_datafieldsize_cnt[1] = currentTC_LEN_RCV[1];
400 TM.rcv_crc[0] = packetDataField[ packetLength - 1 ];
401 TM.rcv_crc[0] = packetDataField[ packetLength - 1 ];
401 TM.rcv_crc[1] = packetDataField[ packetLength ];
402 TM.rcv_crc[1] = packetDataField[ packetLength ];
402 TM.computed_crc[0] = computed_CRC[0];
403 TM.computed_crc[0] = computed_CRC[0];
403 TM.computed_crc[1] = computed_CRC[1];
404 TM.computed_crc[1] = computed_CRC[1];
404
405
405 messageSize = PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
406 messageSize = PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
406
407
407 // SEND DATA
408 // SEND DATA
408 status = rtems_message_queue_send( queue_id, &TM, messageSize);
409 status = rtems_message_queue_send( queue_id, &TM, messageSize);
409 if (status != RTEMS_SUCCESSFUL) {
410 if (status != RTEMS_SUCCESSFUL) {
410 PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n")
411 PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n")
411 }
412 }
412
413
413 return status;
414 return status;
414 }
415 }
415
416
416 void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id )
417 void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id )
417 {
418 {
418 unsigned short sequence_cnt;
419 unsigned short sequence_cnt;
419 unsigned short segmentation_grouping_flag;
420 unsigned short segmentation_grouping_flag;
420 unsigned short new_packet_sequence_control;
421 unsigned short new_packet_sequence_control;
421 unsigned char i;
422 unsigned char i;
422
423
423 switch (destination_id)
424 switch (destination_id)
424 {
425 {
425 case SID_TC_GROUND:
426 case SID_TC_GROUND:
426 i = GROUND;
427 i = GROUND;
427 break;
428 break;
428 case SID_TC_MISSION_TIMELINE:
429 case SID_TC_MISSION_TIMELINE:
429 i = MISSION_TIMELINE;
430 i = MISSION_TIMELINE;
430 break;
431 break;
431 case SID_TC_TC_SEQUENCES:
432 case SID_TC_TC_SEQUENCES:
432 i = TC_SEQUENCES;
433 i = TC_SEQUENCES;
433 break;
434 break;
434 case SID_TC_RECOVERY_ACTION_CMD:
435 case SID_TC_RECOVERY_ACTION_CMD:
435 i = RECOVERY_ACTION_CMD;
436 i = RECOVERY_ACTION_CMD;
436 break;
437 break;
437 case SID_TC_BACKUP_MISSION_TIMELINE:
438 case SID_TC_BACKUP_MISSION_TIMELINE:
438 i = BACKUP_MISSION_TIMELINE;
439 i = BACKUP_MISSION_TIMELINE;
439 break;
440 break;
440 case SID_TC_DIRECT_CMD:
441 case SID_TC_DIRECT_CMD:
441 i = DIRECT_CMD;
442 i = DIRECT_CMD;
442 break;
443 break;
443 case SID_TC_SPARE_GRD_SRC1:
444 case SID_TC_SPARE_GRD_SRC1:
444 i = SPARE_GRD_SRC1;
445 i = SPARE_GRD_SRC1;
445 break;
446 break;
446 case SID_TC_SPARE_GRD_SRC2:
447 case SID_TC_SPARE_GRD_SRC2:
447 i = SPARE_GRD_SRC2;
448 i = SPARE_GRD_SRC2;
448 break;
449 break;
449 case SID_TC_OBCP:
450 case SID_TC_OBCP:
450 i = OBCP;
451 i = OBCP;
451 break;
452 break;
452 case SID_TC_SYSTEM_CONTROL:
453 case SID_TC_SYSTEM_CONTROL:
453 i = SYSTEM_CONTROL;
454 i = SYSTEM_CONTROL;
454 break;
455 break;
455 case SID_TC_AOCS:
456 case SID_TC_AOCS:
456 i = AOCS;
457 i = AOCS;
457 break;
458 break;
458 case SID_TC_RPW_INTERNAL:
459 case SID_TC_RPW_INTERNAL:
459 i = RPW_INTERNAL;
460 i = RPW_INTERNAL;
460 break;
461 break;
461 default:
462 default:
462 i = UNKNOWN;
463 i = UNKNOWN;
463 break;
464 break;
464 }
465 }
465
466
466 if (i != UNKNOWN)
467 if (i != UNKNOWN)
467 {
468 {
468 segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
469 segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
469 sequence_cnt = sequenceCounters_TC_EXE[ i ] & 0x3fff;
470 sequence_cnt = sequenceCounters_TC_EXE[ i ] & 0x3fff;
470
471
471 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
472 new_packet_sequence_control = segmentation_grouping_flag | sequence_cnt ;
472
473
473 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
474 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
474 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
475 packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control );
475
476
476 // increment the sequence counter for the next packet
477 // increment the sequence counter for the next packet
477 if ( sequenceCounters_TC_EXE[ i ] < SEQ_CNT_MAX)
478 if ( sequenceCounters_TC_EXE[ i ] < SEQ_CNT_MAX)
478 {
479 {
479 sequenceCounters_TC_EXE[ i ] = sequenceCounters_TC_EXE[ i ] + 1;
480 sequenceCounters_TC_EXE[ i ] = sequenceCounters_TC_EXE[ i ] + 1;
480 }
481 }
481 else
482 else
482 {
483 {
483 sequenceCounters_TC_EXE[ i ] = 0;
484 sequenceCounters_TC_EXE[ i ] = 0;
484 }
485 }
485 }
486 }
486 else
487 else
487 {
488 {
488 DEBUG_PRINTF1("in increment_seq_counter_destination_id *** ERR destination ID %d not known\n", destination_id)
489 DEBUG_PRINTF1("in increment_seq_counter_destination_id *** ERR destination ID %d not known\n", destination_id)
489 }
490 }
490
491
491 }
492 }
General Comments 0
You need to be logged in to leave comments. Login now