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