##// END OF EJS Templates
CWF_F3 packets are now compliant with the ICD...
paul -
r38:dd0f2a9dcf94 default
parent child
Show More
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -1,233 +1,233
1 #############################################################################
1 #############################################################################
2 # Makefile for building: bin/fsw
2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Oct 10 15:46:11 2013
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Fri Oct 11 10:41:32 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=14 -DPRINT_MESSAGES_ON_CONSOLE
13 DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=15 -DPRINT_MESSAGES_ON_CONSOLE
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header
17 LINK = sparc-rtems-g++
17 LINK = sparc-rtems-g++
18 LFLAGS =
18 LFLAGS =
19 LIBS = $(SUBLIBS)
19 LIBS = $(SUBLIBS)
20 AR = sparc-rtems-ar rcs
20 AR = sparc-rtems-ar rcs
21 RANLIB =
21 RANLIB =
22 QMAKE = /usr/bin/qmake-qt4
22 QMAKE = /usr/bin/qmake-qt4
23 TAR = tar -cf
23 TAR = tar -cf
24 COMPRESS = gzip -9f
24 COMPRESS = gzip -9f
25 COPY = cp -f
25 COPY = cp -f
26 SED = sed
26 SED = sed
27 COPY_FILE = $(COPY)
27 COPY_FILE = $(COPY)
28 COPY_DIR = $(COPY) -r
28 COPY_DIR = $(COPY) -r
29 STRIP = sparc-rtems-strip
29 STRIP = sparc-rtems-strip
30 INSTALL_FILE = install -m 644 -p
30 INSTALL_FILE = install -m 644 -p
31 INSTALL_DIR = $(COPY_DIR)
31 INSTALL_DIR = $(COPY_DIR)
32 INSTALL_PROGRAM = install -m 755 -p
32 INSTALL_PROGRAM = install -m 755 -p
33 DEL_FILE = rm -f
33 DEL_FILE = rm -f
34 SYMLINK = ln -f -s
34 SYMLINK = ln -f -s
35 DEL_DIR = rmdir
35 DEL_DIR = rmdir
36 MOVE = mv -f
36 MOVE = mv -f
37 CHK_DIR_EXISTS= test -d
37 CHK_DIR_EXISTS= test -d
38 MKDIR = mkdir -p
38 MKDIR = mkdir -p
39
39
40 ####### Output directory
40 ####### Output directory
41
41
42 OBJECTS_DIR = obj/
42 OBJECTS_DIR = obj/
43
43
44 ####### Files
44 ####### Files
45
45
46 SOURCES = ../src/wf_handler.c \
46 SOURCES = ../src/wf_handler.c \
47 ../src/tc_handler.c \
47 ../src/tc_handler.c \
48 ../src/fsw_processing.c \
48 ../src/fsw_processing.c \
49 ../src/fsw_misc.c \
49 ../src/fsw_misc.c \
50 ../src/fsw_init.c \
50 ../src/fsw_init.c \
51 ../src/fsw_globals.c \
51 ../src/fsw_globals.c \
52 ../src/fsw_spacewire.c
52 ../src/fsw_spacewire.c
53 OBJECTS = obj/wf_handler.o \
53 OBJECTS = obj/wf_handler.o \
54 obj/tc_handler.o \
54 obj/tc_handler.o \
55 obj/fsw_processing.o \
55 obj/fsw_processing.o \
56 obj/fsw_misc.o \
56 obj/fsw_misc.o \
57 obj/fsw_init.o \
57 obj/fsw_init.o \
58 obj/fsw_globals.o \
58 obj/fsw_globals.o \
59 obj/fsw_spacewire.o
59 obj/fsw_spacewire.o
60 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
60 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
61 /usr/lib64/qt4/mkspecs/common/linux.conf \
61 /usr/lib64/qt4/mkspecs/common/linux.conf \
62 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
62 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
63 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
63 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
64 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
64 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
65 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
65 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
66 /usr/lib64/qt4/mkspecs/qconfig.pri \
66 /usr/lib64/qt4/mkspecs/qconfig.pri \
67 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
67 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
68 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
68 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
69 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
69 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
70 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
70 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
71 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
71 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
72 sparc.pri \
72 sparc.pri \
73 /usr/lib64/qt4/mkspecs/features/release.prf \
73 /usr/lib64/qt4/mkspecs/features/release.prf \
74 /usr/lib64/qt4/mkspecs/features/default_post.prf \
74 /usr/lib64/qt4/mkspecs/features/default_post.prf \
75 /usr/lib64/qt4/mkspecs/features/shared.prf \
75 /usr/lib64/qt4/mkspecs/features/shared.prf \
76 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
76 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
77 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
77 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
78 /usr/lib64/qt4/mkspecs/features/resources.prf \
78 /usr/lib64/qt4/mkspecs/features/resources.prf \
79 /usr/lib64/qt4/mkspecs/features/uic.prf \
79 /usr/lib64/qt4/mkspecs/features/uic.prf \
80 /usr/lib64/qt4/mkspecs/features/yacc.prf \
80 /usr/lib64/qt4/mkspecs/features/yacc.prf \
81 /usr/lib64/qt4/mkspecs/features/lex.prf \
81 /usr/lib64/qt4/mkspecs/features/lex.prf \
82 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
82 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
83 fsw-qt.pro
83 fsw-qt.pro
84 QMAKE_TARGET = fsw
84 QMAKE_TARGET = fsw
85 DESTDIR = bin/
85 DESTDIR = bin/
86 TARGET = bin/fsw
86 TARGET = bin/fsw
87
87
88 first: all
88 first: all
89 ####### Implicit rules
89 ####### Implicit rules
90
90
91 .SUFFIXES: .o .c .cpp .cc .cxx .C
91 .SUFFIXES: .o .c .cpp .cc .cxx .C
92
92
93 .cpp.o:
93 .cpp.o:
94 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
94 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
95
95
96 .cc.o:
96 .cc.o:
97 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
97 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
98
98
99 .cxx.o:
99 .cxx.o:
100 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
100 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
101
101
102 .C.o:
102 .C.o:
103 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
103 $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
104
104
105 .c.o:
105 .c.o:
106 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
106 $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
107
107
108 ####### Build rules
108 ####### Build rules
109
109
110 all: Makefile $(TARGET)
110 all: Makefile $(TARGET)
111
111
112 $(TARGET): $(OBJECTS)
112 $(TARGET): $(OBJECTS)
113 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
113 @$(CHK_DIR_EXISTS) bin/ || $(MKDIR) bin/
114 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
114 $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
115
115
116 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
116 Makefile: fsw-qt.pro /usr/lib64/qt4/mkspecs/linux-g++/qmake.conf /usr/lib64/qt4/mkspecs/common/unix.conf \
117 /usr/lib64/qt4/mkspecs/common/linux.conf \
117 /usr/lib64/qt4/mkspecs/common/linux.conf \
118 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
118 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
119 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
119 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf \
120 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
120 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
121 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
121 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
122 /usr/lib64/qt4/mkspecs/qconfig.pri \
122 /usr/lib64/qt4/mkspecs/qconfig.pri \
123 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
123 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
124 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
124 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
125 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
125 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
126 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
126 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
127 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
127 /usr/lib64/qt4/mkspecs/features/default_pre.prf \
128 sparc.pri \
128 sparc.pri \
129 /usr/lib64/qt4/mkspecs/features/release.prf \
129 /usr/lib64/qt4/mkspecs/features/release.prf \
130 /usr/lib64/qt4/mkspecs/features/default_post.prf \
130 /usr/lib64/qt4/mkspecs/features/default_post.prf \
131 /usr/lib64/qt4/mkspecs/features/shared.prf \
131 /usr/lib64/qt4/mkspecs/features/shared.prf \
132 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
132 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf \
133 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
133 /usr/lib64/qt4/mkspecs/features/warn_on.prf \
134 /usr/lib64/qt4/mkspecs/features/resources.prf \
134 /usr/lib64/qt4/mkspecs/features/resources.prf \
135 /usr/lib64/qt4/mkspecs/features/uic.prf \
135 /usr/lib64/qt4/mkspecs/features/uic.prf \
136 /usr/lib64/qt4/mkspecs/features/yacc.prf \
136 /usr/lib64/qt4/mkspecs/features/yacc.prf \
137 /usr/lib64/qt4/mkspecs/features/lex.prf \
137 /usr/lib64/qt4/mkspecs/features/lex.prf \
138 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
138 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf
139 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
139 $(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
140 /usr/lib64/qt4/mkspecs/common/unix.conf:
140 /usr/lib64/qt4/mkspecs/common/unix.conf:
141 /usr/lib64/qt4/mkspecs/common/linux.conf:
141 /usr/lib64/qt4/mkspecs/common/linux.conf:
142 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
142 /usr/lib64/qt4/mkspecs/common/gcc-base.conf:
143 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
143 /usr/lib64/qt4/mkspecs/common/gcc-base-unix.conf:
144 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
144 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
145 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
145 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
146 /usr/lib64/qt4/mkspecs/qconfig.pri:
146 /usr/lib64/qt4/mkspecs/qconfig.pri:
147 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
147 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
148 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
148 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
149 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
149 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
150 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
150 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
151 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
151 /usr/lib64/qt4/mkspecs/features/default_pre.prf:
152 sparc.pri:
152 sparc.pri:
153 /usr/lib64/qt4/mkspecs/features/release.prf:
153 /usr/lib64/qt4/mkspecs/features/release.prf:
154 /usr/lib64/qt4/mkspecs/features/default_post.prf:
154 /usr/lib64/qt4/mkspecs/features/default_post.prf:
155 /usr/lib64/qt4/mkspecs/features/shared.prf:
155 /usr/lib64/qt4/mkspecs/features/shared.prf:
156 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
156 /usr/lib64/qt4/mkspecs/features/unix/gdb_dwarf_index.prf:
157 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
157 /usr/lib64/qt4/mkspecs/features/warn_on.prf:
158 /usr/lib64/qt4/mkspecs/features/resources.prf:
158 /usr/lib64/qt4/mkspecs/features/resources.prf:
159 /usr/lib64/qt4/mkspecs/features/uic.prf:
159 /usr/lib64/qt4/mkspecs/features/uic.prf:
160 /usr/lib64/qt4/mkspecs/features/yacc.prf:
160 /usr/lib64/qt4/mkspecs/features/yacc.prf:
161 /usr/lib64/qt4/mkspecs/features/lex.prf:
161 /usr/lib64/qt4/mkspecs/features/lex.prf:
162 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
162 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf:
163 qmake: FORCE
163 qmake: FORCE
164 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
164 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
165
165
166 dist:
166 dist:
167 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
167 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
168 $(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
168 $(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
169
169
170
170
171 clean:compiler_clean
171 clean:compiler_clean
172 -$(DEL_FILE) $(OBJECTS)
172 -$(DEL_FILE) $(OBJECTS)
173 -$(DEL_FILE) *~ core *.core
173 -$(DEL_FILE) *~ core *.core
174
174
175
175
176 ####### Sub-libraries
176 ####### Sub-libraries
177
177
178 distclean: clean
178 distclean: clean
179 -$(DEL_FILE) $(TARGET)
179 -$(DEL_FILE) $(TARGET)
180 -$(DEL_FILE) Makefile
180 -$(DEL_FILE) Makefile
181
181
182
182
183 grmon:
183 grmon:
184 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
184 cd bin && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
185
185
186 check: first
186 check: first
187
187
188 compiler_rcc_make_all:
188 compiler_rcc_make_all:
189 compiler_rcc_clean:
189 compiler_rcc_clean:
190 compiler_uic_make_all:
190 compiler_uic_make_all:
191 compiler_uic_clean:
191 compiler_uic_clean:
192 compiler_image_collection_make_all: qmake_image_collection.cpp
192 compiler_image_collection_make_all: qmake_image_collection.cpp
193 compiler_image_collection_clean:
193 compiler_image_collection_clean:
194 -$(DEL_FILE) qmake_image_collection.cpp
194 -$(DEL_FILE) qmake_image_collection.cpp
195 compiler_yacc_decl_make_all:
195 compiler_yacc_decl_make_all:
196 compiler_yacc_decl_clean:
196 compiler_yacc_decl_clean:
197 compiler_yacc_impl_make_all:
197 compiler_yacc_impl_make_all:
198 compiler_yacc_impl_clean:
198 compiler_yacc_impl_clean:
199 compiler_lex_make_all:
199 compiler_lex_make_all:
200 compiler_lex_clean:
200 compiler_lex_clean:
201 compiler_clean:
201 compiler_clean:
202
202
203 ####### Compile
203 ####### Compile
204
204
205 obj/wf_handler.o: ../src/wf_handler.c
205 obj/wf_handler.o: ../src/wf_handler.c
206 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
206 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/wf_handler.o ../src/wf_handler.c
207
207
208 obj/tc_handler.o: ../src/tc_handler.c
208 obj/tc_handler.o: ../src/tc_handler.c
209 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
209 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/tc_handler.o ../src/tc_handler.c
210
210
211 obj/fsw_processing.o: ../src/fsw_processing.c
211 obj/fsw_processing.o: ../src/fsw_processing.c
212 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c
212 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_processing.o ../src/fsw_processing.c
213
213
214 obj/fsw_misc.o: ../src/fsw_misc.c
214 obj/fsw_misc.o: ../src/fsw_misc.c
215 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
215 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_misc.o ../src/fsw_misc.c
216
216
217 obj/fsw_init.o: ../src/fsw_init.c
217 obj/fsw_init.o: ../src/fsw_init.c
218 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
218 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_init.o ../src/fsw_init.c
219
219
220 obj/fsw_globals.o: ../src/fsw_globals.c
220 obj/fsw_globals.o: ../src/fsw_globals.c
221 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
221 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_globals.o ../src/fsw_globals.c
222
222
223 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
223 obj/fsw_spacewire.o: ../src/fsw_spacewire.c
224 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
224 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/fsw_spacewire.o ../src/fsw_spacewire.c
225
225
226 ####### Install
226 ####### Install
227
227
228 install: FORCE
228 install: FORCE
229
229
230 uninstall: FORCE
230 uninstall: FORCE
231
231
232 FORCE:
232 FORCE:
233
233
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -1,63 +1,63
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
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-14
10 SWVERSION=-0-15
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=14
14 DEFINES += SW_VERSION_N4=15
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 TARGET = fsw
32 TARGET = fsw
33 contains( CONFIG, gsa ) {
33 contains( CONFIG, gsa ) {
34 DEFINES += GSA
34 DEFINES += GSA
35 TARGET = fsw-gsa
35 TARGET = fsw-gsa
36 }
36 }
37
37
38 INCLUDEPATH += \
38 INCLUDEPATH += \
39 ../src \
39 ../src \
40 ../header
40 ../header
41
41
42 SOURCES += \
42 SOURCES += \
43 ../src/wf_handler.c \
43 ../src/wf_handler.c \
44 ../src/tc_handler.c \
44 ../src/tc_handler.c \
45 ../src/fsw_processing.c \
45 ../src/fsw_processing.c \
46 ../src/fsw_misc.c \
46 ../src/fsw_misc.c \
47 ../src/fsw_init.c \
47 ../src/fsw_init.c \
48 ../src/fsw_globals.c \
48 ../src/fsw_globals.c \
49 ../src/fsw_spacewire.c
49 ../src/fsw_spacewire.c
50
50
51 HEADERS += \
51 HEADERS += \
52 ../header/wf_handler.h \
52 ../header/wf_handler.h \
53 ../header/tc_handler.h \
53 ../header/tc_handler.h \
54 ../header/grlib_regs.h \
54 ../header/grlib_regs.h \
55 ../header/fsw_processing.h \
55 ../header/fsw_processing.h \
56 ../header/fsw_params.h \
56 ../header/fsw_params.h \
57 ../header/fsw_misc.h \
57 ../header/fsw_misc.h \
58 ../header/fsw_init.h \
58 ../header/fsw_init.h \
59 ../header/ccsds_types.h \
59 ../header/ccsds_types.h \
60 ../header/fsw_params_processing.h \
60 ../header/fsw_params_processing.h \
61 ../header/fsw_spacewire.h \
61 ../header/fsw_spacewire.h \
62 ../header/tm_byte_positions.h
62 ../header/tm_byte_positions.h
63
63
@@ -1,257 +1,257
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-10T08:42:40. -->
3 <!-- Written by QtCreator 2.8.0, 2013-10-11T07:07:36. -->
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">0</value>
59 <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</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 </value>
82 <value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">-r -w </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 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
242 <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
243 </valuemap>
243 </valuemap>
244 </data>
244 </data>
245 <data>
245 <data>
246 <variable>ProjectExplorer.Project.TargetCount</variable>
246 <variable>ProjectExplorer.Project.TargetCount</variable>
247 <value type="int">1</value>
247 <value type="int">1</value>
248 </data>
248 </data>
249 <data>
249 <data>
250 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
250 <variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
251 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
251 <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value>
252 </data>
252 </data>
253 <data>
253 <data>
254 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
254 <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
255 <value type="int">14</value>
255 <value type="int">14</value>
256 </data>
256 </data>
257 </qtcreator>
257 </qtcreator>
@@ -1,633 +1,635
1 #ifndef CCSDS_H_INCLUDED
1 #ifndef CCSDS_H_INCLUDED
2 #define CCSDS_H_INCLUDED
2 #define CCSDS_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
114 #define WRONG_APP_DATA 5
115 //
115 //
116 #define WRONG_CMD_CODE 6
116 #define WRONG_CMD_CODE 6
117 #define CCSDS_TM_VALID 7
117 #define CCSDS_TM_VALID 7
118 #define FAILURE_CODE_INCONSISTENT 5 // 0x00 0x05
118 #define FAILURE_CODE_INCONSISTENT 5 // 0x00 0x05
119 #define FAILURE_CODE_NOT_EXECUTABLE 42000 // 0xa4 0x10
119 #define FAILURE_CODE_NOT_EXECUTABLE 42000 // 0xa4 0x10
120 #define FAILURE_CODE_NOT_IMPLEMENTED 42002 // 0xa4 0x12
120 #define FAILURE_CODE_NOT_IMPLEMENTED 42002 // 0xa4 0x12
121 #define FAILURE_CODE_ERROR 42003 // 0xa4 0x13
121 #define FAILURE_CODE_ERROR 42003 // 0xa4 0x13
122 #define FAILURE_CODE_CORRUPTED 42005 // 0xa4 0x15
122 #define FAILURE_CODE_CORRUPTED 42005 // 0xa4 0x15
123
123
124 // TM SID
124 // TM SID
125 #define SID_DEFAULT 0
125 #define SID_DEFAULT 0
126 #define SID_EXE_INC 5
126 #define SID_EXE_INC 5
127 #define SID_NOT_EXE 42000 // 0xa4 0x10
127 #define SID_NOT_EXE 42000 // 0xa4 0x10
128 #define SID_NOT_IMP 42002 // 0xa4 0x12
128 #define SID_NOT_IMP 42002 // 0xa4 0x12
129 #define SID_EXE_ERR 42003 // 0xa4 0x13
129 #define SID_EXE_ERR 42003 // 0xa4 0x13
130 #define SID_EXE_CORR 42005 // 0xa4 0x15
130 #define SID_EXE_CORR 42005 // 0xa4 0x15
131 #define SID_HK 1
131 #define SID_HK 1
132 #define SID_PARAMETER_DUMP 10
132 #define SID_PARAMETER_DUMP 10
133
133
134 #define SID_NORM_SWF_F0 3
134 #define SID_NORM_SWF_F0 3
135 #define SID_NORM_SWF_F1 4
135 #define SID_NORM_SWF_F1 4
136 #define SID_NORM_SWF_F2 5
136 #define SID_NORM_SWF_F2 5
137 #define SID_NORM_CWF_F3 1
137 #define SID_NORM_CWF_F3 1
138 #define SID_BURST_CWF_F2 2
138 #define SID_BURST_CWF_F2 2
139 #define SID_SBM1_CWF_F1 24
139 #define SID_SBM1_CWF_F1 24
140 #define SID_SBM2_CWF_F2 25
140 #define SID_SBM2_CWF_F2 25
141 #define SID_NORM_ASM_F0 11
141 #define SID_NORM_ASM_F0 11
142 #define SID_NORM_ASM_F1 12
142 #define SID_NORM_ASM_F1 12
143 #define SID_NORM_ASM_F2 13
143 #define SID_NORM_ASM_F2 13
144 #define SID_NORM_BP1_F0 14
144 #define SID_NORM_BP1_F0 14
145 #define SID_NORM_BP1_F1 15
145 #define SID_NORM_BP1_F1 15
146 #define SID_NORM_BP1_F2 16
146 #define SID_NORM_BP1_F2 16
147 #define SID_NORM_BP2_F0 19
147 #define SID_NORM_BP2_F0 19
148 #define SID_NORM_BP2_F1 20
148 #define SID_NORM_BP2_F1 20
149 #define SID_NORM_BP2_F2 21
149 #define SID_NORM_BP2_F2 21
150 #define SID_BURST_BP1_F0 17
150 #define SID_BURST_BP1_F0 17
151 #define SID_BURST_BP2_F0 22
151 #define SID_BURST_BP2_F0 22
152 #define SID_BURST_BP1_F1 18
152 #define SID_BURST_BP1_F1 18
153 #define SID_BURST_BP2_F1 23
153 #define SID_BURST_BP2_F1 23
154 #define SID_SBM1_BP1_F0 28
154 #define SID_SBM1_BP1_F0 28
155 #define SID_SBM1_BP2_F0 31
155 #define SID_SBM1_BP2_F0 31
156 #define SID_SBM2_BP1_F0 29
156 #define SID_SBM2_BP1_F0 29
157 #define SID_SBM2_BP2_F0 32
157 #define SID_SBM2_BP2_F0 32
158 #define SID_SBM2_BP1_F1 30
158 #define SID_SBM2_BP1_F1 30
159 #define SID_SBM2_BP2_F1 33
159 #define SID_SBM2_BP2_F1 33
160
160
161 // LENGTH (BYTES)
161 // LENGTH (BYTES)
162 #define LENGTH_TM_LFR_TC_EXE_MAX 32
162 #define LENGTH_TM_LFR_TC_EXE_MAX 32
163 #define LENGTH_TM_LFR_HK 126
163 #define LENGTH_TM_LFR_HK 126
164
164
165 // HEADER_LENGTH
165 // HEADER_LENGTH
166 #define TM_HEADER_LEN 16
166 #define TM_HEADER_LEN 16
167 #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28
167 #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28
168 // PACKET_LENGTH
168 // PACKET_LENGTH
169 #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET)
169 #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET)
170 #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET)
170 #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET)
171 #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET)
171 #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET)
172 #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET)
172 #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET)
173 #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET)
173 #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET)
174 #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET)
174 #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET)
175 #define PACKET_LENGTH_HK (126 - CCSDS_TC_TM_PACKET_OFFSET)
175 #define PACKET_LENGTH_HK (126 - CCSDS_TC_TM_PACKET_OFFSET)
176 #define PACKET_LENGTH_PARAMETER_DUMP (34 - CCSDS_TC_TM_PACKET_OFFSET)
176 #define PACKET_LENGTH_PARAMETER_DUMP (34 - CCSDS_TC_TM_PACKET_OFFSET)
177 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM (TOTAL_SIZE_SM + HEADER_LENGTH_TM_LFR_SCIENCE_ASM - CCSDS_TC_TM_PACKET_OFFSET)
177 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM (TOTAL_SIZE_SM + HEADER_LENGTH_TM_LFR_SCIENCE_ASM - CCSDS_TC_TM_PACKET_OFFSET)
178
178
179 #define SPARE1_PUSVERSION_SPARE2 0x10
179 #define SPARE1_PUSVERSION_SPARE2 0x10
180
180
181 #define LEN_TM_LFR_HK 126 + 4
181 #define LEN_TM_LFR_HK 130 // 126 + 4
182 #define LEN_TM_LFR_TC_EXE_NOT_IMP 24 +4
182 #define LEN_TM_LFR_TC_EXE_NOT_IMP 28 // 24 + 4
183
183
184 #define TM_LEN_SCI_SWF_340 (340 * 12 + 10 + 12 - 1)
184 #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1
185 #define TM_LEN_SCI_SWF_8 (8 * 12 + 10 + 12 - 1)
185 #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1
186 #define TM_LEN_SCI_CWF_340 (340 * 12 + 10 + 10 - 1)
186 #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1
187 #define TM_LEN_SCI_CWF_8 (8 * 12 + 10 + 10 - 1)
187 #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1
188 #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1
189 #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1
188 #define DEFAULT_PKTCNT 0x07
190 #define DEFAULT_PKTCNT 0x07
189 #define BLK_NR_340 0x0154
191 #define BLK_NR_340 0x0154
190 #define BLK_NR_8 0x0008
192 #define BLK_NR_8 0x0008
191
193
192 enum TM_TYPE{
194 enum TM_TYPE{
193 TM_LFR_TC_EXE_OK,
195 TM_LFR_TC_EXE_OK,
194 TM_LFR_TC_EXE_ERR,
196 TM_LFR_TC_EXE_ERR,
195 TM_LFR_HK,
197 TM_LFR_HK,
196 TM_LFR_SCI,
198 TM_LFR_SCI,
197 TM_LFR_SCI_SBM,
199 TM_LFR_SCI_SBM,
198 TM_LFR_PAR_DUMP
200 TM_LFR_PAR_DUMP
199 };
201 };
200
202
201 struct TMHeader_str
203 struct TMHeader_str
202 {
204 {
203 volatile unsigned char targetLogicalAddress;
205 volatile unsigned char targetLogicalAddress;
204 volatile unsigned char protocolIdentifier;
206 volatile unsigned char protocolIdentifier;
205 volatile unsigned char reserved;
207 volatile unsigned char reserved;
206 volatile unsigned char userApplication;
208 volatile unsigned char userApplication;
207 volatile unsigned char packetID[2];
209 volatile unsigned char packetID[2];
208 volatile unsigned char packetSequenceControl[2];
210 volatile unsigned char packetSequenceControl[2];
209 volatile unsigned char packetLength[2];
211 volatile unsigned char packetLength[2];
210 // DATA FIELD HEADER
212 // DATA FIELD HEADER
211 volatile unsigned char spare1_pusVersion_spare2;
213 volatile unsigned char spare1_pusVersion_spare2;
212 volatile unsigned char serviceType;
214 volatile unsigned char serviceType;
213 volatile unsigned char serviceSubType;
215 volatile unsigned char serviceSubType;
214 volatile unsigned char destinationID;
216 volatile unsigned char destinationID;
215 volatile unsigned char time[6];
217 volatile unsigned char time[6];
216 };
218 };
217 typedef struct TMHeader_str TMHeader_t;
219 typedef struct TMHeader_str TMHeader_t;
218
220
219 struct Packet_TM_LFR_TC_EXE_str
221 struct Packet_TM_LFR_TC_EXE_str
220 {
222 {
221 volatile unsigned char targetLogicalAddress;
223 volatile unsigned char targetLogicalAddress;
222 volatile unsigned char protocolIdentifier;
224 volatile unsigned char protocolIdentifier;
223 volatile unsigned char reserved;
225 volatile unsigned char reserved;
224 volatile unsigned char userApplication;
226 volatile unsigned char userApplication;
225 volatile unsigned char packetID[2];
227 volatile unsigned char packetID[2];
226 volatile unsigned char packetSequenceControl[2];
228 volatile unsigned char packetSequenceControl[2];
227 volatile unsigned char packetLength[2];
229 volatile unsigned char packetLength[2];
228 // DATA FIELD HEADER
230 // DATA FIELD HEADER
229 volatile unsigned char spare1_pusVersion_spare2;
231 volatile unsigned char spare1_pusVersion_spare2;
230 volatile unsigned char serviceType;
232 volatile unsigned char serviceType;
231 volatile unsigned char serviceSubType;
233 volatile unsigned char serviceSubType;
232 volatile unsigned char destinationID;
234 volatile unsigned char destinationID;
233 volatile unsigned char time[6];
235 volatile unsigned char time[6];
234 volatile unsigned char data[LENGTH_TM_LFR_TC_EXE_MAX - 10 + 1];
236 volatile unsigned char data[LENGTH_TM_LFR_TC_EXE_MAX - 10 + 1];
235 };
237 };
236 typedef struct Packet_TM_LFR_TC_EXE_str Packet_TM_LFR_TC_EXE_t;
238 typedef struct Packet_TM_LFR_TC_EXE_str Packet_TM_LFR_TC_EXE_t;
237
239
238 struct Packet_TM_LFR_TC_EXE_SUCCESS_str
240 struct Packet_TM_LFR_TC_EXE_SUCCESS_str
239 {
241 {
240 volatile unsigned char targetLogicalAddress;
242 volatile unsigned char targetLogicalAddress;
241 volatile unsigned char protocolIdentifier;
243 volatile unsigned char protocolIdentifier;
242 volatile unsigned char reserved;
244 volatile unsigned char reserved;
243 volatile unsigned char userApplication;
245 volatile unsigned char userApplication;
244 // PACKET HEADER
246 // PACKET HEADER
245 volatile unsigned char packetID[2];
247 volatile unsigned char packetID[2];
246 volatile unsigned char packetSequenceControl[2];
248 volatile unsigned char packetSequenceControl[2];
247 volatile unsigned char packetLength[2];
249 volatile unsigned char packetLength[2];
248 // DATA FIELD HEADER
250 // DATA FIELD HEADER
249 volatile unsigned char spare1_pusVersion_spare2;
251 volatile unsigned char spare1_pusVersion_spare2;
250 volatile unsigned char serviceType;
252 volatile unsigned char serviceType;
251 volatile unsigned char serviceSubType;
253 volatile unsigned char serviceSubType;
252 volatile unsigned char destinationID;
254 volatile unsigned char destinationID;
253 volatile unsigned char time[6];
255 volatile unsigned char time[6];
254 //
256 //
255 volatile unsigned char telecommand_pkt_id[2];
257 volatile unsigned char telecommand_pkt_id[2];
256 volatile unsigned char pkt_seq_control[2];
258 volatile unsigned char pkt_seq_control[2];
257 };
259 };
258 typedef struct Packet_TM_LFR_TC_EXE_SUCCESS_str Packet_TM_LFR_TC_EXE_SUCCESS_t;
260 typedef struct Packet_TM_LFR_TC_EXE_SUCCESS_str Packet_TM_LFR_TC_EXE_SUCCESS_t;
259
261
260 struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str
262 struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str
261 {
263 {
262 volatile unsigned char targetLogicalAddress;
264 volatile unsigned char targetLogicalAddress;
263 volatile unsigned char protocolIdentifier;
265 volatile unsigned char protocolIdentifier;
264 volatile unsigned char reserved;
266 volatile unsigned char reserved;
265 volatile unsigned char userApplication;
267 volatile unsigned char userApplication;
266 // PACKET HEADER
268 // PACKET HEADER
267 volatile unsigned char packetID[2];
269 volatile unsigned char packetID[2];
268 volatile unsigned char packetSequenceControl[2];
270 volatile unsigned char packetSequenceControl[2];
269 volatile unsigned char packetLength[2];
271 volatile unsigned char packetLength[2];
270 // DATA FIELD HEADER
272 // DATA FIELD HEADER
271 volatile unsigned char spare1_pusVersion_spare2;
273 volatile unsigned char spare1_pusVersion_spare2;
272 volatile unsigned char serviceType;
274 volatile unsigned char serviceType;
273 volatile unsigned char serviceSubType;
275 volatile unsigned char serviceSubType;
274 volatile unsigned char destinationID;
276 volatile unsigned char destinationID;
275 volatile unsigned char time[6];
277 volatile unsigned char time[6];
276 //
278 //
277 volatile unsigned char tc_failure_code[2];
279 volatile unsigned char tc_failure_code[2];
278 volatile unsigned char telecommand_pkt_id[2];
280 volatile unsigned char telecommand_pkt_id[2];
279 volatile unsigned char pkt_seq_control[2];
281 volatile unsigned char pkt_seq_control[2];
280 volatile unsigned char tc_service;
282 volatile unsigned char tc_service;
281 volatile unsigned char tc_subtype;
283 volatile unsigned char tc_subtype;
282 volatile unsigned char byte_position;
284 volatile unsigned char byte_position;
283 volatile unsigned char rcv_value;
285 volatile unsigned char rcv_value;
284 };
286 };
285 typedef struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str Packet_TM_LFR_TC_EXE_INCONSISTENT_t;
287 typedef struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str Packet_TM_LFR_TC_EXE_INCONSISTENT_t;
286
288
287 struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str
289 struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str
288 {
290 {
289 volatile unsigned char targetLogicalAddress;
291 volatile unsigned char targetLogicalAddress;
290 volatile unsigned char protocolIdentifier;
292 volatile unsigned char protocolIdentifier;
291 volatile unsigned char reserved;
293 volatile unsigned char reserved;
292 volatile unsigned char userApplication;
294 volatile unsigned char userApplication;
293 // PACKET HEADER
295 // PACKET HEADER
294 volatile unsigned char packetID[2];
296 volatile unsigned char packetID[2];
295 volatile unsigned char packetSequenceControl[2];
297 volatile unsigned char packetSequenceControl[2];
296 volatile unsigned char packetLength[2];
298 volatile unsigned char packetLength[2];
297 // DATA FIELD HEADER
299 // DATA FIELD HEADER
298 volatile unsigned char spare1_pusVersion_spare2;
300 volatile unsigned char spare1_pusVersion_spare2;
299 volatile unsigned char serviceType;
301 volatile unsigned char serviceType;
300 volatile unsigned char serviceSubType;
302 volatile unsigned char serviceSubType;
301 volatile unsigned char destinationID;
303 volatile unsigned char destinationID;
302 volatile unsigned char time[6];
304 volatile unsigned char time[6];
303 //
305 //
304 volatile unsigned char tc_failure_code[2];
306 volatile unsigned char tc_failure_code[2];
305 volatile unsigned char telecommand_pkt_id[2];
307 volatile unsigned char telecommand_pkt_id[2];
306 volatile unsigned char pkt_seq_control[2];
308 volatile unsigned char pkt_seq_control[2];
307 volatile unsigned char tc_service;
309 volatile unsigned char tc_service;
308 volatile unsigned char tc_subtype;
310 volatile unsigned char tc_subtype;
309 volatile unsigned char lfr_status_word[2];
311 volatile unsigned char lfr_status_word[2];
310 };
312 };
311 typedef struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t;
313 typedef struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t;
312
314
313 struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str
315 struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str
314 {
316 {
315 volatile unsigned char targetLogicalAddress;
317 volatile unsigned char targetLogicalAddress;
316 volatile unsigned char protocolIdentifier;
318 volatile unsigned char protocolIdentifier;
317 volatile unsigned char reserved;
319 volatile unsigned char reserved;
318 volatile unsigned char userApplication;
320 volatile unsigned char userApplication;
319 // PACKET HEADER
321 // PACKET HEADER
320 volatile unsigned char packetID[2];
322 volatile unsigned char packetID[2];
321 volatile unsigned char packetSequenceControl[2];
323 volatile unsigned char packetSequenceControl[2];
322 volatile unsigned char packetLength[2];
324 volatile unsigned char packetLength[2];
323 // DATA FIELD HEADER
325 // DATA FIELD HEADER
324 volatile unsigned char spare1_pusVersion_spare2;
326 volatile unsigned char spare1_pusVersion_spare2;
325 volatile unsigned char serviceType;
327 volatile unsigned char serviceType;
326 volatile unsigned char serviceSubType;
328 volatile unsigned char serviceSubType;
327 volatile unsigned char destinationID;
329 volatile unsigned char destinationID;
328 volatile unsigned char time[6];
330 volatile unsigned char time[6];
329 //
331 //
330 volatile unsigned char tc_failure_code[2];
332 volatile unsigned char tc_failure_code[2];
331 volatile unsigned char telecommand_pkt_id[2];
333 volatile unsigned char telecommand_pkt_id[2];
332 volatile unsigned char pkt_seq_control[2];
334 volatile unsigned char pkt_seq_control[2];
333 volatile unsigned char tc_service;
335 volatile unsigned char tc_service;
334 volatile unsigned char tc_subtype;
336 volatile unsigned char tc_subtype;
335 };
337 };
336 typedef struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t;
338 typedef struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t;
337
339
338 struct Packet_TM_LFR_TC_EXE_ERROR_str
340 struct Packet_TM_LFR_TC_EXE_ERROR_str
339 {
341 {
340 volatile unsigned char targetLogicalAddress;
342 volatile unsigned char targetLogicalAddress;
341 volatile unsigned char protocolIdentifier;
343 volatile unsigned char protocolIdentifier;
342 volatile unsigned char reserved;
344 volatile unsigned char reserved;
343 volatile unsigned char userApplication;
345 volatile unsigned char userApplication;
344 // PACKET HEADER
346 // PACKET HEADER
345 volatile unsigned char packetID[2];
347 volatile unsigned char packetID[2];
346 volatile unsigned char packetSequenceControl[2];
348 volatile unsigned char packetSequenceControl[2];
347 volatile unsigned char packetLength[2];
349 volatile unsigned char packetLength[2];
348 // DATA FIELD HEADER
350 // DATA FIELD HEADER
349 volatile unsigned char spare1_pusVersion_spare2;
351 volatile unsigned char spare1_pusVersion_spare2;
350 volatile unsigned char serviceType;
352 volatile unsigned char serviceType;
351 volatile unsigned char serviceSubType;
353 volatile unsigned char serviceSubType;
352 volatile unsigned char destinationID;
354 volatile unsigned char destinationID;
353 volatile unsigned char time[6];
355 volatile unsigned char time[6];
354 //
356 //
355 volatile unsigned char tc_failure_code[2];
357 volatile unsigned char tc_failure_code[2];
356 volatile unsigned char telecommand_pkt_id[2];
358 volatile unsigned char telecommand_pkt_id[2];
357 volatile unsigned char pkt_seq_control[2];
359 volatile unsigned char pkt_seq_control[2];
358 volatile unsigned char tc_service;
360 volatile unsigned char tc_service;
359 volatile unsigned char tc_subtype;
361 volatile unsigned char tc_subtype;
360 };
362 };
361 typedef struct Packet_TM_LFR_TC_EXE_ERROR_str Packet_TM_LFR_TC_EXE_ERROR_t;
363 typedef struct Packet_TM_LFR_TC_EXE_ERROR_str Packet_TM_LFR_TC_EXE_ERROR_t;
362
364
363 struct Packet_TM_LFR_TC_EXE_CORRUPTED_str
365 struct Packet_TM_LFR_TC_EXE_CORRUPTED_str
364 {
366 {
365 volatile unsigned char targetLogicalAddress;
367 volatile unsigned char targetLogicalAddress;
366 volatile unsigned char protocolIdentifier;
368 volatile unsigned char protocolIdentifier;
367 volatile unsigned char reserved;
369 volatile unsigned char reserved;
368 volatile unsigned char userApplication;
370 volatile unsigned char userApplication;
369 // PACKET HEADER
371 // PACKET HEADER
370 volatile unsigned char packetID[2];
372 volatile unsigned char packetID[2];
371 volatile unsigned char packetSequenceControl[2];
373 volatile unsigned char packetSequenceControl[2];
372 volatile unsigned char packetLength[2];
374 volatile unsigned char packetLength[2];
373 // DATA FIELD HEADER
375 // DATA FIELD HEADER
374 volatile unsigned char spare1_pusVersion_spare2;
376 volatile unsigned char spare1_pusVersion_spare2;
375 volatile unsigned char serviceType;
377 volatile unsigned char serviceType;
376 volatile unsigned char serviceSubType;
378 volatile unsigned char serviceSubType;
377 volatile unsigned char destinationID;
379 volatile unsigned char destinationID;
378 volatile unsigned char time[6];
380 volatile unsigned char time[6];
379 //
381 //
380 volatile unsigned char tc_failure_code[2];
382 volatile unsigned char tc_failure_code[2];
381 volatile unsigned char telecommand_pkt_id[2];
383 volatile unsigned char telecommand_pkt_id[2];
382 volatile unsigned char pkt_seq_control[2];
384 volatile unsigned char pkt_seq_control[2];
383 volatile unsigned char tc_service;
385 volatile unsigned char tc_service;
384 volatile unsigned char tc_subtype;
386 volatile unsigned char tc_subtype;
385 volatile unsigned char pkt_len_rcv_value[2];
387 volatile unsigned char pkt_len_rcv_value[2];
386 volatile unsigned char pkt_datafieldsize_cnt[2];
388 volatile unsigned char pkt_datafieldsize_cnt[2];
387 volatile unsigned char rcv_crc[2];
389 volatile unsigned char rcv_crc[2];
388 volatile unsigned char computed_crc[2];
390 volatile unsigned char computed_crc[2];
389 };
391 };
390 typedef struct Packet_TM_LFR_TC_EXE_CORRUPTED_str Packet_TM_LFR_TC_EXE_CORRUPTED_t;
392 typedef struct Packet_TM_LFR_TC_EXE_CORRUPTED_str Packet_TM_LFR_TC_EXE_CORRUPTED_t;
391
393
392 struct Header_TM_LFR_SCIENCE_SWF_str
394 struct Header_TM_LFR_SCIENCE_SWF_str
393 {
395 {
394 volatile unsigned char targetLogicalAddress;
396 volatile unsigned char targetLogicalAddress;
395 volatile unsigned char protocolIdentifier;
397 volatile unsigned char protocolIdentifier;
396 volatile unsigned char reserved;
398 volatile unsigned char reserved;
397 volatile unsigned char userApplication;
399 volatile unsigned char userApplication;
398 volatile unsigned char packetID[2];
400 volatile unsigned char packetID[2];
399 volatile unsigned char packetSequenceControl[2];
401 volatile unsigned char packetSequenceControl[2];
400 volatile unsigned char packetLength[2];
402 volatile unsigned char packetLength[2];
401 // DATA FIELD HEADER
403 // DATA FIELD HEADER
402 volatile unsigned char spare1_pusVersion_spare2;
404 volatile unsigned char spare1_pusVersion_spare2;
403 volatile unsigned char serviceType;
405 volatile unsigned char serviceType;
404 volatile unsigned char serviceSubType;
406 volatile unsigned char serviceSubType;
405 volatile unsigned char destinationID;
407 volatile unsigned char destinationID;
406 volatile unsigned char time[6];
408 volatile unsigned char time[6];
407 // AUXILIARY HEADER
409 // AUXILIARY HEADER
408 volatile unsigned char sid;
410 volatile unsigned char sid;
409 volatile unsigned char hkBIA;
411 volatile unsigned char hkBIA;
410 volatile unsigned char pktCnt;
412 volatile unsigned char pktCnt;
411 volatile unsigned char pktNr;
413 volatile unsigned char pktNr;
412 volatile unsigned char acquisitionTime[6];
414 volatile unsigned char acquisitionTime[6];
413 volatile unsigned char blkNr[2];
415 volatile unsigned char blkNr[2];
414 };
416 };
415 typedef struct Header_TM_LFR_SCIENCE_SWF_str Header_TM_LFR_SCIENCE_SWF_t;
417 typedef struct Header_TM_LFR_SCIENCE_SWF_str Header_TM_LFR_SCIENCE_SWF_t;
416
418
417 struct Header_TM_LFR_SCIENCE_CWF_str
419 struct Header_TM_LFR_SCIENCE_CWF_str
418 {
420 {
419 volatile unsigned char targetLogicalAddress;
421 volatile unsigned char targetLogicalAddress;
420 volatile unsigned char protocolIdentifier;
422 volatile unsigned char protocolIdentifier;
421 volatile unsigned char reserved;
423 volatile unsigned char reserved;
422 volatile unsigned char userApplication;
424 volatile unsigned char userApplication;
423 volatile unsigned char packetID[2];
425 volatile unsigned char packetID[2];
424 volatile unsigned char packetSequenceControl[2];
426 volatile unsigned char packetSequenceControl[2];
425 volatile unsigned char packetLength[2];
427 volatile unsigned char packetLength[2];
426 // DATA FIELD HEADER
428 // DATA FIELD HEADER
427 volatile unsigned char spare1_pusVersion_spare2;
429 volatile unsigned char spare1_pusVersion_spare2;
428 volatile unsigned char serviceType;
430 volatile unsigned char serviceType;
429 volatile unsigned char serviceSubType;
431 volatile unsigned char serviceSubType;
430 volatile unsigned char destinationID;
432 volatile unsigned char destinationID;
431 volatile unsigned char time[6];
433 volatile unsigned char time[6];
432 // AUXILIARY DATA HEADER
434 // AUXILIARY DATA HEADER
433 volatile unsigned char sid;
435 volatile unsigned char sid;
434 volatile unsigned char hkBIA;
436 volatile unsigned char hkBIA;
435 volatile unsigned char acquisitionTime[6];
437 volatile unsigned char acquisitionTime[6];
436 volatile unsigned char blkNr[2];
438 volatile unsigned char blkNr[2];
437 };
439 };
438 typedef struct Header_TM_LFR_SCIENCE_CWF_str Header_TM_LFR_SCIENCE_CWF_t;
440 typedef struct Header_TM_LFR_SCIENCE_CWF_str Header_TM_LFR_SCIENCE_CWF_t;
439
441
440 struct Header_TM_LFR_SCIENCE_ASM_str
442 struct Header_TM_LFR_SCIENCE_ASM_str
441 {
443 {
442 volatile unsigned char targetLogicalAddress;
444 volatile unsigned char targetLogicalAddress;
443 volatile unsigned char protocolIdentifier;
445 volatile unsigned char protocolIdentifier;
444 volatile unsigned char reserved;
446 volatile unsigned char reserved;
445 volatile unsigned char userApplication;
447 volatile unsigned char userApplication;
446 volatile unsigned char packetID[2];
448 volatile unsigned char packetID[2];
447 volatile unsigned char packetSequenceControl[2];
449 volatile unsigned char packetSequenceControl[2];
448 volatile unsigned char packetLength[2];
450 volatile unsigned char packetLength[2];
449 // DATA FIELD HEADER
451 // DATA FIELD HEADER
450 volatile unsigned char spare1_pusVersion_spare2;
452 volatile unsigned char spare1_pusVersion_spare2;
451 volatile unsigned char serviceType;
453 volatile unsigned char serviceType;
452 volatile unsigned char serviceSubType;
454 volatile unsigned char serviceSubType;
453 volatile unsigned char destinationID;
455 volatile unsigned char destinationID;
454 volatile unsigned char time[6];
456 volatile unsigned char time[6];
455 // AUXILIARY HEADER
457 // AUXILIARY HEADER
456 volatile unsigned char sid;
458 volatile unsigned char sid;
457 volatile unsigned char biaStatusInfo;
459 volatile unsigned char biaStatusInfo;
458 volatile unsigned char cntASM;
460 volatile unsigned char cntASM;
459 volatile unsigned char nrASM;
461 volatile unsigned char nrASM;
460 volatile unsigned char acquisitionTime[6];
462 volatile unsigned char acquisitionTime[6];
461 volatile unsigned char blkNr[2];
463 volatile unsigned char blkNr[2];
462 };
464 };
463 typedef struct Header_TM_LFR_SCIENCE_ASM_str Header_TM_LFR_SCIENCE_ASM_t;
465 typedef struct Header_TM_LFR_SCIENCE_ASM_str Header_TM_LFR_SCIENCE_ASM_t;
464
466
465 struct ccsdsTelecommandPacket_str
467 struct ccsdsTelecommandPacket_str
466 {
468 {
467 //unsigned char targetLogicalAddress; // removed by the grspw module
469 //unsigned char targetLogicalAddress; // removed by the grspw module
468 volatile unsigned char protocolIdentifier;
470 volatile unsigned char protocolIdentifier;
469 volatile unsigned char reserved;
471 volatile unsigned char reserved;
470 volatile unsigned char userApplication;
472 volatile unsigned char userApplication;
471 volatile unsigned char packetID[2];
473 volatile unsigned char packetID[2];
472 volatile unsigned char packetSequenceControl[2];
474 volatile unsigned char packetSequenceControl[2];
473 volatile unsigned char packetLength[2];
475 volatile unsigned char packetLength[2];
474 // DATA FIELD HEADER
476 // DATA FIELD HEADER
475 volatile unsigned char headerFlag_pusVersion_Ack;
477 volatile unsigned char headerFlag_pusVersion_Ack;
476 volatile unsigned char serviceType;
478 volatile unsigned char serviceType;
477 volatile unsigned char serviceSubType;
479 volatile unsigned char serviceSubType;
478 volatile unsigned char sourceID;
480 volatile unsigned char sourceID;
479 volatile unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10];
481 volatile unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10];
480 };
482 };
481 typedef struct ccsdsTelecommandPacket_str ccsdsTelecommandPacket_t;
483 typedef struct ccsdsTelecommandPacket_str ccsdsTelecommandPacket_t;
482
484
483 struct Packet_TM_LFR_HK_str
485 struct Packet_TM_LFR_HK_str
484 {
486 {
485 volatile unsigned char targetLogicalAddress;
487 volatile unsigned char targetLogicalAddress;
486 volatile unsigned char protocolIdentifier;
488 volatile unsigned char protocolIdentifier;
487 volatile unsigned char reserved;
489 volatile unsigned char reserved;
488 volatile unsigned char userApplication;
490 volatile unsigned char userApplication;
489 volatile unsigned char packetID[2];
491 volatile unsigned char packetID[2];
490 volatile unsigned char packetSequenceControl[2];
492 volatile unsigned char packetSequenceControl[2];
491 volatile unsigned char packetLength[2];
493 volatile unsigned char packetLength[2];
492 volatile unsigned char spare1_pusVersion_spare2;
494 volatile unsigned char spare1_pusVersion_spare2;
493 volatile unsigned char serviceType;
495 volatile unsigned char serviceType;
494 volatile unsigned char serviceSubType;
496 volatile unsigned char serviceSubType;
495 volatile unsigned char destinationID;
497 volatile unsigned char destinationID;
496 volatile unsigned char time[6];
498 volatile unsigned char time[6];
497 volatile unsigned char sid;
499 volatile unsigned char sid;
498
500
499 //**************
501 //**************
500 // HK PARAMETERS
502 // HK PARAMETERS
501 unsigned char lfr_status_word[2];
503 unsigned char lfr_status_word[2];
502 unsigned char lfr_sw_version[4];
504 unsigned char lfr_sw_version[4];
503 // tc statistics
505 // tc statistics
504 unsigned char hk_lfr_update_info_tc_cnt[2];
506 unsigned char hk_lfr_update_info_tc_cnt[2];
505 unsigned char hk_lfr_update_time_tc_cnt[2];
507 unsigned char hk_lfr_update_time_tc_cnt[2];
506 unsigned char hk_dpu_exe_tc_lfr_cnt[2];
508 unsigned char hk_dpu_exe_tc_lfr_cnt[2];
507 unsigned char hk_dpu_rej_tc_lfr_cnt[2];
509 unsigned char hk_dpu_rej_tc_lfr_cnt[2];
508 unsigned char hk_lfr_last_exe_tc_id[2];
510 unsigned char hk_lfr_last_exe_tc_id[2];
509 unsigned char hk_lfr_last_exe_tc_type[2];
511 unsigned char hk_lfr_last_exe_tc_type[2];
510 unsigned char hk_lfr_last_exe_tc_subtype[2];
512 unsigned char hk_lfr_last_exe_tc_subtype[2];
511 unsigned char hk_lfr_last_exe_tc_time[6];
513 unsigned char hk_lfr_last_exe_tc_time[6];
512 unsigned char hk_lfr_last_rej_tc_id[2];
514 unsigned char hk_lfr_last_rej_tc_id[2];
513 unsigned char hk_lfr_last_rej_tc_type[2];
515 unsigned char hk_lfr_last_rej_tc_type[2];
514 unsigned char hk_lfr_last_rej_tc_subtype[2];
516 unsigned char hk_lfr_last_rej_tc_subtype[2];
515 unsigned char hk_lfr_last_rej_tc_time[6];
517 unsigned char hk_lfr_last_rej_tc_time[6];
516 // anomaly statistics
518 // anomaly statistics
517 unsigned char hk_lfr_le_cnt[2];
519 unsigned char hk_lfr_le_cnt[2];
518 unsigned char hk_lfr_me_cnt[2];
520 unsigned char hk_lfr_me_cnt[2];
519 unsigned char hk_lfr_he_cnt[2];
521 unsigned char hk_lfr_he_cnt[2];
520 unsigned char hk_lfr_last_er_rid[2];
522 unsigned char hk_lfr_last_er_rid[2];
521 unsigned char hk_lfr_last_er_code;
523 unsigned char hk_lfr_last_er_code;
522 unsigned char hk_lfr_last_er_time[6];
524 unsigned char hk_lfr_last_er_time[6];
523 // vhdl_blk_status
525 // vhdl_blk_status
524 unsigned char hk_lfr_vhdl_aa_sm;
526 unsigned char hk_lfr_vhdl_aa_sm;
525 unsigned char hk_lfr_vhdl_fft_sr;
527 unsigned char hk_lfr_vhdl_fft_sr;
526 unsigned char hk_lfr_vhdl_cic_hk;
528 unsigned char hk_lfr_vhdl_cic_hk;
527 unsigned char hk_lfr_vhdl_iir_cal;
529 unsigned char hk_lfr_vhdl_iir_cal;
528 // spacewire_if_statistics
530 // spacewire_if_statistics
529 unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2];
531 unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2];
530 unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2];
532 unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2];
531 unsigned char hk_lfr_dpu_spw_tick_out_cnt;
533 unsigned char hk_lfr_dpu_spw_tick_out_cnt;
532 unsigned char hk_lfr_dpu_spw_last_timc;
534 unsigned char hk_lfr_dpu_spw_last_timc;
533 // ahb error statistics
535 // ahb error statistics
534 unsigned int hk_lfr_last_fail_addr;
536 unsigned int hk_lfr_last_fail_addr;
535 // temperatures
537 // temperatures
536 unsigned char hk_lfr_temp_scm[2];
538 unsigned char hk_lfr_temp_scm[2];
537 unsigned char hk_lfr_temp_pcb[2];
539 unsigned char hk_lfr_temp_pcb[2];
538 unsigned char hk_lfr_temp_fpga[2];
540 unsigned char hk_lfr_temp_fpga[2];
539 // error counters
541 // error counters
540 unsigned char hk_lfr_dpu_spw_parity;
542 unsigned char hk_lfr_dpu_spw_parity;
541 unsigned char hk_lfr_dpu_spw_disconnect;
543 unsigned char hk_lfr_dpu_spw_disconnect;
542 unsigned char hk_lfr_dpu_spw_escape;
544 unsigned char hk_lfr_dpu_spw_escape;
543 unsigned char hk_lfr_dpu_spw_credit;
545 unsigned char hk_lfr_dpu_spw_credit;
544 unsigned char hk_lfr_dpu_spw_write_sync;
546 unsigned char hk_lfr_dpu_spw_write_sync;
545 unsigned char hk_lfr_dpu_spw_rx_ahb;
547 unsigned char hk_lfr_dpu_spw_rx_ahb;
546 unsigned char hk_lfr_dpu_spw_tx_ahb;
548 unsigned char hk_lfr_dpu_spw_tx_ahb;
547 unsigned char hk_lfr_dpu_spw_header_crc;
549 unsigned char hk_lfr_dpu_spw_header_crc;
548 unsigned char hk_lfr_dpu_spw_data_crc;
550 unsigned char hk_lfr_dpu_spw_data_crc;
549 unsigned char hk_lfr_dpu_spw_early_eop;
551 unsigned char hk_lfr_dpu_spw_early_eop;
550 unsigned char hk_lfr_dpu_spw_invalid_addr;
552 unsigned char hk_lfr_dpu_spw_invalid_addr;
551 unsigned char hk_lfr_dpu_spw_eep;
553 unsigned char hk_lfr_dpu_spw_eep;
552 unsigned char hk_lfr_dpu_spw_rx_too_big;
554 unsigned char hk_lfr_dpu_spw_rx_too_big;
553 // timecode
555 // timecode
554 unsigned char hk_lfr_timecode_erroneous;
556 unsigned char hk_lfr_timecode_erroneous;
555 unsigned char hk_lfr_timecode_missing;
557 unsigned char hk_lfr_timecode_missing;
556 unsigned char hk_lfr_timecode_invalid;
558 unsigned char hk_lfr_timecode_invalid;
557 // time
559 // time
558 unsigned char hk_lfr_time_timecode_it;
560 unsigned char hk_lfr_time_timecode_it;
559 unsigned char hk_lfr_time_not_synchro;
561 unsigned char hk_lfr_time_not_synchro;
560 unsigned char hk_lfr_time_timecode_ctr;
562 unsigned char hk_lfr_time_timecode_ctr;
561 // hk_lfr_buffer_dpu_
563 // hk_lfr_buffer_dpu_
562 unsigned char hk_lfr_buffer_dpu_tc_fifo;
564 unsigned char hk_lfr_buffer_dpu_tc_fifo;
563 unsigned char hk_lfr_buffer_dpu_tm_fifo;
565 unsigned char hk_lfr_buffer_dpu_tm_fifo;
564 // hk_lfr_ahb_
566 // hk_lfr_ahb_
565 unsigned char hk_lfr_ahb_correctable;
567 unsigned char hk_lfr_ahb_correctable;
566 unsigned char hk_lfr_ahb_uncorrectable;
568 unsigned char hk_lfr_ahb_uncorrectable;
567 unsigned char hk_lfr_ahb_fails_trans;
569 unsigned char hk_lfr_ahb_fails_trans;
568 // hk_lfr_adc_
570 // hk_lfr_adc_
569 unsigned char hk_lfr_adc_failure;
571 unsigned char hk_lfr_adc_failure;
570 unsigned char hk_lfr_adc_timeout;
572 unsigned char hk_lfr_adc_timeout;
571 unsigned char hk_lfr_toomany_err;
573 unsigned char hk_lfr_toomany_err;
572 // hk_lfr_cpu_
574 // hk_lfr_cpu_
573 unsigned char hk_lfr_cpu_write_err;
575 unsigned char hk_lfr_cpu_write_err;
574 unsigned char hk_lfr_cpu_ins_access_err;
576 unsigned char hk_lfr_cpu_ins_access_err;
575 unsigned char hk_lfr_cpu_illegal_ins;
577 unsigned char hk_lfr_cpu_illegal_ins;
576 unsigned char hk_lfr_cpu_privilegied_ins;
578 unsigned char hk_lfr_cpu_privilegied_ins;
577 unsigned char hk_lfr_cpu_register_hw;
579 unsigned char hk_lfr_cpu_register_hw;
578 unsigned char hk_lfr_cpu_not_aligned;
580 unsigned char hk_lfr_cpu_not_aligned;
579 unsigned char hk_lfr_cpu_data_exception;
581 unsigned char hk_lfr_cpu_data_exception;
580 unsigned char hk_lfr_cpu_div_exception;
582 unsigned char hk_lfr_cpu_div_exception;
581 unsigned char hk_lfr_cpu_arith_overflow;
583 unsigned char hk_lfr_cpu_arith_overflow;
582 };
584 };
583 typedef struct Packet_TM_LFR_HK_str Packet_TM_LFR_HK_t;
585 typedef struct Packet_TM_LFR_HK_str Packet_TM_LFR_HK_t;
584
586
585 struct Packet_TM_LFR_PARAMETER_DUMP_str
587 struct Packet_TM_LFR_PARAMETER_DUMP_str
586 {
588 {
587 volatile unsigned char targetLogicalAddress;
589 volatile unsigned char targetLogicalAddress;
588 volatile unsigned char protocolIdentifier;
590 volatile unsigned char protocolIdentifier;
589 volatile unsigned char reserved;
591 volatile unsigned char reserved;
590 volatile unsigned char userApplication;
592 volatile unsigned char userApplication;
591 volatile unsigned char packetID[2];
593 volatile unsigned char packetID[2];
592 volatile unsigned char packetSequenceControl[2];
594 volatile unsigned char packetSequenceControl[2];
593 volatile unsigned char packetLength[2];
595 volatile unsigned char packetLength[2];
594 // DATA FIELD HEADER
596 // DATA FIELD HEADER
595 volatile unsigned char spare1_pusVersion_spare2;
597 volatile unsigned char spare1_pusVersion_spare2;
596 volatile unsigned char serviceType;
598 volatile unsigned char serviceType;
597 volatile unsigned char serviceSubType;
599 volatile unsigned char serviceSubType;
598 volatile unsigned char destinationID;
600 volatile unsigned char destinationID;
599 volatile unsigned char time[6];
601 volatile unsigned char time[6];
600 volatile unsigned char sid;
602 volatile unsigned char sid;
601
603
602 //******************
604 //******************
603 // COMMON PARAMETERS
605 // COMMON PARAMETERS
604 volatile unsigned char unused0;
606 volatile unsigned char unused0;
605 volatile unsigned char bw_sp0_sp1_r0_r1;
607 volatile unsigned char bw_sp0_sp1_r0_r1;
606
608
607 //******************
609 //******************
608 // NORMAL PARAMETERS
610 // NORMAL PARAMETERS
609 volatile unsigned char sy_lfr_n_swf_l[2];
611 volatile unsigned char sy_lfr_n_swf_l[2];
610 volatile unsigned char sy_lfr_n_swf_p[2];
612 volatile unsigned char sy_lfr_n_swf_p[2];
611 volatile unsigned char sy_lfr_n_asm_p[2];
613 volatile unsigned char sy_lfr_n_asm_p[2];
612 volatile unsigned char sy_lfr_n_bp_p0;
614 volatile unsigned char sy_lfr_n_bp_p0;
613 volatile unsigned char sy_lfr_n_bp_p1;
615 volatile unsigned char sy_lfr_n_bp_p1;
614
616
615 //*****************
617 //*****************
616 // BURST PARAMETERS
618 // BURST PARAMETERS
617 volatile unsigned char sy_lfr_b_bp_p0;
619 volatile unsigned char sy_lfr_b_bp_p0;
618 volatile unsigned char sy_lfr_b_bp_p1;
620 volatile unsigned char sy_lfr_b_bp_p1;
619
621
620 //****************
622 //****************
621 // SBM1 PARAMETERS
623 // SBM1 PARAMETERS
622 volatile unsigned char sy_lfr_s1_bp_p0;
624 volatile unsigned char sy_lfr_s1_bp_p0;
623 volatile unsigned char sy_lfr_s1_bp_p1;
625 volatile unsigned char sy_lfr_s1_bp_p1;
624
626
625 //****************
627 //****************
626 // SBM2 PARAMETERS
628 // SBM2 PARAMETERS
627 volatile unsigned char sy_lfr_s2_bp_p0;
629 volatile unsigned char sy_lfr_s2_bp_p0;
628 volatile unsigned char sy_lfr_s2_bp_p1;
630 volatile unsigned char sy_lfr_s2_bp_p1;
629 };
631 };
630 typedef struct Packet_TM_LFR_PARAMETER_DUMP_str Packet_TM_LFR_PARAMETER_DUMP_t;
632 typedef struct Packet_TM_LFR_PARAMETER_DUMP_str Packet_TM_LFR_PARAMETER_DUMP_t;
631
633
632
634
633 #endif // CCSDS_H_INCLUDED
635 #endif // CCSDS_H_INCLUDED
@@ -1,221 +1,223
1 #ifndef FSW_RTEMS_CONFIG_H_INCLUDED
1 #ifndef FSW_RTEMS_CONFIG_H_INCLUDED
2 #define FSW_RTEMS_CONFIG_H_INCLUDED
2 #define FSW_RTEMS_CONFIG_H_INCLUDED
3
3
4 #include "fsw_params_processing.h"
4 #include "fsw_params_processing.h"
5 #include "ccsds_types.h"
5 #include "ccsds_types.h"
6
6
7 #define GRSPW_DEVICE_NAME "/dev/grspw0"
7 #define GRSPW_DEVICE_NAME "/dev/grspw0"
8 #define UART_DEVICE_NAME "/dev/console"
8 #define UART_DEVICE_NAME "/dev/console"
9
9
10 //************************
10 //************************
11 // flight software version
11 // flight software version
12 // this parameters is handled by the Qt project options
12 // this parameters is handled by the Qt project options
13
13
14 //**********
14 //**********
15 // LFR MODES
15 // LFR MODES
16 #define LFR_MODE_STANDBY 0
16 #define LFR_MODE_STANDBY 0
17 #define LFR_MODE_NORMAL 1
17 #define LFR_MODE_NORMAL 1
18 #define LFR_MODE_BURST 2
18 #define LFR_MODE_BURST 2
19 #define LFR_MODE_SBM1 3
19 #define LFR_MODE_SBM1 3
20 #define LFR_MODE_SBM2 4
20 #define LFR_MODE_SBM2 4
21 #define LFR_MODE_NORMAL_CWF_F3 5
21 #define LFR_MODE_NORMAL_CWF_F3 5
22
22
23 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
23 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
24 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
24 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
25 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
25 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
26 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
26 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
27 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
27 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
28 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
28 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
29
29
30 //****************************
30 //****************************
31 // LFR DEFAULT MODE PARAMETERS
31 // LFR DEFAULT MODE PARAMETERS
32 // COMMON
32 // COMMON
33 #define DEFAULT_SY_LFR_COMMON0 0x00
33 #define DEFAULT_SY_LFR_COMMON0 0x00
34 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
34 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
35 // NORM
35 // NORM
36 #define DEFAULT_SY_LFR_N_SWF_L 2048 // nb sample
36 #define DEFAULT_SY_LFR_N_SWF_L 2048 // nb sample
37 #define DEFAULT_SY_LFR_N_SWF_P 16 // sec
37 #define DEFAULT_SY_LFR_N_SWF_P 16 // sec
38 #define DEFAULT_SY_LFR_N_ASM_P 16 // sec
38 #define DEFAULT_SY_LFR_N_ASM_P 16 // sec
39 #define DEFAULT_SY_LFR_N_BP_P0 4 // sec
39 #define DEFAULT_SY_LFR_N_BP_P0 4 // sec
40 #define DEFAULT_SY_LFR_N_BP_P1 20 // sec
40 #define DEFAULT_SY_LFR_N_BP_P1 20 // sec
41 #define MIN_DELTA_SNAPSHOT 16 // sec
41 #define MIN_DELTA_SNAPSHOT 16 // sec
42 // BURST
42 // BURST
43 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
43 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
44 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
44 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
45 // SBM1
45 // SBM1
46 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
46 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
47 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
47 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
48 // SBM2
48 // SBM2
49 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
49 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
50 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
50 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
51 // ADDITIONAL PARAMETERS
51 // ADDITIONAL PARAMETERS
52 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
52 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
53 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
53 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
54 //
54 //
55 //****************************
55 //****************************
56
56
57 //*****************************
57 //*****************************
58 // APB REGISTERS BASE ADDRESSES
58 // APB REGISTERS BASE ADDRESSES
59 #define REGS_ADDR_APBUART 0x80000100
59 #define REGS_ADDR_APBUART 0x80000100
60 #define REGS_ADDR_GPTIMER 0x80000300
60 #define REGS_ADDR_GPTIMER 0x80000300
61 #define REGS_ADDR_GRSPW 0x80000500
61 #define REGS_ADDR_GRSPW 0x80000500
62 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
62 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
63 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
63 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
64
64
65 #ifdef GSA
65 #ifdef GSA
66 #else
66 #else
67 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20
67 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20
68 #endif
68 #endif
69
69
70 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
70 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
71 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
71 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
72
72
73 //**********
73 //**********
74 // IRQ LINES
74 // IRQ LINES
75 #define IRQ_SM 9
75 #define IRQ_SM 9
76 #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels
76 #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels
77 #define IRQ_WF 10
77 #define IRQ_WF 10
78 #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels
78 #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels
79 #define IRQ_TIME1 12
79 #define IRQ_TIME1 12
80 #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels
80 #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels
81 #define IRQ_TIME2 13
81 #define IRQ_TIME2 13
82 #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels
82 #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels
83 #define IRQ_WAVEFORM_PICKER 14
83 #define IRQ_WAVEFORM_PICKER 14
84 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
84 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
85 #define IRQ_SPECTRAL_MATRIX 6
85 #define IRQ_SPECTRAL_MATRIX 6
86 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
86 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
87
87
88 //*****
88 //*****
89 // TIME
89 // TIME
90 #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms
90 #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms
91 #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s
91 #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s
92 #define TIMER_SM_SIMULATOR 1
92 #define TIMER_SM_SIMULATOR 1
93 #define TIMER_WF_SIMULATOR 2
93 #define TIMER_WF_SIMULATOR 2
94 #define HK_PERIOD 100 // 100 * 10ms => 1sec
94 #define HK_PERIOD 100 // 100 * 10ms => 1sec
95
95
96 //**********
96 //**********
97 // LPP CODES
97 // LPP CODES
98 #define LFR_SUCCESSFUL 0
98 #define LFR_SUCCESSFUL 0
99 #define LFR_DEFAULT 1
99 #define LFR_DEFAULT 1
100
100
101 //******
101 //******
102 // RTEMS
102 // RTEMS
103 #define TASKID_RECV 1
103 #define TASKID_RECV 1
104 #define TASKID_ACTN 2
104 #define TASKID_ACTN 2
105 #define TASKID_SPIQ 3
105 #define TASKID_SPIQ 3
106 #define TASKID_SMIQ 4
106 #define TASKID_SMIQ 4
107 #define TASKID_STAT 5
107 #define TASKID_STAT 5
108 #define TASKID_AVF0 6
108 #define TASKID_AVF0 6
109 #define TASKID_BPF0 7
109 #define TASKID_BPF0 7
110 #define TASKID_WFRM 8
110 #define TASKID_WFRM 8
111 #define TASKID_DUMB 9
111 #define TASKID_DUMB 9
112 #define TASKID_HOUS 10
112 #define TASKID_HOUS 10
113 #define TASKID_MATR 11
113 #define TASKID_MATR 11
114 #define TASKID_CWF3 12
114 #define TASKID_CWF3 12
115 #define TASKID_CWF2 13
115 #define TASKID_CWF2 13
116 #define TASKID_CWF1 14
116 #define TASKID_CWF1 14
117 #define TASKID_SEND 15
117 #define TASKID_SEND 15
118
118
119 #define TASK_PRIORITY_SPIQ 5
119 #define TASK_PRIORITY_SPIQ 5
120 #define TASK_PRIORITY_SMIQ 10
120 #define TASK_PRIORITY_SMIQ 10
121 //
121 //
122 #define TASK_PRIORITY_RECV 20
122 #define TASK_PRIORITY_RECV 20
123 #define TASK_PRIORITY_ACTN 30
123 #define TASK_PRIORITY_ACTN 30
124 //
124 //
125 #define TASK_PRIORITY_HOUS 40
125 #define TASK_PRIORITY_HOUS 40
126 #define TASK_PRIORITY_CWF1 40
126 #define TASK_PRIORITY_CWF1 40
127 #define TASK_PRIORITY_CWF2 40
127 #define TASK_PRIORITY_CWF2 40
128 #define TASK_PRIORITY_WFRM 40
128 #define TASK_PRIORITY_WFRM 40
129 #define TASK_PRIORITY_CWF3 40
129 #define TASK_PRIORITY_CWF3 40
130 //
130 //
131 #define TASK_PRIORITY_SEND 40
131 #define TASK_PRIORITY_SEND 40
132 //
132 //
133 #define TASK_PRIORITY_AVF0 60
133 #define TASK_PRIORITY_AVF0 60
134 #define TASK_PRIORITY_BPF0 60
134 #define TASK_PRIORITY_BPF0 60
135 #define TASK_PRIORITY_MATR 100
135 #define TASK_PRIORITY_MATR 100
136 #define TASK_PRIORITY_STAT 200
136 #define TASK_PRIORITY_STAT 200
137 #define TASK_PRIORITY_DUMB 200
137 #define TASK_PRIORITY_DUMB 200
138
138
139 #define ACTION_MSG_QUEUE_COUNT 10
139 #define ACTION_MSG_QUEUE_COUNT 10
140 #define ACTION_MSG_PKTS_COUNT 50
140 #define ACTION_MSG_PKTS_COUNT 50
141 #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
141 #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
142 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
142 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
143
143
144 #define QUEUE_QUEU 0
144 #define QUEUE_QUEU 0
145 #define QUEUE_PKTS 1
145 #define QUEUE_PKTS 1
146
146
147 //*******
147 //*******
148 // MACROS
148 // MACROS
149 #ifdef PRINT_MESSAGES_ON_CONSOLE
149 #ifdef PRINT_MESSAGES_ON_CONSOLE
150 #define PRINTF(x) printf(x);
150 #define PRINTF(x) printf(x);
151 #define PRINTF1(x,y) printf(x,y);
151 #define PRINTF1(x,y) printf(x,y);
152 #define PRINTF2(x,y,z) printf(x,y,z);
152 #define PRINTF2(x,y,z) printf(x,y,z);
153 #else
153 #else
154 #define PRINTF(x) ;
154 #define PRINTF(x) ;
155 #define PRINTF1(x,y) ;
155 #define PRINTF1(x,y) ;
156 #define PRINTF2(x,y,z) ;
156 #define PRINTF2(x,y,z) ;
157 #endif
157 #endif
158
158
159 #ifdef BOOT_MESSAGES
159 #ifdef BOOT_MESSAGES
160 #define BOOT_PRINTF(x) printf(x);
160 #define BOOT_PRINTF(x) printf(x);
161 #define BOOT_PRINTF1(x,y) printf(x,y);
161 #define BOOT_PRINTF1(x,y) printf(x,y);
162 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
162 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
163 #else
163 #else
164 #define BOOT_PRINTF(x) ;
164 #define BOOT_PRINTF(x) ;
165 #define BOOT_PRINTF1(x,y) ;
165 #define BOOT_PRINTF1(x,y) ;
166 #define BOOT_PRINTF2(x,y,z) ;
166 #define BOOT_PRINTF2(x,y,z) ;
167 #endif
167 #endif
168
168
169 #ifdef DEBUG_MESSAGES
169 #ifdef DEBUG_MESSAGES
170 #define DEBUG_PRINTF(x) printf(x);
170 #define DEBUG_PRINTF(x) printf(x);
171 #define DEBUG_PRINTF1(x,y) printf(x,y);
171 #define DEBUG_PRINTF1(x,y) printf(x,y);
172 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
172 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
173 #else
173 #else
174 #define DEBUG_PRINTF(x) ;
174 #define DEBUG_PRINTF(x) ;
175 #define DEBUG_PRINTF1(x,y) ;
175 #define DEBUG_PRINTF1(x,y) ;
176 #define DEBUG_PRINTF2(x,y,z) ;
176 #define DEBUG_PRINTF2(x,y,z) ;
177 #endif
177 #endif
178
178
179 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
179 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
180
180
181 #define NB_SAMPLES_PER_SNAPSHOT 2048
181 #define NB_SAMPLES_PER_SNAPSHOT 2048
182 #define TIME_OFFSET 2
182 #define TIME_OFFSET 2
183 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
183 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
184 #define NB_BYTES_SWF_BLK (2 * 6)
184 #define NB_BYTES_SWF_BLK (2 * 6)
185 #define NB_WORDS_SWF_BLK 3
185 #define NB_WORDS_SWF_BLK 3
186 #define NB_BYTES_CWF3_LIGHT_BLK 6
187 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
186
188
187 //******************
189 //******************
188 // SEQUENCE COUNTERS
190 // SEQUENCE COUNTERS
189 #define SEQ_CNT_NB_PID 2
191 #define SEQ_CNT_NB_PID 2
190 #define SEQ_CNT_NB_CAT 4
192 #define SEQ_CNT_NB_CAT 4
191 #define SEQ_CNT_NB_DEST_ID 11
193 #define SEQ_CNT_NB_DEST_ID 11
192 // pid
194 // pid
193 #define SEQ_CNT_PID_76 0
195 #define SEQ_CNT_PID_76 0
194 #define SEQ_CNT_PID_79 1
196 #define SEQ_CNT_PID_79 1
195 //cat
197 //cat
196 #define SEQ_CNT_CAT_1 0
198 #define SEQ_CNT_CAT_1 0
197 #define SEQ_CNT_CAT_4 1
199 #define SEQ_CNT_CAT_4 1
198 #define SEQ_CNT_CAT_9 2
200 #define SEQ_CNT_CAT_9 2
199 #define SEQ_CNT_CAT_12 3
201 #define SEQ_CNT_CAT_12 3
200 // destination id
202 // destination id
201 #define SEQ_CNT_DST_ID_GROUND 0
203 #define SEQ_CNT_DST_ID_GROUND 0
202 #define SEQ_CNT_DST_ID_MISSION_TIMELINE 1
204 #define SEQ_CNT_DST_ID_MISSION_TIMELINE 1
203 #define SEQ_CNT_DST_ID_TC_SEQUENCES 2
205 #define SEQ_CNT_DST_ID_TC_SEQUENCES 2
204 #define SEQ_CNT_DST_ID_RECOVERY_ACTION_CMD 3
206 #define SEQ_CNT_DST_ID_RECOVERY_ACTION_CMD 3
205 #define SEQ_CNT_DST_ID_BACKUP_MISSION_TIMELINE 4
207 #define SEQ_CNT_DST_ID_BACKUP_MISSION_TIMELINE 4
206 #define SEQ_CNT_DST_ID_DIRECT_CMD 5
208 #define SEQ_CNT_DST_ID_DIRECT_CMD 5
207 #define SEQ_CNT_DST_ID_SPARE_GRD_SRC1 6
209 #define SEQ_CNT_DST_ID_SPARE_GRD_SRC1 6
208 #define SEQ_CNT_DST_ID_SPARE_GRD_SRC2 7
210 #define SEQ_CNT_DST_ID_SPARE_GRD_SRC2 7
209 #define SEQ_CNT_DST_ID_OBCP 8
211 #define SEQ_CNT_DST_ID_OBCP 8
210 #define SEQ_CNT_DST_ID_SYSTEM_CONTROL 9
212 #define SEQ_CNT_DST_ID_SYSTEM_CONTROL 9
211 #define SEQ_CNT_DST_ID_AOCS 10
213 #define SEQ_CNT_DST_ID_AOCS 10
212
214
213 struct param_local_str{
215 struct param_local_str{
214 unsigned int local_sbm1_nb_cwf_sent;
216 unsigned int local_sbm1_nb_cwf_sent;
215 unsigned int local_sbm1_nb_cwf_max;
217 unsigned int local_sbm1_nb_cwf_max;
216 unsigned int local_sbm2_nb_cwf_sent;
218 unsigned int local_sbm2_nb_cwf_sent;
217 unsigned int local_sbm2_nb_cwf_max;
219 unsigned int local_sbm2_nb_cwf_max;
218 unsigned int local_nb_interrupt_f0_MAX;
220 unsigned int local_nb_interrupt_f0_MAX;
219 };
221 };
220
222
221 #endif // FSW_RTEMS_CONFIG_H_INCLUDED
223 #endif // FSW_RTEMS_CONFIG_H_INCLUDED
@@ -1,70 +1,74
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
6
7 #include <stdio.h>
7 #include <stdio.h>
8 #include <math.h>
8 #include <math.h>
9
9
10 #include "fsw_params.h"
10 #include "fsw_params.h"
11 #include "grlib_regs.h"
11 #include "grlib_regs.h"
12 #include "ccsds_types.h"
12 #include "ccsds_types.h"
13 #include "fsw_init.h"
13 #include "fsw_init.h"
14
14
15 #define pi 3.1415
15 #define pi 3.1415
16
16
17 //#include <sys/ioctl.h>
17 //#include <sys/ioctl.h>
18
18
19 extern int fdSPW;
19 extern int fdSPW;
20 extern volatile int wf_snap_f0[ ];
20 extern volatile int wf_snap_f0[ ];
21 //
21 //
22 extern volatile int wf_snap_f1[ ];
22 extern volatile int wf_snap_f1[ ];
23 extern volatile int wf_snap_f1_bis[ ];
23 extern volatile int wf_snap_f1_bis[ ];
24 extern volatile int wf_snap_f1_norm[ ];
24 extern volatile int wf_snap_f1_norm[ ];
25 //
25 //
26 extern volatile int wf_snap_f2[ ];
26 extern volatile int wf_snap_f2[ ];
27 extern volatile int wf_snap_f2_bis[ ];
27 extern volatile int wf_snap_f2_bis[ ];
28 extern volatile int wf_snap_f2_norm[ ];
28 extern volatile int wf_snap_f2_norm[ ];
29 //
29 //
30 extern volatile int wf_cont_f3[ ];
30 extern volatile int wf_cont_f3[ ];
31 extern volatile int wf_cont_f3_bis[ ];
31 extern volatile int wf_cont_f3_bis[ ];
32 extern char wf_cont_f3_light[ ];
32 extern waveform_picker_regs_t *waveform_picker_regs;
33 extern waveform_picker_regs_t *waveform_picker_regs;
33
34
34 rtems_isr waveforms_isr( rtems_vector_number vector );
35 rtems_isr waveforms_isr( rtems_vector_number vector );
35 rtems_isr waveforms_simulator_isr( rtems_vector_number vector );
36 rtems_isr waveforms_simulator_isr( rtems_vector_number vector );
36 rtems_task wfrm_task(rtems_task_argument argument);
37 rtems_task wfrm_task( rtems_task_argument argument );
37 rtems_task cwf3_task(rtems_task_argument argument);
38 rtems_task cwf3_task( rtems_task_argument argument );
38 rtems_task cwf2_task(rtems_task_argument argument);
39 rtems_task cwf2_task( rtems_task_argument argument );
39 rtems_task cwf1_task(rtems_task_argument argument);
40 rtems_task cwf1_task( rtems_task_argument argument );
40
41
41 //******************
42 //******************
42 // general functions
43 // general functions
43 void init_waveforms( void );
44 void init_waveforms( void );
44 //
45 //
45 int init_header_snapshot_wf_table(unsigned int sid , Header_TM_LFR_SCIENCE_SWF_t *headerSWF);
46 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
46 int init_header_continuous_wf_table(unsigned int sid , Header_TM_LFR_SCIENCE_CWF_t *headerCWF);
47 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
48 int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
47 //
49 //
48 void reset_waveforms( void );
50 void reset_waveforms( void );
49
51
50 int send_waveform_SWF(volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id);
52 int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
51 int send_waveform_CWF(volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id);
53 int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
54 int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
55 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
52
56
53 //**************
57 //**************
54 // wfp registers
58 // wfp registers
55 void set_wfp_data_shaping();
59 void set_wfp_data_shaping();
56 char set_wfp_delta_snapshot();
60 char set_wfp_delta_snapshot();
57 void set_wfp_burst_enable_register( unsigned char mode);
61 void set_wfp_burst_enable_register( unsigned char mode);
58 void reset_wfp_burst_enable();
62 void reset_wfp_burst_enable();
59 void reset_wfp_status();
63 void reset_wfp_status();
60 void reset_waveform_picker_regs();
64 void reset_waveform_picker_regs();
61
65
62 //*****************
66 //*****************
63 // local parameters
67 // local parameters
64 void set_local_sbm1_nb_cwf_max();
68 void set_local_sbm1_nb_cwf_max();
65 void set_local_sbm2_nb_cwf_max();
69 void set_local_sbm2_nb_cwf_max();
66 void set_local_nb_interrupt_f0_MAX();
70 void set_local_nb_interrupt_f0_MAX();
67 void reset_local_sbm1_nb_cwf_sent();
71 void reset_local_sbm1_nb_cwf_sent();
68 void reset_local_sbm2_nb_cwf_sent();
72 void reset_local_sbm2_nb_cwf_sent();
69
73
70 #endif // WF_HANDLER_H_INCLUDED
74 #endif // WF_HANDLER_H_INCLUDED
@@ -1,72 +1,73
1 //#include <fsw_processing.h>
1 //#include <fsw_processing.h>
2 #include <rtems.h>
2 #include <rtems.h>
3 #include <grspw.h>
3 #include <grspw.h>
4 #include <ccsds_types.h>
4 #include <ccsds_types.h>
5 #include <grlib_regs.h>
5 #include <grlib_regs.h>
6 #include <fsw_params.h>
6 #include <fsw_params.h>
7
7
8 // RTEMS GLOBAL VARIABLES
8 // RTEMS GLOBAL VARIABLES
9 rtems_name misc_name[5];
9 rtems_name misc_name[5];
10 rtems_id misc_id[5];
10 rtems_id misc_id[5];
11 rtems_name Task_name[20]; /* array of task names */
11 rtems_name Task_name[20]; /* array of task names */
12 rtems_id Task_id[20]; /* array of task ids */
12 rtems_id Task_id[20]; /* array of task ids */
13 unsigned int maxCount;
13 unsigned int maxCount;
14 int fdSPW = 0;
14 int fdSPW = 0;
15 int fdUART = 0;
15 int fdUART = 0;
16 unsigned char lfrCurrentMode;
16 unsigned char lfrCurrentMode;
17
17
18 // APB CONFIGURATION REGISTERS
18 // APB CONFIGURATION REGISTERS
19 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
19 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
20 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
20 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
21 #ifdef GSA
21 #ifdef GSA
22 #else
22 #else
23 waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER;
23 waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER;
24 #endif
24 #endif
25 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
25 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
26
26
27 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes
27 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes
28 volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
28 volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
29 //
29 //
30 volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
30 volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
31 volatile int wf_snap_f1_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
31 volatile int wf_snap_f1_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
32 volatile int wf_snap_f1_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
32 volatile int wf_snap_f1_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
33 //
33 //
34 volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
34 volatile int wf_snap_f2[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
35 volatile int wf_snap_f2_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
35 volatile int wf_snap_f2_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
36 volatile int wf_snap_f2_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
36 volatile int wf_snap_f2_norm[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
37 //
37 //
38 volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
38 volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
39 volatile int wf_cont_f3_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET];
39 volatile int wf_cont_f3_bis[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET ];
40 char wf_cont_f3_light[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_CWF3_LIGHT_BLK ];
40
41
41 // SPECTRAL MATRICES GLOBAL VARIABLES
42 // SPECTRAL MATRICES GLOBAL VARIABLES
42 volatile int spec_mat_f0_0[ SM_HEADER + TOTAL_SIZE_SM ];
43 volatile int spec_mat_f0_0[ SM_HEADER + TOTAL_SIZE_SM ];
43 volatile int spec_mat_f0_1[ SM_HEADER + TOTAL_SIZE_SM ];
44 volatile int spec_mat_f0_1[ SM_HEADER + TOTAL_SIZE_SM ];
44 volatile int spec_mat_f0_a[ SM_HEADER + TOTAL_SIZE_SM ];
45 volatile int spec_mat_f0_a[ SM_HEADER + TOTAL_SIZE_SM ];
45 volatile int spec_mat_f0_b[ SM_HEADER + TOTAL_SIZE_SM ];
46 volatile int spec_mat_f0_b[ SM_HEADER + TOTAL_SIZE_SM ];
46 volatile int spec_mat_f0_c[ SM_HEADER + TOTAL_SIZE_SM ];
47 volatile int spec_mat_f0_c[ SM_HEADER + TOTAL_SIZE_SM ];
47 volatile int spec_mat_f0_d[ SM_HEADER + TOTAL_SIZE_SM ];
48 volatile int spec_mat_f0_d[ SM_HEADER + TOTAL_SIZE_SM ];
48 volatile int spec_mat_f0_e[ SM_HEADER + TOTAL_SIZE_SM ];
49 volatile int spec_mat_f0_e[ SM_HEADER + TOTAL_SIZE_SM ];
49 volatile int spec_mat_f0_f[ SM_HEADER + TOTAL_SIZE_SM ];
50 volatile int spec_mat_f0_f[ SM_HEADER + TOTAL_SIZE_SM ];
50 volatile int spec_mat_f0_g[ SM_HEADER + TOTAL_SIZE_SM ];
51 volatile int spec_mat_f0_g[ SM_HEADER + TOTAL_SIZE_SM ];
51 volatile int spec_mat_f0_h[ SM_HEADER + TOTAL_SIZE_SM ];
52 volatile int spec_mat_f0_h[ SM_HEADER + TOTAL_SIZE_SM ];
52 volatile int spec_mat_f0_0_bis[ SM_HEADER + TOTAL_SIZE_SM ];
53 volatile int spec_mat_f0_0_bis[ SM_HEADER + TOTAL_SIZE_SM ];
53 volatile int spec_mat_f0_1_bis[ SM_HEADER + TOTAL_SIZE_SM ];
54 volatile int spec_mat_f0_1_bis[ SM_HEADER + TOTAL_SIZE_SM ];
54 //
55 //
55 volatile int spec_mat_f1[ SM_HEADER + TOTAL_SIZE_SM ];
56 volatile int spec_mat_f1[ SM_HEADER + TOTAL_SIZE_SM ];
56 volatile int spec_mat_f1_bis[ SM_HEADER + TOTAL_SIZE_SM ];
57 volatile int spec_mat_f1_bis[ SM_HEADER + TOTAL_SIZE_SM ];
57 //
58 //
58 volatile int spec_mat_f2[ SM_HEADER + TOTAL_SIZE_SM ];
59 volatile int spec_mat_f2[ SM_HEADER + TOTAL_SIZE_SM ];
59 volatile int spec_mat_f2_bis[ SM_HEADER + TOTAL_SIZE_SM ];
60 volatile int spec_mat_f2_bis[ SM_HEADER + TOTAL_SIZE_SM ];
60
61
61 // MODE PARAMETERS
62 // MODE PARAMETERS
62 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
63 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
63 struct param_local_str param_local;
64 struct param_local_str param_local;
64
65
65 // HK PACKETS
66 // HK PACKETS
66 Packet_TM_LFR_HK_t housekeeping_packet;
67 Packet_TM_LFR_HK_t housekeeping_packet;
67 // sequence counters are incremented by APID (PID + CAT) and destination ID
68 // sequence counters are incremented by APID (PID + CAT) and destination ID
68 unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID];
69 unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID];
69 spw_stats spacewire_stats;
70 spw_stats spacewire_stats;
70 spw_stats spacewire_stats_backup;
71 spw_stats spacewire_stats_backup;
71
72
72
73
@@ -1,1470 +1,1472
1 #include <tc_handler.h>
1 #include <tc_handler.h>
2 #include <fsw_params.h>
2 #include <fsw_params.h>
3
3
4 char *DumbMessages[6] = {"in DUMB *** default", // RTEMS_EVENT_0
4 char *DumbMessages[6] = {"in DUMB *** default", // RTEMS_EVENT_0
5 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
5 "in DUMB *** timecode_irq_handler", // RTEMS_EVENT_1
6 "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
6 "in DUMB *** waveforms_isr", // RTEMS_EVENT_2
7 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
7 "in DUMB *** in SMIQ *** Error sending event to AVF0", // RTEMS_EVENT_3
8 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
8 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ", // RTEMS_EVENT_4
9 "in DUMB *** waveforms_simulator_isr" // RTEMS_EVENT_5
9 "in DUMB *** waveforms_simulator_isr" // RTEMS_EVENT_5
10 };
10 };
11
11
12 unsigned char currentTC_LEN_RCV[2]; // SHALL be equal to the current TC packet estimated packet length field
12 unsigned char currentTC_LEN_RCV[2]; // SHALL be equal to the current TC packet estimated packet length field
13 unsigned char currentTC_COMPUTED_CRC[2];
13 unsigned char currentTC_COMPUTED_CRC[2];
14 unsigned int currentTC_LEN_RCV_AsUnsignedInt;
14 unsigned int currentTC_LEN_RCV_AsUnsignedInt;
15 unsigned int currentTM_length;
15 unsigned int currentTM_length;
16 unsigned char currentTC_processedFlag;
16 unsigned char currentTC_processedFlag;
17
17
18 unsigned int lookUpTableForCRC[256];
18 unsigned int lookUpTableForCRC[256];
19
19
20 //**********************
20 //**********************
21 // GENERAL USE FUNCTIONS
21 // GENERAL USE FUNCTIONS
22 unsigned int Crc_opt( unsigned char D, unsigned int Chk)
22 unsigned int Crc_opt( unsigned char D, unsigned int Chk)
23 {
23 {
24 return(((Chk << 8) & 0xff00)^lookUpTableForCRC [(((Chk >> 8)^D) & 0x00ff)]);
24 return(((Chk << 8) & 0xff00)^lookUpTableForCRC [(((Chk >> 8)^D) & 0x00ff)]);
25 }
25 }
26
26
27 void initLookUpTableForCRC( void )
27 void initLookUpTableForCRC( void )
28 {
28 {
29 unsigned int i;
29 unsigned int i;
30 unsigned int tmp;
30 unsigned int tmp;
31
31
32 for (i=0; i<256; i++)
32 for (i=0; i<256; i++)
33 {
33 {
34 tmp = 0;
34 tmp = 0;
35 if((i & 1) != 0) {
35 if((i & 1) != 0) {
36 tmp = tmp ^ 0x1021;
36 tmp = tmp ^ 0x1021;
37 }
37 }
38 if((i & 2) != 0) {
38 if((i & 2) != 0) {
39 tmp = tmp ^ 0x2042;
39 tmp = tmp ^ 0x2042;
40 }
40 }
41 if((i & 4) != 0) {
41 if((i & 4) != 0) {
42 tmp = tmp ^ 0x4084;
42 tmp = tmp ^ 0x4084;
43 }
43 }
44 if((i & 8) != 0) {
44 if((i & 8) != 0) {
45 tmp = tmp ^ 0x8108;
45 tmp = tmp ^ 0x8108;
46 }
46 }
47 if((i & 16) != 0) {
47 if((i & 16) != 0) {
48 tmp = tmp ^ 0x1231;
48 tmp = tmp ^ 0x1231;
49 }
49 }
50 if((i & 32) != 0) {
50 if((i & 32) != 0) {
51 tmp = tmp ^ 0x2462;
51 tmp = tmp ^ 0x2462;
52 }
52 }
53 if((i & 64) != 0) {
53 if((i & 64) != 0) {
54 tmp = tmp ^ 0x48c4;
54 tmp = tmp ^ 0x48c4;
55 }
55 }
56 if((i & 128) != 0) {
56 if((i & 128) != 0) {
57 tmp = tmp ^ 0x9188;
57 tmp = tmp ^ 0x9188;
58 }
58 }
59 lookUpTableForCRC[i] = tmp;
59 lookUpTableForCRC[i] = tmp;
60 }
60 }
61 }
61 }
62
62
63 void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData)
63 void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData)
64 {
64 {
65 unsigned int Chk;
65 unsigned int Chk;
66 int j;
66 int j;
67 Chk = 0xffff; // reset the syndrom to all ones
67 Chk = 0xffff; // reset the syndrom to all ones
68 for (j=0; j<sizeOfData; j++) {
68 for (j=0; j<sizeOfData; j++) {
69 Chk = Crc_opt(data[j], Chk);
69 Chk = Crc_opt(data[j], Chk);
70 }
70 }
71 crcAsTwoBytes[0] = (unsigned char) (Chk >> 8);
71 crcAsTwoBytes[0] = (unsigned char) (Chk >> 8);
72 crcAsTwoBytes[1] = (unsigned char) (Chk & 0x00ff);
72 crcAsTwoBytes[1] = (unsigned char) (Chk & 0x00ff);
73 }
73 }
74
74
75 void updateLFRCurrentMode()
75 void updateLFRCurrentMode()
76 {
76 {
77 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
77 lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
78 }
78 }
79
79
80 //*********************
80 //*********************
81 // ACCEPTANCE FUNCTIONS
81 // ACCEPTANCE FUNCTIONS
82 int TC_acceptance(ccsdsTelecommandPacket_t *TC, unsigned int tc_len_recv, rtems_id queue_id)
82 int TC_acceptance(ccsdsTelecommandPacket_t *TC, unsigned int tc_len_recv, rtems_id queue_id)
83 {
83 {
84 int ret = 0;
84 int ret = 0;
85 rtems_status_code status;
85 rtems_status_code status;
86 Packet_TM_LFR_TC_EXE_CORRUPTED_t packet;
86 Packet_TM_LFR_TC_EXE_CORRUPTED_t packet;
87 unsigned int parserCode = 0;
87 unsigned int parserCode = 0;
88 unsigned char computed_CRC[2];
88 unsigned char computed_CRC[2];
89 unsigned int packetLength;
89 unsigned int packetLength;
90
90
91 GetCRCAsTwoBytes( (unsigned char*) TC->packetID, computed_CRC, tc_len_recv + 5 );
91 GetCRCAsTwoBytes( (unsigned char*) TC->packetID, computed_CRC, tc_len_recv + 5 );
92 parserCode = TC_parser( TC, tc_len_recv ) ;
92 parserCode = TC_parser( TC, tc_len_recv ) ;
93 if ( (parserCode == ILLEGAL_APID) | (parserCode == WRONG_LEN_PACKET) | (parserCode == INCOR_CHECKSUM)
93 if ( (parserCode == ILLEGAL_APID) | (parserCode == WRONG_LEN_PACKET) | (parserCode == INCOR_CHECKSUM)
94 | (parserCode == ILL_TYPE) | (parserCode == ILL_SUBTYPE) | (parserCode == WRONG_APP_DATA) )
94 | (parserCode == ILL_TYPE) | (parserCode == ILL_SUBTYPE) | (parserCode == WRONG_APP_DATA) )
95 { // generate TM_LFR_TC_EXE_CORRUPTED
95 { // generate TM_LFR_TC_EXE_CORRUPTED
96 packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1];
96 packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1];
97 packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
97 packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
98 packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
98 packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
99 packet.reserved = DEFAULT_RESERVED;
99 packet.reserved = DEFAULT_RESERVED;
100 packet.userApplication = CCSDS_USER_APP;
100 packet.userApplication = CCSDS_USER_APP;
101 // PACKET HEADER
101 // PACKET HEADER
102 packet.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
102 packet.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
103 packet.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
103 packet.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
104 packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
104 packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
105 packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
105 packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
106 packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8);
106 packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8);
107 packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED );
107 packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED );
108 // DATA FIELD HEADER
108 // DATA FIELD HEADER
109 packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
109 packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
110 packet.serviceType = TM_TYPE_TC_EXE;
110 packet.serviceType = TM_TYPE_TC_EXE;
111 packet.serviceSubType = TM_SUBTYPE_EXE_NOK;
111 packet.serviceSubType = TM_SUBTYPE_EXE_NOK;
112 packet.destinationID = TM_DESTINATION_ID_GROUND;
112 packet.destinationID = TM_DESTINATION_ID_GROUND;
113 packet.time[0] = (time_management_regs->coarse_time>>24 );
113 packet.time[0] = (time_management_regs->coarse_time>>24 );
114 packet.time[1] = (time_management_regs->coarse_time>>16 );
114 packet.time[1] = (time_management_regs->coarse_time>>16 );
115 packet.time[2] = (time_management_regs->coarse_time>>8 );
115 packet.time[2] = (time_management_regs->coarse_time>>8 );
116 packet.time[3] = (time_management_regs->coarse_time );
116 packet.time[3] = (time_management_regs->coarse_time );
117 packet.time[4] = (time_management_regs->fine_time>>8 );
117 packet.time[4] = (time_management_regs->fine_time>>8 );
118 packet.time[5] = (time_management_regs->fine_time );
118 packet.time[5] = (time_management_regs->fine_time );
119 //
119 //
120 packet.tc_failure_code[0] = (unsigned char) (FAILURE_CODE_CORRUPTED >> 8);
120 packet.tc_failure_code[0] = (unsigned char) (FAILURE_CODE_CORRUPTED >> 8);
121 packet.tc_failure_code[1] = (unsigned char) (FAILURE_CODE_CORRUPTED );
121 packet.tc_failure_code[1] = (unsigned char) (FAILURE_CODE_CORRUPTED );
122 packet.telecommand_pkt_id[0] = TC->packetID[0];
122 packet.telecommand_pkt_id[0] = TC->packetID[0];
123 packet.telecommand_pkt_id[1] = TC->packetID[1];
123 packet.telecommand_pkt_id[1] = TC->packetID[1];
124 packet.pkt_seq_control[0] = TC->packetSequenceControl[0];
124 packet.pkt_seq_control[0] = TC->packetSequenceControl[0];
125 packet.pkt_seq_control[0] = TC->packetSequenceControl[1];
125 packet.pkt_seq_control[0] = TC->packetSequenceControl[1];
126 packet.tc_service = TC->serviceType;
126 packet.tc_service = TC->serviceType;
127 packet.tc_subtype = TC->serviceSubType;
127 packet.tc_subtype = TC->serviceSubType;
128 packet.pkt_len_rcv_value[0] = TC->packetLength[0];
128 packet.pkt_len_rcv_value[0] = TC->packetLength[0];
129 packet.pkt_len_rcv_value[1] = TC->packetLength[1];
129 packet.pkt_len_rcv_value[1] = TC->packetLength[1];
130 packet.pkt_datafieldsize_cnt[0] = currentTC_LEN_RCV[0];
130 packet.pkt_datafieldsize_cnt[0] = currentTC_LEN_RCV[0];
131 packet.pkt_datafieldsize_cnt[1] = currentTC_LEN_RCV[1];
131 packet.pkt_datafieldsize_cnt[1] = currentTC_LEN_RCV[1];
132 packet.rcv_crc[0] = TC->dataAndCRC[packetLength];
132 packet.rcv_crc[0] = TC->dataAndCRC[packetLength];
133 packet.rcv_crc[1] = TC->dataAndCRC[packetLength];
133 packet.rcv_crc[1] = TC->dataAndCRC[packetLength];
134 packet.computed_crc[0] = computed_CRC[0];
134 packet.computed_crc[0] = computed_CRC[0];
135 packet.computed_crc[1] = computed_CRC[1];
135 packet.computed_crc[1] = computed_CRC[1];
136 // SEND PACKET
136 // SEND PACKET
137 status = write( fdSPW, (char *) &packet, PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + 4);
137 status = write( fdSPW, (char *) &packet, PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + 4);
138 }
138 }
139 else { // send valid TC to the action launcher
139 else { // send valid TC to the action launcher
140 status = rtems_message_queue_send( queue_id, TC, tc_len_recv + CCSDS_TC_TM_PACKET_OFFSET + 3);
140 status = rtems_message_queue_send( queue_id, TC, tc_len_recv + CCSDS_TC_TM_PACKET_OFFSET + 3);
141 ret = -1;
141 ret = -1;
142 }
142 }
143 return ret;
143 return ret;
144 }
144 }
145
145
146 unsigned char TC_parser(ccsdsTelecommandPacket_t * TMPacket, unsigned int TC_LEN_RCV)
146 unsigned char TC_parser(ccsdsTelecommandPacket_t * TMPacket, unsigned int TC_LEN_RCV)
147 {
147 {
148 unsigned char ret = 0;
148 unsigned char ret = 0;
149 unsigned char pid = 0;
149 unsigned char pid = 0;
150 unsigned char category = 0;
150 unsigned char category = 0;
151 unsigned int length = 0;
151 unsigned int length = 0;
152 unsigned char packetType = 0;
152 unsigned char packetType = 0;
153 unsigned char packetSubtype = 0;
153 unsigned char packetSubtype = 0;
154 unsigned char * CCSDSContent = NULL;
154 unsigned char * CCSDSContent = NULL;
155
155
156 // APID check *** APID on 2 bytes
156 // APID check *** APID on 2 bytes
157 pid = ((TMPacket->packetID[0] & 0x07)<<4) + ( (TMPacket->packetID[1]>>4) & 0x0f ); // PID = 11 *** 7 bits xxxxx210 7654xxxx
157 pid = ((TMPacket->packetID[0] & 0x07)<<4) + ( (TMPacket->packetID[1]>>4) & 0x0f ); // PID = 11 *** 7 bits xxxxx210 7654xxxx
158 category = (TMPacket->packetID[1] & 0x0f); // PACKET_CATEGORY = 12 *** 4 bits xxxxxxxx xxxx3210
158 category = (TMPacket->packetID[1] & 0x0f); // PACKET_CATEGORY = 12 *** 4 bits xxxxxxxx xxxx3210
159 length = (TMPacket->packetLength[0] * 256) + TMPacket->packetLength[1];
159 length = (TMPacket->packetLength[0] * 256) + TMPacket->packetLength[1];
160 packetType = TMPacket->serviceType;
160 packetType = TMPacket->serviceType;
161 packetSubtype = TMPacket->serviceSubType;
161 packetSubtype = TMPacket->serviceSubType;
162
162
163 if ( pid != CCSDS_PROCESS_ID ) {
163 if ( pid != CCSDS_PROCESS_ID ) {
164 ret = ILLEGAL_APID;
164 ret = ILLEGAL_APID;
165 }
165 }
166 else if ( category != CCSDS_PACKET_CATEGORY ) {
166 else if ( category != CCSDS_PACKET_CATEGORY ) {
167 ret = ILLEGAL_APID;
167 ret = ILLEGAL_APID;
168 }
168 }
169 else if (length != TC_LEN_RCV ) { // packet length check
169 else if (length != TC_LEN_RCV ) { // packet length check
170 ret = WRONG_LEN_PACKET; // LEN RCV != SIZE FIELD
170 ret = WRONG_LEN_PACKET; // LEN RCV != SIZE FIELD
171 }
171 }
172 else if ( length >= CCSDS_TC_PKT_MAX_SIZE ) {
172 else if ( length >= CCSDS_TC_PKT_MAX_SIZE ) {
173 ret = WRONG_LEN_PACKET; // check that the packet does not exceed the MAX size
173 ret = WRONG_LEN_PACKET; // check that the packet does not exceed the MAX size
174 }
174 }
175 else if ( packetType == TC_TYPE_GEN ){ // service type, subtype and packet length check
175 else if ( packetType == TC_TYPE_GEN ){ // service type, subtype and packet length check
176 switch(packetSubtype){ //subtype, autorized values are 3, 20, 21, 24, 27, 28, 30, 40, 50, 60, 61
176 switch(packetSubtype){ //subtype, autorized values are 3, 20, 21, 24, 27, 28, 30, 40, 50, 60, 61
177 case TC_SUBTYPE_RESET:
177 case TC_SUBTYPE_RESET:
178 if (length!=(TC_LEN_RESET-CCSDS_TC_TM_PACKET_OFFSET)) {
178 if (length!=(TC_LEN_RESET-CCSDS_TC_TM_PACKET_OFFSET)) {
179 ret = WRONG_LEN_PACKET;
179 ret = WRONG_LEN_PACKET;
180 }
180 }
181 else {
181 else {
182 ret = CCSDS_TM_VALID;
182 ret = CCSDS_TM_VALID;
183 }
183 }
184 break;
184 break;
185 case TC_SUBTYPE_LOAD_COMM:
185 case TC_SUBTYPE_LOAD_COMM:
186 if (length!=(TC_LEN_LOAD_COMM-CCSDS_TC_TM_PACKET_OFFSET)) {
186 if (length!=(TC_LEN_LOAD_COMM-CCSDS_TC_TM_PACKET_OFFSET)) {
187 ret = WRONG_LEN_PACKET;
187 ret = WRONG_LEN_PACKET;
188 }
188 }
189 else {
189 else {
190 ret = CCSDS_TM_VALID;
190 ret = CCSDS_TM_VALID;
191 }
191 }
192 break;
192 break;
193 case TC_SUBTYPE_LOAD_NORM:
193 case TC_SUBTYPE_LOAD_NORM:
194 if (length!=(TC_LEN_LOAD_NORM-CCSDS_TC_TM_PACKET_OFFSET)) {
194 if (length!=(TC_LEN_LOAD_NORM-CCSDS_TC_TM_PACKET_OFFSET)) {
195 ret = WRONG_LEN_PACKET;
195 ret = WRONG_LEN_PACKET;
196 }
196 }
197 else {
197 else {
198 ret = CCSDS_TM_VALID;
198 ret = CCSDS_TM_VALID;
199 }
199 }
200 break;
200 break;
201 case TC_SUBTYPE_LOAD_BURST:
201 case TC_SUBTYPE_LOAD_BURST:
202 if (length!=(TC_LEN_LOAD_BURST-CCSDS_TC_TM_PACKET_OFFSET)) {
202 if (length!=(TC_LEN_LOAD_BURST-CCSDS_TC_TM_PACKET_OFFSET)) {
203 ret = WRONG_LEN_PACKET;
203 ret = WRONG_LEN_PACKET;
204 }
204 }
205 else {
205 else {
206 ret = CCSDS_TM_VALID;
206 ret = CCSDS_TM_VALID;
207 }
207 }
208 break;
208 break;
209 case TC_SUBTYPE_LOAD_SBM1:
209 case TC_SUBTYPE_LOAD_SBM1:
210 if (length!=(TC_LEN_LOAD_SBM1-CCSDS_TC_TM_PACKET_OFFSET)) {
210 if (length!=(TC_LEN_LOAD_SBM1-CCSDS_TC_TM_PACKET_OFFSET)) {
211 ret = WRONG_LEN_PACKET;
211 ret = WRONG_LEN_PACKET;
212 }
212 }
213 else {
213 else {
214 ret = CCSDS_TM_VALID;
214 ret = CCSDS_TM_VALID;
215 }
215 }
216 break;
216 break;
217 case TC_SUBTYPE_LOAD_SBM2:
217 case TC_SUBTYPE_LOAD_SBM2:
218 if (length!=(TC_LEN_LOAD_SBM2-CCSDS_TC_TM_PACKET_OFFSET)) {
218 if (length!=(TC_LEN_LOAD_SBM2-CCSDS_TC_TM_PACKET_OFFSET)) {
219 ret = WRONG_LEN_PACKET;
219 ret = WRONG_LEN_PACKET;
220 }
220 }
221 else {
221 else {
222 ret = CCSDS_TM_VALID;
222 ret = CCSDS_TM_VALID;
223 }
223 }
224 break;
224 break;
225 case TC_SUBTYPE_DUMP:
225 case TC_SUBTYPE_DUMP:
226 if (length!=(TC_LEN_DUMP-CCSDS_TC_TM_PACKET_OFFSET)) {
226 if (length!=(TC_LEN_DUMP-CCSDS_TC_TM_PACKET_OFFSET)) {
227 ret = WRONG_LEN_PACKET;
227 ret = WRONG_LEN_PACKET;
228 }
228 }
229 else {
229 else {
230 ret = CCSDS_TM_VALID;
230 ret = CCSDS_TM_VALID;
231 }
231 }
232 break;
232 break;
233 case TC_SUBTYPE_ENTER:
233 case TC_SUBTYPE_ENTER:
234 if (length!=(TC_LEN_ENTER-CCSDS_TC_TM_PACKET_OFFSET)) {
234 if (length!=(TC_LEN_ENTER-CCSDS_TC_TM_PACKET_OFFSET)) {
235 ret = WRONG_LEN_PACKET;
235 ret = WRONG_LEN_PACKET;
236 }
236 }
237 else {
237 else {
238 ret = CCSDS_TM_VALID;
238 ret = CCSDS_TM_VALID;
239 }
239 }
240 break;
240 break;
241 case TC_SUBTYPE_UPDT_INFO:
241 case TC_SUBTYPE_UPDT_INFO:
242 if (length!=(TC_LEN_UPDT_INFO-CCSDS_TC_TM_PACKET_OFFSET)) {
242 if (length!=(TC_LEN_UPDT_INFO-CCSDS_TC_TM_PACKET_OFFSET)) {
243 ret = WRONG_LEN_PACKET;
243 ret = WRONG_LEN_PACKET;
244 }
244 }
245 else {
245 else {
246 ret = CCSDS_TM_VALID;
246 ret = CCSDS_TM_VALID;
247 }
247 }
248 break;
248 break;
249 case TC_SUBTYPE_EN_CAL:
249 case TC_SUBTYPE_EN_CAL:
250 if (length!=(TC_LEN_EN_CAL-CCSDS_TC_TM_PACKET_OFFSET)) {
250 if (length!=(TC_LEN_EN_CAL-CCSDS_TC_TM_PACKET_OFFSET)) {
251 ret = WRONG_LEN_PACKET;
251 ret = WRONG_LEN_PACKET;
252 }
252 }
253 else {
253 else {
254 ret = CCSDS_TM_VALID;
254 ret = CCSDS_TM_VALID;
255 }
255 }
256 break;
256 break;
257 case TC_SUBTYPE_DIS_CAL:
257 case TC_SUBTYPE_DIS_CAL:
258 if (length!=(TC_LEN_DIS_CAL-CCSDS_TC_TM_PACKET_OFFSET)) {
258 if (length!=(TC_LEN_DIS_CAL-CCSDS_TC_TM_PACKET_OFFSET)) {
259 ret = WRONG_LEN_PACKET;
259 ret = WRONG_LEN_PACKET;
260 }
260 }
261 else {
261 else {
262 ret = CCSDS_TM_VALID;
262 ret = CCSDS_TM_VALID;
263 }
263 }
264 break;
264 break;
265 default:
265 default:
266 ret = ILL_SUBTYPE;
266 ret = ILL_SUBTYPE;
267 break;
267 break;
268 }
268 }
269 }
269 }
270 else if ( packetType == TC_TYPE_TIME ){
270 else if ( packetType == TC_TYPE_TIME ){
271 if (packetSubtype!=TC_SUBTYPE_UPDT_TIME) {
271 if (packetSubtype!=TC_SUBTYPE_UPDT_TIME) {
272 ret = ILL_SUBTYPE;
272 ret = ILL_SUBTYPE;
273 }
273 }
274 else if (length!=(TC_LEN_UPDT_TIME-CCSDS_TC_TM_PACKET_OFFSET)) {
274 else if (length!=(TC_LEN_UPDT_TIME-CCSDS_TC_TM_PACKET_OFFSET)) {
275 ret = WRONG_LEN_PACKET;
275 ret = WRONG_LEN_PACKET;
276 }
276 }
277 else {
277 else {
278 ret = CCSDS_TM_VALID;
278 ret = CCSDS_TM_VALID;
279 }
279 }
280 }
280 }
281 else {
281 else {
282 ret = ILL_TYPE;
282 ret = ILL_TYPE;
283 }
283 }
284
284
285 // source ID check // Source ID not documented in the ICD
285 // source ID check // Source ID not documented in the ICD
286
286
287 // packet error control, CRC check
287 // packet error control, CRC check
288 if ( ret == CCSDS_TM_VALID ) {
288 if ( ret == CCSDS_TM_VALID ) {
289 CCSDSContent = (unsigned char*) TMPacket->packetID;
289 CCSDSContent = (unsigned char*) TMPacket->packetID;
290 GetCRCAsTwoBytes(CCSDSContent, currentTC_COMPUTED_CRC, length + CCSDS_TC_TM_PACKET_OFFSET - 2); // 2 CRC bytes removed from the calculation of the CRC
290 GetCRCAsTwoBytes(CCSDSContent, currentTC_COMPUTED_CRC, length + CCSDS_TC_TM_PACKET_OFFSET - 2); // 2 CRC bytes removed from the calculation of the CRC
291 if (currentTC_COMPUTED_CRC[0] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -2]) {
291 if (currentTC_COMPUTED_CRC[0] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -2]) {
292 ret = INCOR_CHECKSUM;
292 ret = INCOR_CHECKSUM;
293 }
293 }
294 else if (currentTC_COMPUTED_CRC[1] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -1]) {
294 else if (currentTC_COMPUTED_CRC[1] != CCSDSContent[length + CCSDS_TC_TM_PACKET_OFFSET -1]) {
295 ret = INCOR_CHECKSUM;
295 ret = INCOR_CHECKSUM;
296 }
296 }
297 else {
297 else {
298 ret = CCSDS_TM_VALID;
298 ret = CCSDS_TM_VALID;
299 }
299 }
300 }
300 }
301
301
302 return ret;
302 return ret;
303 }
303 }
304
304
305 //***********
305 //***********
306 // RTEMS TASK
306 // RTEMS TASK
307 rtems_task recv_task( rtems_task_argument unused )
307 rtems_task recv_task( rtems_task_argument unused )
308 {
308 {
309 int len = 0;
309 int len = 0;
310 unsigned int i = 0;
310 unsigned int i = 0;
311 unsigned int data_length = 0;
311 unsigned int data_length = 0;
312 ccsdsTelecommandPacket_t currentTC;
312 ccsdsTelecommandPacket_t currentTC;
313 char data[100];
313 char data[100];
314 rtems_status_code status;
314 rtems_status_code status;
315 rtems_id queue_id;
315 rtems_id queue_id;
316
316
317 for(i=0; i<100; i++) data[i] = 0;
317 for(i=0; i<100; i++) data[i] = 0;
318
318
319 status = rtems_message_queue_ident( misc_name[QUEUE_QUEU], 0, &queue_id );
319 status = rtems_message_queue_ident( misc_name[QUEUE_QUEU], 0, &queue_id );
320 if (status != RTEMS_SUCCESSFUL)
320 if (status != RTEMS_SUCCESSFUL)
321 {
321 {
322 PRINTF1("in RECV *** ERR getting queue id, %d\n", status)
322 PRINTF1("in RECV *** ERR getting queue id, %d\n", status)
323 }
323 }
324
324
325 BOOT_PRINTF("in RECV *** \n")
325 BOOT_PRINTF("in RECV *** \n")
326
326
327 while(1)
327 while(1)
328 {
328 {
329 len = read(fdSPW, (char*) &currentTC, CCSDS_TC_PKT_MAX_SIZE); // the call to read is blocking
329 len = read(fdSPW, (char*) &currentTC, CCSDS_TC_PKT_MAX_SIZE); // the call to read is blocking
330 if (len == -1){ // error during the read call
330 if (len == -1){ // error during the read call
331 PRINTF("In RECV *** last read call returned -1\n")
331 PRINTF("In RECV *** last read call returned -1\n")
332 //if (rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ) != RTEMS_SUCCESSFUL) {
332 //if (rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ) != RTEMS_SUCCESSFUL) {
333 // PRINTF("IN RECV *** Error: rtems_event_send SPW_LINKERR_EVENT\n")
333 // PRINTF("IN RECV *** Error: rtems_event_send SPW_LINKERR_EVENT\n")
334 //}
334 //}
335 //if (rtems_task_suspend(RTEMS_SELF) != RTEMS_SUCCESSFUL) {
335 //if (rtems_task_suspend(RTEMS_SELF) != RTEMS_SUCCESSFUL) {
336 // PRINTF("In RECV *** Error: rtems_task_suspend(RTEMS_SELF)\n")
336 // PRINTF("In RECV *** Error: rtems_task_suspend(RTEMS_SELF)\n")
337 //}
337 //}
338 }
338 }
339 else {
339 else {
340 if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) {
340 if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) {
341 PRINTF("In RECV *** packet lenght too short\n")
341 PRINTF("In RECV *** packet lenght too short\n")
342 }
342 }
343 else {
343 else {
344 currentTC_LEN_RCV[0] = 0x00;
344 currentTC_LEN_RCV[0] = 0x00;
345 currentTC_LEN_RCV[1] = (unsigned char) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // build the corresponding packet size field
345 currentTC_LEN_RCV[1] = (unsigned char) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // build the corresponding packet size field
346 currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes
346 currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes
347 // CHECK THE TC AND BUILD THE APPROPRIATE TM
347 // CHECK THE TC AND BUILD THE APPROPRIATE TM
348 data_length = TC_acceptance(&currentTC, currentTC_LEN_RCV_AsUnsignedInt, queue_id);
348 data_length = TC_acceptance(&currentTC, currentTC_LEN_RCV_AsUnsignedInt, queue_id);
349 if (data_length!=-1)
349 if (data_length!=-1)
350 {
350 {
351 }
351 }
352 }
352 }
353 }
353 }
354 }
354 }
355 }
355 }
356
356
357 rtems_task actn_task( rtems_task_argument unused )
357 rtems_task actn_task( rtems_task_argument unused )
358 {
358 {
359 int result;
359 int result;
360 rtems_status_code status; // RTEMS status code
360 rtems_status_code status; // RTEMS status code
361 ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task
361 ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task
362 size_t size; // size of the incoming TC packet
362 size_t size; // size of the incoming TC packet
363 unsigned char subtype; // subtype of the current TC packet
363 unsigned char subtype; // subtype of the current TC packet
364 rtems_id queue_rcv_id;
364 rtems_id queue_rcv_id;
365 rtems_id queue_snd_id;
365 rtems_id queue_snd_id;
366
366
367 status = rtems_message_queue_ident( misc_name[QUEUE_QUEU], 0, &queue_rcv_id );
367 status = rtems_message_queue_ident( misc_name[QUEUE_QUEU], 0, &queue_rcv_id );
368 if (status != RTEMS_SUCCESSFUL)
368 if (status != RTEMS_SUCCESSFUL)
369 {
369 {
370 PRINTF1("in ACTN *** ERR getting queue_rcv_id %d\n", status)
370 PRINTF1("in ACTN *** ERR getting queue_rcv_id %d\n", status)
371 }
371 }
372
372
373 status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_snd_id );
373 status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_snd_id );
374 if (status != RTEMS_SUCCESSFUL)
374 if (status != RTEMS_SUCCESSFUL)
375 {
375 {
376 PRINTF1("in ACTN *** ERR getting queue_snd_id %d\n", status)
376 PRINTF1("in ACTN *** ERR getting queue_snd_id %d\n", status)
377 }
377 }
378
378
379 result = LFR_SUCCESSFUL;
379 result = LFR_SUCCESSFUL;
380 subtype = 0; // subtype of the current TC packet
380 subtype = 0; // subtype of the current TC packet
381
381
382 BOOT_PRINTF("in ACTN *** \n")
382 BOOT_PRINTF("in ACTN *** \n")
383
383
384 while(1)
384 while(1)
385 {
385 {
386 status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
386 status = rtems_message_queue_receive( queue_rcv_id, (char*) &TC, &size,
387 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
387 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
388 if (status!=RTEMS_SUCCESSFUL) PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
388 if (status!=RTEMS_SUCCESSFUL) PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
389 else
389 else
390 {
390 {
391 subtype = TC.serviceSubType;
391 subtype = TC.serviceSubType;
392 switch(subtype)
392 switch(subtype)
393 {
393 {
394 case TC_SUBTYPE_RESET:
394 case TC_SUBTYPE_RESET:
395 result = action_reset( &TC, queue_snd_id );
395 result = action_reset( &TC, queue_snd_id );
396 close_action( &TC, result, queue_snd_id );
396 close_action( &TC, result, queue_snd_id );
397 break;
397 break;
398 //
398 //
399 case TC_SUBTYPE_LOAD_COMM:
399 case TC_SUBTYPE_LOAD_COMM:
400 result = action_load_common_par( &TC );
400 result = action_load_common_par( &TC );
401 close_action( &TC, result, queue_snd_id );
401 close_action( &TC, result, queue_snd_id );
402 break;
402 break;
403 //
403 //
404 case TC_SUBTYPE_LOAD_NORM:
404 case TC_SUBTYPE_LOAD_NORM:
405 result = action_load_normal_par( &TC, queue_snd_id );
405 result = action_load_normal_par( &TC, queue_snd_id );
406 close_action( &TC, result, queue_snd_id );
406 close_action( &TC, result, queue_snd_id );
407 break;
407 break;
408 //
408 //
409 case TC_SUBTYPE_LOAD_BURST:
409 case TC_SUBTYPE_LOAD_BURST:
410 result = action_load_burst_par( &TC, queue_snd_id );
410 result = action_load_burst_par( &TC, queue_snd_id );
411 close_action( &TC, result, queue_snd_id );
411 close_action( &TC, result, queue_snd_id );
412 break;
412 break;
413 //
413 //
414 case TC_SUBTYPE_LOAD_SBM1:
414 case TC_SUBTYPE_LOAD_SBM1:
415 result = action_load_sbm1_par( &TC, queue_snd_id );
415 result = action_load_sbm1_par( &TC, queue_snd_id );
416 close_action( &TC, result, queue_snd_id );
416 close_action( &TC, result, queue_snd_id );
417 break;
417 break;
418 //
418 //
419 case TC_SUBTYPE_LOAD_SBM2:
419 case TC_SUBTYPE_LOAD_SBM2:
420 result = action_load_sbm2_par( &TC, queue_snd_id );
420 result = action_load_sbm2_par( &TC, queue_snd_id );
421 close_action( &TC, result, queue_snd_id );
421 close_action( &TC, result, queue_snd_id );
422 break;
422 break;
423 //
423 //
424 case TC_SUBTYPE_DUMP:
424 case TC_SUBTYPE_DUMP:
425 result = action_dump_par( &TC );
425 result = action_dump_par( &TC );
426 close_action( &TC, result, queue_snd_id );
426 close_action( &TC, result, queue_snd_id );
427 break;
427 break;
428 //
428 //
429 case TC_SUBTYPE_ENTER:
429 case TC_SUBTYPE_ENTER:
430 result = action_enter_mode( &TC, queue_snd_id );
430 result = action_enter_mode( &TC, queue_snd_id );
431 close_action( &TC, result, queue_snd_id );
431 close_action( &TC, result, queue_snd_id );
432 break;
432 break;
433 //
433 //
434 case TC_SUBTYPE_UPDT_INFO:
434 case TC_SUBTYPE_UPDT_INFO:
435 result = action_update_info( &TC, queue_snd_id );
435 result = action_update_info( &TC, queue_snd_id );
436 close_action( &TC, result, queue_snd_id );
436 close_action( &TC, result, queue_snd_id );
437 break;
437 break;
438 //
438 //
439 case TC_SUBTYPE_EN_CAL:
439 case TC_SUBTYPE_EN_CAL:
440 result = action_enable_calibration( &TC, queue_snd_id );
440 result = action_enable_calibration( &TC, queue_snd_id );
441 close_action( &TC, result, queue_snd_id );
441 close_action( &TC, result, queue_snd_id );
442 break;
442 break;
443 //
443 //
444 case TC_SUBTYPE_DIS_CAL:
444 case TC_SUBTYPE_DIS_CAL:
445 result = action_disable_calibration( &TC, queue_snd_id );
445 result = action_disable_calibration( &TC, queue_snd_id );
446 close_action( &TC, result, queue_snd_id );
446 close_action( &TC, result, queue_snd_id );
447 break;
447 break;
448 //
448 //
449 case TC_SUBTYPE_UPDT_TIME:
449 case TC_SUBTYPE_UPDT_TIME:
450 result = action_update_time( &TC );
450 result = action_update_time( &TC );
451 close_action( &TC, result, queue_snd_id );
451 close_action( &TC, result, queue_snd_id );
452 break;
452 break;
453 //
453 //
454 default:
454 default:
455 break;
455 break;
456 }
456 }
457 }
457 }
458 }
458 }
459 }
459 }
460
460
461 rtems_task dumb_task( rtems_task_argument unused )
461 rtems_task dumb_task( rtems_task_argument unused )
462 {
462 {
463 unsigned int i;
463 unsigned int i;
464 unsigned int intEventOut;
464 unsigned int intEventOut;
465 unsigned int coarse_time = 0;
465 unsigned int coarse_time = 0;
466 unsigned int fine_time = 0;
466 unsigned int fine_time = 0;
467 rtems_event_set event_out;
467 rtems_event_set event_out;
468
468
469 BOOT_PRINTF("in DUMB *** \n")
469 BOOT_PRINTF("in DUMB *** \n")
470
470
471 while(1){
471 while(1){
472 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | RTEMS_EVENT_4 | RTEMS_EVENT_5,
472 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | RTEMS_EVENT_4 | RTEMS_EVENT_5,
473 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
473 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
474 intEventOut = (unsigned int) event_out;
474 intEventOut = (unsigned int) event_out;
475 for ( i=0; i<32; i++)
475 for ( i=0; i<32; i++)
476 {
476 {
477 if ( ((intEventOut >> i) & 0x0001) != 0)
477 if ( ((intEventOut >> i) & 0x0001) != 0)
478 {
478 {
479 coarse_time = time_management_regs->coarse_time;
479 coarse_time = time_management_regs->coarse_time;
480 fine_time = time_management_regs->fine_time;
480 fine_time = time_management_regs->fine_time;
481 printf("in DUMB *** time = coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
481 printf("in DUMB *** time = coarse: %x, fine: %x, %s\n", coarse_time, fine_time, DumbMessages[i]);
482 }
482 }
483 }
483 }
484 }
484 }
485 }
485 }
486
486
487 //***********
487 //***********
488 // TC ACTIONS
488 // TC ACTIONS
489
489
490 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
490 int action_reset(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
491 {
491 {
492 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
492 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
493 return LFR_DEFAULT;
493 return LFR_DEFAULT;
494 }
494 }
495
495
496 int action_load_common_par(ccsdsTelecommandPacket_t *TC)
496 int action_load_common_par(ccsdsTelecommandPacket_t *TC)
497 {
497 {
498 parameter_dump_packet.unused0 = TC->dataAndCRC[0];
498 parameter_dump_packet.unused0 = TC->dataAndCRC[0];
499 parameter_dump_packet.bw_sp0_sp1_r0_r1 = TC->dataAndCRC[1];
499 parameter_dump_packet.bw_sp0_sp1_r0_r1 = TC->dataAndCRC[1];
500
500
501 set_wfp_data_shaping(parameter_dump_packet.bw_sp0_sp1_r0_r1);
501 set_wfp_data_shaping(parameter_dump_packet.bw_sp0_sp1_r0_r1);
502
502
503 return LFR_SUCCESSFUL;
503 return LFR_SUCCESSFUL;
504 }
504 }
505
505
506 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
506 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
507 {
507 {
508 int result;
508 int result;
509 unsigned int tmp;
509 unsigned int tmp;
510
510
511 result = LFR_SUCCESSFUL;
511 result = LFR_SUCCESSFUL;
512
512
513 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
513 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
514 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
514 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
515 result = LFR_DEFAULT;
515 result = LFR_DEFAULT;
516 }
516 }
517 else {
517 else {
518 // sy_lfr_n_swf_l
518 // sy_lfr_n_swf_l
519 parameter_dump_packet.sy_lfr_n_swf_l[0] = TC->dataAndCRC[0];
519 parameter_dump_packet.sy_lfr_n_swf_l[0] = TC->dataAndCRC[0];
520 parameter_dump_packet.sy_lfr_n_swf_l[1] = TC->dataAndCRC[1];
520 parameter_dump_packet.sy_lfr_n_swf_l[1] = TC->dataAndCRC[1];
521
521
522 // sy_lfr_n_swf_p
522 // sy_lfr_n_swf_p
523 tmp = (unsigned int ) floor(
523 tmp = ( unsigned int ) floor(
524 (TC->dataAndCRC[2] * 256
524 (TC->dataAndCRC[2] * 256
525 + TC->dataAndCRC[3])/8
525 + TC->dataAndCRC[3])/8
526 ) * 8;
526 ) * 8;
527 if ( (tmp < 16) || (tmp>65528) )
527 if ( (tmp < 16) || (tmp>65528) )
528 {
528 {
529 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, 12, TC->dataAndCRC[2]);
530 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, 13, TC->dataAndCRC[3]);
529 result = LFR_DEFAULT;
531 result = LFR_DEFAULT;
530 }
532 }
531 else
533 else
532 {
534 {
533 parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8);
535 parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8);
534 parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp );
536 parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp );
535 }
537 }
536
538
537 // sy_lfr_n_asm_p
539 // sy_lfr_n_asm_p
538 parameter_dump_packet.sy_lfr_n_asm_p[0] = TC->dataAndCRC[4];
540 parameter_dump_packet.sy_lfr_n_asm_p[0] = TC->dataAndCRC[4];
539 parameter_dump_packet.sy_lfr_n_asm_p[1] = TC->dataAndCRC[5];
541 parameter_dump_packet.sy_lfr_n_asm_p[1] = TC->dataAndCRC[5];
540
542
541 // sy_lfr_n_bp_p0
543 // sy_lfr_n_bp_p0
542 parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[6];
544 parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[6];
543
545
544 // sy_lfr_n_bp_p1
546 // sy_lfr_n_bp_p1
545 parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[7];
547 parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[7];
546 }
548 }
547
549
548 return result;
550 return result;
549 }
551 }
550
552
551 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
553 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
552 {
554 {
553 int result;
555 int result;
554 unsigned char lfrMode;
556 unsigned char lfrMode;
555
557
556 result = LFR_DEFAULT;
558 result = LFR_DEFAULT;
557 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
559 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
558
560
559 if ( lfrMode == LFR_MODE_BURST ) {
561 if ( lfrMode == LFR_MODE_BURST ) {
560 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
562 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
561 result = LFR_DEFAULT;
563 result = LFR_DEFAULT;
562 }
564 }
563 else {
565 else {
564 parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[0];
566 parameter_dump_packet.sy_lfr_b_bp_p0 = TC->dataAndCRC[0];
565 parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[1];
567 parameter_dump_packet.sy_lfr_b_bp_p1 = TC->dataAndCRC[1];
566
568
567 result = LFR_SUCCESSFUL;
569 result = LFR_SUCCESSFUL;
568 }
570 }
569
571
570 return result;
572 return result;
571 }
573 }
572
574
573 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
575 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
574 {
576 {
575 int result;
577 int result;
576 unsigned char lfrMode;
578 unsigned char lfrMode;
577
579
578 result = LFR_DEFAULT;
580 result = LFR_DEFAULT;
579 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
581 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
580
582
581 if ( lfrMode == LFR_MODE_SBM1 ) {
583 if ( lfrMode == LFR_MODE_SBM1 ) {
582 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
584 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
583 result = LFR_DEFAULT;
585 result = LFR_DEFAULT;
584 }
586 }
585 else {
587 else {
586 parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[0];
588 parameter_dump_packet.sy_lfr_s1_bp_p0 = TC->dataAndCRC[0];
587 parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[1];
589 parameter_dump_packet.sy_lfr_s1_bp_p1 = TC->dataAndCRC[1];
588
590
589 result = LFR_SUCCESSFUL;
591 result = LFR_SUCCESSFUL;
590 }
592 }
591
593
592 return result;
594 return result;
593 }
595 }
594
596
595 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
597 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
596 {
598 {
597 int result;
599 int result;
598 unsigned char lfrMode;
600 unsigned char lfrMode;
599
601
600 result = LFR_DEFAULT;
602 result = LFR_DEFAULT;
601 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
603 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
602
604
603 if ( lfrMode == LFR_MODE_SBM2 ) {
605 if ( lfrMode == LFR_MODE_SBM2 ) {
604 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
606 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
605 result = LFR_DEFAULT;
607 result = LFR_DEFAULT;
606 }
608 }
607 else {
609 else {
608 parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[0];
610 parameter_dump_packet.sy_lfr_s2_bp_p0 = TC->dataAndCRC[0];
609 parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[1];
611 parameter_dump_packet.sy_lfr_s2_bp_p1 = TC->dataAndCRC[1];
610
612
611 result = LFR_SUCCESSFUL;
613 result = LFR_SUCCESSFUL;
612 }
614 }
613
615
614 return result;
616 return result;
615 }
617 }
616
618
617 int action_dump_par(ccsdsTelecommandPacket_t *TC)
619 int action_dump_par(ccsdsTelecommandPacket_t *TC)
618 {
620 {
619 int status;
621 int status;
620 // send parameter dump packet
622 // send parameter dump packet
621 status = write(fdSPW, (char *) &parameter_dump_packet,
623 status = write(fdSPW, (char *) &parameter_dump_packet,
622 PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + 4);
624 PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + 4);
623 if (status == -1)
625 if (status == -1)
624 {
626 {
625 PRINTF1("in action_dump *** ERR sending packet, code %d", status)
627 PRINTF1("in action_dump *** ERR sending packet, code %d", status)
626 status = RTEMS_UNSATISFIED;
628 status = RTEMS_UNSATISFIED;
627 }
629 }
628 else
630 else
629 {
631 {
630 status = RTEMS_SUCCESSFUL;
632 status = RTEMS_SUCCESSFUL;
631 }
633 }
632
634
633 return status;
635 return status;
634 }
636 }
635
637
636 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
638 int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
637 {
639 {
638 rtems_status_code status;
640 rtems_status_code status;
639 unsigned char requestedMode;
641 unsigned char requestedMode;
640
642
641 requestedMode = TC->dataAndCRC[1];
643 requestedMode = TC->dataAndCRC[1];
642
644
643 if ( (requestedMode != LFR_MODE_STANDBY)
645 if ( (requestedMode != LFR_MODE_STANDBY)
644 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
646 && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST)
645 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
647 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
646 {
648 {
647 status = RTEMS_UNSATISFIED;
649 status = RTEMS_UNSATISFIED;
648 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode );
650 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode );
649 }
651 }
650 else
652 else
651 {
653 {
652 printf("try to enter mode %d\n", requestedMode);
654 printf("try to enter mode %d\n", requestedMode);
653
655
654 #ifdef PRINT_TASK_STATISTICS
656 #ifdef PRINT_TASK_STATISTICS
655 if (requestedMode != LFR_MODE_STANDBY)
657 if (requestedMode != LFR_MODE_STANDBY)
656 {
658 {
657 rtems_cpu_usage_reset();
659 rtems_cpu_usage_reset();
658 maxCount = 0;
660 maxCount = 0;
659 }
661 }
660 #endif
662 #endif
661
663
662 status = transition_validation(requestedMode);
664 status = transition_validation(requestedMode);
663
665
664 if ( status == LFR_SUCCESSFUL ) {
666 if ( status == LFR_SUCCESSFUL ) {
665 if ( lfrCurrentMode != LFR_MODE_STANDBY)
667 if ( lfrCurrentMode != LFR_MODE_STANDBY)
666 {
668 {
667 status = stop_current_mode();
669 status = stop_current_mode();
668 }
670 }
669 if (status != RTEMS_SUCCESSFUL)
671 if (status != RTEMS_SUCCESSFUL)
670 {
672 {
671 PRINTF("ERR *** in action_enter *** stop_current_mode\n")
673 PRINTF("ERR *** in action_enter *** stop_current_mode\n")
672 }
674 }
673 status = enter_mode(requestedMode, TC);
675 status = enter_mode(requestedMode, TC);
674 }
676 }
675 else
677 else
676 {
678 {
677 PRINTF("ERR *** in action_enter *** transition rejected\n")
679 PRINTF("ERR *** in action_enter *** transition rejected\n")
678 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
680 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
679 }
681 }
680 }
682 }
681
683
682 return status;
684 return status;
683 }
685 }
684
686
685 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) {
687 int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) {
686 unsigned int val;
688 unsigned int val;
687 int result;
689 int result;
688 unsigned char lfrMode;
690 unsigned char lfrMode;
689
691
690 result = LFR_DEFAULT;
692 result = LFR_DEFAULT;
691 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
693 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
692
694
693 if ( (lfrMode == LFR_MODE_STANDBY) ) {
695 if ( (lfrMode == LFR_MODE_STANDBY) ) {
694 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
696 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
695 result = LFR_DEFAULT;
697 result = LFR_DEFAULT;
696 }
698 }
697 else {
699 else {
698 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
700 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
699 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
701 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
700 val++;
702 val++;
701 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
703 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
702 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
704 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
703 result = LFR_SUCCESSFUL;
705 result = LFR_SUCCESSFUL;
704 }
706 }
705
707
706 return result;
708 return result;
707 }
709 }
708
710
709 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
711 int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
710 {
712 {
711 int result;
713 int result;
712 unsigned char lfrMode;
714 unsigned char lfrMode;
713
715
714 result = LFR_DEFAULT;
716 result = LFR_DEFAULT;
715 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
717 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
716
718
717 if ( (lfrMode == LFR_MODE_STANDBY) | (lfrMode == LFR_MODE_BURST) | (lfrMode == LFR_MODE_SBM2) ) {
719 if ( (lfrMode == LFR_MODE_STANDBY) | (lfrMode == LFR_MODE_BURST) | (lfrMode == LFR_MODE_SBM2) ) {
718 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
720 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
719 result = LFR_DEFAULT;
721 result = LFR_DEFAULT;
720 }
722 }
721 else {
723 else {
722 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
724 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
723 result = LFR_DEFAULT;
725 result = LFR_DEFAULT;
724 }
726 }
725 return result;
727 return result;
726 }
728 }
727
729
728 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
730 int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
729 {
731 {
730 int result;
732 int result;
731 unsigned char lfrMode;
733 unsigned char lfrMode;
732
734
733 result = LFR_DEFAULT;
735 result = LFR_DEFAULT;
734 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
736 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
735
737
736 if ( (lfrMode == LFR_MODE_STANDBY) | (lfrMode == LFR_MODE_BURST) | (lfrMode == LFR_MODE_SBM2) ) {
738 if ( (lfrMode == LFR_MODE_STANDBY) | (lfrMode == LFR_MODE_BURST) | (lfrMode == LFR_MODE_SBM2) ) {
737 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
739 send_tm_lfr_tc_exe_not_executable( TC, queue_id );
738 result = LFR_DEFAULT;
740 result = LFR_DEFAULT;
739 }
741 }
740 else {
742 else {
741 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
743 send_tm_lfr_tc_exe_not_implemented( TC, queue_id );
742 result = LFR_DEFAULT;
744 result = LFR_DEFAULT;
743 }
745 }
744 return result;
746 return result;
745 }
747 }
746
748
747 int action_update_time(ccsdsTelecommandPacket_t *TC)
749 int action_update_time(ccsdsTelecommandPacket_t *TC)
748 {
750 {
749 unsigned int val;
751 unsigned int val;
750
752
751 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
753 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
752 + (TC->dataAndCRC[1] << 16)
754 + (TC->dataAndCRC[1] << 16)
753 + (TC->dataAndCRC[2] << 8)
755 + (TC->dataAndCRC[2] << 8)
754 + TC->dataAndCRC[3];
756 + TC->dataAndCRC[3];
755 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
757 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
756 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
758 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
757 val++;
759 val++;
758 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
760 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
759 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
761 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
760 time_management_regs->ctrl = time_management_regs->ctrl | 1;
762 time_management_regs->ctrl = time_management_regs->ctrl | 1;
761
763
762 return LFR_SUCCESSFUL;
764 return LFR_SUCCESSFUL;
763 }
765 }
764
766
765 //*******************
767 //*******************
766 // ENTERING THE MODES
768 // ENTERING THE MODES
767
769
768 int transition_validation(unsigned char requestedMode)
770 int transition_validation(unsigned char requestedMode)
769 {
771 {
770 int status;
772 int status;
771
773
772 switch (requestedMode)
774 switch (requestedMode)
773 {
775 {
774 case LFR_MODE_STANDBY:
776 case LFR_MODE_STANDBY:
775 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
777 if ( lfrCurrentMode == LFR_MODE_STANDBY ) {
776 status = LFR_DEFAULT;
778 status = LFR_DEFAULT;
777 }
779 }
778 else
780 else
779 {
781 {
780 status = LFR_SUCCESSFUL;
782 status = LFR_SUCCESSFUL;
781 }
783 }
782 break;
784 break;
783 case LFR_MODE_NORMAL:
785 case LFR_MODE_NORMAL:
784 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
786 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
785 status = LFR_DEFAULT;
787 status = LFR_DEFAULT;
786 }
788 }
787 else {
789 else {
788 status = LFR_SUCCESSFUL;
790 status = LFR_SUCCESSFUL;
789 }
791 }
790 break;
792 break;
791 case LFR_MODE_BURST:
793 case LFR_MODE_BURST:
792 if ( lfrCurrentMode == LFR_MODE_BURST ) {
794 if ( lfrCurrentMode == LFR_MODE_BURST ) {
793 status = LFR_DEFAULT;
795 status = LFR_DEFAULT;
794 }
796 }
795 else {
797 else {
796 status = LFR_SUCCESSFUL;
798 status = LFR_SUCCESSFUL;
797 }
799 }
798 break;
800 break;
799 case LFR_MODE_SBM1:
801 case LFR_MODE_SBM1:
800 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
802 if ( lfrCurrentMode == LFR_MODE_SBM1 ) {
801 status = LFR_DEFAULT;
803 status = LFR_DEFAULT;
802 }
804 }
803 else {
805 else {
804 status = LFR_SUCCESSFUL;
806 status = LFR_SUCCESSFUL;
805 }
807 }
806 break;
808 break;
807 case LFR_MODE_SBM2:
809 case LFR_MODE_SBM2:
808 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
810 if ( lfrCurrentMode == LFR_MODE_SBM2 ) {
809 status = LFR_DEFAULT;
811 status = LFR_DEFAULT;
810 }
812 }
811 else {
813 else {
812 status = LFR_SUCCESSFUL;
814 status = LFR_SUCCESSFUL;
813 }
815 }
814 break;
816 break;
815 default:
817 default:
816 status = LFR_DEFAULT;
818 status = LFR_DEFAULT;
817 break;
819 break;
818 }
820 }
819
821
820 return status;
822 return status;
821 }
823 }
822
824
823 int stop_current_mode()
825 int stop_current_mode()
824 {
826 {
825 rtems_status_code status;
827 rtems_status_code status;
826
828
827 status = RTEMS_SUCCESSFUL;
829 status = RTEMS_SUCCESSFUL;
828
830
829 // mask all IRQ lines related to signal processing
831 // mask all IRQ lines related to signal processing
830 LEON_Mask_interrupt( IRQ_SM ); // mask spectral matrices interrupt (coming from the timer VHDL IP)
832 LEON_Mask_interrupt( IRQ_SM ); // mask spectral matrices interrupt (coming from the timer VHDL IP)
831 LEON_Clear_interrupt( IRQ_SM ); // clear spectral matrices interrupt (coming from the timer VHDL IP)
833 LEON_Clear_interrupt( IRQ_SM ); // clear spectral matrices interrupt (coming from the timer VHDL IP)
832
834
833 #ifdef GSA
835 #ifdef GSA
834 LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP)
836 LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP)
835 LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP)
837 LEON_Clear_interrupt( IRQ_WF ); // clear waveform interrupt (coming from the timer VHDL IP)
836 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR );
838 timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR );
837 #else
839 #else
838 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
840 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
839 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
841 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
840 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt
842 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt
841 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
843 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
842 LEON_Mask_interrupt( IRQ_SM ); // for SM simulation
844 LEON_Mask_interrupt( IRQ_SM ); // for SM simulation
843 LEON_Clear_interrupt( IRQ_SM ); // for SM simulation
845 LEON_Clear_interrupt( IRQ_SM ); // for SM simulation
844 #endif
846 #endif
845 //**********************
847 //**********************
846 // suspend several tasks
848 // suspend several tasks
847 if (lfrCurrentMode != LFR_MODE_STANDBY) {
849 if (lfrCurrentMode != LFR_MODE_STANDBY) {
848 suspend_science_tasks();
850 suspend_science_tasks();
849 }
851 }
850
852
851 if (status != RTEMS_SUCCESSFUL)
853 if (status != RTEMS_SUCCESSFUL)
852 {
854 {
853 PRINTF("ERR *** in stop_current_mode *** suspending tasks\n")
855 PRINTF("ERR *** in stop_current_mode *** suspending tasks\n")
854 }
856 }
855
857
856 //*************************
858 //*************************
857 // initialize the registers
859 // initialize the registers
858 #ifdef GSA
860 #ifdef GSA
859 #else
861 #else
860 reset_wfp_burst_enable(); // reset burst and enable bits
862 reset_wfp_burst_enable(); // reset burst and enable bits
861 reset_wfp_status(); // reset all the status bits
863 reset_wfp_status(); // reset all the status bits
862 #endif
864 #endif
863
865
864 return status;
866 return status;
865 }
867 }
866
868
867 int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC )
869 int enter_mode(unsigned char mode, ccsdsTelecommandPacket_t *TC )
868 {
870 {
869 rtems_status_code status;
871 rtems_status_code status;
870
872
871 status = RTEMS_UNSATISFIED;
873 status = RTEMS_UNSATISFIED;
872
874
873 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d);
875 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d);
874 lfrCurrentMode = mode;
876 lfrCurrentMode = mode;
875
877
876 switch(mode){
878 switch(mode){
877 case LFR_MODE_STANDBY:
879 case LFR_MODE_STANDBY:
878 status = enter_standby_mode( TC );
880 status = enter_standby_mode( TC );
879 break;
881 break;
880 case LFR_MODE_NORMAL:
882 case LFR_MODE_NORMAL:
881 status = enter_normal_mode( TC );
883 status = enter_normal_mode( TC );
882 break;
884 break;
883 case LFR_MODE_BURST:
885 case LFR_MODE_BURST:
884 status = enter_burst_mode( TC );
886 status = enter_burst_mode( TC );
885 break;
887 break;
886 case LFR_MODE_SBM1:
888 case LFR_MODE_SBM1:
887 status = enter_sbm1_mode( TC );
889 status = enter_sbm1_mode( TC );
888 break;
890 break;
889 case LFR_MODE_SBM2:
891 case LFR_MODE_SBM2:
890 status = enter_sbm2_mode( TC );
892 status = enter_sbm2_mode( TC );
891 break;
893 break;
892 default:
894 default:
893 status = RTEMS_UNSATISFIED;
895 status = RTEMS_UNSATISFIED;
894 }
896 }
895
897
896 if (status != RTEMS_SUCCESSFUL)
898 if (status != RTEMS_SUCCESSFUL)
897 {
899 {
898 PRINTF("in enter_mode *** ERR\n")
900 PRINTF("in enter_mode *** ERR\n")
899 status = RTEMS_UNSATISFIED;
901 status = RTEMS_UNSATISFIED;
900 }
902 }
901
903
902 return status;
904 return status;
903 }
905 }
904
906
905 int enter_standby_mode()
907 int enter_standby_mode()
906 {
908 {
907 reset_waveform_picker_regs();
909 reset_waveform_picker_regs();
908
910
909 PRINTF1("maxCount = %d\n", maxCount)
911 PRINTF1("maxCount = %d\n", maxCount)
910
912
911 #ifdef PRINT_TASK_STATISTICS
913 #ifdef PRINT_TASK_STATISTICS
912 rtems_cpu_usage_report();
914 rtems_cpu_usage_report();
913 #endif
915 #endif
914
916
915 #ifdef PRINT_STACK_REPORT
917 #ifdef PRINT_STACK_REPORT
916 rtems_stack_checker_report_usage();
918 rtems_stack_checker_report_usage();
917 #endif
919 #endif
918
920
919 return LFR_SUCCESSFUL;
921 return LFR_SUCCESSFUL;
920 }
922 }
921
923
922 int enter_normal_mode()
924 int enter_normal_mode()
923 {
925 {
924 rtems_status_code status;
926 rtems_status_code status;
925
927
926 status = restart_science_tasks();
928 status = restart_science_tasks();
927
929
928 #ifdef GSA
930 #ifdef GSA
929 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR );
931 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR );
930 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
932 timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
931 LEON_Clear_interrupt( IRQ_WF );
933 LEON_Clear_interrupt( IRQ_WF );
932 LEON_Unmask_interrupt( IRQ_WF );
934 LEON_Unmask_interrupt( IRQ_WF );
933 //
935 //
934 set_local_nb_interrupt_f0_MAX();
936 set_local_nb_interrupt_f0_MAX();
935 LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board
937 LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board
936 LEON_Unmask_interrupt( IRQ_SM );
938 LEON_Unmask_interrupt( IRQ_SM );
937 #else
939 #else
938 //****************
940 //****************
939 // waveform picker
941 // waveform picker
940 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
942 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
941 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
943 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
942 reset_waveform_picker_regs();
944 reset_waveform_picker_regs();
943 set_wfp_burst_enable_register(LFR_MODE_NORMAL);
945 set_wfp_burst_enable_register(LFR_MODE_NORMAL);
944 //****************
946 //****************
945 // spectral matrix
947 // spectral matrix
946 // set_local_nb_interrupt_f0_MAX();
948 // set_local_nb_interrupt_f0_MAX();
947 // LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board
949 // LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board
948 // LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX );
950 // LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX );
949 // spectral_matrix_regs->config = 0x01;
951 // spectral_matrix_regs->config = 0x01;
950 // spectral_matrix_regs->status = 0x00;
952 // spectral_matrix_regs->status = 0x00;
951 #endif
953 #endif
952
954
953 return status;
955 return status;
954 }
956 }
955
957
956 int enter_burst_mode()
958 int enter_burst_mode()
957 {
959 {
958 rtems_status_code status;
960 rtems_status_code status;
959
961
960 status = restart_science_tasks();
962 status = restart_science_tasks();
961
963
962 #ifdef GSA
964 #ifdef GSA
963 LEON_Unmask_interrupt( IRQ_SM );
965 LEON_Unmask_interrupt( IRQ_SM );
964 #else
966 #else
965 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
967 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
966 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
968 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
967 reset_waveform_picker_regs();
969 reset_waveform_picker_regs();
968 set_wfp_burst_enable_register(LFR_MODE_BURST);
970 set_wfp_burst_enable_register(LFR_MODE_BURST);
969 #endif
971 #endif
970
972
971 return status;
973 return status;
972 }
974 }
973
975
974 int enter_sbm1_mode()
976 int enter_sbm1_mode()
975 {
977 {
976 rtems_status_code status;
978 rtems_status_code status;
977
979
978 status = restart_science_tasks();
980 status = restart_science_tasks();
979
981
980 set_local_sbm1_nb_cwf_max();
982 set_local_sbm1_nb_cwf_max();
981
983
982 reset_local_sbm1_nb_cwf_sent();
984 reset_local_sbm1_nb_cwf_sent();
983
985
984 #ifdef GSA
986 #ifdef GSA
985 LEON_Unmask_interrupt( IRQ_SM );
987 LEON_Unmask_interrupt( IRQ_SM );
986 #else
988 #else
987 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
989 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
988 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
990 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
989 reset_waveform_picker_regs();
991 reset_waveform_picker_regs();
990 set_wfp_burst_enable_register(LFR_MODE_SBM1);
992 set_wfp_burst_enable_register(LFR_MODE_SBM1);
991 // SM simulation
993 // SM simulation
992 // timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
994 // timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
993 // LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board
995 // LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board
994 // LEON_Unmask_interrupt( IRQ_SM );
996 // LEON_Unmask_interrupt( IRQ_SM );
995 #endif
997 #endif
996
998
997 return status;
999 return status;
998 }
1000 }
999
1001
1000 int enter_sbm2_mode()
1002 int enter_sbm2_mode()
1001 {
1003 {
1002 rtems_status_code status;
1004 rtems_status_code status;
1003
1005
1004 status = restart_science_tasks();
1006 status = restart_science_tasks();
1005
1007
1006 set_local_sbm2_nb_cwf_max();
1008 set_local_sbm2_nb_cwf_max();
1007
1009
1008 reset_local_sbm2_nb_cwf_sent();
1010 reset_local_sbm2_nb_cwf_sent();
1009
1011
1010 #ifdef GSA
1012 #ifdef GSA
1011 LEON_Unmask_interrupt( IRQ_SM );
1013 LEON_Unmask_interrupt( IRQ_SM );
1012 #else
1014 #else
1013 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
1015 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
1014 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
1016 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
1015 reset_waveform_picker_regs();
1017 reset_waveform_picker_regs();
1016 set_wfp_burst_enable_register(LFR_MODE_SBM2);
1018 set_wfp_burst_enable_register(LFR_MODE_SBM2);
1017 #endif
1019 #endif
1018
1020
1019 return status;
1021 return status;
1020 }
1022 }
1021
1023
1022 int restart_science_tasks()
1024 int restart_science_tasks()
1023 {
1025 {
1024 rtems_status_code status[6];
1026 rtems_status_code status[6];
1025 rtems_status_code ret;
1027 rtems_status_code ret;
1026
1028
1027 ret = RTEMS_SUCCESSFUL;
1029 ret = RTEMS_SUCCESSFUL;
1028
1030
1029 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 );
1031 status[0] = rtems_task_restart( Task_id[TASKID_AVF0], 1 );
1030 if (status[0] != RTEMS_SUCCESSFUL)
1032 if (status[0] != RTEMS_SUCCESSFUL)
1031 {
1033 {
1032 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
1034 PRINTF1("in restart_science_task *** 0 ERR %d\n", status[0])
1033 }
1035 }
1034
1036
1035 status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 );
1037 status[1] = rtems_task_restart( Task_id[TASKID_BPF0],1 );
1036 if (status[1] != RTEMS_SUCCESSFUL)
1038 if (status[1] != RTEMS_SUCCESSFUL)
1037 {
1039 {
1038 PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1])
1040 PRINTF1("in restart_science_task *** 1 ERR %d\n", status[1])
1039 }
1041 }
1040
1042
1041 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
1043 status[2] = rtems_task_restart( Task_id[TASKID_WFRM],1 );
1042 if (status[2] != RTEMS_SUCCESSFUL)
1044 if (status[2] != RTEMS_SUCCESSFUL)
1043 {
1045 {
1044 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
1046 PRINTF1("in restart_science_task *** 2 ERR %d\n", status[2])
1045 }
1047 }
1046
1048
1047 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
1049 status[3] = rtems_task_restart( Task_id[TASKID_CWF3],1 );
1048 if (status[3] != RTEMS_SUCCESSFUL)
1050 if (status[3] != RTEMS_SUCCESSFUL)
1049 {
1051 {
1050 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
1052 PRINTF1("in restart_science_task *** 3 ERR %d\n", status[3])
1051 }
1053 }
1052
1054
1053 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
1055 status[4] = rtems_task_restart( Task_id[TASKID_CWF2],1 );
1054 if (status[4] != RTEMS_SUCCESSFUL)
1056 if (status[4] != RTEMS_SUCCESSFUL)
1055 {
1057 {
1056 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
1058 PRINTF1("in restart_science_task *** 4 ERR %d\n", status[4])
1057 }
1059 }
1058
1060
1059 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
1061 status[5] = rtems_task_restart( Task_id[TASKID_CWF1],1 );
1060 if (status[5] != RTEMS_SUCCESSFUL)
1062 if (status[5] != RTEMS_SUCCESSFUL)
1061 {
1063 {
1062 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
1064 PRINTF1("in restart_science_task *** 5 ERR %d\n", status[5])
1063 }
1065 }
1064
1066
1065 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
1067 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
1066 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
1068 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
1067 {
1069 {
1068 ret = RTEMS_UNSATISFIED;
1070 ret = RTEMS_UNSATISFIED;
1069 }
1071 }
1070
1072
1071 return ret;
1073 return ret;
1072 }
1074 }
1073
1075
1074 int suspend_science_tasks()
1076 int suspend_science_tasks()
1075 {
1077 {
1076 rtems_status_code status[6];
1078 rtems_status_code status[6];
1077 rtems_status_code ret;
1079 rtems_status_code ret;
1078
1080
1079 ret = RTEMS_SUCCESSFUL;
1081 ret = RTEMS_SUCCESSFUL;
1080
1082
1081 status[0] = rtems_task_suspend( Task_id[TASKID_AVF0] );
1083 status[0] = rtems_task_suspend( Task_id[TASKID_AVF0] );
1082 if (status[0] != RTEMS_SUCCESSFUL)
1084 if (status[0] != RTEMS_SUCCESSFUL)
1083 {
1085 {
1084 PRINTF1("in suspend_science_task *** 0 ERR %d\n", status[0])
1086 PRINTF1("in suspend_science_task *** 0 ERR %d\n", status[0])
1085 }
1087 }
1086
1088
1087 status[1] = rtems_task_suspend( Task_id[TASKID_BPF0] );
1089 status[1] = rtems_task_suspend( Task_id[TASKID_BPF0] );
1088 if (status[1] != RTEMS_SUCCESSFUL)
1090 if (status[1] != RTEMS_SUCCESSFUL)
1089 {
1091 {
1090 PRINTF1("in suspend_science_task *** 1 ERR %d\n", status[1])
1092 PRINTF1("in suspend_science_task *** 1 ERR %d\n", status[1])
1091 }
1093 }
1092
1094
1093 status[2] = rtems_task_suspend( Task_id[TASKID_WFRM] );
1095 status[2] = rtems_task_suspend( Task_id[TASKID_WFRM] );
1094 if (status[2] != RTEMS_SUCCESSFUL)
1096 if (status[2] != RTEMS_SUCCESSFUL)
1095 {
1097 {
1096 PRINTF1("in suspend_science_task *** 2 ERR %d\n", status[2])
1098 PRINTF1("in suspend_science_task *** 2 ERR %d\n", status[2])
1097 }
1099 }
1098
1100
1099 status[3] = rtems_task_suspend( Task_id[TASKID_CWF3] );
1101 status[3] = rtems_task_suspend( Task_id[TASKID_CWF3] );
1100 if (status[3] != RTEMS_SUCCESSFUL)
1102 if (status[3] != RTEMS_SUCCESSFUL)
1101 {
1103 {
1102 PRINTF1("in suspend_science_task *** 3 ERR %d\n", status[3])
1104 PRINTF1("in suspend_science_task *** 3 ERR %d\n", status[3])
1103 }
1105 }
1104
1106
1105 status[4] = rtems_task_suspend( Task_id[TASKID_CWF2] );
1107 status[4] = rtems_task_suspend( Task_id[TASKID_CWF2] );
1106 if (status[4] != RTEMS_SUCCESSFUL)
1108 if (status[4] != RTEMS_SUCCESSFUL)
1107 {
1109 {
1108 PRINTF1("in suspend_science_task *** 4 ERR %d\n", status[4])
1110 PRINTF1("in suspend_science_task *** 4 ERR %d\n", status[4])
1109 }
1111 }
1110
1112
1111 status[5] = rtems_task_suspend( Task_id[TASKID_CWF1] );
1113 status[5] = rtems_task_suspend( Task_id[TASKID_CWF1] );
1112 if (status[5] != RTEMS_SUCCESSFUL)
1114 if (status[5] != RTEMS_SUCCESSFUL)
1113 {
1115 {
1114 PRINTF1("in suspend_science_task *** 5 ERR %d\n", status[5])
1116 PRINTF1("in suspend_science_task *** 5 ERR %d\n", status[5])
1115 }
1117 }
1116
1118
1117 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
1119 if ( (status[0] != RTEMS_SUCCESSFUL) || (status[1] != RTEMS_SUCCESSFUL) || (status[2] != RTEMS_SUCCESSFUL) ||
1118 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
1120 (status[3] != RTEMS_SUCCESSFUL) || (status[4] != RTEMS_SUCCESSFUL) || (status[5] != RTEMS_SUCCESSFUL) )
1119 {
1121 {
1120 ret = RTEMS_UNSATISFIED;
1122 ret = RTEMS_UNSATISFIED;
1121 }
1123 }
1122
1124
1123 return ret;
1125 return ret;
1124 }
1126 }
1125
1127
1126 //****************
1128 //****************
1127 // CLOSING ACTIONS
1129 // CLOSING ACTIONS
1128
1130
1129 int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
1131 int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
1130 {
1132 {
1131 int ret;
1133 int ret;
1132 rtems_status_code status;
1134 rtems_status_code status;
1133 Packet_TM_LFR_TC_EXE_SUCCESS_t TM;
1135 Packet_TM_LFR_TC_EXE_SUCCESS_t TM;
1134 unsigned char messageSize;
1136 unsigned char messageSize;
1135
1137
1136 ret = LFR_SUCCESSFUL;
1138 ret = LFR_SUCCESSFUL;
1137
1139
1138 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
1140 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
1139 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
1141 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
1140 TM.reserved = DEFAULT_RESERVED;
1142 TM.reserved = DEFAULT_RESERVED;
1141 TM.userApplication = CCSDS_USER_APP;
1143 TM.userApplication = CCSDS_USER_APP;
1142 // PACKET HEADER
1144 // PACKET HEADER
1143 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
1145 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
1144 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
1146 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
1145 TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8);
1147 TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8);
1146 TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE );
1148 TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE );
1147 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8);
1149 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8);
1148 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS );
1150 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS );
1149 // DATA FIELD HEADER
1151 // DATA FIELD HEADER
1150 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
1152 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
1151 TM.serviceType = TM_TYPE_TC_EXE;
1153 TM.serviceType = TM_TYPE_TC_EXE;
1152 TM.serviceSubType = TM_SUBTYPE_EXE_OK;
1154 TM.serviceSubType = TM_SUBTYPE_EXE_OK;
1153 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
1155 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
1154 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
1156 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
1155 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
1157 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
1156 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
1158 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
1157 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
1159 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
1158 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
1160 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
1159 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
1161 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
1160 //
1162 //
1161 TM.telecommand_pkt_id[0] = TC->packetID[0];
1163 TM.telecommand_pkt_id[0] = TC->packetID[0];
1162 TM.telecommand_pkt_id[1] = TC->packetID[1];
1164 TM.telecommand_pkt_id[1] = TC->packetID[1];
1163 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
1165 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
1164 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
1166 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
1165
1167
1166 messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
1168 messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
1167
1169
1168 // SEND DATA
1170 // SEND DATA
1169 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
1171 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
1170 if (status != RTEMS_SUCCESSFUL) {
1172 if (status != RTEMS_SUCCESSFUL) {
1171 PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n")
1173 PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n")
1172 ret = LFR_DEFAULT;
1174 ret = LFR_DEFAULT;
1173 }
1175 }
1174
1176
1175 return LFR_SUCCESSFUL;
1177 return LFR_SUCCESSFUL;
1176 }
1178 }
1177
1179
1178 int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
1180 int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
1179 unsigned char byte_position, unsigned char rcv_value)
1181 unsigned char byte_position, unsigned char rcv_value)
1180 {
1182 {
1181 int ret;
1183 int ret;
1182 rtems_status_code status;
1184 rtems_status_code status;
1183 Packet_TM_LFR_TC_EXE_INCONSISTENT_t TM;
1185 Packet_TM_LFR_TC_EXE_INCONSISTENT_t TM;
1184 unsigned char messageSize;
1186 unsigned char messageSize;
1185
1187
1186 ret = LFR_SUCCESSFUL;
1188 ret = LFR_SUCCESSFUL;
1187
1189
1188 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
1190 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
1189 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
1191 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
1190 TM.reserved = DEFAULT_RESERVED;
1192 TM.reserved = DEFAULT_RESERVED;
1191 TM.userApplication = CCSDS_USER_APP;
1193 TM.userApplication = CCSDS_USER_APP;
1192 // PACKET HEADER
1194 // PACKET HEADER
1193 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
1195 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
1194 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
1196 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
1195 TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8);
1197 TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8);
1196 TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE );
1198 TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE );
1197 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8);
1199 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8);
1198 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT );
1200 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT );
1199 // DATA FIELD HEADER
1201 // DATA FIELD HEADER
1200 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
1202 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
1201 TM.serviceType = TM_TYPE_TC_EXE;
1203 TM.serviceType = TM_TYPE_TC_EXE;
1202 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
1204 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
1203 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
1205 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
1204 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
1206 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
1205 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
1207 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
1206 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
1208 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
1207 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
1209 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
1208 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
1210 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
1209 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
1211 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
1210 //
1212 //
1211 TM.tc_failure_code[0] = (char) (FAILURE_CODE_INCONSISTENT >> 8);
1213 TM.tc_failure_code[0] = (char) (FAILURE_CODE_INCONSISTENT >> 8);
1212 TM.tc_failure_code[1] = (char) (FAILURE_CODE_INCONSISTENT );
1214 TM.tc_failure_code[1] = (char) (FAILURE_CODE_INCONSISTENT );
1213 TM.telecommand_pkt_id[0] = TC->packetID[0];
1215 TM.telecommand_pkt_id[0] = TC->packetID[0];
1214 TM.telecommand_pkt_id[1] = TC->packetID[1];
1216 TM.telecommand_pkt_id[1] = TC->packetID[1];
1215 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
1217 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
1216 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
1218 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
1217 TM.tc_service = TC->serviceType; // type of the rejected TC
1219 TM.tc_service = TC->serviceType; // type of the rejected TC
1218 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
1220 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
1219 TM.byte_position = byte_position;
1221 TM.byte_position = byte_position;
1220 TM.rcv_value = rcv_value;
1222 TM.rcv_value = rcv_value;
1221
1223
1222 messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
1224 messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
1223
1225
1224 // SEND DATA
1226 // SEND DATA
1225 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
1227 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
1226 if (status != RTEMS_SUCCESSFUL) {
1228 if (status != RTEMS_SUCCESSFUL) {
1227 PRINTF("in send_tm_lfr_tc_exe_inconsistent *** ERR\n")
1229 PRINTF("in send_tm_lfr_tc_exe_inconsistent *** ERR\n")
1228 ret = LFR_DEFAULT;
1230 ret = LFR_DEFAULT;
1229 }
1231 }
1230
1232
1231 return LFR_SUCCESSFUL;
1233 return LFR_SUCCESSFUL;
1232 }
1234 }
1233
1235
1234 int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
1236 int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
1235 {
1237 {
1236 int ret;
1238 int ret;
1237 rtems_status_code status;
1239 rtems_status_code status;
1238 Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t TM;
1240 Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t TM;
1239 unsigned char messageSize;
1241 unsigned char messageSize;
1240
1242
1241 ret = LFR_SUCCESSFUL;
1243 ret = LFR_SUCCESSFUL;
1242
1244
1243 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
1245 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
1244 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
1246 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
1245 TM.reserved = DEFAULT_RESERVED;
1247 TM.reserved = DEFAULT_RESERVED;
1246 TM.userApplication = CCSDS_USER_APP;
1248 TM.userApplication = CCSDS_USER_APP;
1247 // PACKET HEADER
1249 // PACKET HEADER
1248 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
1250 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
1249 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
1251 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
1250 TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8);
1252 TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8);
1251 TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE );
1253 TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE );
1252 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8);
1254 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8);
1253 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE );
1255 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE );
1254 // DATA FIELD HEADER
1256 // DATA FIELD HEADER
1255 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
1257 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
1256 TM.serviceType = TM_TYPE_TC_EXE;
1258 TM.serviceType = TM_TYPE_TC_EXE;
1257 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
1259 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
1258 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
1260 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
1259 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
1261 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
1260 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
1262 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
1261 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
1263 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
1262 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
1264 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
1263 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
1265 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
1264 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
1266 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
1265 //
1267 //
1266 TM.tc_failure_code[0] = (char) (FAILURE_CODE_NOT_EXECUTABLE >> 8);
1268 TM.tc_failure_code[0] = (char) (FAILURE_CODE_NOT_EXECUTABLE >> 8);
1267 TM.tc_failure_code[1] = (char) (FAILURE_CODE_NOT_EXECUTABLE );
1269 TM.tc_failure_code[1] = (char) (FAILURE_CODE_NOT_EXECUTABLE );
1268 TM.telecommand_pkt_id[0] = TC->packetID[0];
1270 TM.telecommand_pkt_id[0] = TC->packetID[0];
1269 TM.telecommand_pkt_id[1] = TC->packetID[1];
1271 TM.telecommand_pkt_id[1] = TC->packetID[1];
1270 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
1272 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
1271 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
1273 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
1272 TM.tc_service = TC->serviceType; // type of the rejected TC
1274 TM.tc_service = TC->serviceType; // type of the rejected TC
1273 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
1275 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
1274 TM.lfr_status_word[0] = housekeeping_packet.lfr_status_word[0];
1276 TM.lfr_status_word[0] = housekeeping_packet.lfr_status_word[0];
1275 TM.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1];
1277 TM.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1];
1276
1278
1277 messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
1279 messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
1278
1280
1279 // SEND DATA
1281 // SEND DATA
1280 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
1282 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
1281 if (status != RTEMS_SUCCESSFUL) {
1283 if (status != RTEMS_SUCCESSFUL) {
1282 PRINTF("in send_tm_lfr_tc_exe_not_executable *** ERR\n")
1284 PRINTF("in send_tm_lfr_tc_exe_not_executable *** ERR\n")
1283 ret = LFR_DEFAULT;
1285 ret = LFR_DEFAULT;
1284 }
1286 }
1285
1287
1286 return LFR_SUCCESSFUL;
1288 return LFR_SUCCESSFUL;
1287 }
1289 }
1288
1290
1289 int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
1291 int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
1290 {
1292 {
1291 int ret;
1293 int ret;
1292 rtems_status_code status;
1294 rtems_status_code status;
1293 Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t TM;
1295 Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t TM;
1294 unsigned char messageSize;
1296 unsigned char messageSize;
1295
1297
1296 ret = LFR_SUCCESSFUL;
1298 ret = LFR_SUCCESSFUL;
1297
1299
1298 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
1300 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
1299 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
1301 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
1300 TM.reserved = DEFAULT_RESERVED;
1302 TM.reserved = DEFAULT_RESERVED;
1301 TM.userApplication = CCSDS_USER_APP;
1303 TM.userApplication = CCSDS_USER_APP;
1302 // PACKET HEADER
1304 // PACKET HEADER
1303 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
1305 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
1304 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
1306 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
1305 TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8);
1307 TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8);
1306 TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE );
1308 TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE );
1307 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8);
1309 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8);
1308 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED );
1310 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED );
1309 // DATA FIELD HEADER
1311 // DATA FIELD HEADER
1310 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
1312 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
1311 TM.serviceType = TM_TYPE_TC_EXE;
1313 TM.serviceType = TM_TYPE_TC_EXE;
1312 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
1314 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
1313 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
1315 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
1314 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
1316 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
1315 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
1317 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
1316 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
1318 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
1317 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
1319 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
1318 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
1320 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
1319 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
1321 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
1320 //
1322 //
1321 TM.tc_failure_code[0] = (char) (FAILURE_CODE_NOT_IMPLEMENTED >> 8);
1323 TM.tc_failure_code[0] = (char) (FAILURE_CODE_NOT_IMPLEMENTED >> 8);
1322 TM.tc_failure_code[1] = (char) (FAILURE_CODE_NOT_IMPLEMENTED );
1324 TM.tc_failure_code[1] = (char) (FAILURE_CODE_NOT_IMPLEMENTED );
1323 TM.telecommand_pkt_id[0] = TC->packetID[0];
1325 TM.telecommand_pkt_id[0] = TC->packetID[0];
1324 TM.telecommand_pkt_id[1] = TC->packetID[1];
1326 TM.telecommand_pkt_id[1] = TC->packetID[1];
1325 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
1327 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
1326 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
1328 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
1327 TM.tc_service = TC->serviceType; // type of the rejected TC
1329 TM.tc_service = TC->serviceType; // type of the rejected TC
1328 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
1330 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
1329
1331
1330 messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
1332 messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
1331
1333
1332 // SEND DATA
1334 // SEND DATA
1333 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
1335 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
1334 if (status != RTEMS_SUCCESSFUL) {
1336 if (status != RTEMS_SUCCESSFUL) {
1335 PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n")
1337 PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n")
1336 ret = LFR_DEFAULT;
1338 ret = LFR_DEFAULT;
1337 }
1339 }
1338
1340
1339 return LFR_SUCCESSFUL;
1341 return LFR_SUCCESSFUL;
1340 }
1342 }
1341
1343
1342 int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
1344 int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id)
1343 {
1345 {
1344 int ret;
1346 int ret;
1345 rtems_status_code status;
1347 rtems_status_code status;
1346 Packet_TM_LFR_TC_EXE_ERROR_t TM;
1348 Packet_TM_LFR_TC_EXE_ERROR_t TM;
1347 unsigned char messageSize;
1349 unsigned char messageSize;
1348
1350
1349 ret = LFR_SUCCESSFUL;
1351 ret = LFR_SUCCESSFUL;
1350
1352
1351 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
1353 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
1352 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
1354 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
1353 TM.reserved = DEFAULT_RESERVED;
1355 TM.reserved = DEFAULT_RESERVED;
1354 TM.userApplication = CCSDS_USER_APP;
1356 TM.userApplication = CCSDS_USER_APP;
1355 // PACKET HEADER
1357 // PACKET HEADER
1356 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
1358 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
1357 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
1359 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
1358 TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8);
1360 TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8);
1359 TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE );
1361 TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE );
1360 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8);
1362 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8);
1361 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR );
1363 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR );
1362 // DATA FIELD HEADER
1364 // DATA FIELD HEADER
1363 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
1365 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
1364 TM.serviceType = TM_TYPE_TC_EXE;
1366 TM.serviceType = TM_TYPE_TC_EXE;
1365 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
1367 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
1366 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
1368 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
1367 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
1369 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
1368 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
1370 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
1369 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
1371 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
1370 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
1372 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
1371 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
1373 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
1372 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
1374 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
1373 //
1375 //
1374 TM.tc_failure_code[0] = (char) (FAILURE_CODE_ERROR >> 8);
1376 TM.tc_failure_code[0] = (char) (FAILURE_CODE_ERROR >> 8);
1375 TM.tc_failure_code[1] = (char) (FAILURE_CODE_ERROR );
1377 TM.tc_failure_code[1] = (char) (FAILURE_CODE_ERROR );
1376 TM.telecommand_pkt_id[0] = TC->packetID[0];
1378 TM.telecommand_pkt_id[0] = TC->packetID[0];
1377 TM.telecommand_pkt_id[1] = TC->packetID[1];
1379 TM.telecommand_pkt_id[1] = TC->packetID[1];
1378 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
1380 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
1379 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
1381 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
1380 TM.tc_service = TC->serviceType; // type of the rejected TC
1382 TM.tc_service = TC->serviceType; // type of the rejected TC
1381 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
1383 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
1382
1384
1383 messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
1385 messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
1384
1386
1385 // SEND DATA
1387 // SEND DATA
1386 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
1388 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
1387 if (status != RTEMS_SUCCESSFUL) {
1389 if (status != RTEMS_SUCCESSFUL) {
1388 PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n")
1390 PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n")
1389 ret = LFR_DEFAULT;
1391 ret = LFR_DEFAULT;
1390 }
1392 }
1391
1393
1392 return LFR_SUCCESSFUL;
1394 return LFR_SUCCESSFUL;
1393 }
1395 }
1394
1396
1395 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC)
1397 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC)
1396 {
1398 {
1397 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
1399 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
1398 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
1400 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
1399 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
1401 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
1400 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
1402 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
1401 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
1403 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
1402 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
1404 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
1403 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
1405 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
1404 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
1406 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
1405 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
1407 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
1406 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time);
1408 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time);
1407 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8);
1409 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8);
1408 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = (unsigned char) (time_management_regs->fine_time);
1410 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = (unsigned char) (time_management_regs->fine_time);
1409 }
1411 }
1410
1412
1411 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC)
1413 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC)
1412 {
1414 {
1413 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
1415 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
1414 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
1416 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
1415 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
1417 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
1416 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
1418 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
1417 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
1419 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
1418 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
1420 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
1419 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
1421 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
1420 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
1422 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
1421 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
1423 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
1422 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time);
1424 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time);
1423 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8);
1425 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8);
1424 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = (unsigned char) (time_management_regs->fine_time);
1426 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = (unsigned char) (time_management_regs->fine_time);
1425 }
1427 }
1426
1428
1427 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id)
1429 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id)
1428 {
1430 {
1429 unsigned int val = 0;
1431 unsigned int val = 0;
1430 if (result == LFR_SUCCESSFUL)
1432 if (result == LFR_SUCCESSFUL)
1431 {
1433 {
1432 if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) )
1434 if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) )
1433 {
1435 {
1434 send_tm_lfr_tc_exe_success( TC, queue_id );
1436 send_tm_lfr_tc_exe_success( TC, queue_id );
1435 }
1437 }
1436 update_last_TC_exe( TC );
1438 update_last_TC_exe( TC );
1437 val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1];
1439 val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1];
1438 val++;
1440 val++;
1439 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
1441 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
1440 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val);
1442 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val);
1441 }
1443 }
1442 else
1444 else
1443 {
1445 {
1444 update_last_TC_rej( TC );
1446 update_last_TC_rej( TC );
1445 val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1];
1447 val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1];
1446 val++;
1448 val++;
1447 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
1449 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
1448 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val);
1450 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val);
1449 }
1451 }
1450 }
1452 }
1451
1453
1452 //***************************
1454 //***************************
1453 // Interrupt Service Routines
1455 // Interrupt Service Routines
1454 rtems_isr commutation_isr1( rtems_vector_number vector )
1456 rtems_isr commutation_isr1( rtems_vector_number vector )
1455 {
1457 {
1456 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
1458 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
1457 printf("In commutation_isr1 *** Error sending event to DUMB\n");
1459 printf("In commutation_isr1 *** Error sending event to DUMB\n");
1458 }
1460 }
1459 }
1461 }
1460
1462
1461 rtems_isr commutation_isr2( rtems_vector_number vector )
1463 rtems_isr commutation_isr2( rtems_vector_number vector )
1462 {
1464 {
1463 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
1465 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
1464 printf("In commutation_isr2 *** Error sending event to DUMB\n");
1466 printf("In commutation_isr2 *** Error sending event to DUMB\n");
1465 }
1467 }
1466 }
1468 }
1467
1469
1468
1470
1469
1471
1470
1472
@@ -1,843 +1,973
1 #include <wf_handler.h>
1 #include <wf_handler.h>
2
2
3 // SWF
3 // SWF
4 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7];
4 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7];
5 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
5 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
6 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
6 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
7 // CWF
7 // CWF
8 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7];
8 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7];
9 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7];
9 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7];
10 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7];
10 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7];
11 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7];
11 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7];
12 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[7];
12
13
13 unsigned char doubleSendCWF1 = 0;
14 unsigned char doubleSendCWF1 = 0;
14 unsigned char doubleSendCWF2 = 0;
15 unsigned char doubleSendCWF2 = 0;
15
16
16 rtems_isr waveforms_isr( rtems_vector_number vector )
17 rtems_isr waveforms_isr( rtems_vector_number vector )
17 {
18 {
18
19
19 #ifdef GSA
20 #ifdef GSA
20 #else
21 #else
21 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
22 if ( (lfrCurrentMode == LFR_MODE_NORMAL)
22 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
23 || (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
23 { // in modes other than STANDBY and BURST, send the CWF_F3 data
24 { // in modes other than STANDBY and BURST, send the CWF_F3 data
24 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
25 if ((waveform_picker_regs->status & 0x08) == 0x08){ // [1000] f3 is full
25 // (1) change the receiving buffer for the waveform picker
26 // (1) change the receiving buffer for the waveform picker
26 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) {
27 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) {
27 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_bis);
28 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_bis);
28 }
29 }
29 else {
30 else {
30 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3);
31 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3);
31 }
32 }
32 // (2) send an event for the waveforms transmission
33 // (2) send an event for the waveforms transmission
33 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
34 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
34 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
35 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
35 }
36 }
36 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
37 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
37 }
38 }
38 }
39 }
39 #endif
40 #endif
40
41
41 switch(lfrCurrentMode)
42 switch(lfrCurrentMode)
42 {
43 {
43 //********
44 //********
44 // STANDBY
45 // STANDBY
45 case(LFR_MODE_STANDBY):
46 case(LFR_MODE_STANDBY):
46 break;
47 break;
47
48
48 //******
49 //******
49 // NORMAL
50 // NORMAL
50 case(LFR_MODE_NORMAL):
51 case(LFR_MODE_NORMAL):
51 #ifdef GSA
52 #ifdef GSA
52 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
53 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
53 #else
54 #else
54 if ( (waveform_picker_regs->burst_enable & 0x7) == 0x0 ){ // if no channel is enable
55 if ( (waveform_picker_regs->burst_enable & 0x7) == 0x0 ){ // if no channel is enable
55 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
56 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
56 }
57 }
57 else {
58 else {
58 if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full
59 if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full
59 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable & 0x08;
60 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable & 0x08;
60 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
61 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
61 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
62 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
62 }
63 }
63 waveform_picker_regs->status = waveform_picker_regs->status & 0x00;
64 waveform_picker_regs->status = waveform_picker_regs->status & 0x00;
64 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x07; // [0111] enable f2 f1 f0
65 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x07; // [0111] enable f2 f1 f0
65 }
66 }
66 }
67 }
67 #endif
68 #endif
68 break;
69 break;
69
70
70 //******
71 //******
71 // BURST
72 // BURST
72 case(LFR_MODE_BURST):
73 case(LFR_MODE_BURST):
73 #ifdef GSA
74 #ifdef GSA
74 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
75 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
75 #else
76 #else
76 if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit
77 if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit
77 // (1) change the receiving buffer for the waveform picker
78 // (1) change the receiving buffer for the waveform picker
78 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
79 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
79 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
80 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
80 }
81 }
81 else {
82 else {
82 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
83 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
83 }
84 }
84 // (2) send an event for the waveforms transmission
85 // (2) send an event for the waveforms transmission
85 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
86 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
86 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
87 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
87 }
88 }
88 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0
89 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bits = 0
89 }
90 }
90 #endif
91 #endif
91 break;
92 break;
92
93
93 //*****
94 //*****
94 // SBM1
95 // SBM1
95 case(LFR_MODE_SBM1):
96 case(LFR_MODE_SBM1):
96 #ifdef GSA
97 #ifdef GSA
97 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
98 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
98 #else
99 #else
99 if ((waveform_picker_regs->status & 0x02) == 0x02){ // [0010] check the f1 full bit
100 if ((waveform_picker_regs->status & 0x02) == 0x02){ // [0010] check the f1 full bit
100 // (1) change the receiving buffer for the waveform picker
101 // (1) change the receiving buffer for the waveform picker
101 if ( param_local.local_sbm1_nb_cwf_sent == (param_local.local_sbm1_nb_cwf_max-1) )
102 if ( param_local.local_sbm1_nb_cwf_sent == (param_local.local_sbm1_nb_cwf_max-1) )
102 {
103 {
103 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_norm);
104 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_norm);
104 }
105 }
105 else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1_norm )
106 else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1_norm )
106 {
107 {
107 doubleSendCWF1 = 1;
108 doubleSendCWF1 = 1;
108 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
109 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
109 }
110 }
110 else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1 ) {
111 else if ( waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1 ) {
111 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis);
112 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis);
112 }
113 }
113 else {
114 else {
114 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
115 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
115 }
116 }
116 // (2) send an event for the waveforms transmission
117 // (2) send an event for the waveforms transmission
117 if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
118 if (rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
118 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
119 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
119 }
120 }
120 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0
121 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bit = 0
121 }
122 }
122 if ( ( (waveform_picker_regs->status & 0x05) == 0x05 ) ) { // [0101] check the f2 and f0 full bit
123 if ( ( (waveform_picker_regs->status & 0x05) == 0x05 ) ) { // [0101] check the f2 and f0 full bit
123 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
124 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
124 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
125 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
125 }
126 }
126 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0
127 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2 and f0 bits = 0
127 reset_local_sbm1_nb_cwf_sent();
128 reset_local_sbm1_nb_cwf_sent();
128 }
129 }
129
130
130 #endif
131 #endif
131 break;
132 break;
132
133
133 //*****
134 //*****
134 // SBM2
135 // SBM2
135 case(LFR_MODE_SBM2):
136 case(LFR_MODE_SBM2):
136 #ifdef GSA
137 #ifdef GSA
137 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
138 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
138 #else
139 #else
139 if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit
140 if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit
140 // (1) change the receiving buffer for the waveform picker
141 // (1) change the receiving buffer for the waveform picker
141 if ( param_local.local_sbm2_nb_cwf_sent == (param_local.local_sbm2_nb_cwf_max-1) )
142 if ( param_local.local_sbm2_nb_cwf_sent == (param_local.local_sbm2_nb_cwf_max-1) )
142 {
143 {
143 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_norm);
144 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_norm);
144 }
145 }
145 else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2_norm ) {
146 else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2_norm ) {
146 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
147 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
147 doubleSendCWF2 = 1;
148 doubleSendCWF2 = 1;
148 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2_WFRM ) != RTEMS_SUCCESSFUL) {
149 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2_WFRM ) != RTEMS_SUCCESSFUL) {
149 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
150 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
150 }
151 }
151 reset_local_sbm2_nb_cwf_sent();
152 reset_local_sbm2_nb_cwf_sent();
152 }
153 }
153 else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2 ) {
154 else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2 ) {
154 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
155 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis);
155 }
156 }
156 else {
157 else {
157 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
158 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2);
158 }
159 }
159 // (2) send an event for the waveforms transmission
160 // (2) send an event for the waveforms transmission
160 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
161 if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
161 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
162 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
162 }
163 }
163 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
164 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
164 }
165 }
165 if ( ( (waveform_picker_regs->status & 0x03) == 0x03 ) ) { // [0011] f3 f2 f1 f0, f1 and f0 are full
166 if ( ( (waveform_picker_regs->status & 0x03) == 0x03 ) ) { // [0011] f3 f2 f1 f0, f1 and f0 are full
166 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
167 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ) != RTEMS_SUCCESSFUL) {
167 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
168 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
168 }
169 }
169 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
170 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
170 }
171 }
171 #endif
172 #endif
172 break;
173 break;
173
174
174 //********
175 //********
175 // DEFAULT
176 // DEFAULT
176 default:
177 default:
177 break;
178 break;
178 }
179 }
179 }
180 }
180
181
181 rtems_isr waveforms_simulator_isr( rtems_vector_number vector )
182 rtems_isr waveforms_simulator_isr( rtems_vector_number vector )
182 {
183 {
183 unsigned char lfrMode;
184 unsigned char lfrMode;
184 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
185 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
185
186
186 switch(lfrMode) {
187 switch(lfrMode) {
187 case (LFR_MODE_STANDBY):
188 case (LFR_MODE_STANDBY):
188 break;
189 break;
189 case (LFR_MODE_NORMAL):
190 case (LFR_MODE_NORMAL):
190 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
191 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
191 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_5 );
192 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_5 );
192 }
193 }
193 break;
194 break;
194 case (LFR_MODE_BURST):
195 case (LFR_MODE_BURST):
195 break;
196 break;
196 case (LFR_MODE_SBM1):
197 case (LFR_MODE_SBM1):
197 break;
198 break;
198 case (LFR_MODE_SBM2):
199 case (LFR_MODE_SBM2):
199 break;
200 break;
200 }
201 }
201 }
202 }
202
203
203 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
204 rtems_task wfrm_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
204 {
205 {
205 rtems_event_set event_out;
206 rtems_event_set event_out;
206 rtems_id queue_id;
207 rtems_id queue_id;
207 rtems_status_code status;
208 rtems_status_code status;
208
209
209 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
210 init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 );
210 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
211 init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 );
211 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
212 init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 );
212
213
213 init_waveforms();
214 init_waveforms();
214
215
215 status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id );
216 status = rtems_message_queue_ident( misc_name[QUEUE_PKTS], 0, &queue_id );
216 if (status != RTEMS_SUCCESSFUL)
217 if (status != RTEMS_SUCCESSFUL)
217 {
218 {
218 PRINTF1("in WFRM *** ERR getting queue id, %d\n", status)
219 PRINTF1("in WFRM *** ERR getting queue id, %d\n", status)
219 }
220 }
220
221
221 BOOT_PRINTF("in WFRM ***\n")
222 BOOT_PRINTF("in WFRM ***\n")
222
223
223 while(1){
224 while(1){
224 // wait for an RTEMS_EVENT
225 // wait for an RTEMS_EVENT
225 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
226 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1
226 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
227 | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM,
227 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
228 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
228
229
229 if (event_out == RTEMS_EVENT_MODE_NORMAL)
230 if (event_out == RTEMS_EVENT_MODE_NORMAL)
230 {
231 {
231 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
232 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
232 send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
233 send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
233 send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
234 send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
234 #ifdef GSA
235 #ifdef GSA
235 waveform_picker_regs->status = waveform_picker_regs->status & 0xf888; // [1111 1000 1000 1000] f2, f1, f0 bits =0
236 waveform_picker_regs->status = waveform_picker_regs->status & 0xf888; // [1111 1000 1000 1000] f2, f1, f0 bits =0
236 #endif
237 #endif
237 }
238 }
238 else if (event_out == RTEMS_EVENT_MODE_SBM1)
239 else if (event_out == RTEMS_EVENT_MODE_SBM1)
239 {
240 {
240 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
241 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
241 send_waveform_SWF(wf_snap_f1_norm, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
242 send_waveform_SWF(wf_snap_f1_norm, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
242 send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
243 send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
243 #ifdef GSA
244 #ifdef GSA
244 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2, f0 bits = 0
245 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2, f0 bits = 0
245 #endif
246 #endif
246 }
247 }
247 else if (event_out == RTEMS_EVENT_MODE_SBM2)
248 else if (event_out == RTEMS_EVENT_MODE_SBM2)
248 {
249 {
249 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
250 send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
250 send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
251 send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
251 #ifdef GSA
252 #ifdef GSA
252 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
253 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0
253 #endif
254 #endif
254 }
255 }
255 else if (event_out == RTEMS_EVENT_MODE_SBM2_WFRM)
256 else if (event_out == RTEMS_EVENT_MODE_SBM2_WFRM)
256 {
257 {
257 send_waveform_SWF(wf_snap_f2_norm, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
258 send_waveform_SWF(wf_snap_f2_norm, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
258 }
259 }
259 else
260 else
260 {
261 {
261 PRINTF("in WFRM *** unexpected event")
262 PRINTF("in WFRM *** unexpected event")
262 }
263 }
263
264
264
265
265 #ifdef GSA
266 #ifdef GSA
266 // irq processed, reset the related register of the timer unit
267 // irq processed, reset the related register of the timer unit
267 gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl = gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl | 0x00000010;
268 gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl = gptimer_regs->timer[TIMER_WF_SIMULATOR].ctrl | 0x00000010;
268 // clear the interruption
269 // clear the interruption
269 LEON_Unmask_interrupt( IRQ_WF );
270 LEON_Unmask_interrupt( IRQ_WF );
270 #endif
271 #endif
271 }
272 }
272 }
273 }
273
274
274 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
275 rtems_task cwf3_task(rtems_task_argument argument) //used with the waveform picker VHDL IP
275 {
276 {
276 rtems_event_set event_out;
277 rtems_event_set event_out;
277 rtems_id queue_id;
278 rtems_id queue_id;
278
279
279 init_header_continuous_wf_table( SID_NORM_CWF_F3, headerCWF_F3 );
280 init_header_continuous_wf_table( SID_NORM_CWF_F3, headerCWF_F3 );
281 init_header_continuous_wf3_light_table( headerCWF_F3_light );
280
282
281 queue_id = get_pkts_queue_id();
283 queue_id = get_pkts_queue_id();
282
284
283 BOOT_PRINTF("in CWF3 ***\n")
285 BOOT_PRINTF("in CWF3 ***\n")
284
286
285 while(1){
287 while(1){
286 // wait for an RTEMS_EVENT
288 // wait for an RTEMS_EVENT
287 rtems_event_receive( RTEMS_EVENT_0,
289 rtems_event_receive( RTEMS_EVENT_0,
288 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
290 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
289 PRINTF("send CWF F3 \n")
291 PRINTF("send CWF F3 \n")
290 #ifdef GSA
292 #ifdef GSA
291 #else
293 #else
292 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) {
294 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3) {
293 send_waveform_CWF( wf_cont_f3_bis, SID_NORM_CWF_F3, headerCWF_F3, queue_id );
295 send_waveform_CWF3_light( wf_cont_f3_bis, headerCWF_F3_light, queue_id );
294 }
296 }
295 else {
297 else {
296 send_waveform_CWF( wf_cont_f3, SID_NORM_CWF_F3, headerCWF_F3, queue_id );
298 send_waveform_CWF3_light( wf_cont_f3, headerCWF_F3_light, queue_id );
297 }
299 }
298 #endif
300 #endif
299 }
301 }
300 }
302 }
301
303
302 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
304 rtems_task cwf2_task(rtems_task_argument argument) // ONLY USED IN BURST AND SBM2
303 {
305 {
304 rtems_event_set event_out;
306 rtems_event_set event_out;
305 rtems_id queue_id;
307 rtems_id queue_id;
306
308
307 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
309 init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST );
308 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
310 init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 );
309
311
310 queue_id = get_pkts_queue_id();
312 queue_id = get_pkts_queue_id();
311
313
312 BOOT_PRINTF("in CWF2 ***\n")
314 BOOT_PRINTF("in CWF2 ***\n")
313
315
314 while(1){
316 while(1){
315 // wait for an RTEMS_EVENT
317 // wait for an RTEMS_EVENT
316 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
318 rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2,
317 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
319 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
318
320
319 if (event_out == RTEMS_EVENT_MODE_BURST)
321 if (event_out == RTEMS_EVENT_MODE_BURST)
320 {
322 {
321 // F2
323 // F2
322 #ifdef GSA
324 #ifdef GSA
323 #else
325 #else
324 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
326 if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
325 send_waveform_CWF( wf_snap_f2_bis, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
327 send_waveform_CWF( wf_snap_f2_bis, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
326 }
328 }
327 else {
329 else {
328 send_waveform_CWF( wf_snap_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
330 send_waveform_CWF( wf_snap_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
329 }
331 }
330 #endif
332 #endif
331 }
333 }
332
334
333 else if (event_out == RTEMS_EVENT_MODE_SBM2)
335 else if (event_out == RTEMS_EVENT_MODE_SBM2)
334 {
336 {
335 #ifdef GSA
337 #ifdef GSA
336 #else
338 #else
337 if (doubleSendCWF2 == 1)
339 if (doubleSendCWF2 == 1)
338 {
340 {
339 doubleSendCWF2 = 0;
341 doubleSendCWF2 = 0;
340 send_waveform_CWF( wf_snap_f2_norm, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
342 send_waveform_CWF( wf_snap_f2_norm, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
341 }
343 }
342 else if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
344 else if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) {
343 send_waveform_CWF( wf_snap_f2_bis, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
345 send_waveform_CWF( wf_snap_f2_bis, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
344 }
346 }
345 else {
347 else {
346 send_waveform_CWF( wf_snap_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
348 send_waveform_CWF( wf_snap_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
347 }
349 }
348 param_local.local_sbm2_nb_cwf_sent ++;
350 param_local.local_sbm2_nb_cwf_sent ++;
349 #endif
351 #endif
350 }
352 }
351 else
353 else
352 {
354 {
353 PRINTF1("in CWF2 *** ERR mode = %d\n", lfrCurrentMode)
355 PRINTF1("in CWF2 *** ERR mode = %d\n", lfrCurrentMode)
354 }
356 }
355 }
357 }
356 }
358 }
357
359
358 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
360 rtems_task cwf1_task(rtems_task_argument argument) // ONLY USED IN SBM1
359 {
361 {
360 rtems_event_set event_out;
362 rtems_event_set event_out;
361 rtems_id queue_id;
363 rtems_id queue_id;
362
364
363 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
365 init_header_continuous_wf_table( SID_SBM1_CWF_F1, headerCWF_F1 );
364
366
365 queue_id = get_pkts_queue_id();
367 queue_id = get_pkts_queue_id();
366
368
367 BOOT_PRINTF("in CWF1 ***\n")
369 BOOT_PRINTF("in CWF1 ***\n")
368
370
369 while(1){
371 while(1){
370 // wait for an RTEMS_EVENT
372 // wait for an RTEMS_EVENT
371 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
373 rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
372 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
374 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
373 if (event_out == RTEMS_EVENT_MODE_SBM1)
375 if (event_out == RTEMS_EVENT_MODE_SBM1)
374 {
376 {
375 #ifdef GSA
377 #ifdef GSA
376 #else
378 #else
377 if (doubleSendCWF1 == 1)
379 if (doubleSendCWF1 == 1)
378 {
380 {
379 doubleSendCWF1 = 0;
381 doubleSendCWF1 = 0;
380 send_waveform_CWF( wf_snap_f1_norm, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
382 send_waveform_CWF( wf_snap_f1_norm, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
381 }
383 }
382 else if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
384 else if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
383 send_waveform_CWF( wf_snap_f1_bis, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
385 send_waveform_CWF( wf_snap_f1_bis, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
384 }
386 }
385 else {
387 else {
386 send_waveform_CWF( wf_snap_f1, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
388 send_waveform_CWF( wf_snap_f1, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
387 }
389 }
388 param_local.local_sbm1_nb_cwf_sent ++;
390 param_local.local_sbm1_nb_cwf_sent ++;
389 #endif
391 #endif
390 }
392 }
391 else
393 else
392 {
394 {
393 PRINTF1("in CWF1 *** ERR mode = %d\n", lfrCurrentMode)
395 PRINTF1("in CWF1 *** ERR mode = %d\n", lfrCurrentMode)
394 }
396 }
395 }
397 }
396 }
398 }
397
399
398 //******************
400 //******************
399 // general functions
401 // general functions
400 void init_waveforms( void )
402 void init_waveforms( void )
401 {
403 {
402 int i = 0;
404 int i = 0;
403
405
404 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
406 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
405 {
407 {
406 //***
408 //***
407 // F0
409 // F0
408 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
410 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x88887777; //
409 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
411 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111; //
410 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
412 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0x44443333; //
411
413
412 //***
414 //***
413 // F1
415 // F1
414 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
416 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x22221111;
415 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
417 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x44443333;
416 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
418 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
417
419
418 //***
420 //***
419 // F2
421 // F2
420 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
422 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET ] = 0x44443333;
421 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
423 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET ] = 0x22221111;
422 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
424 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET ] = 0xaaaa0000;
423
425
424 //***
426 //***
425 // F3
427 // F3
426 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
428 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 0 ] = val1;
427 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
429 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 1 ] = val2;
428 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
430 //wf_cont_f3[ (i* NB_WORDS_SWF_BLK) + 2 ] = 0xaaaa0000;
429 }
431 }
430 }
432 }
431
433
432 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
434 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
433 {
435 {
434 unsigned char i;
436 unsigned char i;
435
437
436 for (i=0; i<7; i++)
438 for (i=0; i<7; i++)
437 {
439 {
438 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
440 headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
439 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
441 headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
440 headerSWF[ i ].reserved = DEFAULT_RESERVED;
442 headerSWF[ i ].reserved = DEFAULT_RESERVED;
441 headerSWF[ i ].userApplication = CCSDS_USER_APP;
443 headerSWF[ i ].userApplication = CCSDS_USER_APP;
442 headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
444 headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
443 headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
445 headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
444 if (i == 0)
446 if (i == 0)
445 {
447 {
446 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
448 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
447 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
449 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
448 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
450 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
449 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
451 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
450 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
452 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
451 }
453 }
452 else if (i == 6)
454 else if (i == 6)
453 {
455 {
454 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
456 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
455 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_8 >> 8);
457 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_8 >> 8);
456 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_8 );
458 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_8 );
457 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
459 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
458 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
460 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
459 }
461 }
460 else
462 else
461 {
463 {
462 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
464 headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
463 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
465 headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8);
464 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
466 headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 );
465 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
467 headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
466 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
468 headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
467 }
469 }
468 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
470 headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
469 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
471 headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT
470 headerSWF[ i ].pktNr = i+1; // PKT_NR
472 headerSWF[ i ].pktNr = i+1; // PKT_NR
471 // DATA FIELD HEADER
473 // DATA FIELD HEADER
472 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
474 headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
473 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
475 headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
474 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
476 headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
475 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
477 headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
476 // AUXILIARY DATA HEADER
478 // AUXILIARY DATA HEADER
477 headerSWF[ i ].sid = sid;
479 headerSWF[ i ].sid = sid;
478 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
480 headerSWF[ i ].hkBIA = DEFAULT_HKBIA;
479 headerSWF[ i ].time[0] = 0x00;
481 headerSWF[ i ].time[0] = 0x00;
480 headerSWF[ i ].time[0] = 0x00;
482 headerSWF[ i ].time[0] = 0x00;
481 headerSWF[ i ].time[0] = 0x00;
483 headerSWF[ i ].time[0] = 0x00;
482 headerSWF[ i ].time[0] = 0x00;
484 headerSWF[ i ].time[0] = 0x00;
483 headerSWF[ i ].time[0] = 0x00;
485 headerSWF[ i ].time[0] = 0x00;
484 headerSWF[ i ].time[0] = 0x00;
486 headerSWF[ i ].time[0] = 0x00;
485 }
487 }
486 return LFR_SUCCESSFUL;
488 return LFR_SUCCESSFUL;
487 }
489 }
488
490
489 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
491 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
490 {
492 {
491 unsigned int i;
493 unsigned int i;
492
494
493 for (i=0; i<7; i++)
495 for (i=0; i<7; i++)
494 {
496 {
495 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
497 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
496 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
498 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
497 headerCWF[ i ].reserved = DEFAULT_RESERVED;
499 headerCWF[ i ].reserved = DEFAULT_RESERVED;
498 headerCWF[ i ].userApplication = CCSDS_USER_APP;
500 headerCWF[ i ].userApplication = CCSDS_USER_APP;
499 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
501 if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) )
500 {
502 {
501 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8);
503 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8);
502 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2);
504 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2);
503 }
505 }
504 else
506 else
505 {
507 {
506 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
508 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
507 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
509 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
508 }
510 }
509 if (i == 0)
511 if (i == 0)
510 {
512 {
511 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
513 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
512 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
514 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
513 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
515 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
514 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
516 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
515 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
517 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
516 }
518 }
517 else if (i == 6)
519 else if (i == 6)
518 {
520 {
519 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
521 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
520 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8);
522 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_8 >> 8);
521 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 );
523 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_8 );
522 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
524 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
523 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
525 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
524 }
526 }
525 else
527 else
526 {
528 {
527 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
529 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
528 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
530 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF_340 >> 8);
529 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
531 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF_340 );
530 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
532 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
531 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
533 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
532 }
534 }
533 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
535 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
534 // PKT_CNT
536 // PKT_CNT
535 // PKT_NR
537 // PKT_NR
536 // DATA FIELD HEADER
538 // DATA FIELD HEADER
537 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
539 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
538 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
540 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
539 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
541 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
540 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
542 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
541 // AUXILIARY DATA HEADER
543 // AUXILIARY DATA HEADER
542 headerCWF[ i ].sid = sid;
544 headerCWF[ i ].sid = sid;
543 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
545 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
544 headerCWF[ i ].time[0] = 0x00;
546 headerCWF[ i ].time[0] = 0x00;
545 headerCWF[ i ].time[0] = 0x00;
547 headerCWF[ i ].time[0] = 0x00;
546 headerCWF[ i ].time[0] = 0x00;
548 headerCWF[ i ].time[0] = 0x00;
547 headerCWF[ i ].time[0] = 0x00;
549 headerCWF[ i ].time[0] = 0x00;
548 headerCWF[ i ].time[0] = 0x00;
550 headerCWF[ i ].time[0] = 0x00;
549 headerCWF[ i ].time[0] = 0x00;
551 headerCWF[ i ].time[0] = 0x00;
550 }
552 }
551 return LFR_SUCCESSFUL;
553 return LFR_SUCCESSFUL;
552 }
554 }
553
555
556 int init_header_continuous_wf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF )
557 {
558 unsigned int i;
559
560 for (i=0; i<7; i++)
561 {
562 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
563 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
564 headerCWF[ i ].reserved = DEFAULT_RESERVED;
565 headerCWF[ i ].userApplication = CCSDS_USER_APP;
566
567 headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
568 headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
569 if (i == 0)
570 {
571 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST;
572 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
573 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
574 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
575 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
576 }
577 else if (i == 6)
578 {
579 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST;
580 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 >> 8);
581 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_8 );
582 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8);
583 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 );
584 }
585 else
586 {
587 headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION;
588 headerCWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 >> 8);
589 headerCWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_CWF3_LIGHT_340 );
590 headerCWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8);
591 headerCWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 );
592 }
593 headerCWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
594 // DATA FIELD HEADER
595 headerCWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
596 headerCWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type
597 headerCWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype
598 headerCWF[ i ].destinationID = TM_DESTINATION_ID_GROUND;
599 // AUXILIARY DATA HEADER
600 headerCWF[ i ].sid = SID_NORM_CWF_F3;
601 headerCWF[ i ].hkBIA = DEFAULT_HKBIA;
602 headerCWF[ i ].time[0] = 0x00;
603 headerCWF[ i ].time[0] = 0x00;
604 headerCWF[ i ].time[0] = 0x00;
605 headerCWF[ i ].time[0] = 0x00;
606 headerCWF[ i ].time[0] = 0x00;
607 headerCWF[ i ].time[0] = 0x00;
608 }
609 return LFR_SUCCESSFUL;
610 }
611
554 void reset_waveforms( void )
612 void reset_waveforms( void )
555 {
613 {
556 int i = 0;
614 int i = 0;
557
615
558 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
616 for (i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
559 {
617 {
560 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000;
618 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x10002000;
561 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
619 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
562 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
620 wf_snap_f0[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
563
621
564 //***
622 //***
565 // F1
623 // F1
566 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000;
624 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x1000f000;
567 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000;
625 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0xf0001000;
568 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
626 wf_snap_f1[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x40008000;
569
627
570 //***
628 //***
571 // F2
629 // F2
572 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000;
630 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 0 + TIME_OFFSET] = 0x40008000;
573 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
631 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 1 + TIME_OFFSET] = 0x20001000;
574 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000;
632 wf_snap_f2[ (i* NB_WORDS_SWF_BLK) + 2 + TIME_OFFSET] = 0x10002000;
575
633
576 //***
634 //***
577 // F3
635 // F3
578 /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1
636 /*wf_cont_f3[ i* NB_WORDS_SWF_BLK + 0 ] = build_value( i, i ); // v and 1
579 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1
637 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 1 ] = build_value( i, i ); // e2 and b1
580 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/
638 wf_cont_f3[ i* NB_WORDS_SWF_BLK + 2 ] = build_value( i, i ); // b2 and b3*/
581 }
639 }
582 }
640 }
583
641
584 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
642 int send_waveform_SWF( volatile int *waveform, unsigned int sid,
585 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
643 Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
586 {
644 {
587 unsigned int i;
645 unsigned int i;
588 int ret;
646 int ret;
589 rtems_status_code status;
647 rtems_status_code status;
590 spw_ioctl_pkt_send spw_ioctl_send_SWF;
648 spw_ioctl_pkt_send spw_ioctl_send_SWF;
591
649
592 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
650 spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
593 spw_ioctl_send_SWF.options = 0;
651 spw_ioctl_send_SWF.options = 0;
594
652
595 ret = LFR_DEFAULT;
653 ret = LFR_DEFAULT;
596
654
597 for (i=0; i<7; i++) // send waveform
655 for (i=0; i<7; i++) // send waveform
598 {
656 {
599 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
657 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
600 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
658 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
601 // BUILD THE DATA
659 // BUILD THE DATA
602 if (i==6) {
660 if (i==6) {
603 spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK;
661 spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK;
604 }
662 }
605 else {
663 else {
606 spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK;
664 spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK;
607 }
665 }
608 // SET PACKET TIME
666 // SET PACKET TIME
609 headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
667 headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
610 headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
668 headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
611 headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
669 headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
612 headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time);
670 headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time);
613 headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8);
671 headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8);
614 headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time);
672 headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time);
615 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
673 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
616 headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
674 headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
617 headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
675 headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
618 headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
676 headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
619 headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
677 headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
620 headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
678 headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
621 // SEND PACKET
679 // SEND PACKET
622 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
680 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
623 if (status != RTEMS_SUCCESSFUL) {
681 if (status != RTEMS_SUCCESSFUL) {
624 printf("%d-%d, ERR %d\n", sid, i, (int) status);
682 printf("%d-%d, ERR %d\n", sid, i, (int) status);
625 ret = LFR_DEFAULT;
683 ret = LFR_DEFAULT;
626 }
684 }
627 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
685 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
628 }
686 }
629
687
630 return ret;
688 return ret;
631 }
689 }
632
690
633 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
691 int send_waveform_CWF(volatile int *waveform, unsigned int sid,
634 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
692 Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
635 {
693 {
636 unsigned int i;
694 unsigned int i;
637 int ret;
695 int ret;
638 rtems_status_code status;
696 rtems_status_code status;
639 spw_ioctl_pkt_send spw_ioctl_send_CWF;
697 spw_ioctl_pkt_send spw_ioctl_send_CWF;
640
698
641 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
699 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
642 spw_ioctl_send_CWF.options = 0;
700 spw_ioctl_send_CWF.options = 0;
643
701
644 ret = LFR_DEFAULT;
702 ret = LFR_DEFAULT;
645
703
646 for (i=0; i<7; i++) // send waveform
704 for (i=0; i<7; i++) // send waveform
647 {
705 {
648 int coarseTime = 0x00;
706 int coarseTime = 0x00;
649 int fineTime = 0x00;
707 int fineTime = 0x00;
650 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
708 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ];
651 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
709 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
652 // BUILD THE DATA
710 // BUILD THE DATA
653 if (i==6) {
711 if (i==6) {
654 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK;
712 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_SWF_BLK;
655 }
713 }
656 else {
714 else {
657 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK;
715 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK;
658 }
716 }
659 // SET PACKET TIME
717 // SET PACKET TIME
660 coarseTime = time_management_regs->coarse_time;
718 coarseTime = time_management_regs->coarse_time;
661 fineTime = time_management_regs->fine_time;
719 fineTime = time_management_regs->fine_time;
662 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
720 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
663 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
721 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
664 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
722 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
665 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
723 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
666 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
724 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
667 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
725 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
668 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
726 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
669 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
727 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
670 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
728 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
671 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
729 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
672 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
730 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
673 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
731 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
674 // SEND PACKET
732 // SEND PACKET
675 if (sid == SID_NORM_CWF_F3)
733 if (sid == SID_NORM_CWF_F3)
676 {
734 {
677 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
735 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
678 if (status != RTEMS_SUCCESSFUL) {
736 if (status != RTEMS_SUCCESSFUL) {
679 printf("%d-%d, ERR %d\n", sid, i, (int) status);
737 printf("%d-%d, ERR %d\n", sid, i, (int) status);
680 ret = LFR_DEFAULT;
738 ret = LFR_DEFAULT;
681 }
739 }
682 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
740 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
683 }
741 }
684 else
742 else
685 {
743 {
686 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
744 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
687 if (status != RTEMS_SUCCESSFUL) {
745 if (status != RTEMS_SUCCESSFUL) {
688 printf("%d-%d, ERR %d\n", sid, i, (int) status);
746 printf("%d-%d, ERR %d\n", sid, i, (int) status);
689 ret = LFR_DEFAULT;
747 ret = LFR_DEFAULT;
690 }
748 }
691 }
749 }
692 }
750 }
693
751
694 return ret;
752 return ret;
695 }
753 }
696
754
755 int send_waveform_CWF3_light(volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
756 {
757 unsigned int i;
758 int ret;
759 rtems_status_code status;
760 spw_ioctl_pkt_send spw_ioctl_send_CWF;
761 char *sample;
762
763 spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
764 spw_ioctl_send_CWF.options = 0;
765
766 ret = LFR_DEFAULT;
767
768 //**********************
769 // BUILD CWF3_light DATA
770 for ( i=0; i< 2048; i++)
771 {
772 sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ];
773 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ];
774 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ];
775 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ];
776 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ];
777 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ];
778 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ];
779 }
780
781 //*********************
782 // SEND CWF3_light DATA
783
784 for (i=0; i<7; i++) // send waveform
785 {
786 int coarseTime = 0x00;
787 int fineTime = 0x00;
788 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * 340 * NB_BYTES_CWF3_LIGHT_BLK) ];
789 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
790 // BUILD THE DATA
791 if ( i == WFRM_INDEX_OF_LAST_PACKET ) {
792 spw_ioctl_send_CWF.dlen = 8 * NB_BYTES_CWF3_LIGHT_BLK;
793 }
794 else {
795 spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK;
796 }
797 // SET PACKET TIME
798 coarseTime = time_management_regs->coarse_time;
799 fineTime = time_management_regs->fine_time;
800 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
801 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
802 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
803 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
804 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
805 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
806 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
807 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
808 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
809 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
810 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
811 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
812 // SEND PACKET
813 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
814 if (status != RTEMS_SUCCESSFUL) {
815 printf("%d-%d, ERR %d\n", SID_NORM_CWF_F3, i, (int) status);
816 ret = LFR_DEFAULT;
817 }
818 rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS);
819 }
820
821 return ret;
822 }
823
824
697 //**************
825 //**************
698 // wfp registers
826 // wfp registers
699 void set_wfp_data_shaping()
827 void set_wfp_data_shaping()
700 {
828 {
701 unsigned char data_shaping;
829 unsigned char data_shaping;
702
830
703 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
831 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
704 // waveform picker : [R1 R0 SP1 SP0 BW]
832 // waveform picker : [R1 R0 SP1 SP0 BW]
705
833
706 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
834 data_shaping = parameter_dump_packet.bw_sp0_sp1_r0_r1;
707
835
708 #ifdef GSA
836 #ifdef GSA
709 #else
837 #else
710 waveform_picker_regs->data_shaping =
838 waveform_picker_regs->data_shaping =
711 ( (data_shaping & 0x10) >> 4 ) // BW
839 ( (data_shaping & 0x10) >> 4 ) // BW
712 + ( (data_shaping & 0x08) >> 2 ) // SP0
840 + ( (data_shaping & 0x08) >> 2 ) // SP0
713 + ( (data_shaping & 0x04) ) // SP1
841 + ( (data_shaping & 0x04) ) // SP1
714 + ( (data_shaping & 0x02) << 2 ) // R0
842 + ( (data_shaping & 0x02) << 2 ) // R0
715 + ( (data_shaping & 0x01) << 4 ); // R1
843 + ( (data_shaping & 0x01) << 4 ); // R1
716 #endif
844 #endif
717 }
845 }
718
846
719 char set_wfp_delta_snapshot()
847 char set_wfp_delta_snapshot()
720 {
848 {
721 char ret;
849 char ret;
722 unsigned int delta_snapshot;
850 unsigned int delta_snapshot;
851 unsigned int aux;
852
853 aux = 0;
723 ret = LFR_DEFAULT;
854 ret = LFR_DEFAULT;
724
855
725 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
856 delta_snapshot = parameter_dump_packet.sy_lfr_n_swf_p[0]*256
726 + parameter_dump_packet.sy_lfr_n_swf_p[1];
857 + parameter_dump_packet.sy_lfr_n_swf_p[1];
727
858
728 #ifdef GSA
859 #ifdef GSA
729 #else
860 #else
730 unsigned char aux = 0;
731 if ( delta_snapshot < MIN_DELTA_SNAPSHOT )
861 if ( delta_snapshot < MIN_DELTA_SNAPSHOT )
732 {
862 {
733 aux = MIN_DELTA_SNAPSHOT;
863 aux = MIN_DELTA_SNAPSHOT;
734 ret = LFR_DEFAULT;
864 ret = LFR_DEFAULT;
735 }
865 }
736 else
866 else
737 {
867 {
738 aux = delta_snapshot ;
868 aux = delta_snapshot ;
739 ret = LFR_SUCCESSFUL;
869 ret = LFR_SUCCESSFUL;
740 }
870 }
741 waveform_picker_regs->delta_snapshot = aux; // max 2 bytes
871 waveform_picker_regs->delta_snapshot = aux; // max 2 bytes
742 #endif
872 #endif
743
873
744 return ret;
874 return ret;
745 }
875 }
746
876
747 void set_wfp_burst_enable_register( unsigned char mode)
877 void set_wfp_burst_enable_register( unsigned char mode)
748 {
878 {
749 #ifdef GSA
879 #ifdef GSA
750 #else
880 #else
751 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
881 // [0000 0000] burst f2, f1, f0 enable f3 f2 f1 f0
752 // the burst bits shall be set first, before the enable bits
882 // the burst bits shall be set first, before the enable bits
753 switch(mode) {
883 switch(mode) {
754 case(LFR_MODE_NORMAL):
884 case(LFR_MODE_NORMAL):
755 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enable
885 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enable
756 waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
886 waveform_picker_regs->burst_enable = 0x0f; // [0000 1111] enable f3 f2 f1 f0
757 break;
887 break;
758 case(LFR_MODE_BURST):
888 case(LFR_MODE_BURST):
759 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
889 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
760 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2
890 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x04; // [0100] enable f2
761 break;
891 break;
762 case(LFR_MODE_SBM1):
892 case(LFR_MODE_SBM1):
763 waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled
893 waveform_picker_regs->burst_enable = 0x20; // [0010 0000] f1 burst enabled
764 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
894 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
765 break;
895 break;
766 case(LFR_MODE_SBM2):
896 case(LFR_MODE_SBM2):
767 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
897 waveform_picker_regs->burst_enable = 0x40; // [0100 0000] f2 burst enabled
768 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
898 waveform_picker_regs->burst_enable = waveform_picker_regs->burst_enable | 0x0f; // [1111] enable f3 f2 f1 f0
769 break;
899 break;
770 default:
900 default:
771 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
901 waveform_picker_regs->burst_enable = 0x00; // [0000 0000] no burst enabled, no waveform enabled
772 break;
902 break;
773 }
903 }
774 #endif
904 #endif
775 }
905 }
776
906
777 void reset_wfp_burst_enable()
907 void reset_wfp_burst_enable()
778 {
908 {
779 #ifdef GSA
909 #ifdef GSA
780 #else
910 #else
781 waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
911 waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
782 #endif
912 #endif
783 }
913 }
784
914
785 void reset_wfp_status()
915 void reset_wfp_status()
786 {
916 {
787 #ifdef GSA
917 #ifdef GSA
788 #else
918 #else
789 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
919 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
790 #endif
920 #endif
791 }
921 }
792
922
793 void reset_waveform_picker_regs()
923 void reset_waveform_picker_regs()
794 {
924 {
795 #ifdef GSA
925 #ifdef GSA
796 #else
926 #else
797 set_wfp_data_shaping();
927 set_wfp_data_shaping();
798 reset_wfp_burst_enable();
928 reset_wfp_burst_enable();
799 waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); //
929 waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); //
800 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); //
930 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); //
801 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); //
931 waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); //
802 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); //
932 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); //
803 set_wfp_delta_snapshot(); // time in seconds between two snapshots
933 set_wfp_delta_snapshot(); // time in seconds between two snapshots
804 waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes)
934 waveform_picker_regs->delta_f2_f1 = 0xffff; // 0x16800 => 92160 (max 4 bytes)
805 waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes)
935 waveform_picker_regs->delta_f2_f0 = 0x17c00; // 97 280 (max 5 bytes)
806 waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
936 waveform_picker_regs->nb_burst_available = 0x180; // max 3 bytes, size of the buffer in burst (1 burst = 16 x 4 octets)
807 waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1
937 waveform_picker_regs->nb_snapshot_param = 0x7ff; // max 3 octets, 2048 - 1
808 waveform_picker_regs->status = 0x00; //
938 waveform_picker_regs->status = 0x00; //
809 #endif
939 #endif
810 }
940 }
811
941
812 //*****************
942 //*****************
813 // local parameters
943 // local parameters
814 void set_local_sbm1_nb_cwf_max()
944 void set_local_sbm1_nb_cwf_max()
815 {
945 {
816 // (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot)
946 // (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot)
817 param_local.local_sbm1_nb_cwf_max = 2 *
947 param_local.local_sbm1_nb_cwf_max = 2 *
818 (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256
948 (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256
819 + parameter_dump_packet.sy_lfr_n_swf_p[1]) - 8; // 16 CWF1 parts during 1 SWF2
949 + parameter_dump_packet.sy_lfr_n_swf_p[1]) - 8; // 16 CWF1 parts during 1 SWF2
820 }
950 }
821
951
822 void set_local_sbm2_nb_cwf_max()
952 void set_local_sbm2_nb_cwf_max()
823 {
953 {
824 // (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz)
954 // (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz)
825 param_local.local_sbm2_nb_cwf_max = (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256
955 param_local.local_sbm2_nb_cwf_max = (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256
826 + parameter_dump_packet.sy_lfr_n_swf_p[1]) / 8;
956 + parameter_dump_packet.sy_lfr_n_swf_p[1]) / 8;
827 }
957 }
828
958
829 void set_local_nb_interrupt_f0_MAX()
959 void set_local_nb_interrupt_f0_MAX()
830 {
960 {
831 param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256
961 param_local.local_nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256
832 + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100;
962 + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100;
833 }
963 }
834
964
835 void reset_local_sbm1_nb_cwf_sent()
965 void reset_local_sbm1_nb_cwf_sent()
836 {
966 {
837 param_local.local_sbm1_nb_cwf_sent = 0;
967 param_local.local_sbm1_nb_cwf_sent = 0;
838 }
968 }
839
969
840 void reset_local_sbm2_nb_cwf_sent()
970 void reset_local_sbm2_nb_cwf_sent()
841 {
971 {
842 param_local.local_sbm2_nb_cwf_sent = 0;
972 param_local.local_sbm2_nb_cwf_sent = 0;
843 }
973 }
General Comments 0
You need to be logged in to leave comments. Login now